Andrew Campomizzi
2011-Aug-19 22:20 UTC
[R] Calculating p-value for 1-tailed test in a linear model
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. Thanks for your assistance, Andy [[alternative HTML version deleted]]
Rolf Turner
2011-Aug-20 02:18 UTC
[R] Calculating p-value for 1-tailed test in a linear model
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. > > Thanks for your assistance, > > AndyThe r-help mailing list is *not* for giving assistance with homework. cheers, Rolf Turner
Campomizzi, Andrew J
2011-Aug-20 17:11 UTC
[R] Calculating p-value for 1-tailed test in a linear model
My question isn't related to homework. It is a small part of an actual problem I'm trying to solve. I've been unable to find a solution in R help files and discussions, in statistics books, or from colleagues. The solution may not be overly complicated, but any assistance is appreciated. Thanks, Andy ----- Original Message ----- From: "Rolf Turner" <rolf.turner at xtra.co.nz> To: "Andrew Campomizzi" <acampomizzi at tamu.edu> Cc: r-help at r-project.org Sent: Friday, August 19, 2011 9:18:07 PM GMT -06:00 US/Canada Central Subject: Re: [R] Calculating p-value for 1-tailed test in a linear model The r-help mailing list is *not* for giving assistance with homework. cheers, Rolf Turner 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. > > Thanks for your assistance, > > Andy
David Winsemius
2011-Aug-20 23:01 UTC
[R] Calculating p-value for 1-tailed test in a linear model
On Aug 19, 2011, at 6:20 PM, 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.You need to clearly state your hypothesis. Then using the output from the regression function should be straightforward. (Yes. this is a intentionally vague answer designed to elicit further information about your understanding of the statistical issues and how they relate to your domain knowledge. Many time peole already have the data and because they didn't get the answer they wanted, they search for other ways to "game the system" by ad-hoc changes in the statistical "rules of the road".) -- David Winsemius, MD West Hartford, CT