ICCier: Run MELSM model.

Description Usage Arguments Details Value

View source: R/melsm.R

Description

Runs the MELSM model and returns an ICCier object.

Usage

1

Arguments

formula

Formula representing the model. See details.

data

Data frame containing all variables.

...

Arguments passed to sampling. By default, sampling is called with chains=4,iter=2000,adapt_delta=.95,init=0. If options('mc.cores') is defined, then cores=getOption("mc.cores"); otherwise all detected cores are used.

Details

ICCier uses the mixed effects location scale model to estimate an unconditional (intercept-only) or conditional location model with random effect of person. The within-person variances (i.e., residual, or error variances) are log-linearly modelled from a set of observation-level and person-level predictors, with coefficients γ. The between-person variances are also log-linearly modelled from a set of person-level predictors, with coefficients η.

The formula syntax is as follows:

For an unconditional model: outcome | personID ~ Level_1_formula | Level_2_formula

For a conditional model: outcome | personID ~ Level_1_formula | Level_2_formula | Level_1_conditional | Level_2_conditional

The model is implemented in a 'maximal' manner, meaning all level 1 effects are assumed to randomly vary and correlate. Moreover, all level 2 variables predict each level 1 parameter. This means you should not include cross-level interaction terms, because they are implicit in the model formulation. Level 1 or Level 2 interaction terms may be included.

For now, the Level 2 formula predicts both the level 1 scale parameters, as well as the level 2 random effect variances. If you wish to only have person-specific ICCs, use 1 as the level 1 formula (intercept-only).

When using a conditional model, the default ICCs are "unadjusted". In our case, the "unadjusted" ICC is still the random intercept variance divided by the random intercept variance and error variance. This makes sense, if the location model(s) are meant to be controlling variables. If you wish to have the so-called adjusted ICC, use adjusted = TRUE. The adjusted ICC instead uses the expected variance due to all random factors, divided by itself and the error variance. The adjusted ICC is therefore the proportion of random variance due to the random factors. This makes sense if the goal is to examine individual differences, and therefore examine the random effects themselves.

Value

ICCier object. List containing the model formula, data, stan_data, model fit, and mapping between original ID and numeric ID.


stephensrmmartin/ICCier documentation built on Aug. 22, 2019, 10 a.m.