Learn R Programming

saeSim (version 0.11.0)

sim_resp: Response component

Description

One of the components which can be added to a sim_setup.

Usage

sim_resp(simSetup, respFun)

sim_resp_eq(simSetup, ...)

Arguments

simSetup

a sim_setup.

respFun

a function constructing the response variable

...

<data-masking> Name-value pairs. The name gives the name of the column in the output.

The value can be:

  • A vector of length 1, which will be recycled to the correct length.

  • A vector the same length as the current group (or the whole data frame if ungrouped).

  • NULL, to remove the column.

  • A data frame or tibble, to create multiple columns in the output.

Details

Potentially you can define an respFun yourself. Take care that it only has one argument, named dat, and returns the a data.frame.

See Also

agg_all, sim_gen, sim_comp_pop, sim_sample, , sim_comp_sample

Examples

Run this code
# NOT RUN {
base_id() %>% sim_gen_x() %>% sim_gen_e() %>% sim_resp_eq(y = 100 + 2 * x + e)
# }

Run the code above in your browser using DataLab