Hi all,
I just cannot think of how to do it:
I want to take the first variable (column) of a data frame and regress
it against all other variables.
bla - function (dat) {
reg - lm(whateverthefirstofthevariablenamesis ~., data=dat)
return(reg)
}
What kind of function do I have to take
On Wed, 24 Mar 2004, Christian Hoffmann wrote:
Hi all,
I just cannot think of how to do it:
I want to take the first variable (column) of a data frame and regress
it against all other variables.
bla - function (dat) {
reg - lm(whateverthefirstofthevariablenamesis ~., data=dat)
Christian Hoffmann christian.hoffmann at wsl.ch writes:
Hi all,
I just cannot think of how to do it:
I want to take the first variable (column) of a data frame and regress
it against all other variables.
bla - function (dat) {
reg - lm(whateverthefirstofthevariablenamesis ~.,
)
Curious Minds Want to Know
Bob
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 12:51 PM
To: [EMAIL PROTECTED]
Subject: Re: [R] First Variable in lm
Christian Hoffmann christian.hoffmann at wsl.ch writes:
Hi all,
I just
It isn't lm but terms.formula. Compare
terms(dat$y ~ .,data = dat)
terms(dat[, 1] ~ ., data = dat)
Now as to why, exactly, see the C code in src/main/model.c.
The short answer is that dat$y matches y, and dat[, 1] does not.
(I am not at all sure the first is intentional.)
On Wed, 24 Mar 2004,
I want to take the first variable (column) of a data frame and regress
it against all other variables.
bla - function (dat) {
reg - lm(whateverthefirstofthevariablenamesis ~., data=dat)
return(reg)
}
Thanks to all who answered my question:
Prof. Brian Ripley:
---