# NOT RUN {
# School Girls Data Example
data(schoolgirls)
attach(schoolgirls)
# Prior information
prior <- list(a0=5,b0=1,
M=4,
typepr=1,
frstlprob=FALSE,
tau1=0.01,tau2=0.01,
nu0=4.01,
tinv=diag(10,2),
mub=rep(0,2),
Sb=diag(1000,2))
# Initial state
state <- NULL
# MCMC parameters
nburn <- 10000
nsave <- 10000
nskip <- 20
ndisplay <- 1000
mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,ndisplay=ndisplay,
tune1=1.5,tune2=1.1,samplef=1)
# Fitting the model
fit1 <- PTlmm(fixed=height~1,random=~age|child,prior=prior,mcmc=mcmc,
state=state,status=TRUE)
fit1
# Summary with HPD and Credibility intervals
summary(fit1)
summary(fit1,hpd=FALSE)
# Plot model parameters (to see the plots gradually set ask=TRUE)
plot(fit1,ask=FALSE)
plot(fit1,ask=FALSE,nfigr=2,nfigc=2)
# Plot an specific model parameter (to see the plots gradually set ask=TRUE)
plot(fit1,ask=FALSE,nfigr=1,nfigc=2,param="sigma-(Intercept)")
# Random effects information
PTrandom(fit1)
# Predictive marginal and joint distributions
plot(PTrandom(fit1,predictive=TRUE))
# }
Run the code above in your browser using DataLab