Learn R Programming

NestedCategBayesImpute (version 1.2.1)

samplehouseholds: Rcpp implementation for sampling household data without constraints.

Description

Rcpp implementation for sampling household data without constraints.

Usage

samplehouseholds(phi, omega, pi, d, lambda, currrentbatch, nHouseholds, householdsize,
      HeadAtGroupLevel, 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.

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.

d

Vector containing the number of levels for each of the indiviual-level variables.

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.

currrentbatch

The current batch number for the household data to be generated. The household ID will be generated based on this batch number.

nHouseholds

The number of households to be generated by one call to this function.

householdsize

The size of the households to be generated.

HeadAtGroupLevel

Logical indicator for running the model that codes household head at the group level.

Parallel

Logical indicator for running the function in parallel mode.

Value

A data matrix with each row for one household.

Details

This function allows the model to generate a batch of nHouseholds with each household of size householdsize. The generated household data will include both possible and impossible households. Use samplehouseholds when the household head is included as an individual within the household.