[R-sig-ME] Calculating CI's for multiple fixed effects

Ben Bolker bbolker at gmail.com
Tue Jul 10 17:18:39 CEST 2012


Gus Jespersen <jesper <at> u.washington.edu> writes:

> 
> Greetings,
> My questions are related to producing confidence intervals via
> mcmcsamp and HPDinterval.  As you can see in the output below, my
> model has several fixed effect parameters.  Of interest to me are each
> of the "Treatment" vs. "Control" comparisons for each "site"(in each
> fixed effect parameter name, these are specified by the text
> immediately following "sitett").  As I understand it, if I want to
> produce a CI for each "Treatment" parameter from the anova output, I
> need to simply subtract the Control estimate from the Treatment
> estimate for each site. The SE's are a little more complicated, but
> that's not important here.  This is easy enough.  However, if I want
> to use the mcmcsamp+HPDinterval combo to produce my CI's, I unsure how
> to proceed.  The HPDinterval output below lists upper and lower bounds
> for each fixed effect parameter, but I have no idea how to get the
> "Treatment" vs. "Control" comparison for each site when working with
> just the upper and lower bounds of the CI.  Any advice on how to
> proceed here would be much appreciated.
> 
> Thanks,
> Gus

  I think you just need to take the output of mcmcsamp, manipulate,
and *then* use HPDinterval.

  m <- mcmcsamp(...)
  library(coda)
  m2 <- as.mcmc(as.matrix(m))

should give you an mcmc object -- you can then manipulate (mostly)
as though it were a matrix (e.g. subtract each Control column from
the corresponding Treatment column), then use the HPDinterval
built into coda to find the 95% CI on the differences ...



More information about the R-sig-mixed-models mailing list