jz7 at duke.edu
2006-Jul-13 01:28 UTC
[R] question about cross-validation for mutivariate linear regression
Dear all, I am trying to do a standard mutivariate linear regression for my training set, and want to perform leave-one-out cross-validation to see how well the model is. I found several CV in R, such as cv.lm in DAAG, cv.glm in boot, and crossval in bootstrap. Which one should I use? And how can I get the squared correlation coefficient (q^2) for LOO-CV? I have tried the cv.lm in DAAG, but it seems that there is no option do give that output. Thanks so much!
Dear all, Suppose "h1.lm1" is my multiple regression object. When I tried to use "plot(h1.lm1)", I got the following warning message. --------------------- plot(hla4.lm1) Warning messages: 1: NaNs produced in: sqrt(crit * p * (1 - hh)/hh) 2: NaNs produced in: sqrt(crit * p * (1 - hh)/hh) --------------------- Does anyone know Where the problem might come from? Thanks so much!
Dear all, I am reading the data using "read.table". However, there are a few rows I want to skip. How can I do that in an easy way? Suppose I know the row number that I want to skip. Thanks so much!
Just read them in and throw them away: read.table("myfile.dat", ...whatever...)[-c(10, 12), ] On 7/27/06, jz7 at duke.edu <jz7 at duke.edu> wrote:> Dear all, > > I am reading the data using "read.table". However, there are a few rows I > want to skip. How can I do that in an easy way? Suppose I know the row > number that I want to skip. Thanks so much!