if (FALSE) {
if(requireNamespace("rsae", quietly = TRUE)) {
# LMM example from Booth & Hobert 1998 JASA
data("landsat", package = "rsae")
fitCorn <- fitme(HACorn ~ PixelsCorn + PixelsSoybeans + (1|CountyName),data=landsat[-33,])
newXandZ <- unique(data.frame(PixelsCorn=landsat$MeanPixelsCorn,
PixelsSoybeans=landsat$MeanPixelsSoybeans,
CountyName=landsat$CountyName))
(cpredvar <- get_cPredVar(fitCorn, newdata=newXandZ, nsim=200L, seed=123)) # serial computation
(cpredvar <- get_cPredVar(fitCorn, newdata=newXandZ, nsim=200L, seed=123,
nb_cores=parallel::detectCores(logical=FALSE)-1L,
fit_env=list2env(list(newXandZ=newXandZ))))
}
# GLMM example from Booth & Hobert 1998 JASA
data(clinics)
fitClinics <- HLfit(cbind(npos,nneg)~treatment+(1|clinic),family=binomial(),data=clinics)
#
(get_cPredVar(fitClinics, newdata=clinics[1:8,], nsim=200L, seed=123)) # serial computation
(get_cPredVar(fitClinics, newdata=clinics[1:8,], nsim=200L, seed=123,
nb_cores=parallel::detectCores(logical=FALSE)-1L,
fit_env=list2env(list(clinics=clinics))))
}
Run the code above in your browser using DataLab