Re: [R] generalized least squares with empirical error covariance matrix

From: Roy Mendelssohn <>
Date: Wed, 09 May 2007 13:16:11 -0700

Look at "DLM". it can do bayesian dynamic linear models, ie. the bayes equivalent of kalman filtering.

-Roy M.
On May 9, 2007, at 1:09 PM, Andrew Schuh wrote:

> I have a bayesian hierarchical normal regression model, in which the
> regression coefficients are nested, which I've wrapped into one
> regression framework, y = X %*% beta + e . I would like to run data
> through the model in a filter style (kalman filterish), updating
> regression coefficients at each step new data can be gathered. After
> the first filter step, I will need to be able to feed the a non-
> diagonal
> posterior covariance in for the prior of the next step. "gls" and
> "glm"
> seem to be set up to handle structured error covariances, where
> mine is
> more empirical, driven completely by the data. Explicitly solving w/
> "solve" is really sensitive to small values in the covariance
> matrix and
> I've only been able to get reliable results at the first step by using
> weighted regression w/ lm(). Am I missing an obvious function for
> linear regression w/ a correlated prior on the errors for the
> updating
> steps? Thanks in advance for any advice.
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

"The contents of this message do not reflect any position of the U.S. Government or NOAA."

Roy Mendelssohn
Supervisory Operations Research Analyst
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: (Note new e-mail address) voice: (831)-648-9029
fax: (831)-648-8440

"Old age and treachery will overcome youth and skill." mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 09 May 2007 - 20:30:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 May 2007 - 20:33:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.