I have a data set similar to this,
x <- sample(55:100,200,replace = T)
head(x)
# [1] 67 95 97 91 98 81
And I need to find out the converging point of this particular data something similar to gradient descent curve. For that I tried the following,
x_mean <- c()
for (i in 1:length(x)) {
x_mean[i] <- mean(x[1:i])
}
mean_diff <- c()
for (i in 2:length(x_mean)) {
mean_diff[i-1]=(x_mean[i] - x_mean[i-1])^2
}
x2 <-seq(1,length(mean_diff),1)
lo <- loess(mean_diff ~ x2,span = 1)
convergence <- predict(lo)
convergence_point <- which.min(convergence)
convergence_point # 79
plot(convergence,ty = "l",lwd = 2)
abline(v = convergence_point, col = "red")
I am not sure whether my finding is correct or not. Is there any alternative way to figure out the converging point ?
Thanks in adavance.