Hi,

I think a preferable approach to relying on a normal approximation after
the hyperbolic arc tangent transformation (so-called Fisher's r-to-z
transformation) would be to calculate based on bootstrapping or perhaps a
profile likelihood.

require(lme4)
(gm1a <- glmer(cbind(incidence, size - incidence) ~ 1 + as.numeric(period)
+ (1 + as.numeric(period) | herd), cbpp, binomial, nAGQ = 1))
confint(gm1a, parm = 2, method = "boot", nsim = 100)

Best,

Josh



On Tue, Feb 25, 2014 at 1:33 PM, Jake Westfall <jake987722@hotmail.com>wrote:

> Mike,
>
> I am not really sure. But here is a top-of-the-head idea that I think
> could at least yield a useful *approximate* CI. If someone else reading
> thinks my reasoning here sounds sketchy, please speak up.
>
> We have a point estimate of the correlation r, and let F(r) be the Fisher
> transformation of r. We also have a LRT statistic, L. Now we know that the
> LRT statistic is asymptotically equivalent to a Wald chi-square statistic
> which is just (estimate/standard error)^2. So then the standard error of
> F(r) should be approximately F(r)/sqrt(L). If so then we can construct an
> approximate 95% confidence interval on the original [-1,1] scale as G(F(r)
> +/- 1.96*F(r)/sqrt(L)), where G() is the inverse of the Fisher
> transformation.
>
> Jake
>
> From: mike.lwrnc@gmail.com
> Date: Tue, 25 Feb 2014 15:15:41 -0400
> Subject: Re: [R-sig-ME] Characterizing correlation between binomial
> intercepts
> To: jake987722@hotmail.com
> CC: r-sig-mixed-models@r-project.org
>
> Beautiful, thanks!
> For others, I found it easier to understand what's going on by re-coding
> your solution slightly:
>     task1 = as.numeric(factor(task))-1
>
>     task2 = 1-task1    mod1 <- glmer(        formula = y ~ 0+task1+task2 +
> (0+task1+task2|subject)
>
>
>         , family = binomial    )    summary(mod1)    mod2 <- glmer(
>
>         formula = y ~ 0+task1+task2 + (0+task1|subject)+(0+task2|subject)
>        , family = binomial
>
>     )    summary(mod2)
>
>     anova(mod1, mod2)
>
>
> One remaining question I have is how one might go about computing a 95% CI
> for the estimate of the correlation between task1 and task2 provided by
> mod1?
>
>
>
> --
> Mike Lawrence
> Graduate Student
> Department of Psychology & Neuroscience
> Dalhousie University
>
> ~ Certainty is (possibly) folly ~
>
>
> On Tue, Feb 25, 2014 at 2:11 PM, Jake Westfall <jake987722@hotmail.com>
> wrote:
>
>
> Mike,
>
>
>
> How about the following? Assume "task" is a dummy-coded numeric variable
> (not a factor!).
>
>
>
> mod1 <- glmer(y ~ 0+task+I(1-task) + (0+task+I(1-task)|subject),
> family=binomial)
>
> summary(mod1)
>
>
>
> mod2 <- glmer(y ~ 0+task+I(1-task) +
> (0+task|subject)+(0+I(1-task)|subject), family=binomial)
>
> summary(mod2)
>
>
>
> anova(mod1, mod2)
>
>
>
> And of course you could compare the models using something other than
> anova() if you wish. Let me know if this seems to do what you want.
>
>
>
> Jake
>
>
>
> > From: mike.lwrnc@gmail.com
>
> > Date: Tue, 25 Feb 2014 09:38:22 -0400
>
> > To: r-sig-mixed-models@r-project.org
>
> > Subject: [R-sig-ME] Characterizing correlation between binomial
> intercepts
>
> >
>
> > Hi folks,
>
> >
>
> > Related to this previous query (
>
> > https://stat.ethz.ch/pipermail/r-sig-mixed-models/2012q3/019079.html),
>
> > which sought (and received a solution) to characterize the correlation
>
> > (across levels of a random effect) between two effects on a binomial dv,
>
> > I'm now curious if there's a way to characterize the correlation (across
>
> > levels of a random effect) between the intercepts of a binomial dv. That
>
> > is, I have each level of a random effect ("subject", human participants
> in
>
> > a psych experiment) experience two different tasks where I could model
> each
>
> > task separately as:
>
> >
>
> >     task1Fit = glmer(
>
> >         data = a[a$task=='1',]
>
> >         , family = binomial
>
> >         , formula = error ~ (1|subject)
>
> >     )
>
> >     task2Fit = glmer(
>
> >         data = a[a$task=='2',]
>
> >         , family = binomial
>
> >         , formula = error ~ (1|subject)
>
> >     )
>
> >
>
> > Now, I could obtain the BLUPs for each participant and task via:
>
> >
>
> >     task1BLUPs = coef(task1Fit)$subject$"(Intercept)"
>
> >     task2BLUPs = coef(task2Fit)$subject$"(Intercept)"
>
> >
>
> > And then evaluate the correlations between these via:
>
> >
>
> >     cor.test(task1BLUPS,task2BLUPS)
>
> >
>
> > However, I suspect that there must be a way to evaluate this correlation
> by
>
> > creating and comparing glmer models as with the solution (
>
> > https://gist.github.com/mike-lawrence/3657148) for the above linked
>
> > previous query on computing a similar correlation for effects. I know I'm
>
> > going to do a head-smack when I see the solution, but for the life of me
> I
>
> > can't visualize what I need to do to achieve this. Any suggestions?
>
> >
>
> > Mike
>
> >
>
> > --
>
> > Mike Lawrence
>
> > Graduate Student
>
> > Department of Psychology & Neuroscience
>
> > Dalhousie University
>
> >
>
> > ~ Certainty is (possibly) folly ~
>
> >
>
> >       [[alternative HTML version deleted]]
>
> >
>
> > _______________________________________________
>
> > R-sig-mixed-models@r-project.org mailing list
>
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>
>         [[alternative HTML version deleted]]
>
>
>
> _______________________________________________
>
> R-sig-mixed-models@r-project.org mailing list
>
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://joshuawiley.com/
Senior Analyst - Elkhart Group Ltd.
http://elkhartgroup.com
260.673.5518

	[[alternative HTML version deleted]]

