data("weight_behavior")
##binary x
#binary y
x=weight_behavior[,2:14]
y=weight_behavior[,15]
data.bin<-data.org(x,y,pred=2,contmed=c(8:10,12:13),binmed=c(7,11),
binref=c(1,1),catmed=6,catref=1,predref="M",alpha=0.4,alpha2=0.4)
temp1<-boot.med(data=data.bin,n=2,n2=4,seed=1)
temp2<-boot.med(data=data.bin,n=2,n2=4,nu=0.05,seed=1,nonlinear=TRUE)
#continuous y
x=weight_behavior[,2:14]
y=weight_behavior[,1]
data.cont<-data.org(x,y,pred=2,contmed=c(8:10,12:13),binmed=c(7,11),
binref=c(1,1),catmed=6,catref=1,
family1=gaussian(link="identity"),predref="M",alpha=0.4,alpha2=0.4)
temp3<-boot.med(data=data.cont,n=2,n2=4,seed=1)
temp4<-boot.med(data=data.cont,n=2,n2=4,nu=0.05,seed=1, nonlinear=TRUE)
##continuous x
#binary y
x=weight_behavior[,2:14]
y=weight_behavior[,15]
data.contx<-data.org(x,y,pred=1,contmed=c(8:10,12:13),binmed=c(7,11),
binref=c(1,1),catmed=6,catref=1,alpha=0.4,alpha2=0.4)
temp5<-boot.med(data=data.contx,seed=1,n=1,n2=2)
plot(temp5,vari="exercises",xlim=c(0,30))
temp6<-boot.med(data=data.contx,seed=1,n=1,refy=0,nonlinear=T,n2=2)
#continuous y
x=weight_behavior[,2:14]
y=weight_behavior[,1]
data.contx<-data.org(x,y,pred=1,contmed=c(8:10,12:13),binmed=c(7,11),
binref=c(1,1),catmed=6,catref=1,alpha=0.4,alpha2=0.4)
temp7<-boot.med(data=data.contx,seed=1,n=1,n2=2)
temp8<-boot.med(data=data.contx,nonlinear=T,seed=1,n=1,n2=2)
Run the code above in your browser using DataLab