lsa_weights: lsa_weights() computes normalized and effective sample size...

View source: R/lsa_weights.R

lsa_weightsR Documentation

lsa_weights() computes normalized and effective sample size weights for pseudo maximum likelihood mixed models, with large scale assessment data

Description

lsa_weights() computes normalized and effective sample size weights for pseudo maximum likelihood mixed models, with large scale assessment data

Usage

lsa_weights(data, id_i, id_j, id_k, wt, wi, wj)

Arguments

data

data frame object which contains the rest of the arguments

id_i

a numeric vector of a single variable

id_j

a numeric vector of a single variable

id_k

a numeric vector of a single variable

wt

observations final weight

wi

observations weigth within the primary sampling unit (i.e. students eight within the school)

wj

cluster weights (i.e. school weights)

Details

a collection of dplyr::mutate sequences to create normalized and effective sample weights (see Rabe-Hesketh & Skrondal, 2006; Snijder & Bosker, 2012)

Value

the original data frame with the new weights at the end, where 'wa1' nad 'wa2' are level 1 and level 2 normalized weights; 'wb1' nad 'wb2' are level 1 and level 2 effectives sample weights.

Examples

library(dplyr)
data_frame_with_weights <- data_frame %>%
                           r4sda::lsa_weights(.,
                             id_i = 'id_i',
                             id_j = 'id_j',
                             id_k = 'id_k',
                             wt = 'wt',
                             wi = 'wi',
                             wj = 'wj' )

dacarras/r4sda documentation built on Nov. 9, 2023, 10:17 a.m.