[R] Cannot create summary of old glm object. How to ensure that R objects will be usable in the future.

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Sep 9 11:07:32 CEST 2013


On 09/09/2013 10:02, Clara wrote:
> Thanks Prof. Ripley,
>
> my.model$family <- binomial() worked
>
> Do you have any suggestions on how to store the models? I used the
> models mostly for projections, so being able to use "predict" would be
> handy. Refitting the model would be an option but it would not ensure
> AFAIK that the resulting model would be the same in all cases.

It should, if you store scripts.  But ultimately to reproduce results 
you need to use the same version of R and of all your packages (and of 
your OS ...).

>
> Clara
>
>
>
>
>
> On 2013-09-09 10:22, Prof Brian Ripley wrote:
>> On 09/09/2013 08:48, Clara wrote:
>>> my.model$family <- binomial()
>>> Hi all,
>>>
>>> I have an older, probably about 2 years old glm object, I am not sure
>>> with which version of glm it was produced. I have tried to
>>
>> Before R 3.0.0, which was a change in major version number.
>>
>>> summary(my.model) but I get an error.
>>>
>>>  > summary(my.model)
>>> Error in .Call("binomial_dev_resids", y, mu, wt, PACKAGE = "stats") :
>>>    "binomial_dev_resids" not available for .Call() for package "stats"
>>>
>>> Some info about the model:
>>> Call:  glm(formula = my.formula, family = binomial, data = my.data,
>>> weights = my.weights,
>>>      x = T, y = T)
>>>
>>> My current r version and platform:
>>> R version 3.0.1 (2013-05-16) -- "Good Sport"
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>>
>>> I have used my.model before, about a year ago, without any problems. So
>>> my questions are,
>>> (1) Is there a way to "update" the model so it works with the new
>>> version of summary.glm? or is there a way to make the new summary.glm
>>> function agreeable to my.model?
>>
>> It is not to do with summary.glm: it is AFAIK due to what is stored in
>> 'my.model'.  You should re-fit my.model.
>>
>> In this particular case (which is not reproducible to us) it is
>> possible that
>>
>> my.model$family <- binomial()
>>
>> would work.
>>
>>> (2) Should I expect this behavior with other older models? I mean, If I
>>> create a model today should I expect to have problems when I try to do
>>> simple stuff with it, like "summary", in a couple of years?
>>
>> Yes.
>>
>>> (3) Is there a way to prevent this? What would be the best way to make
>>> sure, as much as possible, that the models I produce today will be
>>> usable in the future by me and others?
>>
>> Not save .RData files and expect them to work with an R with an
>> increased major version number.
>>
>> You should regard .RData files as a permanent form of storage only for
>> data (things like data frames).
>>
>>> Any help is greatly appreciated. I will run into this problem again, so
>>> I would very much appreciate any help on how to handle this.
>>
>> Use the version of R you used to create the object my.model to explore
>> it.
>>
>> And BTW R 3.0.x has been out for several months and I have not seen
>> anyone one else reporting such a problem so I think it is much rarer
>> than you believe.
>>
>>> Clara
>>
>>
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list