fitstepwise.bestpath: Fit lmer model using model selection

Description Usage Arguments Details Value See Also Examples

Description

Analyzes data using lmer, using model selection to test significance of random slope terms in the model (likelihood ratio tests). Does forward or backward selection. Unlike fitstepwise, before taking a step forward (or backward) both possible slopes are tested, and the "best" (most conservative) step is taken. NB: one-factor design only.

Usage

1
2
fitstepwise.bestpath(mcr.data, forward, crit = c(0.01, 0.05, seq(0.1,
  0.8, 0.1)))

Arguments

mcr.data

A dataframe formatted as described in mkDf. Named thus to interface with the function mcRun.

forward

Should a forward model (TRUE) or backward model (FALSE) be run?

crit

alpha level for each likelihood-ratio test of slope variance.

Details

It only makes sense to run this with data from a within-subject/within-items design (since for within-subject/between-items data, there is only one slope to be tested, and the procedure is therefore equivalent to a simple stepwise algorithm.

Note that for purposes of efficiency, forward and backward models are not run simultaneously as with fitstepwise.

Value

A single row of a dataframe with number of fields depending on crit. Stepwise lmer models output six values for each alpha level (i.e., level of crit. These values are:

The values are given once for the specified direction (forward or backward). Thus, if there are two values of crit, there will be 6 (value) x 2 (levels of crit) = 12 values in each row of the dataframe. To assemble a dataframe of results from a file into a three-dimensional array, see reassembleStepwiseFile.

fm

the model that was selected. 4 means that no model converged. For forward stepping models, 3 = maximal model was selected; 2 = model includes only first slope; 1 = model is random intercept only. For backward stepping models, 1 = maximal model, 2 = model minus one slope, 3 = random intercept model.

t

t-statistic for the treatment effect

chi

chi-square statistic for the likelihood ratio test (1 df)

pt

p-value for the t-statistic (normal distribution)

pchi

p-value for the chi-square statistic

See Also

fitlmer, fitstepwise, reassembleStepwiseFile

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
nmc <- 10
pmx <- cbind(randParams(genParamRanges(), nmc, 1001), seed=mkSeeds(nmc, 1001))

x8 <- mkDf(nsubj=24, nitem=24, pmx[8,], wsbi=FALSE)

# forward
fitstepwise.bestpath(mcr.data=x8, forward=TRUE, crit=.05)

# backward
fitstepwise.bestpath(mcr.data=x8, forward=FALSE, crit=.05)

dalejbarr/simgen documentation built on May 14, 2019, 3:32 p.m.