Data are generated from an a density defined by a vector of integers.

addDataDensity(dtOld, dataDist, varname, uselimits = FALSE)

Arguments

dtOld

Name of data table that is to be updated.

dataDist

Vector that defines the desired density.

varname

Name of variable name.

uselimits

Indicator to use minimum and maximum of input data vector as limits for sampling. Defaults to FALSE, in which case a smoothed density that extends beyond the limits is used.

Value

A data table with the generated data.

Examples

def <- defData(varname = "x1", formula = 5, dist = "poisson")

data_dist <- data_dist <- c(1, 2, 2, 3, 4, 4, 4, 5, 6, 6, 7, 7, 7, 8, 9, 10, 10)

dd <- genData(500, def)
dd <- addDataDensity(dd, data_dist, varname = "x2")
dd <- addDataDensity(dd, data_dist, varname = "x3", uselimits = TRUE)