Hi there. I have a data frame, X, with n+m columns. I want to regress each of 
the first n columns on the last m. This is what I am trying to do:

for ( i in 1:n )

assign(   paste ("reg",1:14,sep="")[i]  , lm(  X[,i]  ~ X[,i+1] + ... + 
X[,i+m],  data= X  )  )

It happens that some of the regressions, say the 3rd, seems to be a singular 
fit (or something else I don't know what ). I got the following error message:

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
        NA/NaN/Inf in foreign function call (arg 4)

Since it first happens with, say the 3rd regression, only the first two are 
computed. R does not run the 4th regression and so on. I don't want to 
necessarly remove the columns from the data frame, though, because n is large 
and there could be many singular fits, implying I had to remove many columns 
from the data frame. What should I do?

Thanks,

Dimitri

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to