This Tutorial 3 was originally designed in part for
NIMBioS
Tutorial,
"Computing in the Cloud"
on April 6-8, 2014.
The idea was suggested by and discussed with Dr. Russell Zaretzki
at University of Tennessee, Knoxville.
I reserved codes for parallel statistical applications
focusing on intensive computation algorithms.
The application can be found in a book
``Mixed Effects Models and Extensions in Ecology with R'' (2009)
Zuur, Ieno, Walker, Saveliev and Smith. Springer.
(ZIWSS)
Suppose the model is
$Y_{ij} \sim B(1, p_{ij})$
$
logit(p_{ij})
= \beta_0 + \beta_1 (Length)_{ij} + \beta_2 (Sex)_{ij} +
\beta_3 (Length)_{ij} (Sex)_{ij} + a_i
$
$a_i \sim N(0, \sigma^2_a)$
where
$Y_{ij}$
is independent bernoulli distribution,
is 1 if dear
$j$
in farm
$i$
has E. cervi L1 and 0 otherwise,
$p_{ij}$
is the observing probability,
Length and Sex are explanatory variables via
logit link function, and
$a_i$
is the independent random intercept for farm
$i$.
The main task is to fit generalized linear model (GLM) and generalized
linear mixed-effect model (GLMM) to a Deer dataset
via penalized quasi-likelihood (glmmPQL)
and MCMC algorithm to find fixed/random effects and variance parameters of
random effects.
The details are described in the Chapter 13 of the ZIWSS book, and
the source of Deer dataset can be found from the ZIWSS book's website at
``www.highstat.com/book2.htm''.
All files next are given in
tutorial3.tar.gz or
tutorial3.zip.
The detais of R
codes, data and relative information are:
File Name |
Purpose |
00-readme.txt |
A read me first file that describe the models, data set, and
rest of files. |
DeerEcervi.txt |
Original Deer data set from the ZIWSS book. |
01-max_pql.r |
Maximize penalized quasi-likelihood for GLMM. |
11-npbs_for.r |
- Bootstrap confidence interval for standard deviation of random
effects.
- Using the
for() loop.
|
12-npbs_lapply.r |
- Bootstrap confidence interval for standard deviation of random effects.
- Using the
lapply() function.
|
13-npbs_mclapply.r |
- Bootstrap confidence interval for standard deviation of random
effects.
- Using the
mclapply() function from the
parallel package.
- Parallelization is done in the level of multiple independent
bootstrap samples.
|
14-npbs_pbdR.r |
- Bootstrap confidence interval for standard deviation of
random effects.
- Using the
task.pull() functions from the
pbdMPI package.
- Parallelization is done in the level of multiple independent
bootstrap samples.
|
21-mcmc_glm.r |
- MCMC approach for GLM (no random effects).
- Using the
lapply() function.
|
22-mcmc_glm_mclapply.r |
- MCMC approach for GLM (no random effects).
- Using the
mclapply() function from the
parallel package.
- Parallelization is done in the level of multiple independent
chains.
|
23-mcmc_glm_pbdR.r |
- MCMC approach for GLM (no random effects).
- Using the
task.pull() functions from the
pbdMPI package.
- Parallelization is done in the level of multiple independent
chains.
|
31-mcmc_glmm.r |
MCMC approach for GLMM (random intercepts). |
41-mcmc_glmm_mclapply.r |
- MCMC approach for GLMM (random intercepts).
- Using the
mclapply() function from the
parallel package.
- Parallelization is done within the iterations of MCMC.
- See u4-mcmc_glmm_mclapply.r for details.
|
42-mcmc_glmm_pbdR.r |
- MCMC approach for GLMM (random intercepts).
- Using the
task.pull() functions from the
pbdMPI package.
- Parallelization is done within the iterations of MCMC.
- See u4-mcmc_glmm_pbdR.r for details.
|
u0-deer.r |
Utility. |
u1-npbs.r |
Utility. |
u2-mcmc_glm.r |
Utility. |
u3-mcmc_glmm.r |
Utility. |
u4-mcmc_glmm_mclapply.r |
Utility. |
u4-mcmc_glmm_pbdR.r |
Utility. |