Say I have a random variable, and its mean or variance is changing over time, how do I detect this, given back-data? One idea is just to look at the recent values vs the less recent values and detect changes that way? Is there a standardized way to do this? A name for the method?

  • $\begingroup$ In addition to dglm mentioned by @GordonSmyth, in glmmTMB you can model variation in the dispersion parameter of the response via a separate linear predictor. $\endgroup$ Commented Nov 17, 2022 at 10:40
  • $\begingroup$ nice thank you that helps for sure $\endgroup$ Commented Nov 24, 2022 at 9:23

1 Answer 1


You could consider the dglm package from CRAN, which will do log-linear modelling for the variance at the same time as linear model modelling of the mean.

Here are some references:


Aitkin, M. (1987). Modelling variance heterogeneity in normal regression using GLIM. Journal of the Royal Statistical Society: Series C (Applied Statistics), 36(3), 332-339.

Smyth, G. K. (1989). Generalized linear models with varying dispersion. Journal of the Royal Statistical Society B 51(1), 47-60.

Rigby, R. A., & Stasinopoulos, M. D. (1995). Mean and dispersion additive models: applications and diagnostics. In Statistical Modelling (pp. 249-256). Springer, New York, NY.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.