did it again... it has to be > getOut <- which(colSums(is.na(y))==dim(y)[1]) > lm( y[,-getOut] ~ x )
off course. Cheers Joris On Sat, Jun 12, 2010 at 2:22 AM, Joris Meys <jorism...@gmail.com> wrote: > On Fri, Jun 11, 2010 at 5:28 PM, ivo welch <ivo.we...@gmail.com> wrote: >> thanks, everybody. >> >> joris---let me disagree with you, please. there are so many >> possibilities of how lm.fit could fail that by the time I am done with >> pre-checking, I may as well write my own lm() routine. > If we all would agree, life would be boring, no? ;-) I see your point, > but the thing is that if the function returns only NA coefficients > (and it can't do anything else than that, as a fit is mathematically > not possible), you have literally no information about what went > wrong. If I fit can't be done, I'd like to know why it happened, and > not just get the answer "Not Available". That's an error message too. > > Checking your data before doing an analysis is what we call "Good > Statistical Practice". Using a model on data you didn't check before > is like starting to drive to another country without checking which > direction you have to go. Pretty unlikely you're going to arrive at > the right spot... > > This said, you gave us what we need. >> y= matrix(rnorm(1000), nrow=10, ncol=100) >> y[,28]= rep(NA, 10) >> x=rnorm(10) >> lm( y ~ x ) >> ## now what do you do? hunt for which column was responsible? > I'd do : > y= matrix(rnorm(1000), nrow=10, ncol=100) > y[,28]= rep(NA, 10) > x=rnorm(10) > > getOut <- which(colSums(is.na(y))==dim(y)[1]) > > lm( y[-getOut] ~ x ) > > Cheers > Joris > -- > Joris Meys > Statistical consultant > > Ghent University > Faculty of Bioscience Engineering > Department of Applied mathematics, biometrics and process control > > tel : +32 9 264 59 87 > joris.m...@ugent.be > ------------------------------- > Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php > -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php ______________________________________________ R-help@r-project.org 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.