[R] Calculating p-value for 1-tailed test in a linear model
Albyn Jones
jones at reed.edu
Mon Aug 22 19:40:02 CEST 2011
For H_0: beta >= 0, then the correct p-value is
pt(tvalue,df)
regardless of the sign of tvalue. Negative tvalues of large magnitude
will yield small p-values.
albyn
On Mon, Aug 22, 2011 at 05:22:06PM +0000, Ben Bolker wrote:
> Campomizzi, Andrew J <acampomizzi <at> neo.tamu.edu> writes:
>
> > On 20/08/11 10:20, Andrew Campomizzi wrote:
> > > Hello,
> > >
> > > I'm having trouble figuring out how to calculate a p-value for a 1-tailed
> > > test of beta_1 in a linear model fit using command lm. My model has only 1
> > > continuous, predictor variable. I want to test the null hypothesis beta_1
> > > is>= 0. I can calculate the p-value for a 2-tailed test using the code
> > > "2*pt(-abs(t-value), df=degrees.freedom)", where t-value and degrees.freedom
> > > are values provided in the summary of the lm. The resulting p-value is the
> > > same as provided by the summary of the lm for beta_1. I'm unsure how to
> > > change my calculation of the p-value for a 1-tailed test.
> > >
>
> Isn't it just
>
> pt(tvalue,df=degrees.freedom,lower.tail=FALSE)
>
> if the value is positive (and expected to be positive) or
>
> pt(tvalue,df=degrees.freedom)
>
> if the value is negative (and expected to be negative)?
>
> In fact, if the value is in the expected direction, I think you
> can just leave out the multiplication by 2 and get the right answer ...
>
> ______________________________________________
> 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.
>
--
Albyn Jones
Reed College
jones at reed.edu
More information about the R-help
mailing list