[R] Odp: Linear Regression with slope equals 0

Petr PIKAL petr.pikal at precheza.cz
Tue Aug 14 13:59:56 CEST 2007


Hi

Not being a trained statistician regression with slope = 0 seems odd to 
me.

If you do

> fit<-lm(d~t)
> summary(fit)

Call:
lm(formula = d ~ t)

Residuals:
       1        2        3        4        5        6 
 0.04762 -1.43810  0.07619  1.59048  2.10476 -2.38095 

Coefficients:
            Estimate Std. Error t value Pr(>|t|) 
(Intercept) 302.4667     1.7849  169.45 7.28e-09 ***
t             0.4857     0.4583    1.06    0.349 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 1.917 on 4 degrees of freedom
Multiple R-Squared: 0.2192,     Adjusted R-squared: 0.02402 
F-statistic: 1.123 on 1 and 4 DF,  p-value: 0.349 

you will get estimate of your coeficients and AFAIK they are tested 
against Ho that they differ from 0.

So as you see your "t" is not statistically different from 0.

Regards
Petr


r-help-bounces at stat.math.ethz.ch napsal dne 14.08.2007 13:36:37:

> 
>  Hi there, am trying to run a linear regression with a slope of 0.
> 
>  I have a dataset as follows
> 
>  t d
>  1 303
>  2 302
>  3 304
>  4 306
>  5 307
>  6 303
> 
>  I would like to test the significance that these points would lie on a
> horizontal straight line.
> 
>  The standard regression lm(d~t) doesn't seem to allow the slope to be 
set.
> 
>  Any help very welcome.
> 
>  ed
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list