Sorry if the question is trivial, but I'm not finding a proper idea for this issue.
I'd like to find if a series of fitted value of a loess is increasing in the end.
I'm working with some data like this:
data(economics, package="ggplot2")
economics$index <- 1:nrow(economics)
economics <- economics[1:45, ]
And I am fitting a loess
model to them, using the base R
function:
model_1 <- loess(uempmed ~ index, data=economics, span=0.40)
With this result for the fitted values:
plot(model_1$fitted, type ="line")
Is there a way to detect the last high increase of the fitted value? I'm posting here because I am probably missing the point of something in the theory, rather than in the coding.
The only things I can think are arbitrary ways, like a condition if the last value is x times bigger than the mean of the fitted values without it, so there is an increase, or maybe a kind of comparison of the mean of the last n values vs the mean of the previous m values, but they seems too much subjective.
Thanks in advance.