Automatic Best Curve Fitting
显示 更早的评论
I want to fit the best curve to my data. Everytime I have to do a trial and error method to see what fits (i.e it could be any degree of polynomial). Is there any automatic way to do this as I need to do on 100s of data set individually?
Thanks!!
采纳的回答
更多回答(2 个)
Star Strider
2012-8-23
编辑:Star Strider
2012-8-23
0 个投票
How do you define ‘best curve’? If you’re doing it from a statistical perspective, look in the polyfit documentation for information on calculating the covariance matrix and the 95% confidence intervals on the parameters. As a general rule, the confidence interval for a particular parameter that include zero means that parameter is not necessary in the model. So the ‘best’ polynomial models are those with all parameter confidence intervals in the model not including zero, meaning that all parameters are significantly different than zero. That could be a polynomial of a much lower degree than length(data)-1. It may not fit as well but it will at least have statistical validity, if that is a consideration.
Greg Heath
2012-8-23
0 个投票
It is not clear whether you want
1. To fit the sampled data containing noise and measurement error as closely as possible
or
2. To fit a larger population of data containing noise and measurement error from which the sampled data is considered to be representative.
For example, consider a sample of N = 20 points from a contaminated linear model
y = a*x + b + c*randn(1,N).
The sample data can be represented exactly by a 19th order polynomial with Np = 20 estimated coefficients. However, that polynomial is usually not a good represenative model for the population.
In the latter case functions like STEPWISE and STEPWISEFIT that can automatically choose a more reasonable polynomial order are more appropriate.
Regardless of the model, it is usually wise to use as few estimated parameters, Np, as possible to increase the confidence in the parameter estimates (Search Occam's Razor). A useful rule of thumb is to assume N > Np is necessary and N >> Np is sufficient.
In the case of nonlinear neural network models, trial and error is a relatively straightforward approach. However, more advanced techniques like regularization and validation set stopping tend to be used by frequent practicioners.
Hope this helps.
Greg
2 个评论
Swathi
2012-8-23
Greg Heath
2012-8-26
My point is if the sample is sufficient, the model will work on the entire population without further adjustments.
Hope this helps.
Greg
类别
在 帮助中心 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!