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

MikSmith mike at hsm.org.uk
Wed May 20 00:21:35 CEST 2009


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 produce a
multiple regression. I had thought something like:

spectra.lm <- lm(response[,3]~spectra.spec[,2:20])

might work but lm() doesnt appear to like being fed a range of columns. I
suspect Ive missed something fairly fundamental here.....

Any help much appreciated

best wishes

View this message in context: http://www.nabble.com/Getting-lm%28%29-to-work-with-a-matrix-tp23625486p23625486.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list