estimator.kind | R Documentation |
Identifies what kind of estimator has been used to compute a (set of) survey static(s).
estimator.kind(stat, design)
stat |
An object containing survey statistics. |
design |
Object of class |
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’).
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'
Diego Zardetto
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.
# 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
estimator.kind(stat,des)
stat<-svystatTM(des,~emp.num,estimator="Mean")
stat
estimator.kind(stat,des)
stat<-svystatTM(des,~emp.num+emp.cl)
stat
estimator.kind(stat,des)
stat<-svystatR(des,num=~va.imp2,den=~emp.num,by=~region)
stat
estimator.kind(stat,des)
stat<-svystatQ(des,y=~va.imp2,ties="rounded")
stat
estimator.kind(stat,des)
# 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
estimator.kind(stat,des)
## grouped summary statistics:
stat<-svystat(des,kind="R",num=~va.imp2,den=~emp.num,by=~emp.cl:nace.macro,
group=~region,forGVF=FALSE)
stat
estimator.kind(stat,des)
# 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)
range(des$variables$ent)
# The estimated total is correctly recognized as a count
stat<-svystatTM(des,~ent)
stat
estimator.kind(stat,des)
## 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)
range(des$variables$emp.gt.29)
# The estimated total is correctly recognized as an absolute frequency
stat<-svystatTM(des,~emp.gt.29)
stat
estimator.kind(stat,des)
# The estimated mean is correctly recognized as a relative frequency
stat<-svystatTM(des,~emp.gt.29,estimator="Mean")
stat
estimator.kind(stat,des)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.