Learn R Programming

NestedCategBayesImpute (version 1.2.1)

sampleG: Update household (group) level latent class indexes.

Description

Update household (group) level latent class indexes.

Usage

sampleG(phi, data, omega, pi, ni, HHdata, lambda, Parallel)

Arguments

phi

Matrix of posterior samples for the individual-level probabilities for each individual-level variable by each pair of group-level and individual-level latent classes.

data

Individual level data.

omega

Matrix of the probabilities for the individual-level latent classes by the group-level latent classes.

pi

Vector of the probabilities for the group-level latent classes.

ni

Vector containing the number of individuals in each household in the data..

HHdata

Household level data.

lambda

A list of matrices of the group-level probabilities for each group-level variable by the group-level latent classes. Each matrix in the list is for each group-level variable.

Parallel

Logical indicator for running the function in parallel mode.

Value

A list with two variables.

G

A vector for the updated values of the household-level latent class indexes for all households in the input data.

G_Individuals

The vector G expanded to a long format to match the number of individuals in data.

Details

Function for obtaining a posterior sample of the household-level latent class indexes for all households in the input data based on the corresponding full conditional distribution.