Identifies what kind of estimator has been used to compute a (set of) survey static(s).

estimator.kind(stat, design)

Arguments

stat

An object containing survey statistics.

design

Object of class analytic (or inheriting from it) containing survey data and sampling design metadata.

Details

Given a survey statistic object stat and a survey design object design from which stat is supposed to have been derived, this function returns the “precise kind” of the corresponding estimator, as a textual description.

Argument stat can be any object which have been returned by calling a survey statistics function (e.g. svystatTM, svystatR, svystatS, svystatSR, svystatB, svystatQ, svystatL, svySigma, and svySigma2) on survey design object design. It can also be a collection of survey statistics as generated by protean function svystat, provided that function is invoked with forGVF = FALSE.

Should stat be a survey statistic derived from a design object other than design, the function would raise an error.

Note that function estimator.kind is smart enough to recognize that estimates of totals/means of dummy variables are actually estimates of absolute/relative frequencies, despite such variables are of class numeric (see Section ‘Examples’).

Value

A character string describing the estimator kind.
Currently, possible return values (i.e. estimator kinds) are the following:

 (1)  'Total'
 (2)  'Absolute Frequency'
 (3)  'Mix of Totals and Absolute Frequencies'
 (4)  'Mean'
 (5)  'Relative Frequency'
 (6)  'Mix of Means and Relative Frequencies'
 (7)  'Ratio'
 (8)  'Share'
 (9)  'Share Ratio'
(10)  'Regression Coefficient'
(11)  'Quantile'
(12)  'Complex Estimator'
(13)  'Population Variance'
(14)  'Population Standard Deviation'
 

See also

gvf.input and svystat to prepare the input for GVF model fitting, fit.gvf to fit GVF models, and GVF.db to manage ReGenesees archive of registered GVF models.

Examples

