plot.med {mma} | R Documentation |
Plot the mediation effect on the fitted med object
Description
Plot the marginal effect of the selected variable on the outcome, and the marginal effect of the predictor on the selected variable.
Usage
## S3 method for class 'med'
plot(x,...,vari,xlim=NULL)
Arguments
x |
a med object created initially call to med, med.binx, or med.contx. |
vari |
an indices or the name of the variable to plot. |
xlim |
the range of the variable to be plotted. |
... |
other arguments passed to the plot function. |
Details
plot.med plots the marginal effect of the selected variable on the outcome, and the marginal effect of the predictor on the selected variable. If the predictor is binary, draw a histogram or boxplot of the marginal density of the variable at each different value of the predictor.
Value
No return value, called for graphs
Author(s)
Qingzhao Yu qyu@lsuhsc.edu
References
Yu, Q., Fan, Y., and Wu, X. (2014) <doi:10.4172/2155-6180.1000189>. "General Multiple Mediation Analysis With an Application to Explore Racial Disparity in Breast Cancer Survival," Journal of Biometrics & Biostatistics,5(2): 189.
See Also
"med"
Examples
data("weight_behavior")
x=weight_behavior[,c(2,4:14)]
pred=weight_behavior[,3]
y=weight_behavior[,15]
data.bin<-data.org(x,y,pred=pred,contmed=c(7:9,11:12),binmed=c(6,10),
binref=c(1,1),catmed=5,catref=1,predref="M",alpha=0.4,alpha2=0.4)
temp1<-med(data=data.bin,n=2)
temp2<-med(data=data.bin,n=2,nonlinear=TRUE)
plot(temp1,data.bin,vari="exercises",xlim=c(0,50))
plot(temp2,data.bin,vari="sports")