问题
I performed a simple linear regression and using summary() I get the result of a two-tailed t-test testing whether the regression coefficient is significantly different from 0.
lmb <- lm(logspec ~ logfreq)
I would like to perform a one-tailed t-test testing whether the regression coefficient is less than 1.
I read in previous threads about the use of offset() to set the comparison value different from 0 but I am not sure if it does what I would like to see happen:
t <- lm(logspec ~ logfreq + offset(1*logfreq))
A possible way to perform a one-tailed t-test I believe is the following:
res <- summary(lmb)
d <- pt(coef(res)[, 3], lmb$df, lower.tail=FALSE)
In which the upper tail is the one of interest and the quantiles of a t-distribution are calculated, but here I am also not entirely sure if this connects to what I would like to achieve.
So I have found these 2 methods, which aim at setting the comparison value different from 0 and performing a one-tailed t-test but I am not sure whether they are the way to go and if (and how) I can combine both?
来源:https://stackoverflow.com/questions/56542744/testing-whether-the-regression-coefficient-is-significantly-less-than-1-one-tai