How to get rid of high error linear regression for log-log model

3 次查看(过去 30 天)
I have the function D = alpha*(Pop)^b1*(Gdp)^b2*d^b3. I turn this into a log-log model: ln(D)= ln(alpha)+ b1*ln(Pop)+b2*ln(Gdp)+b3*ln(d). Now I would like to find the b coefficients and the intercept(ln(alpha)). I have the values for D and the other variables. I take the natural log of these vectors and try to find the coefficients by regression. This works only the errors are way too large. Especially when turned back to original value with exp().Any help to minimize this error or another appraoch would be greatly appreciated.
distanceln = log(distancevec); POPln = log(POPvec); GDPln = log(GDPvec);demandln = log(Demandvec);
X = [ones(size(POPln)),POPln,GDPln,distanceln];
y = demandln;
b = X\y;
Y = X*b;
err = max(abs(y-Y));

采纳的回答

Star Strider
Star Strider 2017-1-11
This might be solvable with a simple nonlinear regression using fminsearch, avoiding the need to do the log transformation (considered to be inadvisable for the reason you have discovered).
Your ‘data.mat’ file has: ‘Demandvec’, ‘GDPvec’, ‘POPvec’, and ‘distancevec’. I assume that ‘d’ is ‘distancevec’, and you want to fit to ‘Demandvec’.
What is ‘alpha’? Are we estimating it as well?
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by