# Create a design object: data(sbs) des<-e.svydesign(data=sbs,ids=~id,strata=~strata,weights=~weight, fpc=~fpc) # Compute some statistics and ask the corresponding estimator kind: stat<-svystatTM(des,~emp.num) stat
#> Total SE #> emp.num 985157.9 1421.315
estimator.kind(stat,des)
#> [1] "Total"
stat<-svystatTM(des,~emp.num,estimator="Mean") stat
#> Mean SE #> emp.num 56.88635 0.08207154
estimator.kind(stat,des)
#> [1] "Mean"
stat<-svystatTM(des,~emp.num+emp.cl) stat
#> Total SE #> emp.num 985157.9 1421.315 #> emp.cl[6,9] 5310.0 0.000 #> emp.cl(9,19] 4778.0 0.000 #> emp.cl(19,49] 3617.0 0.000 #> emp.cl(49,99] 1669.0 0.000 #> emp.cl(99,Inf] 1944.0 0.000
estimator.kind(stat,des)
#> [1] "Mix of Totals and Absolute Frequencies"
stat<-svystatR(des,num=~va.imp2,den=~emp.num,by=~region) stat
#> region va.imp2/emp.num SE.va.imp2/emp.num #> North North 58.27539 1.267878 #> Center Center 46.24878 1.725314 #> South South 68.51341 3.426335
estimator.kind(stat,des)
#> [1] "Ratio"
stat<-svystatQ(des,y=~va.imp2,ties="rounded") stat
#> va.imp2.Q[p] SE CI.l(95%) CI.u(95%) #> p = 0.250 185.5388 5.89108 174.3669 197.4595 #> p = 0.500 602.9879 13.80093 567.7387 621.8374 #> p = 0.750 1862.2366 70.69782 1723.6714 2000.8018
estimator.kind(stat,des)
#> [1] "Quantile"
# Using protean function svystat to get many statistics in a single shot: ## ungrouped summary statistics: stat<-svystat(des,kind="R",num=~va.imp2,den=~emp.num,by=~emp.cl:nace.macro, combo=2,forGVF=FALSE) stat
#> $population #> Ratio SE #> va.imp2/emp.num 57.14199 1.018897 #> #> $emp.cl #> emp.cl va.imp2/emp.num SE.va.imp2/emp.num #> [6,9] [6,9] 176.10328 12.712330 #> (9,19] (9,19] 126.09412 6.351647 #> (19,49] (19,49] 97.43465 6.545057 #> (49,99] (49,99] 59.46508 2.827201 #> (99,Inf] (99,Inf] 36.71352 0.000000 #> #> $nace.macro #> nace.macro va.imp2/emp.num SE.va.imp2/emp.num #> Agriculture Agriculture 58.59297 3.2226705 #> Industry Industry 47.93647 0.6580034 #> Commerce Commerce 226.99062 12.9021106 #> Services Services 36.89123 0.5767339 #> #> $`emp.cl:nace.macro` #> emp.cl nace.macro va.imp2/emp.num SE.va.imp2/emp.num #> [6,9].Agriculture [6,9] Agriculture 319.12944 51.112725 #> (9,19].Agriculture (9,19] Agriculture 89.32856 13.544489 #> (19,49].Agriculture (19,49] Agriculture 32.28502 5.257163 #> (49,99].Agriculture (49,99] Agriculture 38.69109 5.946148 #> (99,Inf].Agriculture (99,Inf] Agriculture 40.95623 0.000000 #> [6,9].Industry [6,9] Industry 121.11926 7.080938 #> (9,19].Industry (9,19] Industry 78.65799 4.980054 #> (19,49].Industry (19,49] Industry 66.31190 3.614409 #> (49,99].Industry (49,99] Industry 46.51120 2.568126 #> (99,Inf].Industry (99,Inf] Industry 39.34111 0.000000 #> [6,9].Commerce [6,9] Commerce 316.70158 46.278618 #> (9,19].Commerce (9,19] Commerce 285.70264 28.001828 #> (19,49].Commerce (19,49] Commerce 301.21698 46.346981 #> (49,99].Commerce (49,99] Commerce 232.77093 30.304836 #> (99,Inf].Commerce (99,Inf] Commerce 120.80088 0.000000 #> [6,9].Services [6,9] Services 121.93810 8.805127 #> (9,19].Services (9,19] Services 103.32787 6.112382 #> (19,49].Services (19,49] Services 78.11955 4.368817 #> (49,99].Services (49,99] Services 47.08830 2.824022 #> (99,Inf].Services (99,Inf] Services 23.83632 0.000000 #> #> attr(,"class") #> [1] "svystat.gr" "list"
estimator.kind(stat,des)
#> [1] "Ratio"
## grouped summary statistics: stat<-svystat(des,kind="R",num=~va.imp2,den=~emp.num,by=~emp.cl:nace.macro, group=~region,forGVF=FALSE) stat
#> $North #> region emp.cl nace.macro va.imp2/emp.num #> North.[6,9].Agriculture North [6,9] Agriculture 366.96371 #> North.(9,19].Agriculture North (9,19] Agriculture 125.14796 #> North.(19,49].Agriculture North (19,49] Agriculture 26.38628 #> North.(49,99].Agriculture North (49,99] Agriculture 40.69757 #> North.(99,Inf].Agriculture North (99,Inf] Agriculture 40.78901 #> North.[6,9].Industry North [6,9] Industry 149.44154 #> North.(9,19].Industry North (9,19] Industry 93.67811 #> North.(19,49].Industry North (19,49] Industry 71.30895 #> North.(49,99].Industry North (49,99] Industry 54.98881 #> North.(99,Inf].Industry North (99,Inf] Industry 42.17408 #> North.[6,9].Commerce North [6,9] Commerce 284.44988 #> North.(9,19].Commerce North (9,19] Commerce 285.75077 #> North.(19,49].Commerce North (19,49] Commerce 343.19045 #> North.(49,99].Commerce North (49,99] Commerce 277.32682 #> North.(99,Inf].Commerce North (99,Inf] Commerce 119.01810 #> North.[6,9].Services North [6,9] Services 114.79726 #> North.(9,19].Services North (9,19] Services 108.58072 #> North.(19,49].Services North (19,49] Services 81.84604 #> North.(49,99].Services North (49,99] Services 49.24988 #> North.(99,Inf].Services North (99,Inf] Services 23.62823 #> SE.va.imp2/emp.num #> North.[6,9].Agriculture 69.399164 #> North.(9,19].Agriculture 23.521324 #> North.(19,49].Agriculture 7.379092 #> North.(49,99].Agriculture 6.878927 #> North.(99,Inf].Agriculture 0.000000 #> North.[6,9].Industry 10.542207 #> North.(9,19].Industry 6.876373 #> North.(19,49].Industry 4.276559 #> North.(49,99].Industry 4.406634 #> North.(99,Inf].Industry 0.000000 #> North.[6,9].Commerce 53.520240 #> North.(9,19].Commerce 33.649105 #> North.(19,49].Commerce 65.511219 #> North.(49,99].Commerce 41.975198 #> North.(99,Inf].Commerce 0.000000 #> North.[6,9].Services 12.025794 #> North.(9,19].Services 7.641878 #> North.(19,49].Services 5.870567 #> North.(49,99].Services 3.834554 #> North.(99,Inf].Services 0.000000 #> #> $Center #> region emp.cl nace.macro va.imp2/emp.num #> Center.[6,9].Agriculture Center [6,9] Agriculture 255.17000 #> Center.(9,19].Agriculture Center (9,19] Agriculture 77.44690 #> Center.(19,49].Agriculture Center (19,49] Agriculture 54.65256 #> Center.(49,99].Agriculture Center (49,99] Agriculture 28.89706 #> Center.(99,Inf].Agriculture Center (99,Inf] Agriculture 71.19741 #> Center.[6,9].Industry Center [6,9] Industry 59.87445 #> Center.(9,19].Industry Center (9,19] Industry 34.18783 #> Center.(19,49].Industry Center (19,49] Industry 65.88804 #> Center.(49,99].Industry Center (49,99] Industry 26.98472 #> Center.(99,Inf].Industry Center (99,Inf] Industry 29.40858 #> Center.[6,9].Commerce Center [6,9] Commerce 250.78978 #> Center.(9,19].Commerce Center (9,19] Commerce 352.27161 #> Center.(19,49].Commerce Center (19,49] Commerce 177.15472 #> Center.(49,99].Commerce Center (49,99] Commerce 209.69909 #> Center.(99,Inf].Commerce Center (99,Inf] Commerce 75.61189 #> Center.[6,9].Services Center [6,9] Services 225.47039 #> Center.(9,19].Services Center (9,19] Services 72.56336 #> Center.(19,49].Services Center (19,49] Services 81.61965 #> Center.(49,99].Services Center (49,99] Services 32.95646 #> Center.(99,Inf].Services Center (99,Inf] Services 27.64846 #> SE.va.imp2/emp.num #> Center.[6,9].Agriculture 134.721936 #> Center.(9,19].Agriculture 35.177421 #> Center.(19,49].Agriculture 12.999974 #> Center.(49,99].Agriculture 10.348290 #> Center.(99,Inf].Agriculture 0.000000 #> Center.[6,9].Industry 11.869080 #> Center.(9,19].Industry 4.301401 #> Center.(19,49].Industry 9.918660 #> Center.(49,99].Industry 2.081170 #> Center.(99,Inf].Industry 0.000000 #> Center.[6,9].Commerce 37.069887 #> Center.(9,19].Commerce 87.846914 #> Center.(19,49].Commerce 28.297146 #> Center.(49,99].Commerce 55.335978 #> Center.(99,Inf].Commerce 0.000000 #> Center.[6,9].Services 19.646717 #> Center.(9,19].Services 10.978079 #> Center.(19,49].Services 9.053992 #> Center.(49,99].Services 2.193392 #> Center.(99,Inf].Services 0.000000 #> #> $South #> region emp.cl nace.macro va.imp2/emp.num #> South.[6,9].Agriculture South [6,9] Agriculture 184.591520 #> South.(9,19].Agriculture South (9,19] Agriculture 40.105422 #> South.(19,49].Agriculture South (19,49] Agriculture 34.953927 #> South.(99,Inf].Agriculture South (99,Inf] Agriculture 2.538631 #> South.[6,9].Industry South [6,9] Industry 114.786806 #> South.(9,19].Industry South (9,19] Industry 87.405151 #> South.(19,49].Industry South (19,49] Industry 51.414112 #> South.(49,99].Industry South (49,99] Industry 57.637797 #> South.(99,Inf].Industry South (99,Inf] Industry 45.439600 #> South.[6,9].Commerce South [6,9] Commerce 469.637600 #> South.(9,19].Commerce South (9,19] Commerce 218.753010 #> South.(19,49].Commerce South (19,49] Commerce 237.570888 #> South.(49,99].Commerce South (49,99] Commerce 65.432565 #> South.(99,Inf].Commerce South (99,Inf] Commerce 159.420290 #> South.[6,9].Services South [6,9] Services 58.804592 #> South.(9,19].Services South (9,19] Services 106.823712 #> South.(19,49].Services South (19,49] Services 59.160541 #> South.(49,99].Services South (49,99] Services 47.408801 #> South.(99,Inf].Services South (99,Inf] Services 22.027478 #> SE.va.imp2/emp.num #> South.[6,9].Agriculture 40.8041969 #> South.(9,19].Agriculture 9.9078878 #> South.(19,49].Agriculture 8.3784352 #> South.(99,Inf].Agriculture 0.0000000 #> South.[6,9].Industry 13.6388730 #> South.(9,19].Industry 13.1573725 #> South.(19,49].Industry 4.8598330 #> South.(49,99].Industry 4.3907101 #> South.(99,Inf].Industry 0.0000000 #> South.[6,9].Commerce 157.2612126 #> South.(9,19].Commerce 42.4770659 #> South.(19,49].Commerce 39.7773417 #> South.(49,99].Commerce 31.5943961 #> South.(99,Inf].Commerce 0.0000000 #> South.[6,9].Services 9.6455143 #> South.(9,19].Services 15.6861187 #> South.(19,49].Services 4.1040128 #> South.(49,99].Services 0.9976743 #> South.(99,Inf].Services 0.0000000 #> #> attr(,"group.vars") #> [1] "region" #> attr(,"class") #> [1] "svystat.gr" "list"
estimator.kind(stat,des)
#> [1] "Ratio"
# Behaviour with dummy variables: ## 1. convenience variable 'ent' (whose values are always 1, so that its # estimated total actually estimates haw many enterprises are there in the # target population) class(des$variables$ent)
#> [1] "numeric"
range(des$variables$ent)
#> [1] 1 1
# The estimated total is correctly recognized as a count stat<-svystatTM(des,~ent) stat
#> Total SE #> ent 17318 0
estimator.kind(stat,des)
#> [1] "Absolute Frequency"
## 2. an actual dummy variable (built on the fly) which indicates if the # enterprise has more than 29 employess or not: des<-des.addvars(des,emp.gt.29=as.numeric(emp.num > 29)) class(des$variables$emp.gt.29)
#> [1] "numeric"
range(des$variables$emp.gt.29)
#> [1] 0 1
# The estimated total is correctly recognized as an absolute frequency stat<-svystatTM(des,~emp.gt.29) stat
#> Total SE #> emp.gt.29 5283.518 57.90218
estimator.kind(stat,des)
#> [1] "Absolute Frequency"
# The estimated mean is correctly recognized as a relative frequency stat<-svystatTM(des,~emp.gt.29,estimator="Mean") stat
#> Mean SE #> emp.gt.29 0.3050882 0.003343468
estimator.kind(stat,des)
#> [1] "Relative Frequency"