rggplot2significance

Quantify the significance of a slope


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.


Solution

  • 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