We compare the MSE which generates from the function we write with the function blasso
in monomvn
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
library(monomvn)
data(Data)
attach(Data)
x<-Data$diabetes.x
y<-Data$diabetes.y
n<-nrow(Data$diabetes.x)
yc<-y-mean(y)
result<-BayesianLasso(x,y)
proc.time()
resid<-yc-x%*%result$beta
mse1<-t(resid)%*%resid/n
n.max=1e4
result1<-blasso(x,y,T=n.max)
proc.time()
result2<-round(apply(result1$beta[seq(round(n.max/2),n.max),],2, median),3)
resid<-yc-x%*%result2
mse2<-t(resid)%*%resid/n
mse1;mse2
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.