Last chance! 50% off unlimited learning
Sale ends in
#First of all we load and attach the data:
data(mldata)
attach(mldata)
#Then we define all the inputs:
Y<-data.frame(measure,age)
X<-data.frame(rep(1,1000),sex)
Z<-data.frame(rep(1,1000))
clus<-data.frame(city)
betap<-matrix(0,2,2)
up<-matrix(0,10,2)
covp<-diag(1,2)
covu<-diag(1,2)
Sp=diag(1,2);
nburn=as.integer(200);
Sup=diag(1,5);
#And finally we run the imputation function:
imp<-jomo1rancon.MCMCchain(Y,X,Z,clus,betap,up,covp, covu,Sp,Sup,nburn)
#We can check the convergence of the first element of beta:
plot(c(1:nburn),imp$collectbeta[1,1,1:nburn],type="l")
#Or similarly we can check the convergence of any element of the level 2 covariance matrix:
plot(c(1:nburn),imp$collectcovu[1,2,1:nburn],type="l")
Run the code above in your browser using DataLab