Re: [R] how to store lme/lmer fit result

From: tingtingzhan <tingting.zhan_at_jefferson.edu>
Date: Thu, 03 Mar 2011 20:29:22 -0800 (PST)

Hi All,

I'm experiencing difficulties in saving a model fit by gls().

Basically if I just save() a gls object "gls.fit" in my workspace into an .RData file and later reload this .RData file, I get error when running script such as
summary(gls.fit)$coefficients

Dr. Bates's reply (quoted below) is the latest info I could find by Google. Would any one suggest if there is any modern way to save an gls object?

Many thanks,
Tingting

Re: how to store lme/lmer fit result
Nov 03, 2008; 11:51am — by Douglas Bates-2 On Thu, Oct 9, 2008 at 8:51 PM, liujb <[hidden email]> wrote:

> Dear R users,

> I am building a hierarchical model on a large data set. It can take quite
> some time to finish one fit, I was just wondering whether it is possible
> to
> store the fit object (the result) to a file for later (offline) analysis.

As others have suggested, you can use save/load to save and restore the fitted model.

However, there is a problem with trying to save and load a model fit by lmer. These are S4 classed objects and can only be reloaded in a version of the lme4 package with the same definition of the S4 class. Unfortunately, as I develop the computing methods I change the class definition to reflect the newer approach. This can mean that you can restore a model fit with a previous version of the lme4 package but you can't do anything with it.

I regret that this happens but I do feel that the changes ultimately are beneficial. The best advice is that, in addition to saving the fitted model, you should also save the original data and a copy of the code that was used to fit the model.

An alternative is to save a copy of the lme4 package and the Matrix package along with the saved model so you can downdate those packages if necessary. This may be tricky because of dependencies between packages that may prevent downdating some but not all packages.

--
View this message in context: http://r.789695.n4.nabble.com/how-to-store-lme-lmer-fit-result-tp869777p3334663.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 04 Mar 2011 - 04:37:01 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 Fri 04 Mar 2011 - 05:20:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive