Learn R Programming

NestedCategBayesImpute (version 1.2.1)

GetImpossibleHouseholds: Generate the desired number of impossible households required to observe a given number of possible households.

Description

Given model parameters, generate the desired number of impossible households required to observe a given number of possible households. Also generate synthetic (and valid) data of the same size as the observed data when required.

Usage

GetImpossibleHouseholds(d, n_star_h, lambda, omega, phi, pi, blocksize, n, synindex,
                        HHhead_at_group_level,Parallel)

Arguments

d

Vector containing the number of levels for each individual-level variable.

n_star_h

Vector containing the number of observed households for the different household sizes in the original data.

lambda

Multinomial probabilities for each group-level variable.

omega

Latent class probabilities for the group-level and individual-level latent class pairs.

phi

Multinomial probabilities for each individual-level variable by each pair of group-level and individual-level latent classes.

pi

Latent class probabilities for the group-level latent classes.

blocksize

Number of households to be generated at a time; batch sampling is used to improve computing speed.

n

Number of households in the original input data and the sum of n_star_h.

synindex

Logical indicator for sampling synthetic data. Set to TRUE when synthetic data is needed.

HHhead_at_group_level

Logical indicator for data structure with respect to the household head. Set to TRUE if the household head has been moved to the household level and FALSE otherwise.

Parallel

Logical indicator for running the function in parallel mode.

Value

G_Individuals_and_M_extra

A data matrix containing both the group-level (in long format) and individual-level latent classes for the impossible households.

G_extra

A vector containing the group-level latent classes for the impossible households.

IndividualData_extra

A data matrix containing the individual-level data for the impossible households.

HHdata_extra

A data matrix containing the group-level data for the impossible households.

hh_size_new

A vector for the number of impossible households for the different household sizes.

synIndividuals_all

Synthetic data when synindex is TRUE. NULL otherwise.