fit_lmem: Fit Linear Mixed-Effects Model to Simulated Ratings

Description Usage Arguments Details Value See Also Examples

View source: R/fit.R

Description

Fit a linear mixed-effects model (LMM) to simulated ratings data.

Usage

1
fit_lmem(.data, main_effect = FALSE)

Arguments

.data

Data frame, with the format as resulting from a call to gen_data.

main_effect

Whether to test the main effect of repetition (TRUE) or the repetition-by-interval interaction (FALSE; the default).

Details

This function is used to estimate parameters for power analysis with simulated data. fit_lmem fits a linear-mixed effects model to the data with lmer and tests the specified effect (interaction or main effect) using a likelihood-ratio test. If the interaction is to be tested, the following two models are compared.

trating ~ R * (I1 + I2 + I3) + (1 + R:I1 + R:I2 + R:I3 || subj_id) + (1 + R:I1 + R:I2 + R:I3 || stim_id)

trating ~ R + I1 + I2 + I3 + (1 + R:I1 + R:I2 + R:I3 || subj_id) + (1 + R:I1 + R:I2 + R:I3 || stim_id).

If the main effect is to be tested, then the following two models are compared.

trating ~ R * (I1 + I2 + I3) + (1 + R || subj_id) + (1 + R || stim_id)

trating ~ I1 + I2 + I3 + R:I1 + R:I2 + R:I3) + (1 + R || subj_id) + (1 + R || stim_id).

Value

A vector, with the following elements.

(Intercept)

Fixed-effects estimate of the intercept.

R

Fixed-effects estimate of the main effect of repetition.

I1

Fixed-effects estimate of the main effect of interval (1).

I2

Fixed-effects estimate of the main effect of interval (2).

I3

Fixed-effects estimate of the main effect of interval (3).

R:I1

Fixed-effects estimate of the interaction (1).

R:I2

Fixed-effects estimate of the interaction (2).

R:I3

Fixed-effects estimate of the interaction (3).

dev1

Deviance for the model including the effect(s) of interest.

dev2

Deviance for the model excluding the effect(s) of interest.

chisq_RI

Chi-square value for the likelihood ratio test.

p_RI

Associated p-value.

m1_singular

Whether the covariance matrix for model 1 was singular.

m2_singular

Whether the covariance matrix for model 2 was singular.

m1_conv

Whether model 1 converged.

m2_conv

Whether model 2 converged.

See Also

gen_data, power_sim.

Examples

1
2
3
set.seed(62)
dat <- gen_data(40) 
fit_lmem(dat, TRUE) # test main effect

truthiness documentation built on May 24, 2021, 9:07 a.m.