I was using Version 2.3.1 for Windows (binary download version). Guess I
should be using the latest version, (but the reason is I'm writing up my
PhD and I thought my results would be more 'repeatable' if I didn't keep
changing my version of the software, I didn't really think there would
be any glitches as big as this). Sorry if this is a waste of your time.
And thanks very much for replying so quickly.
Jenny
_
Jenny Hodgson
Department of Biology - area 18
PO box 373
University of York
YO10 5YW
UK
Tel: 01904 328623
Peter Dalgaard wrote:
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
yx1 x2 weights
1 -4.546477 0.1859556 50.0 0.9466022
2 1.484246 0.4740497 29.88000 1.3252430
3 2.203681 0.8594264 16.9 0.9466022
4 1.943163 0.8713360 42.11765 2.7766997
5 1.886473 0.9006082 19.0 0.9466022
6 1.795393 0.8455183 23.68421 1.1674760
7 1.878077 0.5641396 35.0 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.8 0.1262136
12 0.995959 0.4638751 0.0 0.9466022
13 -4.516514 0.2794199 77.85714 0.8834954
sum(example$weights)
[1] 13.0
model-lm(y~1,data=example,weights=weights)
add1(model,.~.+x1+x2)
Single term additions
Model:
y ~ 1
Df Sum of SqRSSAIC
none 94.000 27.719
x1 155.290 38.710 18.185
x2 158.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 SqRSSAIC
none 74.541 24.703
x1 144.377 30.164 14.942
x2 136.619 37.922 17.918
__
R-help@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.