mixed_mf: mixed_mf

View source: R/mixed_mf.R

mixed_mfR Documentation

mixed_mf

Description

Basic function for running mixed models for the multiverse analysis

Usage

mixed_mf(
  cs1,
  cs2,
  data,
  subj,
  group = NULL,
  phase = "acquisition",
  dv = "scr",
  exclusion = "full data",
  cut_off = "full data"
)

Arguments

cs1

The column name(s) of the conditioned responses for the first conditioned stimulus

cs2

The column name(s) of the conditioned responses for the second conditioned stimulus

data

A data frame containing all the relevant columns for the analyses

subj

The name of the column including the participant numbers. Unique numbers are expected

group

the name of the group, if included, default to NULL

phase

The conditioned phase that the analyses refer to. Accepted values are acquisition, acq, extinction, or ext

dv

name of the measured conditioned response. Default to "SCR"

exclusion

Name of the data reduction procedure used. Default to full data

cut_off

cut off Name of the cut_off applied. Default to full data

Details

The function assumes that you include more than 1 trial per CS. The function returns an error if that is not the function.

The function performs by default two dependent variable standardizations, the one per subject and the other one without taking subject into account.

In case time is included, the function computes the intercept – i.e., the 0 point – on the middle of the time sequence.

The following models are run and compared: a) Intercept only model, b) Intercept plus CS model, and c) Intercept plus CS x Time interaction.

Separate models are run with 'Subject' as random factor, as well as 'Subject and Time' as random factors.

The model is fit by maximizing the log-likelihood (i.e., "ML" term in nlme::lme).

The model comparison is done using 'BIC'.

Value

A data frame with the results.

The data frame returned is the standard one returned in all function in the package. Specifically we have:

A tibble with the following column names:

x: the name of the independent variable (e.g., cs). There, you can see the term of the model that is returned. So, not the full model is returned but only this particular term.

y: the name of the dependent variable as this defined in the dv argument

exclusion: see exclusion argument

model: the model that was run (e.g., mixed_model)

controls: ignore this column for this test

method: the model that was run

p.value: the p-value for each factor

effect.size: irrelevant here

effect.size.ma: irrelevant here

effect.size.ma.lci: irrelevant here

effect.size.ma.hci: irrelevant here

statistic: the t-value for each factor

conf.low: the lower confidence interval for the estimate

conf.high: the higher confidence interval for the estimate

data_used: a list with the data used for the specific test

See Also

lme

Examples

# Load example data
data(example_data)

cs1 <- paste0("CSP", 1:2)
cs2 <- paste0("CSM", 1:2)
subj <- "id"

# mixed models without groups
mixed_mf(cs1 = cs1, cs2 = cs2, subj = subj, data = example_data)

# mixed models with groups
mixed_mf(cs1 = cs1, cs2 = cs2, subj = subj, group = "group", data = example_data)



multifear documentation built on Sept. 24, 2023, 1:06 a.m.