How to get rid of high error linear regression for log-log model
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
JJP van den Berg
am 11 Jan. 2017
Kommentiert: Star Strider
am 11 Jan. 2017
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));
0 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Jan. 2017
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!