OK, I found the answer: 2*pt(t,summary(fit1)$df[2])
Thanks anyway ... 2013/2/7 Antonio Silva <aolinto....@gmail.com> > Dear list members > > I have a doubt on how p-values for t-statistics are calculated in the > summary of Linear Models. > > Here goes an example: > > x <- rnorm(100,50,10) > y <- rnorm(100,0,5) > fit1<-lm(y~x) > summary(fit1) > summary(fit1)$coef[2] # b > summary(fit1)$coef[4] # Std. Error > summary(fit1)$coef[6] # t-statistic > summary(fit1)$coef[8] # Pr(>|t| > summary(fit1)$df [2] # degrees of freedom > > # t-statistic can be calculated as: > t<-(summary(fit1)$coef[2])/summary(fit1)$coef[4] > t # t-statistic > > # the critical value for t0.05(2)df can be obtained in a t distribuition > table > # http://www.math.unb.ca/~knight/utility/t-table.htm or with > qt(0.975,summary(fit1)$df[2]) > > # Two-sided p-value should be estimated with > dt(t,summary(fit1)$df[2]) # isn't it? > > But this value is different from summary(fit1)$coef[8] > > My question is: how to reach to the same p-value indicated in Pr(>|t|) or > summary(fit1)$coef[8]? > > Thanks in advance, > > Antonio Olinto > -- Antônio Olinto Ávila da Silva Biólogo / Oceanógrafo Instituto de Pesca (Fisheries Institute) São Paulo, Brasil [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org 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.