HOW CA I WRITE A OLS CODE FOR THIS FUNCTION?
2 views (last 30 days)
Show older comments
Using the OLS regression I want to minimize the sum of square residual? How can I do it in matlab P=CD*+error Such as P is a Kx1 matrix and C kxn matrix and D*is a kx1 matrix and the error is a Kx1 matrix And D*=exp(-r(tn)*tn) and I want to get the r(tn) which should be a Kx1 matrix ,t =1,2,….n D=arg {min}_(D*) {ε'ε|ε=P-CD*} And D=((C' C))^(-1) C' P COULD SOME BODY SUGGEST A SOLUTION?PLEASE
0 Comments
Answers (1)
Sargondjani
on 11 May 2012
there are many tools. have a look at them (for some you need specific toolboxes):
\ (left divide) regress
curvefit
lsqlin (linear least squares) lsqnonlin (non linear least squares)
for more specific problems: fminunc (unconstrained optimization) fmincon (constrained optimization)
0 Comments
See Also
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!