plot.med | R Documentation |
Plot the marginal effect of the selected variable on the outcome, and the marginal effect of the predictor on the selected variable.
## S3 method for class 'med'
plot(x,...,vari,xlim=NULL)
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. |
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.
No return value, called for graphs
Qingzhao Yu qyu@lsuhsc.edu
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.
"med"
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.