Hi,
You know how you can apply a weight series to an OLS time series regression (Estimate>Options>Weights>Select Type> select the series to weight your regression by)? Well, I would like to do something very similar to that only in a panel model (2 way FE). I don't see an obvious way to do this and was wondering if there's a workaround.
Here is the reason I'm interested in doing this.... I work with log-linear panel models where the cross sections are regions. The model has to be logged because I want a functional form that makes sense for what I'm doing. The only problem is that by applying natural logs to the LHS of the panel equation I'm effectively giving equal weight to all of my regions, which I don't want. In fact one of my regions is very large (London) and other regions are very small (West Country).
Any suggestions?
How to apply a weight series to a panel model?
Moderators: EViews Gareth, EViews Moderator
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: How to apply a weight series to a panel model?
The only way is to pre-transform your data. But you have to think a bit about what happens to the fixed effects estimates when you do so.
Note that if you estimate with cross-section weights EViews will automatically estimate the heteroskedastic variances for your cross-sections and perform EGLS using those weights. That's the easiest way for you to handle your issue.
Note that if you estimate with cross-section weights EViews will automatically estimate the heteroskedastic variances for your cross-sections and perform EGLS using those weights. That's the easiest way for you to handle your issue.
Re: How to apply a weight series to a panel model?
Turns out this is still a problem after all this time. The solution you suggested doesn't really work.
We now typically use the system object to evaluate our regional models, but they are still limited in that you can't specifiy a weight/ or size series to weight the coefficient estimates by.
I see that Eviews 8 has user defined optimisation "supported by the Equation, System, Sspace, and VAR objects". Does that mean, or example, that I could specify that the system must minimise the sum of squared residuals X some cross sectional weighting variable?
We now typically use the system object to evaluate our regional models, but they are still limited in that you can't specifiy a weight/ or size series to weight the coefficient estimates by.
I see that Eviews 8 has user defined optimisation "supported by the Equation, System, Sspace, and VAR objects". Does that mean, or example, that I could specify that the system must minimise the sum of squared residuals X some cross sectional weighting variable?
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: How to apply a weight series to a panel model?
Yes. Note that you're probably best off just going directly at the ssr and not using the built-in equations and looping over weights.
Re: How to apply a weight series to a panel model?
Great - just to clarify...
There is new functionality in version 8 that will allow me to apply a weighting series to the system object?
Or at least to set the system object to minimize a weighted SSR?
I'm not entirely sure what you mean by 'just going directly at the ssr'. Does this require the Logl object?
We are using a COM add in that automatically generates systems from Excel using the estimation command wls(deriv=fa). My understanding is that this weights by the inverse of the variance of my cross sectional elements / individual equations. That helps with my problem, but ideally I just want to weight the solution by the raw size of the cross section. What is your suggested approach?
Thanks
There is new functionality in version 8 that will allow me to apply a weighting series to the system object?
Or at least to set the system object to minimize a weighted SSR?
I'm not entirely sure what you mean by 'just going directly at the ssr'. Does this require the Logl object?
We are using a COM add in that automatically generates systems from Excel using the estimation command wls(deriv=fa). My understanding is that this weights by the inverse of the variance of my cross sectional elements / individual equations. That helps with my problem, but ideally I just want to weight the solution by the raw size of the cross section. What is your suggested approach?
Thanks
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: How to apply a weight series to a panel model?
Sorry. Let me be clearer. I was commenting (unnecessarily tersely) on the last post, rather than the entire thread.
There is new functionality in EViews 8 that lets you estimate parameters that optimize an arbitrary objective function. You simply provide a subroutine that computes an objective for your weighted data, and tell EVIews to find the best parameters. In principle, this subroutine could use an equation or system object or matrix or any other EViews object as part of the subroutine which computes the objective function. This functionality facilitates lots of estimation that was not practical using the earlier LOGL framework. But it doesn't modify what systems and equations can do, only allows you to use them as building blocks. My earlier comment was simply to note that if you wanted to go this route, it is probably easiest just to directly compute the SSR as a function of parameters, rather than using a system and trying to do weighting there.
But rereading the thread, there is a different set of issues going on. So let me try to walk through this problem in a better fashion than I've done previously (
)...
(Let me start with non-system estimation using the in-built panel routines. We'll come back to systems -- which may be a red herring -- in a second...)
My earliest comment was
For the cross-section dummies, this creates no problems since the weights are constant within a cross-section (I'm assuming that this is true -- if your weights vary with time within a cross-section, then what I'm going to say in a minute for period dummies also holds here). If all you had were cross-section fixed effects and cross-section weighted data, then the internal routines would work fine (though the fixed effects estimates would be scaled since you've scaled the original data).
However, since you are doing two-way fixed effects, the weighted time dummies no longer have nice computational properties and you can no longer use the built-in fixed effects routines. You could, however, add the "weighted" period dummies to the built-in cross-section fixed effects estimator "by-hand" using @expand and scaling using the weights. You have to be very careful about the dummy variable trap here, but it should work.
To see the idea, note that in the unweighted case, you can estimate the two-way fixed effects using
The second form does cross-section fixed effects and explicitly adds period dummies. The last form just adds dummies, dummies, everywhere.
In weighted form, you need to do the estimation explicitly
Note that this specification can have a lot of parameters.
For systems, you'll have to scale each variable in your system. If your system is really a pool in system clothing, then there are simpler ways of doing what I did with the panel estimation above. If you give me a better idea of your the nature of your system, then we can probably figure out the best approach.
There is new functionality in EViews 8 that lets you estimate parameters that optimize an arbitrary objective function. You simply provide a subroutine that computes an objective for your weighted data, and tell EVIews to find the best parameters. In principle, this subroutine could use an equation or system object or matrix or any other EViews object as part of the subroutine which computes the objective function. This functionality facilitates lots of estimation that was not practical using the earlier LOGL framework. But it doesn't modify what systems and equations can do, only allows you to use them as building blocks. My earlier comment was simply to note that if you wanted to go this route, it is probably easiest just to directly compute the SSR as a function of parameters, rather than using a system and trying to do weighting there.
But rereading the thread, there is a different set of issues going on. So let me try to walk through this problem in a better fashion than I've done previously (
(Let me start with non-system estimation using the in-built panel routines. We'll come back to systems -- which may be a red herring -- in a second...)
My earliest comment was
Let me expand on this. You want cross-section weighted data. The easiest way to do that is simply to create a series with cross-section weights and divide (or multiply-depending on how you've specified your weights) *all* of your dependent and independent variables by the weight series. The problem is that I've said "all". This includes all cross-section and time dummies, which for the built-in fixed effects routines, you have no access to.The only way is to pre-transform your data. But you have to think a bit about what happens to the fixed effects estimates when you do so.
For the cross-section dummies, this creates no problems since the weights are constant within a cross-section (I'm assuming that this is true -- if your weights vary with time within a cross-section, then what I'm going to say in a minute for period dummies also holds here). If all you had were cross-section fixed effects and cross-section weighted data, then the internal routines would work fine (though the fixed effects estimates would be scaled since you've scaled the original data).
However, since you are doing two-way fixed effects, the weighted time dummies no longer have nice computational properties and you can no longer use the built-in fixed effects routines. You could, however, add the "weighted" period dummies to the built-in cross-section fixed effects estimator "by-hand" using @expand and scaling using the weights. You have to be very careful about the dummy variable trap here, but it should work.
To see the idea, note that in the unweighted case, you can estimate the two-way fixed effects using
Code: Select all
equation eq0.ls(cx=f, per=f) y c x
equation eq1.ls(cx=f) y c x @expand(1, @date, @dropfirst)
equation eq2.ls y c x @expand(1, @crossid, @dropfirst) @expand(1, @date, @dropfirst)
In weighted form, you need to do the estimation explicitly
Code: Select all
equation eq2a.ls y/w 1/w x/w @expand(1, @crossid, @dropfirst)/w @expand(1, @date, @dropfirst)/w
For systems, you'll have to scale each variable in your system. If your system is really a pool in system clothing, then there are simpler ways of doing what I did with the panel estimation above. If you give me a better idea of your the nature of your system, then we can probably figure out the best approach.
Who is online
Users browsing this forum: No registered users and 2 guests
