sim_data | R Documentation |
Simulate data based on a model and parameter distributions
sim_data(
design = cbind(id = c(1, 1, 1), idv = c(0, 1, 2)),
model = function(x) {
return(x$alpha + x$beta)
},
theta,
omega_mat,
par_names,
par_values = NULL,
draw_iiv = "mvrnorm",
error = list(proportional = 0, additive = 0, exponential = 0),
n = 100
)
design |
a design dataset. See example |
model |
A function with the first argument the simulation design, i.e. a dataset with the columns ... The second argument to this function is a dataset with parameters for every individual. This can be supplied by the user, or generated by this sim_data if theta and omega_mat are supplied. |
theta |
vector of fixed effect parameters |
omega_mat |
vector of between subject random effects, specified as lower triangle |
par_names |
A character vector linking the parameters in the model to the variables in the dataset. See example. |
par_values |
parameter values |
draw_iiv |
draw between subject random effects? |
error |
see example |
n |
number of simulations to perform |
This function generates the simulated dependent values for use in the VPC plotting function.
a vector of simulated dependent variables (for us in the VPC plotting function)
vpc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.