| Title: | Functions for Weighting Effects |
|---|---|
| Description: | Functions for determining the effect of data weights on the variance of survey data: users will load a data set which has a weights column, and the package will calculate the design effect (DEFF), weighting loss, root design effect (DEFT), effective sample size (ESS), and/or weighted margin of error. |
| Authors: | Joshua Miller [aut, cre] |
| Maintainer: | Joshua Miller <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.1.2 |
| Built: | 2026-06-03 10:23:40 UTC |
| Source: | https://github.com/cran/WgtEff |
Calculates design effect (DEFF)
DEFF(x)DEFF(x)
x |
= weights vector (name of weights column) |
Design effect (DEFF)
Design effect (DEFF) due to weighting => n * (sum(x^2) / sum(x)^2)
DEFF(testweights$weights_column)DEFF(testweights$weights_column)
Calculates root design effect (DEFT)
DEFT(x)DEFT(x)
x |
= weights vector (name of weights column) |
Root design effect (DEFT)
Root design effect (DEFT) => square root of DEFF
DEFT(testweights$weights_column)DEFT(testweights$weights_column)
Calculates effective sample size (ESS)
ESS(x)ESS(x)
x |
= weights vector (name of weights column) |
Effective sample size (ESS)
Effective sample size (ESS) => sum(x)^2 / sum(x^2)
ESS(testweights$weights_column)ESS(testweights$weights_column)
Calculates DEFF, weighting loss, DEFT, ESS, and MOE
FULL(p = 50, conf = 95, N, wtcol)FULL(p = 50, conf = 95, N, wtcol)
p |
= percentage for which MOE is calculated (optional, default is p = 50) |
conf |
= level of confidence (optional, default is conf = 95) |
N |
= population size (optional, used for finite population correction) |
wtcol |
= Weights vector (name of weights column) |
DEFF, weighting loss, DEFT, ESS, and MOE
FULL(N=3000, wtcol=testweights$weights_column)FULL(N=3000, wtcol=testweights$weights_column)
Calculates weighted margin of error (MOE)
MOE(p = 50, conf = 95, N, wtcol)MOE(p = 50, conf = 95, N, wtcol)
p |
= percentage for which MOE is calculated (optional, default is p = 50) |
conf |
= level of confidence (optional, default is conf = 95) |
N |
= population size (optional, used for finite population correction) |
wtcol |
= Weights vector (name of weights column) |
Weighted margin of error (MOE)
Weighted margin of error (MOE) => unweighted MOE * DEFT
MOE(N=3000, wtcol=testweights$weights_column)MOE(N=3000, wtcol=testweights$weights_column)
An example weights column for a data set of 80 cases
testweightstestweights
A data frame with 80 rows and 1 variable
data weights
Example data generated by author
Calculates weighting loss
WTGLOSS(x)WTGLOSS(x)
x |
= weights vector (name of weights column) |
Weighting loss
Weighting loss => DEFF-1
WTGLOSS(testweights$weights_column)WTGLOSS(testweights$weights_column)