I have been struggling to fit my data to a sine curve.

My data looks like:

frame = data.frame(hour = c(0, 1, 2, ... 24), value = (numbers between 0 and 500))

I have the following model:


It doesn't model much. Adjusted R squared of .1836.

Here is the plot: graph

Histogram of log(value) hist

Plot of log(value) plot

As a time series time series

  • $\begingroup$ judging from your plot you should not expect to get higher R^2 value, because you have a whole range of response for a single hour. $\endgroup$ Nov 22 '14 at 7:00
  • $\begingroup$ @KarolisKoncevičius so how can I better model this then? $\endgroup$
    – compguy24
    Nov 22 '14 at 7:01
  • 1
    $\begingroup$ If you don't have external causal variables that explain why a particular value at 10am is high rather than low, you won't be able to model it better. "Noise" is whatever you don't know about, and you apparently have a lot of it. $\endgroup$ Nov 22 '14 at 7:09
  • 1
    $\begingroup$ Your response appears to be strictly positive. You might be better off with a GLM perhaps. What does the response consist of? $\endgroup$
    – Glen_b
    Nov 22 '14 at 8:59
  • 1
    $\begingroup$ There's at least some suggestion from that information that a gamma model might be reasonable for the conditional distribution. Alternatively, you might want to consider whether some kind of time series model in the logs (possibly AR, say, perhaps with regressors as well). It may that there's simply a lot of noise. One thing that has me curious is why a period like 50*hour? Was that deliberately chosen? $\endgroup$
    – Glen_b
    Nov 22 '14 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.