cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
aadecarlojr
Level II

analysis of fit to cosine wave

I am planning to analyze circadian rhythm data and can fit it to the Savitzky-Golan smoother with a cubic degree and local cosine weighting. This provides a visual with a confidence of fit.  However, is there a way to statistically determine the quality of the fit to the cosine waveform?  I have tried saving the smoother formula to the data table then launching the analysis using the upper and lower smoother values in a Sheffe Cubic macro with the x-time covariant but I am not sure if this is the best way to analyze fit.  Any advice?

 

Thanks,

Arthur DeCarlo

2 REPLIES 2
SDF1
Super User

Re: analysis of fit to cosine wave

Hi @aadecarlojr ,

 

  I think the following is one possible approach that you could take.

 

  What I've done is generate a column of values :t and another column called :M M is a function of :t, namely:

SDF1_0-1697047018775.png

  As you pointed out, in Graph Builder, you can use the Savitzky-Golay smoother to fit functions like this. I have also used the cubic degree and local cosine weighting by using the options in the red hot button menu net to "Smoother". One thing you can also do is "Save Formula", 

SDF1_1-1697047145900.png

Which, in my case, saves the following column :Smoother(M) to the data table with the following formula:

SDF1_2-1697047190021.png

You can then proceed to do a Fit Y by X, where you use the actual data as the Y variable and the predicted data as the X, and then fit a line to the data. This will give you some fit statistics and basis to quantify how good of a fit you actually have.

SDF1_3-1697047278087.png

  In my case, you can see the fit does very well, with an r^2 of 0.97. In addition to getting this fit statistic, you can also save the 95% confidence interval on the fit by clicking the red hot button next to Linear Fit and selecting Indiv Confidence Limit Formula.

SDF1_4-1697047356269.png

  This will save two additional columns to the data table that you can then use in an overlay plot to see how well the fit and actual data stay within the 95% confidence intervals, see below.

SDF1_5-1697047439183.png

  This should at least get you started on being able to quantify the fit of your data.

 

Hope this helps!,

DS

 

Re: analysis of fit to cosine wave

Graph Builder is flexible, but it focuses on visualization. See the Nonlinear platform for fitting and evaluating models. You can update the column formula used as the model and then plot it in Graph Builder.