0

I have created plots of heart rate recovery against time, using ggplot2.

I have noticed them seem to have an inflection point where the heart rate levels off. I was looking to ask if there is a way of determining this inflection point for each subject, using R studio instead of doing it manually myself?

This is the script for plots:

ggplot(data = f, aes(x=Seconds, y=Heart.Rate, group=ID, colour=ID + geom_point() + geom_line()
Phil
  • 7,287
  • 3
  • 36
  • 66
C.Morton
  • 3
  • 3
  • Have a look at [this answer](https://stackoverflow.com/questions/18647661/detecting-one-or-more-inflection-points-in-a-simple-numeric-vector) – Stewart Ross Jan 28 '18 at 19:43

1 Answers1

0

You should write a script to calculate the change in Y divided by change in X. This is basically derivative of y wrt x. In a distance versus time curve this gives you velocity. Often a sudden change will create an easily discernable peak or inflection in the derivative curve. This should be simple to calculate as well. It's just the difference in 2 consecutive y points divided by the difference in their corresponding x values. You can then plot this new curve and see what it looks like. You will have to start at point 2 since there is no earlier value for point 1.

Natsfan
  • 4,093
  • 3
  • 22
  • 29