I am trying to find the point where the slope of my data changes significantly. I want to determine a single point (in this case a value for days) in order to use it as an argument in a model I try to run.
study_data <- data.frame(days = c(30,50,100,133,166,200,233,266,300,333,366,400,450,500,750) ,
participants = c(100,85,60,45,36,30,27,23,21,19,19,17,16,16,6))
plot(study_data$days, study_data$participants)
using the cpop
package gave me multiple points of change.
result <- cpop(study_data$participants, study_data$days)
summary(result)
plot(result)
using the segmented
package I get the following
nodes_model <- lm(participants ~ days, data = study_data)
segmented_nodes_model <- segmented(nodes_model, seg.Z = ~days)
nodes_breaks <- segmented_nodes_model$psi
Initial Est. St.Err
psi1.days NA 175.7564 6.215544
Both outputs don't really line up. I am sorry, but I am confused.