[R-sig-ME] autocorrelated errors

Paul Johnson pauljohn32 at gmail.com
Wed Aug 6 19:44:07 CEST 2014


That's a terrific email. Thanks so much. Clearly, people thinking ahead.
I'll check out the flexLambda branch.

I was searching CRAN and found a poisson model with conditional
heteroskedasticity  ("acp" : Autoregressive Conditional Poisson). It
made me day dream of finding any "one unit" regression model and just
throwing it at a multi-level tool like lmer.  I'm pretty sure that's
what the Stata package gllaam does, it fits everything, but is super
slow.  So maybe I should be more careful what I wish for.



On Wed, Aug 6, 2014 at 11:19 AM, Steve Walker <steve.walker at utoronto.ca> wrote:
> Hi Paul,
>
> tl;dr  There is some work in this direction, but unfortunately it is still
> somewhat experimental.
>
> 1. It is currently not possible to fit models with correlated residuals, per
> se, in lme4.  This is because the c++ machinery in lme4 only allows for
> observation weights (heterogeneous variance), not correlations.
>
> 2. Having said that, there is enough of this machinery exposed to fit models
> with flexible covariance structures in the random effects covariance matrix,
> if you are willing to write code for these structures.  There is currently
> no API on how to do this, although such an API is a long-term goal.
>
> 3. The flexLambda branch of lme4 on github is currently being developed
> specifically to facilitate the development of such flexible covariance
> structures.  It can be installed with:  install_github("lme4", user =
> "lme4", ref = "flexLambda").  However, this branch is not stable and should
> be considered experimental.
>
> 4. Fabian Scheipl has implemented AR1, compound symmetry, and diagonal
> structures in flexLambda (see
> https://github.com/lme4/lme4/blob/flexLambda/R/reGenerators.R).  Note
> however that there are no special functions for interpreting the output of
> such structures (e.g. plot, summary, etc...), and so unfortunately at this
> point you have to "know what you are doing".
>
> 5. All of these structures in flexLambda take place in the relative
> covariance factor for the random-effects, Lambda, and not in the residual
> variance, sigma^2.  One might be tempted to set the residual variance to
> zero, and handle residual variance in the relative covariance factor,
> Lambda.  Then one could construct a covariance structure that is effectively
> for the residuals, but using Lambda instead of sigma^2.  One challenge here
> is that lme4 machinery cannot handle models with zero residual variance
> (i.e. sigma^2 = 0) -- roughly because sigma^2 scales both the residual
> variance and the random-effects covariance matrix.  One may carefully set
> prior weights to get around this
> (https://github.com/lme4/lme4/issues/224#issuecomment-50510943), but this is
> somewhat hackish.
>
> 6. The modular approach to lmer and glmer may also be useful, if you just
> want to hack some specific model fits.  See ?modular and the Appendix of the
> lmer preprint (http://arxiv.org/abs/1406.5823).  The main difference between
> the modular and flexLambda approaches is how the covariance parameters are
> mapped into Lambda (see the last paragraph on p. 20 of the preprint for more
> details).
>
> Cheers,
> Steve
>
>
>
> On 2014-08-05, 7:23 PM, Paul Johnson wrote:
>>
>> Sorry to bother you, but
>>
>> I ask here every year or so if anybody is working on lme4 with time or
>> spatially correlated random errors. Bring corStruct back to life?
>>
>> If nobody is, maybe we could start a project together? I'm getting
>> great & fast estimates from lme4 with the cross sectional models, but
>> to work on longitudinal panels, we need some AR(1) error terms, or
>> such.
>>
>> pj
>>
>



-- 
Paul E. Johnson
Professor, Political Science      Assoc. Director
1541 Lilac Lane, Room 504      Center for Research Methods
University of Kansas                 University of Kansas
http://pj.freefaculty.org               http://quant.ku.edu



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