From: r user <ruser2006_at_yahoo.com>

Date: Sat 12 Aug 2006 - 02:43:01 EST

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 and provide commented, minimal, self-contained, reproducible code. Received on Sat Aug 12 02:49:55 2006

Date: Sat 12 Aug 2006 - 02:43:01 EST

Is there a way to get the following code to include
liens where the coefficients are “NA”?

explanation:

Using a loop, I am running regressions on several “subsets” of “data1”.

“reg <- ( lm(lm(data1[,1] ~., data1[,2:l])) )”

My regression has 10 independent variables, and I
therefore expect 11 coefficients.

After each regression, I wish to save the coefficients
and standard errors of the coefficients in a table
with 22 columns.

I successfully extract the coefficients using the
following code:

“reg$coefficients”

I attempt to extract the standard erros using :

aperm((summary(reg))$coefficients)[2,]

My problem:

For some of my subsets, I am missing data for one or
more of the independent variables. This of course
causes the coefficients and standard erros for this
variable to be “NA”.

Is there a way to include the NA standard errors, so that I have the same number of standard erros and coefficients for each regression, and can then store the coefficients and standard erros in my table of 22 columns?

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 and provide commented, minimal, self-contained, reproducible code. Received on Sat Aug 12 02:49:55 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Sat 12 Aug 2006 - 04:20:25 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*