jammGLM: GLM Mediation Model

View source: R/jammglm.f.R

jammGLMR Documentation

GLM Mediation Model

Description

GLM mediation model

Usage

jammGLM(
  data,
  dep = NULL,
  mediators = NULL,
  factors = NULL,
  covs = NULL,
  modelTerms = NULL,
  ciType = "standard",
  ciWidth = 95,
  bootN = 1000,
  contrasts = NULL,
  showRealNames = TRUE,
  showContrastCode = FALSE,
  bogus = FALSE,
  simpleScale = "mean_sd",
  cvalue = 1,
  percvalue = 25,
  simpleScaleLabels = "labels",
  scaling = NULL,
  tableOptions = list("beta", "component"),
  pathOptions = list("suggested"),
  mediatorsTerms = list(list()),
  moderatorsTerms = list(list()),
  formula
)

Arguments

data

the data as a data frame

dep

a string naming the dependent variable from data, variable must be numeric. Not useful if formula is used.

mediators

a vector of strings naming the mediators from data. Not useful if formula is used.

factors

a vector of strings naming the fixed factors from data. Not useful if formula is used or the variable is already a factor in the data

covs

a vector of strings naming the covariates from data. Not useful if formula is used.

modelTerms

a list of character vectors describing fixed effects terms. Not useful if formula is used

ciType

Choose the confidence interval type

ciWidth

a number between 50 and 99.9 (default: 95) specifying the confidence interval width for the parameter estimates

bootN

number of bootstrap samples for estimating confidence intervals

contrasts

a named vector of the form c(var1='type', var2='type2') specifying the type of contrast to use, one of 'deviation', 'simple', 'dummy', 'difference', 'helmert', 'repeated' or 'polynomial'. If NULL, 'simple' is used. Can also be passed as a list of list of the form list(list(var='var1',type='type1')).

showRealNames

TRUE or FALSE (default), provide raw names of the contrasts variables

showContrastCode

TRUE or FALSE (default), provide contrast coefficients tables

bogus

a bogus option to define a label without visible children, used for internal checks

simpleScale

'mean_sd' (default), 'custom' , or 'custom_percent'. Use to condition the covariates (if any).

cvalue

offset value for conditioning. Values are mean +/- cvalue.

percvalue

offset value for conditioning. Values are median +/- pecvalue

simpleScaleLabels

style for presenting condition values of a moderator. It can be 'labels' (default), 'values' or 'labels_values' for both.

scaling

a named vector of the form c(var1='type1',var2='type2'). Types are 'centered' to the mean, 'standardized', log-transformed 'log' or 'none'. 'none' leaves the variable as it is. It can also be passed as a list of lists.

tableOptions

a vector of options to be shown in the tables. 'component' shows the indirect effects components in the results tables. 'regression' show the results of all the regression (R-squared, F-test and coefficients) involved in the model.

pathOptions

.

mediatorsTerms

a list of lists specifying the models for with the mediators as dependent variables. Not required in formula is used.

moderatorsTerms

a named list of the form list("med"=c("mod1",mod2"),med2="mod1") specifying the moderator(s) of each mediator. This is required to decide for which variable we need to condition the mediated effects and to single out moderators in the path diagram. If not specified, any interaction is considered as any other term in the model

formula

a list of formulas to use, see the examples

Value

A results object containing:

results$info a table
results$pathmodelgroup$pathmodel a path model
results$pathmodelgroup$pathnotes a table
results$models$moderationEffects a table
results$models$main a table
results$models$contrastCodeTables an array of contrast coefficients tables
results$regressions$overall a group
results$regressions$mediator_regressions an array of regressions for the mediators
results$regressions$full a group

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$info$asDF

as.data.frame(results$info)


jamovi-amm/jamm documentation built on Nov. 15, 2023, 9:18 p.m.