Significance of curve Fit

10 views (last 30 days)
Kevin Davis
Kevin Davis on 31 Oct 2013
Edited: Kevin Davis on 6 Nov 2013
I've got some data that is visually sinusoidal in nature and I'm trying to find a way to statistically display that it is in fact sinusoidal.
What I've done so far is I've applied the data to the lsqcurvefit function to get a model. Then using that model I preform an F-Test to check the "lack-of-fit." The originally data is binned, or grouped out by 16 different groups from 0º to 360º. The expected values are taken from the model obtained from lsqcurvefit, and tested against the average per bin, and observed values (according to F-Test) using the value I get back from the F test i use the following to get a P value
p = 1 - fcdf(f, df1, df2);
df1 and df2 being the degree of freedom values for the numerator and denominator of the F-Test respectively.
I'm continually getting 0 for a p value across all data sets. I was expecting to at least some some sort of differential feedback. Perhaps there is a better way to show the significance that the data follows (or doesn't follow) a sinusoidal fit.
Also, I've been thinking about using the resnorm values returned from the lsqcurve fit to calculate the r Squared value, seeing as that would give me a goodness of fit. So if the there is a good fit between the data and the model I can conclude that data is sinusoidal. However I'm not sure if there's some sort of significant P value I would be able to show for this.
Regardless of the method however, I'd like to find some way to show that the data provided is significantly sinusoidal.

Answers (1)

David Sanchez
David Sanchez on 31 Oct 2013
You should perform a Fast Fourier Transform ( fft ), this will present the frequencies that are present in your data. If it is indeed sinusoidal, you will see a peak in the FFT plot corresponding to the main frequency of your sinusoidal data.
doc fft % Matlab documentation has a very good example of how to do it
  1 Comment
Kevin Davis
Kevin Davis on 4 Nov 2013
Right. However what if the transform came back with multiple frequencies, because the data is pretty scattered.

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!