'Determining when there is a decrease in the rate of change

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()


Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Natsfan