Description Usage Arguments Value References Examples
Gibbs sampler for one-way mixed-effects ANOVA and ANCOVA models using flat priors.
1 | acovamcmc(Y, trt, X, nochn, numIter, initval, credint = 0.95, Rthresh = 1.1)
|
Y |
Vector of reponses of n subjects |
trt |
Vector of categorical factor levels for n subjects |
X |
Design matrix with dimension (n x p) where p is the number of continuous predictors (for ANOVA, p = 1 to include grand mean) |
nochn |
Number of chains to test convergence of the Gibbs sampler |
numIter |
Number of iterations in the Gibbs sampler |
initval |
Matrix of initial values for Gibbs sampler with dimension (nochn, (p + nlevels(trt) + 2)) |
credint |
Coverage probability for parameter credible intervals |
Rthresh |
Gelman-Rubin diagnostic for test of convergence |
S3 acovamcmc
object; a list consisting of
beta |
values of regression coefficients for each iteration |
sig2a |
values of mixed-effect variance for each iteration |
sig2e |
values of error variance for each iteration |
Credible_Interval |
lower bound, point estimate, and upper bound for parameters |
Credible_Interval_Coverage |
coverage percentage for credible intervals |
Convergence_Diag |
status of Gibbs sampler convergence using threshold set for Gelman and Rubin's diagnostic |
Gelman_Rubin_Threshold |
threshold set for Gelman and Rubin's diagnostic |
Iterations |
number of iterations of Gibbs sampler |
Run_Time |
total elapsed seconds |
Gelman, A and Rubin, DB (1992) Inference from iterative simulation using multiple sequences, Statistical Science, 7, 457-511.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
# ANCOVA with 2 continuous predictors and 5 factor levels
data(corn)
init1 <- c(rep(0,7), 1, 1)
init2 <- c(rnorm(7), rgamma(2,2,1))
init3 <- c(rnorm(7), rgamma(2,2,1))
init4 <- c(rnorm(7), rgamma(2,2,1))
initval <- rbind(init1, init2, init3, init4)
acovamcmc(corn$yield, corn$variety, cbind((corn$nitrogen)^2, corn$nitrogen), 4, 10000 , initval)
# ANOVA with grand mean parameterization and 12 factor levels
data(csection)
init1 <- c(rep(0,13), 1, 1)
init2 <- c(rnorm(13), rgamma(2,2,1))
init3 <- c(rnorm(13), rgamma(2,2,1))
init4 <- c(rnorm(13), rgamma(2,2,1))
initval <- rbind(init1, init2, init3, init4)
Y = log(csection$rate / (1-csection$rate))
acovamcmc(Y, factor(csection$hospital), matrix(1,length(csection$hospital),1), 4, 10000, initval)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.