Page 1 of 1

### Unit specific time averages

Posted: Fri Aug 19, 2016 7:53 am
Hi,

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

Thanks,
Angie

### Re: Unit specific time averages

Posted: Fri Aug 19, 2016 8:01 am
You probably want the @meansby function with the date series as the by parameter.

### Re: Unit specific time averages

Posted: Fri Aug 19, 2016 8:14 am
And how do I do that? Could you please explain that with steps cause I am new to panel data?

### Re: Unit specific time averages

Posted: Fri Aug 19, 2016 8:26 am
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?

### Re: Unit specific time averages

Posted: Fri Aug 19, 2016 8:42 am
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.

### Re: Unit specific time averages

Posted: Fri Aug 19, 2016 11:31 am

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.