1
$\begingroup$

I have generated posterior distributions of several estimates by combining a series of chains from Bayesian regression models. Specifically, they are merged chains from MCMCglmm models.

These models are of the form y ~ a + b + c, where a and b are factors with multiple levels, and c is a continuous variable. From these posterior distributions I can calculate the estimate (mean) and its confidence interval.

For the continuous variable this is sufficient. However, for the factors I would like to know the predicted mean and CI for each of the factor levels. Ideally, I would also like to test which levels are different from each other.

Example code in R:

library(MCMCglmm)
m <- MCMCglmm(mpg ~ factor(cyl) + factor(vs) + wt, data = mtcars)
d <- as.data.frame(test$Sol)

Can one use d to:

  • calculate the means of each level of cyl and vs?
  • test whether the different levels of cyl differ significantly from each other?

(I mainly interested in knowing if and how I can do this in a statistical sense. R code would be appreciated, but it is not the focus of my question.)

$\endgroup$
1
  • 2
    $\begingroup$ You seem to have a mixture of statistical questions (which are on-topic) and coding questions (which are not). Can you clarify the statistical issues you are puzzling over and ask the other ones elsewhere, perhaps on R-help or StackOverflow for both of which you will need a reproducible example $\endgroup$
    – mdewey
    Nov 30, 2016 at 15:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.