Learn R Programming

simPop (version 0.2.15)

simStructure: Simulate the household structure of population data

Description

Simulate basic categorical variables that define the household structure (typically variables such as household ID, age and gender) of population data by resampling from survey data.

Usage

simStructure(dataS, method = c("direct", "multinom", "distribution"), basicHHvars, seed)

Arguments

dataS
an object of class dataObj containing household survey data that is usually generated with specifyInput.
method
a character string specifying the method to be used for simulating the household sizes. Accepted values are "direct" (estimation of the population totals for each combination of stratum and household size using the Horvitz-Thompson estimator
basicHHvars
a character vector specifying important variables for the household structure that need to be available in dataS. Typically variables such as age or sex may be used.
seed
optional; an integer value to be used as the seed of the random number generator, or an integer vector containing the state of the random number generator to be restored.

Value

  • An object of class simPopObj containing the simulated population household structure as well as the underlying sample that was provided as input.

See Also

simCategorical, simContinuous, simComponents, simEUSILC

Examples

Run this code
data(eusilcS)
inp <- specifyInput(data=eusilcS, hhid="db030", hhsize="hsize", strata="db040", weight="db090")
eusilcP <- simStructure(data=inp, method="direct", basicHHvars=c("age", "rb090"))
class(eusilcP)
str(eusilcP)

Run the code above in your browser using DataLab