catMediation: Make Mediation Equation with one categorical variable

View source: R/catMediation.R

catMediationR Documentation

Make Mediation Equation with one categorical variable

Description

Make Mediation Equation with one categorical variable

Usage

catMediation(
  X = NULL,
  M = NULL,
  Y = NULL,
  labels = list(),
  data,
  moderator = list(),
  covar = NULL,
  mode = 0,
  maxylev = 2,
  range = TRUE,
  rangemode = 1
)

Arguments

X

Name of independent variable

M

Name of mediator variable

Y

Name of dependent variable

labels

optional list

data

A data.frame

moderator

A list

covar

A list of covariates

mode

A numeric. 0: SEM equation, 1: regression equation

maxylev

maximal unique length of categorical variable

range

A logical

rangemode

range mode

Examples

labels=list(X="cyl",M="am",Y="mpg")
moderator=list(name=c("cyl","wt"),site=list(c("a","c"),c("c")))
covar=list(name=c("carb","disp"),label=c("carb","disp"),site=list(c("M","Y"),"Y","Y"))
cat(catMediation(labels=labels,data=mtcars))
cat(catMediation(X="am",Y="mpg",data=mtcars,moderator=moderator,covar=covar,maxylev=6))
cat(catMediation(X="am",Y="mpg",data=mtcars,moderator=moderator,covar=covar))
cat(catMediation(X="cyl",M="am",Y="mpg",data=mtcars))
cat(catMediation(X="cyl",M="am",Y="mpg",data=mtcars,moderator=moderator))
cat(catMediation(X="cyl",M="am",Y="mpg",data=mtcars,moderator=moderator))
cat(catMediation(X="am",M="hp",Y="mpg",data=mtcars,moderator=moderator,maxylev=6))
cat(catMediation(X="hp",M="am",Y="mpg",data=mtcars,maxylev=6))
cat(catMediation(X="am",M="hp",Y="mpg",data=mtcars,moderator=moderator,covar=covar))

processR documentation built on Jan. 23, 2023, 5:44 p.m.