Re: [R] creating names for regressios using the assign()

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Thu 05 May 2005 - 23:56:02 EST

Dimitri Joe wrote:

> 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?

See ?try

Uwe Ligges

> 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



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 Received on Fri May 06 00:19:02 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:35 EST