powered by
One of the components which can be added to a sim_setup.
sim_setup
sim_resp(simSetup, respFun)sim_resp_eq(simSetup, ...)
sim_resp_eq(simSetup, ...)
a sim_setup.
a function constructing the response variable
<data-masking> Name-value pairs. The name gives the name of the column in the output.
data-masking
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.
NULL
A data frame or tibble, to create multiple columns in the output.
Potentially you can define an respFun yourself. Take care that it only has one argument, named dat, and returns the a data.frame.
respFun
dat
data.frame
agg_all, sim_gen, sim_comp_pop, sim_sample, , sim_comp_sample
agg_all
sim_gen
sim_comp_pop
sim_sample
sim_comp_sample
# 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