title: How to find the lowest and highest values on a regression line with R?
body: <p>I have data similar to this:</p>
  
  <pre><code>sample &lt;- read.table(text =
                         "   value    date
                             -5.4     2017-03-01
                              -2.2    2017-03-05
                             -1.1    2017-03-10
                             4.9      2017-03-12
                             4.8      2017-03-22
                             5.6      2017-04-02
                             -0.3     2017-04-11
                             0.6      2017-04-16
                             3.3     2017-04-20
                             5.2      2017-04-22  ", header = T)
  sample$date = as.Date(sample$date)
  </code></pre>
  
  <p>I made a plot with these values with linear regression trend:</p>
  
  <pre><code>plot(sample$date,sample$value)
  abline(lm(sample$value ~ sample$date))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/MPoA5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MPoA5.png" alt="enter image description here"></a></p>
  
  <p>I would like to find difference between lowest and highest 'value' from regression line. I marked those points with red on the plot. </p>
  
  <p>How to do that in R?</p>
  
  <p>My idea is to somehow make a column of values on the regression line corresponding each date of my dataset, but I struggle to do that. </p>