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

John Sorkin jsorkin at grecc.umaryland.edu
Mon Oct 1 05:17:40 CEST 2007


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.62115494  1.880007 6.307727e-02
x           1.887634 0.04372724 43.168382 1.410167e-65

What I want is something that looks more like a table:

            lm(formula = y ~ x) Estimate Std. Error   t value     Pr(>|t|)
(Intercept)                     4.927791 2.62115494  1.880007 6.307727e-02
x                               1.887634 0.04372724 43.168382 1.410167e-65

Thanks,
John



John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

>>> "jim holtman" <jholtman at gmail.com> 9/30/2007 11:00 PM >>>
try using a 'list':

whatIwant<-list(call=summary(myreg)$call, coef=summary(myreg)$coefficients)

On 9/30/07, John Sorkin <jsorkin at grecc.umaryland.edu> 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 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 above, nor any one of twenty variations I have tried work. I would appreciate any advice.
> Thanks,
> John
>
>
>
>
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for the ...{{dropped}}



More information about the R-help mailing list