[R] inconsistent behaviour of add1 and drop1 with a weighted linear model

Bojanowski, M.J. (Michal) M.J.Bojanowski at uu.nl
Tue Mar 13 18:01:34 CET 2007


Hmmm, this is the same I got

> add1(model,.~.+x1+x2)
Single term additions

Model:
y ~ 1
       Df Sum of Sq    RSS    AIC
<none>              74.541 24.703
x1      1    44.377 30.164 14.942
x2      1    36.619 37.922 17.918 


R version 2.4.1 (2006-12-18) 
i386-pc-mingw32 

locale:
LC_COLLATE=Polish_Poland.1250;LC_CTYPE=Polish_Poland.1250;LC_MONETARY=Po
lish_Poland.1250;LC_NUMERIC=C;LC_TIME=Polish_Poland.1250

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"
"methods"  
[7] "base"     
> 


*** Note that my e-mail address has changed to m.j.bojanowski at uu.nl
*** Please update your address books accordingly. Thank you!

_________________________________________
Michal Bojanowski
ICS / Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
Room 1428
m.j.bojanowski at uu.nl
http://www.fss.uu.nl/soc/bojanowski
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Peter Dalgaard
Sent: Tuesday, March 13, 2007 5:35 PM
To: Jenny Hodgson
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] inconsistent behaviour of add1 and drop1 with a
weighted linear model

Jenny Hodgson wrote:
> Dear R Help,
> I have noticed some inconsistent behaviour of add1 and drop1 with a 
> weighted linear model, which affects the interpretation of the
results.
> I have these data to fit with a linear model, I want to weight them by

> the relative size of the geographical areas they represent.
> ______________________________________________________________________
> ___________________
>  > example
>            y        x1       x2   weights
> 1  -4.546477 0.1859556 50.00000 0.9466022
> 2   1.484246 0.4740497 29.88000 1.3252430
> 3   2.203681 0.8594264 16.93333 0.9466022
> 4   1.943163 0.8713360 42.11765 2.7766997
> 5   1.886473 0.9006082 19.00000 0.9466022
> 6   1.795393 0.8455183 23.68421 1.1674760
> 7   1.878077 0.5641396 35.00000 0.8203885
> 8  -4.215484 0.4356858 58.75000 0.4417477
> 9   1.993339 0.5440061 19.28571 0.8519420
> 10  1.560869 0.6285066 19.54545 0.8203885
> 11  2.761535 0.7017720 15.83333 0.1262136
> 12  0.995959 0.4638751  0.00000 0.9466022
> 13 -4.516514 0.2794199 77.85714 0.8834954  > sum(example$weights) [1] 
> 13.00000
>
>  > model<-lm(y~1,data=example,weights=weights)
>  > add1(model,.~.+x1+x2)
> Single term additions
>
> Model:
> y ~ 1
>        Df Sum of Sq    RSS    AIC
> <none>              94.000 27.719
> x1      1    55.290 38.710 18.185
> x2      1    58.630 35.371 17.012
>   
Which version of R??!

I get (2.4.1 on Fedora 6):

 > add1(model,.~.+x1+x2)
Single term additions

Model:
y ~ 1
       Df Sum of Sq    RSS    AIC
<none>              74.541 24.703
x1      1    44.377 30.164 14.942
x2      1    36.619 37.922 17.918

______________________________________________
R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list