Input fixed variables, sample size, and number of within variables, returns design matrix.
sim_fixef_nested3(
fixed,
fixed_vars,
cov_param,
k,
n,
p,
data_str,
cor_vars = NULL,
fact_vars = list(NULL),
contrasts = NULL,
knot_args = list(NULL)
)
One sided formula for fixed effects in the simulation.
Character vector of covariates for design matrix.
List of arguments. Required arguments are:
dist_fun: This is a quoted R distribution function.
var_type: This is the level of variable to generate. Must be either 'level1', 'level2', or 'level3'. Must be same order as fixed formula above.
Optional arguments to the distribution functions are in a nested list, see the examples for example code for this. Does not include intercept, time, factors, or interactions.
Number of third level clusters.
Number of clusters.
Number of within cluster units.
Type of data. Must be "cross", or "long".
A vector of correlations between variables.
A nested list of factor, categorical, or ordinal variable specification, each list must include:
numlevels = Number of levels for ordinal or factor variables.
var_type = Must be 'level1', 'level2', or 'level3'.
Optional arguments passed on to sample in a nested list. These include:
replace
prob
value.labels
See also sample
for use of these optional arguments.
An optional list that specifies the contrasts to be used for factor
variables (i.e. those variables with .f or .c). See contrasts
for
more detail.
A nested list of named knot arguments. See sim_knot
for more details. Arguments must include:
var
knot_locations
Simulates the fixed effects for the sim_reg
function when a
linear mixed model is specified. This function assumes a time variable when
longitudinal data is specified and does include any interactions that are
specified.