Im trying to perform a simple hypothesis test but now I need t-values for alpha = 0.01 instead of 0.05 (the default). Is there a way to do this in R?
This is what I am trying to get for alpha = 0.01: enter image description here
CodePudding user response:
If you used the t.test
function in R, you can use the argument conf.level = 0.99
, since the confidence level is equivalent to 1 – the alpha level. You can also read this page on Rdocumentation on the t.test function for more information on what arguments can be used
CodePudding user response:
This seems to be a statistical question rather than a programming question, and as such probably belongs on CrossValidated ...
Results table:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 93.10386 44.482243 2.093057 3.647203e-02
educ 39.82828 3.314467 12.016497 3.783286e-32
When you change alpha (the cutoff value for significance testing), nothing in the table above — neither the t-statistic (t value
) nor the p-value (Pr(>|t|)
) — changes. The only thing that changes is the judgment of whether you rejected or failed to reject the null hypothesis. In this case, since the p-value for the intercept (0.036) is between 0.01 and 0.05, the conclusion would change from "reject H0" (alpha=0.05) to "fail to reject H0" (alpha=0.01). The p-value for educ
is way less than 0.01, so the conclusion would be "reject" either way.
In most cases, base-R functions don't specify an alpha value; they let you make the decision yourself. If you do have a vector of p-values, you could implement an alpha threshold by saying
result <- ifelse(pval<alpha, "reject H0", "fail to reject H0")