WLS estimation with constraint

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

cannibal
Posts: 3
Joined: Mon Apr 06, 2009 6:56 am

WLS estimation with constraint

Postby cannibal » Wed Apr 08, 2009 10:54 am

Hi, I am trying to run a weighted least-squares regressions:

Ri = α + β1X1+ B2X2 + εi

The objective is to minimize the weighted squared residuals, ∑Wiεi^2 (wherein Wi's are weights know to us beforehand) - subject to the constraints:

γ1β1+ γ2β2 = 0 (γ1 and γ2 are weights known to us)

and

Ω1β1+ Ω2β2 = 0 (Ω1 and Ω2 are weights known to us)

Any pointers as to how we can do this exerciese in Eviews would be great.

Thanks

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: WLS estimation with constraint

Postby startz » Wed Apr 08, 2009 12:08 pm

Hi, I am trying to run a weighted least-squares regressions:

Ri = α + β1X1+ B2X2 + εi

The objective is to minimize the weighted squared residuals, ∑Wiεi^2 (wherein Wi's are weights know to us beforehand) - subject to the constraints:

γ1β1+ γ2β2 = 0 (γ1 and γ2 are weights known to us)

and

Ω1β1+ Ω2β2 = 0 (Ω1 and Ω2 are weights known to us)

Any pointers as to how we can do this exerciese in Eviews would be great.

Thanks
Can I ask if this is a homework question, and if it is where it's from?

cannibal
Posts: 3
Joined: Mon Apr 06, 2009 6:56 am

Re: WLS estimation with constraint

Postby cannibal » Wed Apr 08, 2009 9:13 pm

Hi Gareth,

Sorry to disappoint, but it isn't a home assignment. Guess, should have more explicit in expalining my query.
Trying to do a monthly cross-sectional weighted least-squares regressions on Ri to determine the pure Xj and Xk effects - across; wherein

βi j = a dummy variable equal to 1 if Ri belongs to X j and 0 otherwise;
βi k = a dummy variable equal to 1 if Ri belongs to X k and 0 otherwise;

Given this, the zero-sum constraints are used to avoid perfect collinearity among the regressors without having to drop one dummy per set of indicators.

Hope it answers ur question.

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: WLS estimation with constraint

Postby startz » Thu Apr 09, 2009 3:54 am

Hi, I am trying to run a weighted least-squares regressions:

Ri = α + β1X1+ B2X2 + εi

The objective is to minimize the weighted squared residuals, ∑Wiεi^2 (wherein Wi's are weights know to us beforehand) - subject to the constraints:

γ1β1+ γ2β2 = 0 (γ1 and γ2 are weights known to us)

and

Ω1β1+ Ω2β2 = 0 (Ω1 and Ω2 are weights known to us)

Any pointers as to how we can do this exerciese in Eviews would be great.

Thanks
Can I ask if this is a homework question, and if it is where it's from?
The reason I asked about homework is that the question, as written, is a little funky. You've given two linear equations in two unknowns for the constraints. That gives the answer for beta1 and beta2 without reference to the data. Do you actually want this for two constraints among K>2 betas?

(By the way, how did you post math symbols? I've been wondering about that one.)

cannibal
Posts: 3
Joined: Mon Apr 06, 2009 6:56 am

Re: WLS estimation with constraint

Postby cannibal » Thu Apr 09, 2009 4:32 am

Hi Startz,

Yes, the problem became spurious as i tried to make it easy to understand.

You are right. We have two linear constraints on the slope parameters, which are greater than two.

The problem is to perform a weighted least squares regression of R = a + b1X1+b2X2+.........+bnXn

where n>2

the weights on different observations are known a priori,

the two constraints that the slope parameters should satisfy are:

1. y1b1+y2b2+........+ynbn=0 (y1, y2, ........ , yn are known)

2. c1b1+c2b2+........+cnbn=0 (c1, c2, ........ , cn are known).

Thanks.

PS: inserted the mathematic symbols from MS word

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: WLS estimation with constraint

Postby startz » Thu Apr 09, 2009 4:49 am

Hi Startz,

Yes, the problem became spurious as i tried to make it easy to understand.

You are right. We have two linear constraints on the slope parameters, which are greater than two.

The problem is to perform a weighted least squares regression of R = a + b1X1+b2X2+.........+bnXn

where n>2

the weights on different observations are known a priori,

the two constraints that the slope parameters should satisfy are:

1. y1b1+y2b2+........+ynbn=0 (y1, y2, ........ , yn are known)

2. c1b1+c2b2+........+cnbn=0 (c1, c2, ........ , cn are known).

Thanks.

PS: inserted the mathematic symbols from MS word
The weighting part is easy. EViews lets you specify weights in Options under the Estimate button in the equation window.

EViews does not have an option for constrained regression, but you can do it manually. Basically, solve for b1 and then substitute out. If you have c1b1+c2b2=0 and the regression y=b1x1 + b2x2, write
y = b2*(-c2/c1)x1 + b2x2, y = b2(x2-(c2/c1)*x1)

or

ls y (x2-c2/c1)*x1)

This is mechanical, although with two constraints may be painful.

guero303030
Posts: 14
Joined: Sun May 24, 2009 4:28 pm
Location: Laredo, Texas
Contact:

Re: WLS estimation with constraint

Postby guero303030 » Mon May 25, 2009 12:07 pm

Dear Startz,
To follow up on Cannibal's question if I could, I am trying to correct for heteroskedasicity using WLS on Eviews. I am a doctoral student at Texas A&M and bought the student version, but we also have all of the full versions in the labs as well. I appreciate such great software and the work that goes behind it. My question is probably really ignorant, but Where it asks to place the series you are going to use for your Weight under the LS/TLS WLS option box, How do you obtain that weight series. I am working on a paper and our instructor never showed us how to do this. Eviews is fairly new to me. My equation is Rsp500 = B0 +B1 pcip + B2 i3. Can I take the fitted values after I have regressed the log of resid^2 onto X1 through X3. I would call those fitted values g and then h=exp(fitted values) and set the series up like that. Could I use that series as my weight series that the WLS prompt/estimation option box is asking for when perfoming WLS? Would this be how I get my series of weights? Any advice would be so much appreciated. If I posted in the wrong category of the forum please forgive me. Thanks so much guero303030

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: WLS estimation with constraint

Postby startz » Mon May 25, 2009 12:24 pm

Dear Startz,
To follow up on Cannibal's question if I could, I am trying to correct for heteroskedasicity using WLS on Eviews. I am a doctoral student at Texas A&M and bought the student version, but we also have all of the full versions in the labs as well. I appreciate such great software and the work that goes behind it. My question is probably really ignorant, but Where it asks to place the series you are going to use for your Weight under the LS/TLS WLS option box, How do you obtain that weight series. I am working on a paper and our instructor never showed us how to do this. Eviews is fairly new to me. My equation is Rsp500 = B0 +B1 pcip + B2 i3. Can I take the fitted values after I have regressed the log of resid^2 onto X1 through X3. I would call those fitted values g and then h=exp(fitted values) and set the series up like that. Could I use that series as my weight series that the WLS prompt/estimation option box is asking for when perfoming WLS? Would this be how I get my series of weights? Any advice would be so much appreciated. If I posted in the wrong category of the forum please forgive me. Thanks so much guero303030
Basically, what you say is just fine. The trick is that EViews multiplies by the weight series. (This is just a convention.) You probably want to divide each observation by its standard deviation, so use 1/sqr(h) for the weight.

By the way, are you in Economics? I'll be visiting A&M in the Fall--if you're in econ stop by and say hello.

guero303030
Posts: 14
Joined: Sun May 24, 2009 4:28 pm
Location: Laredo, Texas
Contact:

Re: WLS estimation with constraint

Postby guero303030 » Mon May 25, 2009 12:36 pm

Thanks Startz for getting back to me so quickly. Since it was my first time, I also sent the same message to support@eviews, forgive me. Close, not econ but finance. I am actually on the Texas A&M International campus in Laredo, TX. College Station is great. If you are ever down this way, by all means please stop by. Just to clarify with your answer, once I set up that series of weights using the 1/SQRT(H), can I just enter it into the blank "Weight" box and then it will run the WLS automatically and hopefully I will come out with better estimates and +/- std errors? Thanks again, you sure have been a big help. guero303030

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: WLS estimation with constraint

Postby startz » Mon May 25, 2009 12:46 pm

Just to clarify with your answer, once I set up that series of weights using the 1/SQRT(H), can I just enter it into the blank "Weight" box and then it will run the WLS automatically and hopefully I will come out with better estimates and +/- std errors?
You've got it right!

guero303030
Posts: 14
Joined: Sun May 24, 2009 4:28 pm
Location: Laredo, Texas
Contact:

Re: WLS estimation with constraint

Postby guero303030 » Tue Jun 09, 2009 10:37 am

Dear Startz,
Thanks so much, That really helped me. I really appreciate it. Again, this is for a paper I am doing and also for my self knowledge. Eviews is a great tool. I am now desperately trying to get the serial correlation robust standards errors or use the feasible GLS with heteroskedasticity and AR(1) serial correlation, so I can get some estimates that will work in my model = rsp500 = c + rsp500(-1) + pcip - i3. I am trying to get the HAC so at least my estimates are asymptotically valid within my model. As I understand, this process does not get rid of serial correlation or heterosked.. but allows you to have estimates that are asymptotically valid under OLS and for my model unless I have misspecified the model completely which I don't think is the case? The way Wooldridge 4e explains the process is very difficult on page 436 to apply to eviews. I uploaded a picture of the page that has the process on page 436.

My question is there any way using possibly GMM to get these valid estimates? I pulled up GMM with the equation I mentioned above and place it in the equation box. I need to enter something for instrumental variables? but I don't know what? Do you know of any good candidates. Dividend yield, percentage change in sp500(pcsp), etc? I clicked the radio button for HAC times series button, kept Barlett, and used bandwidth Fixed Newey West and placed in the box = nw. By entering some possible instrumental variable will this allow me to arrive at some asymptotically efficient estimates? I am really lost on this one. I could completely follow the correction for heteroskedasticity by weighting using 1/square rt of h, but trying to do SC and Hetero is tough. Any suggestions would be greatly appreciated. you guys are great and very helpful.

Sean Byrne ph.d. student and lecturer Texas A&M International Laredo, Texas. P.S. I have the student version but we have the full version in our labs. P.S. I attached the work file that has the data that I am trying to work with. I am using it for my paper on stock market volatility and business cycle, following up on Hamilton's findings. I also attached page 436 of wooldridge, to show you the process I am looking at for a feasible GLS with heterosk and S.C. AR(1). Take care. Sean
Attachments
page 436 wooldridge 4e.doc
The is the process when I try to apply it to eviews it is very difficult
(92 KiB) Downloaded 729 times
volat.wf1
This is my data that I am using Thanks
(88.19 KiB) Downloaded 712 times

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: WLS estimation with constraint

Postby startz » Wed Jun 10, 2009 8:12 am

I think you can just do LS, adding in AR(1) to the estimation list to correct serial correlation and option (H) for robust standard errors. Since you have a lagged dependent variable it is important to correct the coefficients for serial correlation as well as correcting standard errors.

guero303030
Posts: 14
Joined: Sun May 24, 2009 4:28 pm
Location: Laredo, Texas
Contact:

Re: WLS estimation with constraint

Postby guero303030 » Wed Jun 10, 2009 11:21 am

thanks Startz. Appreciate it. Sean Byrne

guero303030
Posts: 14
Joined: Sun May 24, 2009 4:28 pm
Location: Laredo, Texas
Contact:

Re: WLS estimation with constraint

Postby guero303030 » Wed Jun 10, 2009 11:48 am

Startz,
Forgive for my ignorance, but this is where I get really confused. "AR(1)" you can add it in just like that and then make sure to press newey west. By adding AR(1) am I letting eviews know that it is an autoregressive process of order one? I thought you had to have an actually different series of number backing up the AR(1) where the series name would be AR(1). I did it and it worked out but I just trying to understand the 'behind the scenes' why or how I can just enter AR(1). what does that tell eviews? thanks so so much. I really appreciated your help. :D

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: WLS estimation with constraint

Postby startz » Wed Jun 10, 2009 1:18 pm

Startz,
Forgive for my ignorance, but this is where I get really confused. "AR(1)" you can add it in just like that and then make sure to press newey west. By adding AR(1) am I letting eviews know that it is an autoregressive process of order one? I thought you had to have an actually different series of number backing up the AR(1) where the series name would be AR(1). I did it and it worked out but I just trying to understand the 'behind the scenes' why or how I can just enter AR(1). what does that tell eviews? thanks so so much. I really appreciated your help. :D
You basically have it right. Adding AR(1) estimates an autogressive model. It's using the residuals of the equation to do this. You would probably choose White rather than Newey-West to adjust for heteroskedasticity, because the AR(1) already "took care of" the autocorrelation.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests