1
$\begingroup$

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

enter image description here

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.

$\endgroup$
3
  • $\begingroup$ stats.stackexchange.com/a/225504/11849 $\endgroup$
    – Roland
    Dec 5, 2018 at 9:06
  • $\begingroup$ @Roland , thanks for the comment. Are you suggesting to calculate a global maximum? If so, how can I decide if it's in the end? Sorry I think that could be a nice hint but I'm not grabbing how to use it. $\endgroup$
    – s__
    Dec 5, 2018 at 12:56
  • $\begingroup$ The curve might go up or down at the end, so here is what I would try: find the peak-to-peak value of my data, and if the difference between a (smoother) quadratic and the loess is outside plus-or-minus half of the data peak-to-peak then I should have found this condition. $\endgroup$ Dec 5, 2018 at 16:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.