[R] simple question on one-sided p-values for coef() on output of lm()

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Feb 21 21:23:55 CET 2007


On Wed, 21 Feb 2007, Ranjan Maitra wrote:

> I was wondering if it is possible to get the p-values for one-sided 
> tests on the parameters of a linear regression.
>
> For instance, I use lm() and store the result in an object. lm() gives 
> me a matrix, using summary() and coef() on which gives me a matrix 
> containing the coefficients, the standard errors, the t-statistics and 
> the two-sided p-values by default. Can I get it to provide me with 
> one-sided p-values (something like alternative less than or greater 
> than)?

Not 'it', but you can easily do the calculation yourself from the output.
E.g.

example(lm)
s <- summary(lm.D90)
pt(coef(s)[, 2], s$df[2], lower=FALSE) # or TRUE

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list