0

This is more of a technical question rather than coding. Is it possible to test whether the slope of a data set is significant or not?

So I have the following plot:

enter image description here

I managed to determine the slope of this blue geom_smooth line, which is basically the mean of all the pink lines. Is it possible to test if the slope of that blue line is significant based on the dataset?

I'm not directly interested in the code but just want to check if it's possible to determine a possible significance in the data set.

1 Answers1

1

This shows the p-value, 0.0544, of the slope in the output:

summary(lm(demand ~ Time, BOD))

giving:

Call:
lm(formula = demand ~ Time, data = BOD)

Residuals:
      1       2       3       4       5       6 
-1.9429 -1.6643  5.3143  0.5929 -1.5286 -0.7714 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept)   8.5214     2.6589   3.205   0.0328 *
Time          1.7214     0.6387   2.695   0.0544 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 3.085 on 4 degrees of freedom
Multiple R-squared:  0.6449,    Adjusted R-squared:  0.5562 
F-statistic: 7.265 on 1 and 4 DF,  p-value: 0.05435
G. Grothendieck
  • 254,981
  • 17
  • 203
  • 341
  • Thanks! So, does it means, that a perfectly horizontal line with a slope of 0 would have a p-value of 1 and a vertical line would have a p-value of 0? (or at least nearly vertical as a perfect vertical is not possible) – evian_bottle Apr 15 '21 at 13:05
  • suggest you try some artificially constructed examples such as `set.seed(123); x <- 1:10; y <- rep(1, length(x)) + rnorm(10); summary(lm(y ~ x))` – G. Grothendieck Apr 15 '21 at 13:10