Methods and utility functions for objects of class svystat_rob
.
mse(object, ...)
# S3 method for svystat_rob
mse(object, ...)
# S3 method for svystat
mse(object, ...)
# S3 method for svystat_rob
summary(object, digits = max(3L,
getOption("digits") - 3L), ...)
# S3 method for svystat_rob
coef(object, ...)
# S3 method for svystat_rob
SE(object, ...)
# S3 method for svystat_rob
vcov(object, ...)
# S3 method for svystat_rob
scale(x, ...)
# S3 method for svystat_rob
residuals(object, ...)
# S3 method for svystat_rob
fitted(object, ...)
robweights(object)
# S3 method for svystat_rob
robweights(object)
# S3 method for svystat_rob
print(x, digits = max(3L, getOption("digits") - 3L), ...)
object of class svystat_rob
.
[integer]
minimal number of significant digits.
additional arguments passed to the method.
object of class svystat_rob
.
Package survey must be attached to the search path in order to use
the functions (see library
or require
).
Utility functions:
mse
computes the estimated risk (mean square
error) in presence of representative outliers; see also
mer
summary
gives a summary of the estimation properties
robweights
extracts the robustness weights
coef
extracts the estimate of location
SE
extracts the (estimated) standard error
vcov
extracts the (estimated) covariance matrix
residuals
extracts the residuals
fitted
extracts the fitted values
svymean_dalen
, svymean_huber
,
svymean_ratio
, svymean_reg
,
svymean_tukey
, svymean_trimmed
,
svymean_winsorized
svytotal_dalen
, svytotal_huber
,
svytotal_ratio
, svytotal_reg
,
svytotal_tukey
, svytotal_trimmed
,
svytotal_winsorized
head(workplace)
library(survey)
# Survey design for stratified simple random sampling without replacement
dn <- if (packageVersion("survey") >= "4.2") {
# survey design with pre-calibrated weights
svydesign(ids = ~ID, strata = ~strat, fpc = ~fpc, weights = ~weight,
data = workplace, calibrate.formula = ~-1 + strat)
} else {
# legacy mode
svydesign(ids = ~ID, strata = ~strat, fpc = ~fpc, weights = ~weight,
data = workplace)
}
# Estimated one-sided k winsorized population total (i.e., k = 2 observations
# are winsorized at the top of the distribution)
wtot <- svytotal_k_winsorized(~employment, dn, k = 2)
# Show summary statistic of the estimated total
summary(wtot)
# Estimated mean square error (MSE)
mse(wtot)
# Estimate, std. err., variance, and the residuals
coef(wtot)
SE(wtot)
vcov(wtot)
residuals(wtot)
# M-estimate of the total (Huber psi-function; tuning constant k = 3)
mtot <- svytotal_huber(~employment, dn, k = 45)
# Plot of the robustness weights of the M-estimate against its residuals
plot(residuals(mtot), robweights(mtot))
Run the code above in your browser using DataLab