population_gen: Generate population

View source: R/population.R

population_genR Documentation

Generate population

Description

Generate population data (X in standart notation) from a population object.

Usage

population_gen(population, seed = NULL, class = TRUE)

Arguments

population

Input population configuration

seed

The seed to be set before attempting to generate population data. Defaults to NULL.

class

Logical. Indicates whether or not to include individual class information to the resulting data.frame. Defaults to NULL.

Value

data.frame A data.frame (X) with simulated population (one row per individual).

Examples

# Create individuals
ind1 <- individual$new()
ind1$add_characteristics(Age = rnorm(mean = 40, sd = 10))
ind1$add_decision_rule(drule <- decision_rule$new())
ind2 <- individual$new()
ind2$add_characteristics(Age = rnorm(mean = 30, sd = 5))
ind2$add_decision_rule(drule <- decision_rule$new())

# Regroup individuals into population
pop <- population$new(profiles = list(ind1, ind2), n = list(10, 15))
X <- population_gen(pop)

nikitagusarov/dcesimulatr documentation built on Jan. 7, 2023, 4:27 p.m.