catMediation | R Documentation |
Make Mediation Equation with one categorical variable
catMediation( X = NULL, M = NULL, Y = NULL, labels = list(), data, moderator = list(), covar = NULL, mode = 0, maxylev = 2, range = TRUE, rangemode = 1 )
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 |
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.