R linear regression test hypothesis for zero slope I'm working with some data and I used R to the a linear regression model Y = aX + b.
The code I used was
summary(lm(Y~X))
What I got was
              Estimate  Std. Error t value Pr(>|t|)    
(Intercept) -0.3884045  0.0260232  -14.93   <2e-16 ***
X            0.0062095  0.0004635   13.40   <2e-16 ***

What I want to test now is the null hypothesis H0: a=0, that is, the case where the slope is zero.
I'm confused about how to do that. I tried using the offset parameter ( the idea was to subtract the 'a' coefficient found previously in the former fit ), but I'm not sure it is the correct way to test this hypothesis. 
What I did was:
summary(lm(Y~X,offset=0.0062095*X)
and I got:
             Estimate   Std. Error t value Pr(>|t|)    
(Intercept) -3.884e-01  2.602e-02  -14.93   <2e-16 ***
X           -2.464e-08  4.635e-04    0.00        1  

Is it right? Am I now supposed to reject H0 since the p-value found was 1?
 A: No.
The output when you print the summary of the original model contains (in this case), the column Pr(>|t|) gives you the p-value associated with the hypothesis test you want
              Estimate  Std. Error t value Pr(>|t|)    
(Intercept) -0.3884045  0.0260232  -14.93   <2e-16 ***
X            0.0062095  0.0004635   13.40   <2e-16 ***

In this case $p < 2 \times10^{-16}$. There isn't much point reporting at that level of precision, but you are rejecting the null hypothesis that $a=0$ at all but the most ludicrous level of confidence.
For cases when you are testing multiple parameters (such as the effect of a multi-level categorical variable) you can fit the reduced model, then use anova to perform the hypothesis test.
eg
data.(swiss)
lmFull <- lm(Fertility~., swiss)
# drop Examination and Education
lmReduced <- update(lm1, .~. - Examination - Education)
anova(lmFull, lmReduced,test= 'F')
## Analysis of Variance Table
## 
## Model 1: Fertility ~ Agriculture + Examination + Education + Catholic + 
##     Infant.Mortality
## Model 2: Fertility ~ Agriculture + Catholic + Infant.Mortality
##   Res.Df  RSS Df Sum of Sq      F    Pr(>F)    
## 1     41 2105                                  
## 2     43 4408 -2     -2303 22.428 2.629e-07 ***
## ---
## Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

A: If I understand correctly, you're overthinking it.  You're interested in a linear model mapping X, and an intercept, to Y.  You're interested in the slope a mapping X to Y.  The linear regression that you run (without that offset) finds a coefficient of 0.0062095.  That coefficinet is very much significantly different from zero, with p<.00001.  In other words, the probability that the a is zero is very small (assuming that a linear model is a good match to the data.
I think that you're done.  What is this business with offsets?
