January 18th, 2010, 7:48 am
MATLAB is generally pretty weak when it comes to providing canned routines. If you want software that would solve your problem with a single command, look into something like gretl, STATA, or EVIEWS. As you know, the formula for GLS is trivial: B = inv(X'inv(G)X)X'inv(G)yPerhaps Matlab has it built it, but otherwise you can use something like B =solve(inv(X'*inv(G)*X)*X'*inv(G),y) (typing the first formula directly is bad for numerical accuracy).Of course, you need to know what goes inside of G, which is the covariance matrix of e_0,e_1,...,e_T. For AR(1) model it has a trivial structure where all off diagonal entries depend on a single parameter that dies out geometrically. You get the parameter by estimating the AR model first, then building G, and solving the GLS equations above. Any good econometrics text book works through this example. I suggest that you look into Goldberger's graduate econometrics book, the chapter on GLS with serial correlation. Alternatively, forget the GLS, and do OLS with serial correlation robust standard errors. (again, MATLAB probably does not have functions that compute robust standard errors)
Last edited by
APS on January 17th, 2010, 11:00 pm, edited 1 time in total.