Skip to content
Back to formatted view

Raw Message

Message-ID: <4B45F119.4050502@ucalgary.ca>
Date: 2010-01-07T14:35:05Z
From: Peter Ehlers
Subject: Extract p-value from linear model
In-Reply-To: <7dc3eb8d1001070615u7a84def7t21e4336e5eac70e3@mail.gmail.com>

coef(summary(lm(..stuff..)))[,4]
or
  coef(summary(lm(..stuff..)))[,4,drop=FALSE]

  -Peter Ehlers

Trafim Vanishek wrote:
> Dear all,
> 
> I have the following question.
> Is it possible in R to call for the p-value directly in a model like this
> 
> a <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> b <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> 
> summary(lm(a~(b+0)))
> 
> or even in this
> a <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> b <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> 
> summary(lm(a~b))
> 
> to call the p-values directly for every estimated parameter.
> Thanks a lot for the help!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
> 
> 

-- 
Peter Ehlers
University of Calgary
403.202.3921