Title: | Functions for Weighting Effects |
Version: | 0.1.2 |
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. |
Imports: | stats |
Depends: | R (≥ 3.5) |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.1.1 |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2019-06-09 21:12:18 UTC; JOSHUA |
Author: | Joshua Miller [aut, cre] |
Maintainer: | Joshua Miller <joshlmiller@msn.com> |
Repository: | CRAN |
Date/Publication: | 2019-06-09 22:30:03 UTC |
Calculate DEFF
Description
Calculates design effect (DEFF)
Usage
DEFF(x)
Arguments
x |
= weights vector (name of weights column) |
Value
Design effect (DEFF)
References
Design effect (DEFF) due to weighting => n * (sum(x^2) / sum(x)^2)
Examples
DEFF(testweights$weights_column)
Calculate DEFT
Description
Calculates root design effect (DEFT)
Usage
DEFT(x)
Arguments
x |
= weights vector (name of weights column) |
Value
Root design effect (DEFT)
References
Root design effect (DEFT) => square root of DEFF
Examples
DEFT(testweights$weights_column)
Calculate ESS
Description
Calculates effective sample size (ESS)
Usage
ESS(x)
Arguments
x |
= weights vector (name of weights column) |
Value
Effective sample size (ESS)
References
Effective sample size (ESS) => sum(x)^2 / sum(x^2)
Examples
ESS(testweights$weights_column)
Calculate Full Statistics
Description
Calculates DEFF, weighting loss, DEFT, ESS, and MOE
Usage
FULL(p = 50, conf = 95, N, wtcol)
Arguments
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) |
Value
DEFF, weighting loss, DEFT, ESS, and MOE
Examples
FULL(N=3000, wtcol=testweights$weights_column)
Calculate MOE
Description
Calculates weighted margin of error (MOE)
Usage
MOE(p = 50, conf = 95, N, wtcol)
Arguments
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) |
Value
Weighted margin of error (MOE)
References
Weighted margin of error (MOE) => unweighted MOE * DEFT
Examples
MOE(N=3000, wtcol=testweights$weights_column)
Calculate weighting loss
Description
Calculates weighting loss
Usage
WTGLOSS(x)
Arguments
x |
= weights vector (name of weights column) |
Value
Weighting loss
References
Weighting loss => DEFF-1
Examples
WTGLOSS(testweights$weights_column)
An example weights column for a data set of 80 cases
Description
An example weights column for a data set of 80 cases
Usage
testweights
Format
A data frame with 80 rows and 1 variable
- weights_column
data weights
Source
Example data generated by author