[R-sig-ME] separate variance-covariance matrix for each level of grouping variable
Ben Bolker
bbo|ker @end|ng |rom gm@||@com
Fri Aug 23 15:51:51 CEST 2019
The most obvious differences are that brms (a) imposes priors on all
parameters and (b) computes the point estimate by taking the posterior
mean (maybe median? I'm not sure) rather than the value with the highest
likelihood.
There are some good answers about MLE vs Bayesian answers here:
https://stats.stackexchange.com/questions/401349/maximum-likelihood-parameters-deviate-from-posterior-distributions/401356#401356
To explore this further you could (1) try out the blme package, which
allows for priors (not necessarily the same as those used in brms
through) and finds MAP (maximum a posteriori) estimates; (2) look at the
likelihood profile for the confidence intervals, and/or their posterior
distributions, which should show you that they're very flat [in which
case it's easy to get a large difference between the MLE and the
posterior mean due to the combination of priors and mode vs mean])
On 2019-08-23 7:44 a.m., Thomas MERKLING wrote:
> Thanks Ben for your reply,
>
> I used:
>
> glmmTMB(count ~ Trt + (0 + dummy(Trt, "0") + dummy(Trt, "0"):zAge |
> patient) + (0 + dummy(Trt, "1") + dummy(Trt, "1"):zAge | patient), data =
> epilepsy)
>
> which gave me similar SDs for the random intercepts and slopes as the brms
> output but the correlations were 1 and -1 (see below) which is quite
> different from the brms output (0.56 and -0.84).
> Given that the correlations were exactly 1 and -1, I'm wondering if it is
> the exact same fit as brms (count ~ Trt + (zAge|gr(patient, by = Trt)),
> data = epilepsy), or if something differs in how the covariances are
> estimated ?
>
> Thomas
>
> Conditional model:
> Groups Name Variance Std.Dev. Corr
> patient dummy(Trt, "0") 57.57 7.588
> dummy(Trt, "0"):zAge 11.60 3.405 1.00
> patient.1 dummy(Trt, "1") 103.60 10.178
> dummy(Trt, "1"):zAge 38.37 6.194 -1.00
> Residual 32.21 5.676
>
>
>>
>> count ~ Trt + (0 + dummy(Trt, "Trt0"):zAge | patient) +
>> (0 + dummy(Trt, "Trt1"):zAge | patient)
>>
>> might work in either glmmTMB or lme4. The dummy() function (which is in
>> the lme4 package, you may need to load it even if you're using glmmTMB)
>> is 'sugar' for creating a numeric dummy variable. An interaction with a
>> numeric variable corresponds to multiplying the interacting term by the
>> variable, so (for example) the first term is zero except for
>> observations in Trt0.
>>
>> This hack gets awkward if you have lots of groups (although you can
>> always construct the formula programmatically).
>>
>> In lme4 you may have to use lmerControl() to override some of the
>> checks that there aren't too many random-effects levels.
>>
>> Ben Bolker
>>
>>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list