## Correlation for Sine Model?

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

mathmannix
Posts: 1415
Joined: Fri Jul 06, 2012 2:12 pm UTC
Location: Washington, DC

### Correlation for Sine Model?

I am trying to fit a monthly sine wave to data. For simplicity, I am using for each data point the average of the values on that day of the month, so I have 31 data points. I want the period to be 31. As a quick-and-dirty method, I am (for now) using the max value minus the min value as the amplitude, and the mean of the 31 values as the displacement, and so my model is

y = A * sin ( (2π/31) x + c) + μ,

where μ is the mean of all 31 values (I don't know how to make an x-bar symbol), and A = xmax - xmin. (c, which determines the phase shift (-31c/2π), is my variable which I am adjusting to find the best fit.)

My problem is trying to objectively compare how well the model fit different groups of data. I need a correlation coefficient, but R2 is only meaningful for linear regression.

I tried taking the arcsine of both my data and my model, in order to get a linear model, but I haven't gotten this to work, or at least to provide me with an R2 value that makes sense.

I hear velociraptor tastes like chicken.

doogly
Dr. The Juggernaut of Touching Himself
Posts: 5461
Joined: Mon Oct 23, 2006 2:31 am UTC
Location: Lexington, MA
Contact:

### Re: Correlation for Sine Model?

The chi^2 is a good general choice.

Though is there very strong motivation for presetting things like the amplitude? Since you are picking that based on the max and min values, these two data points become extremely important in determining the form of your model. In general they should be given no more weight than any other data point in finding a functional form - and maybe the extreme values have reason to be *distrusted!*
LE4dGOLEM: What's a Doug?
Noc: A larval Doogly. They grow the tail and stinger upon reaching adulthood.

Keep waggling your butt brows Brothers.
Or; Is that your eye butthairs?

mathmannix
Posts: 1415
Joined: Fri Jul 06, 2012 2:12 pm UTC
Location: Washington, DC

### Re: Correlation for Sine Model?

Thanks! Pearson's chi-squared seems to be working out quite well for my purposes. (Like I said, my model is a quick-and-dirty one; the important thing is to have something which works to compare different groups of data. I can always change the parameters later to get even better-fitting models.)
I hear velociraptor tastes like chicken.

flownt
Posts: 70
Joined: Sat Feb 09, 2013 5:24 pm UTC

### Re: Correlation for Sine Model?

Typically one wants to find the maximum likelihood estimators. If your errors are Normal distributed then this is equivalent to finding those parameters that minimize the squared error. This suggests the root-mean-square error as a reasonable measure.