extractors | R Documentation |
These functions extract standard errors (SE
), variances (VAR
), coefficients of variation (cv
) and design effects (deff
) from an object which has been returned by a survey statistic function (e.g. svystatTM
, svystatR
, svystatS
, svystatSR
, svystatB
, svystatQ
, svystatL
, svystat
, ...).
SE(object, ...)
VAR(object, ...)
cv(object, ...)
deff(object, ...)
object |
An object containing survey statistics. |
... |
Arguments for future expansion. |
With the exception of deff
, all extractor functions can be used on any object returned by a survey statistic function: the correct answer will be obtained whatever the call that generated the object. For getting the design effect, object
must have been built with option deff = TRUE
or deff = "replace"
.
A data structure (typically inheriting from classes matrix
or data.frame
) storing the requested information.
Package ReGenesees provides extensions of methods coef
and confint
(originally from package stats) that can be used to extract estimates and confidence intervals respectively.
Diego Zardetto
Function coef
to extract estimates and function confint
to extract confidence intervals. Estimators of Totals and Means svystatTM
, Ratios between Totals svystatR
, Shares svystatS
, Ratios between Shares svystatSR
, Multiple Regression Coefficients svystatB
, Quantiles svystatQ
, Complex Analytic Functions of Totals and/or Means svystatL
, and all of the above svystat
.
# Creation of a design object:
data(sbs)
des<-e.svydesign(data=sbs,ids=~id,strata=~strata,weights=~weight,
fpc=~fpc)
# Estimation of the average value added at the
# nation level (by default one gets the SE):
VA.avg <- svystatTM(des,~va.imp2,estimator="Mean")
VA.avg
# Extractions of some variance statistics from the
# object above:
## 1) SE
SE(VA.avg)
## 2) CV
cv(VA.avg)
## 3) VAR
VAR(VA.avg)
# Design effects have to be requested in advance,
# i.e. the following invocation produces an error:
## Not run:
deff(VA.avg)
## End(Not run)
# ...while the following works:
VA.avg <- svystatTM(des,~va.imp2,estimator="Mean",deff=TRUE)
deff(VA.avg)
# Further examples:
## Extract the statistic:
coef(VA.avg)
## Extract the confidence interval at 90%
## confidence level (the default would be 95%):
confint(VA.avg, level=0.9)
## note the argument 'level', which comes from confint function in package stats
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.