Basic function for running mixed models for the multiverse analysis

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

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

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`.

See also

Examples

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)
#> # A tibble: 6 × 16
#>   x           y     exclusion model       controls method    p.value effect.size
#>   <chr>       <chr> <chr>     <chr>       <lgl>    <chr>       <dbl> <lgl>      
#> 1 cscs2       scr   full data mixed_model NA       mixed_mo…  0.0477 NA         
#> 2 cscs2:time2 scr   full data mixed_model NA       mixed_mo…  0.240  NA         
#> 3 cscs2       scr   full data mixed_model NA       mixed_mo…  0.157  NA         
#> 4 cscs2:time2 scr   full data mixed_model NA       mixed_mo…  0.0306 NA         
#> 5 cscs2       scr   full data mixed_model NA       mixed_mo…  0.0477 NA         
#> 6 cscs2:time2 scr   full data mixed_model NA       mixed_mo…  0.240  NA         
#> # … with 8 more variables: efffect.size.ma <lgl>, effect.size.ma.lci <lgl>,
#> #   effect.size.ma.hci <lgl>, estimate <dbl>, statistic <dbl>, conf.low <lgl>,
#> #   conf.high <lgl>, data_used <list>

# mixed models with groups
mixed_mf(cs1 = cs1, cs2 = cs2, subj = subj, group = "group", data = example_data)
#> # A tibble: 6 × 16
#>   x           y     exclusion model       controls method    p.value effect.size
#>   <chr>       <chr> <chr>     <chr>       <lgl>    <chr>       <dbl> <lgl>      
#> 1 cscs2       scr   full data mixed_model NA       mixed_mo…  0.0477 NA         
#> 2 cscs2:time2 scr   full data mixed_model NA       mixed_mo…  0.240  NA         
#> 3 cscs2       scr   full data mixed_model NA       mixed_mo…  0.157  NA         
#> 4 cscs2:time2 scr   full data mixed_model NA       mixed_mo…  0.0306 NA         
#> 5 cscs2       scr   full data mixed_model NA       mixed_mo…  0.0477 NA         
#> 6 cscs2:time2 scr   full data mixed_model NA       mixed_mo…  0.240  NA         
#> # … with 8 more variables: efffect.size.ma <lgl>, effect.size.ma.lci <lgl>,
#> #   effect.size.ma.hci <lgl>, estimate <dbl>, statistic <dbl>, conf.low <lgl>,
#> #   conf.high <lgl>, data_used <list>