MATLAB Answers

0

formula for nonlinear regression model

Dear MatLab Experts,
I have four column vectors with 14 elements representing respectively:
Area, Max.Diameter, Min.Diameter, Field Size Factor (FSF) of custom-made collimators.
I believe the FSF depends somehow on the other three quantities. The dependence is not linear.
I woud like to tryto model the FSF as a power law involving products of the other quantities.
For instance, FSF ~a*(Max.Diam*Min.Diam)^b + c*(Area/Max.Diam)^d + e*(Area/Min.Diam)^f + g*(Max.Diam/Min.Diam)^h + i
where a, b,c,d,e,f,g,h,i are the unknown model coefficients.
I am pretty sure most of the terms are useless. Perobably just one is necessary for the model. However, I do not know which one is the most important term. I expect the modeling function will figure that out.
My problem is that I do not know how to write the above formula in the proper format expected by the nonlinear regression functions.
I need some help to set up the above outlined particular model.
Thank you very much in advance.
Best regards,
Maura E. M.

  0 Comments

Sign in to comment.

1 Answer

Answer by SYED IMTIAZ ALI SHAH on 14 Aug 2019
 Accepted Answer

Is this what you want?
x = MaxFDiam .* MinFDiam + Area ./ MaxFDiam + Area ./ MinFDiam + MaxFDiam ./ MinFDiam; % your formula
Linear model Poly7:
Your resultant equation with coefficients.
f(x) = p1*x^7 + p2*x^6 + p3*x^5 + p4*x^4 + p5*x^3 +
p6*x^2 + p7*x + p8
Coefficients (with 95% confidence bounds):
p1 = 2.961e-18 (-5.495e-18, 1.142e-17)
p2 = -6.914e-15 (-2.189e-14, 8.064e-15)
p3 = 6.708e-12 (-4.044e-12, 1.746e-11)
p4 = -3.496e-09 (-7.522e-09, 5.297e-10)
p5 = 1.054e-06 (2.132e-07, 1.895e-06)
p6 = -0.0001832 (-0.0002798, -8.656e-05)
p7 = 0.01691 (0.01138, 0.02244)
p8 = 0.3618 (0.2454, 0.4782)
Goodness of fit:
SSE: 5.048e-06
R-square: 0.9998
Adjusted R-square: 0.9995
RMSE: 0.0009173
1.PNG
2.PNG

  4 Comments

Show 1 older comment
I use the Curve Fitting Toolbox which uses the Polyfit function. Means you can use both Polyfit and Curve Fitting Toolbox (It is more convenient).
I just used your equation without any coefficient and power, and let matlab find these automatically for me (without telling matlab).
As I am not a professional statistician, I don't fully understand the error, I used the equation derived from this toolbox in many practical experiments and it gave me best results.
Moreover some of the coefficients look somewhat odd to me also.
Yes. The coefficients are very small. But the fit is close to perfection.
I have sdeveloped a Monte Carlo simulation that reproduces the trend of the experimental measurements but not as accurately as your model.
I tried to fit a much simpler linear model using 'fitlm'. The result was bad although the R^2 was more than 0.9. But some P_values were 'NaN'.
I am going to accept your very good solution. Although I really would like to learn how to play with nonlinear models.
Thank you.
Regards,
maura E. M.

Sign in to comment.