[R] how to the p-values or t-values from the lm's results

Dimitrios Rizopoulos Dimitris.Rizopoulos at med.kuleuven.be
Sun Aug 20 10:34:22 CEST 2006


try the following:

data <- data.frame(matrix(rnorm(900), ncol = 9))
names(data) <- c("y", paste("x", 1:8, sep = ""))
logr <- lm(y ~ . - 1, data)
a <- summary(logr)

coef(a)
coef(a)[, 3:4]
coef(a)[, "t value"]
coef(a)[, "Pr(>|t|)"]


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
      http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting zhijie zhang <epistat at gmail.com>:

> Dear friends,
>   After running the lm() model, we can get summary resluts like the
> following:
> Coefficients:
>    Estimate  Std. Error  t value Pr(>|t|)
> x1  0.11562    0.10994   1.052   0.2957
> x2 -0.13879    0.09674  -1.435   0.1548
> x3  0.01051    0.09862   0.107   0.9153
> x4  0.14183    0.08471   1.674   0.0975 .
> x5  0.18995    0.10482   1.812   0.0732 .
> x6  0.24832    0.10059   2.469   0.0154 *
> x7 -0.04425    0.11008  -0.402   0.6886
> x8  0.05146    0.10290   0.500   0.6182
> -------------------------------------------------------------
> **the program maybe :
> data<-matrix(rnorm(900),ncol=9) #9variables,1dependent var,8independent
> data<-data.frame(data)
> names(data)<-c('y','x1','x2','x3','x4','x5','x6','x7','x8')
> logr<-lm(y~x1+x2+x3+x4+x5+x6+x7+x8-1,data)
> a<-summary(logr)
> ------------------------------------------------------------------------------------------------------------------------
> Could i extract the p-values or t-values from the a$Coefficients, i searched
> the attributes(a), but don't find the options,how to do that?
> Thanks very much!
>
> --
> Kind Regards,
> Zhi Jie,Zhang ,
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
>



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list