View source: R/svymean_dalen.R
| svymean_dalen | R Documentation |
Dalen's estimators Z2 and Z3 of the population mean and total; see
weighted_mean_dalen for further details.
svymean_dalen(x, design, censoring, type = "Z2", na.rm = FALSE,
verbose = TRUE, ...)
svytotal_dalen(x, design, censoring, type = "Z2", na.rm = FALSE,
verbose = TRUE, ...)
x |
a one-sided |
design |
an object of class |
censoring |
|
type |
|
na.rm |
|
verbose |
|
... |
additional arguments (currently not used). |
Package survey must be attached to the search path in order to use
the functions (see library or require).
type = "Z2" or type = "Z3"; see
weighted_mean_dalen for more details.
summary,
coef, SE,
vcov,
residuals,
fitted,
robweights.
See weighted_mean_dalen and
weighted_total_dalen.
Object of class svystat_rob
Dalén, J. (1987). Practical Estimators of a Population Total Which Reduce the Impact of Large Observations. R & D Report U/STM 1987:32, Statistics Sweden, Stockholm.
Overview (of all implemented functions)
svymean_trimmed, svytotal_trimmed,
svymean_winsorized, svytotal_winsorized,
svymean_huber and svytotal_huber
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)
}
# Dalen's estimator Z3 of the population total
svytotal_dalen(~employment, dn, censoring = 20000, type = "Z3")
# Dalen's estimator Z3 of the population mean
m <- svymean_dalen(~employment, dn, censoring = 20000, type = "Z3")
# Summarize
summary(m)
# Extract estimate
coef(m)
# Extract estimated standard error
SE(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.