fit_2x2: Fit models to 2x2 data with autocorrelated errors

Description Usage Arguments Details Value

View source: R/simulation.R

Description

Fit models to 2x2 data with autocorrelated errors

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fit_2x2(
  dat,
  cs = FALSE,
  by_subj_fs = TRUE,
  dontfit = FALSE,
  m = NA,
  k = -1,
  bam_args = NULL,
  fit_blocked = TRUE,
  fit_lmem = TRUE
)

Arguments

dat

Data generated using sim_2x2().

cs

Fit smooths as main effect of trial (in addition to by-subject factor smooths) for the GAMM models?

by_subj_fs

Include by-subject factor smooths in GAMM?

dontfit

If TRUE, don't fit the models, just return the model formulas. Used for debugging.

m

The m parameter to be passed on to any factor smooths (specified in the mgcv::s() function).

k

The k parameter to be passed on to any factor smooths (specified in the mgcv::s() function).

bam_args

Any other arguments to be passed on to mgcv::bam() (for the fitting of the GAMM models only.)

fit_blocked

Whether to fit the blocked version in addition to the randomized version.

fit_lmem

Whether to fit the LMEM in addition to the GAMM.

Details

Fits four models using bam:

1

A Generalized Additive Mixed Model (GAMM) for the blocked DV (Y_b);

2

A Linear Mixed-Effects Model (LMEM) for the blocked DV (Y_b);

3

A GAMM for the randomized DV (Y_r); and

4

A LMEM for the randomized DV (Y_r).

Value

15x2x2 array with model statistics (or just the model formulas if dontfit is TRUE). Second dimension is GAMM or LMEM, third is randomized or blocked, and first dimension is as follows.

e_int

Estimated intercept.

e_A

Estimated main effect of A.

e_B

Estimated main effect of B.

e_AB

Estimated AB interaction.

se_int

Standard error for the intercept.

se_A

Standard error for A.

se_B

Standard error for B.

se_AB

Standard error for AB.

p_int

P-value for the intercept.

p_A

P-value for the main effect of A.

p_B

P-value for the main effect of B.

p_AB

P-value for the AB interaction.

AIC

Akaike Information Criterion for the model.

resid_df

Residual degrees of freedom.

resid_dev

Residual deviance.


dalejbarr/autocorr documentation built on March 27, 2021, 3:03 a.m.