## Not run:
# set.seed(1)
# n<-500
# k<-5
# treat<-sample(c("a","b","c"),n,replace=TRUE,pr=c(.5,.25,.25))
# treat2<-sample(c("a","b","c","d"),n,replace=TRUE,pr=c(.25,.25,.25,.25))
# Sigma<-diag(k)
# Sigma[Sigma==0]<-.5
# X<-mvrnorm(n,m=rep(0,k),S=Sigma)
# y.true<-3+X[,2]*2+(treat=="a")*2 +(treat=="b")*(-2)+X[,2]*(treat=="b")*(-2)+
# X[,2]*(treat2=="c")*2
# y<-y.true+rnorm(n,sd=2)
#
# ##Fit a linear model.
# s1<-sparsereg(y, X, cbind(treat,treat2), scale.type="TX")
# s1.EM<-sparsereg(y, X, cbind(treat,treat2), EM=TRUE, scale.type="TX")
#
# ##Summarize results from MCMC fit
# summary(s1)
# plot(s1)
# violinplot(s1)
#
# ##Summarize results from MCMC fit
# summary(s1.EM)
# plot(s1.EM)
#
# ##Extension using a baseline category
# s1.base<-sparsereg(y, X, treat, scale.type="TX", baseline.vec="a")
#
# summary(s1.base)
# plot(s1.base)
# violinplot(s1.base)
#
# ## End(Not run)
Run the code above in your browser using DataLab