Package 'WgtEff'

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: 2025-03-04 04:47:36 UTC
Source: https://github.com/cran/WgtEff

Help Index


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)

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


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)