Learn R Programming

simglm (version 0.8.0)

sim_err_single: Function that simulates errors.

Description

Input error simulation parameters and outputs simulated errors.

Usage

sim_err_single(
  error_var,
  n,
  with_err_gen,
  arima = FALSE,
  lvl1_err_params = NULL,
  arima_mod = list(NULL),
  ther = c(0, 1),
  ther_sim = FALSE,
  homogeneity = TRUE,
  fixef = NULL,
  heterogeneity_var = NULL,
  ...
)

Arguments

error_var

Numeric scalar of error variance or vector used when simulating heterogeneity of variance.

n

Cluster sample size.

with_err_gen

The generating function used.

arima

TRUE/FALSE flag indicating whether residuals should be correlated. If TRUE, must specify a valid model to pass to arima.sim via the arima_mod argument. See arima.sim for examples.

lvl1_err_params

Additional values that need to be passed to the function called from with_err_gen.

arima_mod

A list indicating the ARIMA model to pass to arima.sim. See arima.sim for examples.

ther

A vector of length two that specifies the theoretical mean and standard deviation of the with_err_gen. This would commonly be used to standardize the generating variable to have a mean of 0 and standard deviation of 1 to meet model assumptions. The variable is then rescaled to have the variance specified by error_var.

ther_sim

A TRUE/FALSE flag indicating whether the error simulation function should be simulated, that is should the mean and standard deviation used for standardization be simulated.

homogeneity

Either TRUE (default) indicating homogeneity of variance assumption is assumed or FALSE to indicate desire to generate heterogeneity of variance.

fixef

The design matrix, this is passed internally and used for heterogeneity of variance simulation.

heterogeneity_var

Variable name as a character string to use for heterogeneity of variance simulation.

...

Not currently used.

Details

Simulates error term for single level regression models.