How do I test $H_0 : \beta_1\leq 2$ in R? How do I test $H_0 : \beta_1\leq 2$ in R?
The data is as follows:
x<-c(1,2,3,3,4,5,5)
y<-c(3,7,5,8,11,14,12)


If the regression equation is the simplest one, e.g.
$$Y_i = \beta_0 + \beta_1x_i + \epsilon_i,$$
then to test $H_0:\beta_1\leq 2$ against $H_1:\beta_1>2$ you can do
x<-c(1,2,3,3,4,5,5)
y<-c(3,7,5,8,11,14,12)
n <- length(y)

summary(mod <- lm(y~x))

Call:
lm(formula = y ~ x)

Residuals:
       1        2        3        4        5        6        7 
 0.02128  1.57447 -2.87234  0.12766  0.68085  1.23404 -0.76596 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   0.5319     1.5881   0.335  0.75127   
x             2.4468     0.4454   5.494  0.00273 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.632 on 5 degrees of freedom
Multiple R-squared:  0.8579,    Adjusted R-squared:  0.8294 
F-statistic: 30.18 on 1 and 5 DF,  p-value: 0.002729



t_obs <- (2.4468-2)/0.4454 # observed t statistic
pt(t_obs, df=n-2, lower.tail = F) # p-value

