## Unit specific time averages

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

AngieL
Posts: 17
Joined: Tue Aug 09, 2016 8:17 am

### Unit specific time averages

Hi,

Does someone know how to do unit-specific time averages for panel data on Eviews?

Thanks,
Angie

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11991
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Unit specific time averages

You probably want the @meansby function with the date series as the by parameter.

AngieL
Posts: 17
Joined: Tue Aug 09, 2016 8:17 am

### Re: Unit specific time averages

And how do I do that? Could you please explain that with steps cause I am new to panel data?

AngieL
Posts: 17
Joined: Tue Aug 09, 2016 8:17 am

### Re: Unit specific time averages

Can I also ask something else is there a way that I can make the random effect used instead of the fixed effects (so it passes the Hausman test), because random effects is the method to be used for my data?
Last edited by AngieL on Fri Aug 19, 2016 10:12 am, edited 1 time in total.

AngieL
Posts: 17
Joined: Tue Aug 09, 2016 8:17 am

### Re: Unit specific time averages

This is what I am trying to do on eviews but I can not seem to find the way to do it :

There are two ways of rescuing a random effects approach under correlation between the country specific error and the regressors. One is to do the Hausman-Taylor IV estimation but for that we would have to come up with possible instruments that are not correlated with ai, which does not seem an easy task. In this paper we will opt for a different approach that consists on modelling the error term ai. This approach, described in Wooldridge (2002), is usually applied when estimating non-linear models, as IV estimation proves to be a Herculean task but, as we shall see, the application to our case
is quite successful. The idea is to give an explicit expression for the correlation between the error and the regressors, stating that the expected value of the country specific error is a linear combination of time-averages of the regressors X i . This follows Hajivassiliou and Ioannides (2006) and Hajivassiliou (2006).
( i | it , i ) i E a X Z = η X . (2)
If we modify our initial equation (1), with i t i a =η X +ε we get
Xi it it i i it R = β X +λ Z +η +ε +μ , (3)
where εi is an error term by definition uncorrelated with the regressors. In practical terms, we eliminate the problem by including a time-average of the explanatory variables as additional time-invariant regressors.

EViews Glenn
EViews Developer
Posts: 2600
Joined: Wed Oct 15, 2008 9:17 am

### Re: Unit specific time averages

Code: Select all

`series ymean = @meansby(y, @crossid)`

computes, for each cross-section, the mean of Y taken across all of the time-periods and assigns that value to each observation in the cross-section.