Re: [R] data structure with coefficients, and call from lm()

2007-10-01 Thread P Ehlers
John, Jim has shown how to accomplish what you want. Here's a slight variation (for a single model): y <- rnorm(20) x <- runif(20) z <- runif(20) fm <- lm(y ~ x + z) m <- cbind(NA, coef(summary(fm))) colnames(m)[1] <- deparse(formula(fm)) print(m, na.print = "") - Peter Ehlers jim holtman wr

Re: [R] data structure with coefficients, and call from lm()

2007-09-30 Thread jim holtman
This is close to what you want. I created the list by hand, but you can create it in your processing loop. Once you have the list created, you can create your own print routine. > x <- runif(100) > z <- runif(100) > y <- runif(100) > > > # I am doing this by hand, but you could easily automate i

Re: [R] data structure with coefficients, and call from lm()

2007-09-30 Thread John Sorkin
Jim, You are indeed trying to help, again my thanks. What I want to do is make a single structure - a table is an apt description that will summarize all the regressions, something like: Estimate Std. Error t value Pr(>|t|) (Intercept) lm(formula = y ~ x) 4

Re: [R] data structure with coefficients, and call from lm()

2007-09-30 Thread John Sorkin
Thank you Moshe, I understand you point, but I would hope that I could use summary to save my self some work. I need to do what I described in my original Email to the list server on tens of regressions. John John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryl

Re: [R] data structure with coefficients, and call from lm()

2007-09-30 Thread John Sorkin
Jim, Again thank you for your quick reply. Your suggestion does not give me exactly what I want: > whatIwant<-list(,summary(fitdelete)$call,summary(fitdelete)$coefficients) > whatIwant [[1]] lm(formula = y ~ x) [[2]] Estimate Std. Error t value Pr(>|t|) (Intercept) 4.927791 2.6

Re: [R] data structure with coefficients, and call from lm()

2007-09-30 Thread jim holtman
try using a 'list': whatIwant<-list(call=summary(myreg)$call, coef=summary(myreg)$coefficients) On 9/30/07, John Sorkin <[EMAIL PROTECTED]> wrote: > Widows XP > R 2.3.1 > > I have been trying to make a data structure that will contain both the > coefficients from a linear regression along with c

[R] data structure with coefficients, and call from lm()

2007-09-30 Thread John Sorkin
Widows XP R 2.3.1 I have been trying to make a data structure that will contain both the coefficients from a linear regression along with column and row titles AND the call, i.e. myreg<-lm(y~x+y+z) whatIwant<-cbind(c(summary(myreg)$call,"",""),summary(myreg)$coefficients) Neither the statement