Learn R Programming

languageR (version 1.0)

simulateRegression.fnc: Simulate regression data and compare models

Description

This function creates a user-specified number of simulated regression datasets, and compares mixed-effects regression with random regression, by-subject regression, by-item regression, and by-subject plus by-item regression. Optionally, an effect of learning or fatigue can be incorporated.

Usage

simulateRegression.fnc(beta = c(400, 2, 6, 4), nitem = 20, nsubj = 10, 
stdevItem = 40, stdevSubj = 80, stdevError = 50, nruns = 100, learn = FALSE, 
learnRate = 10, ...)

Arguments

beta
A numeric vector with beta weights for the intercept and three numeric predictors.
nitem
A number specifying the number of items.
nsubj
A number specifying the number of subjects.
stdevItem
A number specifying the standard deviation of the Item random effect.
stdevSubj
A number specifying the standard deviation of the Subject random effect.
stdevError
A number specifying the standard deviation of the Residual Error.
nruns
A number specifying the required number of simulated datasets.
learn
A logical that if TRUE, allows an effect of learning or fatigue into the model.
learnRate
A number specifying the learning rate (if negative) or the effect of fatigue (if positive).
...
other parameters to be passed through to plotting functions.

Value

  • A list with components
  • alpha05proportion of runs in which predictors are significant at the 05 significance level.
  • alpha01proportion of runs in which predictors are significant at the 01 significance level.
  • ranefmean estimated random effects.
  • As this may take some time, the index of each completed run is shown on the output device.

See Also

See Also make.reg.fnc.

Examples

Run this code
library(lme4)
  simulateRegression.fnc(beta = c(400, 2, 6, 4), nruns = 5)

  \dontrun{simulateRegression.fnc(beta = c(400, 2, 6, 0), nruns = 1000, learn = TRUE)}

Run the code above in your browser using DataLab