Re: [R] Getting lm() to work with a matrix

2009-05-20 Thread Berwin A Turlach
G'day Luc, On Wed, 20 May 2009 09:58:41 -0400 Luc Villandre wrote: > MikSmith wrote: > > [...] > Indeed, functions like /lm()/ require the object fed to the /data/ > argument to be either [...] But the data argument is optional and does not need to be specified. > In your situation, I sugges

Re: [R] Getting lm() to work with a matrix

2009-05-20 Thread Luc Villandre
MikSmith wrote: Hi I'm fairly new to R and am trying to analyse some large spectral datasets using stepwise regression (fairly standard in this area). I have a field sampled dataset, of which a proportion has been held back for validation. I gather than step() needs to be fed a regression model

Re: [R] Getting lm() to work with a matrix

2009-05-19 Thread Gabor Grothendieck
Try this (note dot after ~): lm(response[, 3] ~., as.data.frame(spectra.spec[, 2:20])) On Tue, May 19, 2009 at 6:21 PM, MikSmith wrote: > > Hi > > I'm fairly new to R and am trying to analyse some large spectral datasets > using stepwise regression (fairly standard in this area). I have a field

[R] Getting lm() to work with a matrix

2009-05-19 Thread MikSmith
Hi I'm fairly new to R and am trying to analyse some large spectral datasets using stepwise regression (fairly standard in this area). I have a field sampled dataset, of which a proportion has been held back for validation. I gather than step() needs to be fed a regression model and lm() can prod