[R] lm without a formula?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed May 12 23:05:29 CEST 2004
x <- data.frame( x1=rnorm(10), x2=rnorm(10) )
lm(y ~., data=x)
seems to be what you want.
BTW, R is not C/Perl/... and ; is a separator, not a terminator.
On Wed, 12 May 2004, ivo welch wrote:
>
> hi: I have a y vector and an x data frame. is it possible to use the
> standard linear regression (lm, summary.lm) without having to construct
> a formula, i.e., all x variables should be used.
>
> x <- data.frame( rnorm(10), rnorm(10) ); # <-- well, this would
> really be read from a file
> y <- rnorm(10); # ok, also read from the file.
> lm (y ~ x); # this is sort of what I want to do, but of course, it
> is not.
--
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