Different results with EViews5 and STATA
Moderators: EViews Gareth, EViews Moderator
Different results with EViews5 and STATA
I am working with panel data and have run the LevinLinChu test. I've got Eviews 5.0 and Stata10. I'm using, obviously, the same dataset, although in Stata, I'm using the dataset in long format whereas in Eviews I'm using the wide format with the panel identifiers. In principle, I should obtain the same results. I'm posting this because I am not obtaining not even remotely the same results. I guess I'm doing something wrong not that there's a bug in either Eviews or Stata so I would request your help.
Just to check, in Eviews I'm running a LLC test with constant only (ie Individual effects only) with 5 lags and the other options just as they come by default (ie levels, Bartlett, NeweyWest, etc). Results:
Method Statistic Prob.**
Levin, Lin & Chu t* 1.65623 0.9512
Or, in full:
Null Hypothesis: Unit root (common unit root process)
Date: 02/05/09 Time: 16:29
Sample: 1950 1992
Series: GDP_CAN, GDP_FRA, GDP_GER, GDP_ITA, GDP_JPN,
GDP_UK, GDP_US
Exogenous variables: Individual effects
User specified lags at: 5
NeweyWest bandwidth selection using Bartlett kernel
Total (balanced) observations: 259
Crosssections included: 7
Method Statistic Prob.**
Levin, Lin & Chu t* 1.65623 0.9512
** Probabilities are computed assuming asympotic normality
Intermediate results on GDP?
2nd Stage Variance HAC of Max Band
Series Coefficient of Reg Dep. Lag Lag width Obs
GDP_CAN 0.00090 138615 184603 5 5 1.0 37
GDP_FRA 0.01037 29938. 45926. 5 5 2.0 37
GDP_GER 0.00246 42449. 50967. 5 5 4.0 37
GDP_ITA 0.01305 23416. 32129. 5 5 1.0 37
GDP_JPN 0.00504 38483. 120962 5 5 4.0 37
GDP_UK 0.02642 37582. 51817. 5 5 4.0 37
GDP_US 0.00550 104951 44935. 5 5 11.0 37
Coefficient tStat SE Reg mu* sig* Obs
Pooled 0.00309 0.636 1.008 0.539 0.860 259
If I tick the option 'use balanced sample', the result varies to:
Levin, Lin & Chu t* 1.67675 0.9532
In Stata, I'm using the Levinlin package and, again, I've chosen the constant deterministics and 5 lags. Results:
LevinLinChu test for g7 Deterministics chosen: constant
Pooled ADF test, N,T = (7,43) Obs = 259
Augmented by 5 lags (average) Truncation: 10 lags
coefficient tvalue tstar P > t
0.03736 2.052 0.76078 0.7766
Again, I'm sure I'm doing something wrong, but I cannot realise what. Could you please help me? Even an explanation of any theoretical differences in how EVIEWS and STATA approach this issue, if any, would help.
Regards,
José
José Luis Iparraguirre
Senior Research Economist
Economic Research Institute of Northern Ireland
Floral Buildings
2 14 East Bridge Street
Belfast BT1 3NQ
Northern Ireland
United Kingdom
Just to check, in Eviews I'm running a LLC test with constant only (ie Individual effects only) with 5 lags and the other options just as they come by default (ie levels, Bartlett, NeweyWest, etc). Results:
Method Statistic Prob.**
Levin, Lin & Chu t* 1.65623 0.9512
Or, in full:
Null Hypothesis: Unit root (common unit root process)
Date: 02/05/09 Time: 16:29
Sample: 1950 1992
Series: GDP_CAN, GDP_FRA, GDP_GER, GDP_ITA, GDP_JPN,
GDP_UK, GDP_US
Exogenous variables: Individual effects
User specified lags at: 5
NeweyWest bandwidth selection using Bartlett kernel
Total (balanced) observations: 259
Crosssections included: 7
Method Statistic Prob.**
Levin, Lin & Chu t* 1.65623 0.9512
** Probabilities are computed assuming asympotic normality
Intermediate results on GDP?
2nd Stage Variance HAC of Max Band
Series Coefficient of Reg Dep. Lag Lag width Obs
GDP_CAN 0.00090 138615 184603 5 5 1.0 37
GDP_FRA 0.01037 29938. 45926. 5 5 2.0 37
GDP_GER 0.00246 42449. 50967. 5 5 4.0 37
GDP_ITA 0.01305 23416. 32129. 5 5 1.0 37
GDP_JPN 0.00504 38483. 120962 5 5 4.0 37
GDP_UK 0.02642 37582. 51817. 5 5 4.0 37
GDP_US 0.00550 104951 44935. 5 5 11.0 37
Coefficient tStat SE Reg mu* sig* Obs
Pooled 0.00309 0.636 1.008 0.539 0.860 259
If I tick the option 'use balanced sample', the result varies to:
Levin, Lin & Chu t* 1.67675 0.9532
In Stata, I'm using the Levinlin package and, again, I've chosen the constant deterministics and 5 lags. Results:
LevinLinChu test for g7 Deterministics chosen: constant
Pooled ADF test, N,T = (7,43) Obs = 259
Augmented by 5 lags (average) Truncation: 10 lags
coefficient tvalue tstar P > t
0.03736 2.052 0.76078 0.7766
Again, I'm sure I'm doing something wrong, but I cannot realise what. Could you please help me? Even an explanation of any theoretical differences in how EVIEWS and STATA approach this issue, if any, would help.
Regards,
José
José Luis Iparraguirre
Senior Research Economist
Economic Research Institute of Northern Ireland
Floral Buildings
2 14 East Bridge Street
Belfast BT1 3NQ
Northern Ireland
United Kingdom

 EViews Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Different results with EViews5 and STATA
Not being familiar with the Stata Levinlin package I can't say for certain, but given the relative simplicity of LevinLinChu, I would guess that it has to do with differences in degreeoffreedom corrections for the variances used in the ADFs. This isn't a theoretical difference, but rather a practical difference in computation of the longrun variances. With 37 observations per crosssection and 5 lags per crosssection, I would expect df differences to yield test statistic differences on the order of what you report.
Does the Stata module offer intermediate results for the secondstage ADF regression? That would help us track down the nature of the differences.
Does the Stata module offer intermediate results for the secondstage ADF regression? That would help us track down the nature of the differences.
Re: Different results with EViews5 and STATA
Thank you for the prompt reply. I contacted the author of Levinlin (Kit Baum, from Boston College) and he guided me as to how to obtain any further results.
It may not be enough, but this is what I got:
LevinLinChu test for g7 Deterministics chosen: constant
Source  SS df MS Number of obs = 259
+ F( 1, 258) = 4.20
Model  4.35181272 1 4.35181272 Prob > F = 0.0415
Residual  267.588441 258 1.0371645 Rsquared = 0.0160
+ Adj Rsquared = 0.0122
Total  271.940253 259 1.04996237 Root MSE = 1.0184

__000004  Coef. Std. Err. t P>t [95% Conf. Interval]
+
__000006  .0373616 .0182396 2.05 0.042 .0732789 .0014442

Still puzzled, but confident!
Regards,
José Luis
It may not be enough, but this is what I got:
LevinLinChu test for g7 Deterministics chosen: constant
Source  SS df MS Number of obs = 259
+ F( 1, 258) = 4.20
Model  4.35181272 1 4.35181272 Prob > F = 0.0415
Residual  267.588441 258 1.0371645 Rsquared = 0.0160
+ Adj Rsquared = 0.0122
Total  271.940253 259 1.04996237 Root MSE = 1.0184

__000004  Coef. Std. Err. t P>t [95% Conf. Interval]
+
__000006  .0373616 .0182396 2.05 0.042 .0732789 .0014442

Still puzzled, but confident!
Regards,
José Luis

 EViews Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Different results with EViews5 and STATA
Most probably a d.f. correction issue. Can you send your workfile to support@eviews.com.
We might not get a chance to look at it until next week as there are quite a few things going on right now, but we'll see if we can take a look.
We might not get a chance to look at it until next week as there are quite a few things going on right now, but we'll see if we can take a look.

 EViews Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Different results with EViews5 and STATA
I've spent a bit of time looking into the differences between the Stata/levinlin and EViews results and have some answers. The following discussion refers to both EViews 5.1 and EViews 6, in comparison with the 1.1.5 version of the levinlin ado.
There are four reasons for differences between the levinlin and EViews results, two of which (*) are minor:
1. EViews and levinlin estimate different base test specifications.
*2. levinlin uses estimates for the individual crosssection residual variances which use a slightly different denominator than that described in LevinLinChu (2002) and used in EViews.
3. EViews and levinlin employ a different bandwidths for the kernel estimator of the longrun variance of the differenced series.
*4. EViews uses interpolated values for the mu* and sigma* values used in constructing the final test statistic, while levinlin uses threshold values.
I'll discuss these below in depth.

Of these 4 differences, 2 and 4 are relatively minor so let's talk about 1 and 3 first.
1. The LevinLinChu estimator requires firststage estimates of an ADF equation for each crosssection. In keeping with the main result in the LevinLinChu (1992) paper, EViews estimates this ADF using the differences of the original series. levinlin adopts the variant of the estimator which first removes crosssection averages from the data (on p. 13 of the LevinLinChu paper). There isn't any discussion in the levinlin docs about the fact that they perform this adjustment and so far as I can tell, there is no way to instruct levinlin not to remove the crosssection averages. Therefore in order to match results, one must remove the periodmeans from the data prior to performing the test in EViews.
The first task is therefore to compute series containing deviations from crosssections means. The data that I received was set up as a pool ("wide" in Stata terminology). Suppose we name the pool series in question X?. To remove the timemeans from the pool series X? requires two simple steps. First, use the pool to create a group containing X?. You can do this interactively by selecting Proc/MakeGroup then enter "X?", and naming the resulting group XGROUP, or you can issue the command,
Next use the pool genr command to create the adjusted series
which removes the row (byperiod) means. We will perform the remaining analysis using the pool series XM?.
If in a panel workfile setting, it's even easier, just issue the command
since in this case, the data are observed on an annual basis. The remaining analysis should be performed with the series XM.
3. By default, both EViews and the levinlin program employ nonparametric (Bartlett) kernel methods to estimate the crosssection specific longrun variances. The default bandwidth for levinlin (generally) uses the value 3.21*(TALAGS1)^(1/3), where ALAGS is the average number of ADF lags, to match the Monte Carlo analysis provided by LevinLinChu. In this example, the bandwidth is 10. In EViews, the default setting uses the plugin automatic NeweyWest method which chooses a variety of bandwidths for the different crosssections. As a result of the differing bandwidths, the default estimates of the longrun variances are quite different. To get results that are close to the levinlin results, you must set the EViews bandwidth to 10.
To summarize the first two issues, using the timemean adjusted data and setting the EViews bandwidth values to match the levinlin gets us very close.
The command form for the test with these settings is:
The EViews results for the modified data, with the correct bandwidth settings are:
Levin, Lin & Chu t* 0.72290 0.7651
Coefficient tStat SE Reg mu* sig* Obs
Pooled 0.03736 2.052 1.030 0.539 0.860 259
while as before, the levinlin results are:
coefficient tvalue tstar P > t
0.03736 2.052 0.76078 0.7766
The remaining two items are relatively minor:
2. One component of the computed statistic is the residual variance from the ADF regressions. LevinLinChu use Tp1 in the denominator of this expression; T1 for the number of observations remaining after taking first differences, and subtracting off p for the number of observations lost to including p lags in the ADF regression. EViews follows this computation. levinlin differs eversoslightly by subtracting 1 off of this denominator. This difference should have no practical impact asymptotically, but does mean that a couple of later calculations in the user's example differ between the two by (sqrt(37/36)).
4. There are a couple of adjustment terms mu* and sigma* that are used in the final computation of the test statistics. A table of these terms, indexed by the type of specification and the average number of time observations, is provided by LevinLinChu (p. 14). When using these values, levinlin uses the average T adjusted for lags and chooses the next highest level (e.g., using the 37 obs in the adjusted T for this case will use the LevinLinChu entry for 40 obs). EViews also adjusts the average T for lags, but linearly interpolates the value. For example, in your case, the levinlin mu* value is .537, while the EViews value is .5394.
The remaining differences between the EViews and levinlin results are entirely due to (2) and (4). I have verified that modifying results for the differences described in (2) and (4) results in identical values.
If you'd like, I can send you the workfile that I created with the adjusted data.
There are four reasons for differences between the levinlin and EViews results, two of which (*) are minor:
1. EViews and levinlin estimate different base test specifications.
*2. levinlin uses estimates for the individual crosssection residual variances which use a slightly different denominator than that described in LevinLinChu (2002) and used in EViews.
3. EViews and levinlin employ a different bandwidths for the kernel estimator of the longrun variance of the differenced series.
*4. EViews uses interpolated values for the mu* and sigma* values used in constructing the final test statistic, while levinlin uses threshold values.
I'll discuss these below in depth.

Of these 4 differences, 2 and 4 are relatively minor so let's talk about 1 and 3 first.
1. The LevinLinChu estimator requires firststage estimates of an ADF equation for each crosssection. In keeping with the main result in the LevinLinChu (1992) paper, EViews estimates this ADF using the differences of the original series. levinlin adopts the variant of the estimator which first removes crosssection averages from the data (on p. 13 of the LevinLinChu paper). There isn't any discussion in the levinlin docs about the fact that they perform this adjustment and so far as I can tell, there is no way to instruct levinlin not to remove the crosssection averages. Therefore in order to match results, one must remove the periodmeans from the data prior to performing the test in EViews.
The first task is therefore to compute series containing deviations from crosssections means. The data that I received was set up as a pool ("wide" in Stata terminology). Suppose we name the pool series in question X?. To remove the timemeans from the pool series X? requires two simple steps. First, use the pool to create a group containing X?. You can do this interactively by selecting Proc/MakeGroup then enter "X?", and naming the resulting group XGROUP, or you can issue the command,
Code: Select all
pool01.makegroup(xgroup) x?
Next use the pool genr command to create the adjusted series
Code: Select all
pool01.genr xm? = x?@rmeans(xgroup)
which removes the row (byperiod) means. We will perform the remaining analysis using the pool series XM?.
If in a panel workfile setting, it's even easier, just issue the command
Code: Select all
series xm = x  @meansby(x, @year)
since in this case, the data are observed on an annual basis. The remaining analysis should be performed with the series XM.
3. By default, both EViews and the levinlin program employ nonparametric (Bartlett) kernel methods to estimate the crosssection specific longrun variances. The default bandwidth for levinlin (generally) uses the value 3.21*(TALAGS1)^(1/3), where ALAGS is the average number of ADF lags, to match the Monte Carlo analysis provided by LevinLinChu. In this example, the bandwidth is 10. In EViews, the default setting uses the plugin automatic NeweyWest method which chooses a variety of bandwidths for the different crosssections. As a result of the differing bandwidths, the default estimates of the longrun variances are quite different. To get results that are close to the levinlin results, you must set the EViews bandwidth to 10.
To summarize the first two issues, using the timemean adjusted data and setting the EViews bandwidth values to match the levinlin gets us very close.
The command form for the test with these settings is:
Code: Select all
pool01.uroot(llc, lag=5, band=10) xm?
The EViews results for the modified data, with the correct bandwidth settings are:
Levin, Lin & Chu t* 0.72290 0.7651
Coefficient tStat SE Reg mu* sig* Obs
Pooled 0.03736 2.052 1.030 0.539 0.860 259
while as before, the levinlin results are:
coefficient tvalue tstar P > t
0.03736 2.052 0.76078 0.7766
The remaining two items are relatively minor:
2. One component of the computed statistic is the residual variance from the ADF regressions. LevinLinChu use Tp1 in the denominator of this expression; T1 for the number of observations remaining after taking first differences, and subtracting off p for the number of observations lost to including p lags in the ADF regression. EViews follows this computation. levinlin differs eversoslightly by subtracting 1 off of this denominator. This difference should have no practical impact asymptotically, but does mean that a couple of later calculations in the user's example differ between the two by (sqrt(37/36)).
4. There are a couple of adjustment terms mu* and sigma* that are used in the final computation of the test statistics. A table of these terms, indexed by the type of specification and the average number of time observations, is provided by LevinLinChu (p. 14). When using these values, levinlin uses the average T adjusted for lags and chooses the next highest level (e.g., using the 37 obs in the adjusted T for this case will use the LevinLinChu entry for 40 obs). EViews also adjusts the average T for lags, but linearly interpolates the value. For example, in your case, the levinlin mu* value is .537, while the EViews value is .5394.
The remaining differences between the EViews and levinlin results are entirely due to (2) and (4). I have verified that modifying results for the differences described in (2) and (4) results in identical values.
If you'd like, I can send you the workfile that I created with the adjusted data.
Re: Different results with EViews5 and STATA
Thank for for such a thorough analysis. It's mindblogging to see how far two software packages can go not just in terms of default options but of internal procedures and calculations. Plese, send me the series you have created to obtain the results. Regards,
José
José

 EViews Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Different results with EViews5 and STATA
While your point about there being perhaps unsurprising differences in implementation is certainly true, I do want to note that In the program Stata LevinLin program in question is not an official Stata routine with all of the vetting that that entails, but rather one written by users for their particular needs.
And given that this literature in particular has a variety of specifications that one could run and various choices for things (like kernels, and bandwidths) so to some extent the enduser should naturally understand that when you say you are doing a "LevinLinChu panel unit root test", that it isn't a sufficient description of the problem. EViews is pretty clear in its documentation exactly how we are doing the computations for the test (and we give you various options for controlling most of the things that user's might want to control), but our way is certainly not the only way (as you have seen) to do the computations.
And given that this literature in particular has a variety of specifications that one could run and various choices for things (like kernels, and bandwidths) so to some extent the enduser should naturally understand that when you say you are doing a "LevinLinChu panel unit root test", that it isn't a sufficient description of the problem. EViews is pretty clear in its documentation exactly how we are doing the computations for the test (and we give you various options for controlling most of the things that user's might want to control), but our way is certainly not the only way (as you have seen) to do the computations.
Re: Different results with EViews5 and STATA
Hello,
I am trying to make the within estimator manually, by removing the crosssectional means from the original pool data series. Following on from your hints provided in this post, I'm trying the following commands, but they're not working. Do you have any suggestions please?
pool1.makegroup(cgroup) cost?
pool.genr wicost? = cost?@cmeans(cgroup)
Many thanks.
Best wishes,
Thea.
I am trying to make the within estimator manually, by removing the crosssectional means from the original pool data series. Following on from your hints provided in this post, I'm trying the following commands, but they're not working. Do you have any suggestions please?
pool1.makegroup(cgroup) cost?
pool.genr wicost? = cost?@cmeans(cgroup)
Many thanks.
Best wishes,
Thea.

 EViews Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Different results with EViews5 and STATA
In the pool context, the syntax is slightly different
Code: Select all
pool.genr wicost? = cost?@mean(cost?)
Re: Different results with EViews5 and STATA
Done it again  thanks very much Glenn!
Yours appreciatively,
Thea.
Yours appreciatively,
Thea.
Re: Different results with EViews5 and STATA
Hi, gents
I've estimated a 7 variable SVAR model, and got the contemporaneous relationship A matrix. Then using exactly the same dataset as in Eviews, tried to estimate the same model with Stata. The results were quite different, besides convergence was not achieved. First I thought that the problem was the structure of my A matrix, so I tried a standard Choleski factorization. the results were still different. who knows what's the matter? what is the problem different optimization algorithms, or perhaps starting values, or something else?
Thanks in advance
I've estimated a 7 variable SVAR model, and got the contemporaneous relationship A matrix. Then using exactly the same dataset as in Eviews, tried to estimate the same model with Stata. The results were quite different, besides convergence was not achieved. First I thought that the problem was the structure of my A matrix, so I tried a standard Choleski factorization. the results were still different. who knows what's the matter? what is the problem different optimization algorithms, or perhaps starting values, or something else?
Thanks in advance

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11260
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Different results with EViews5 and STATA
If convergence is not achieved, it is hardly surprising that the results are different.
Follow us on Twitter @IHSEViews
Return to “EViews 5 and Earlier”
Who is online
Users browsing this forum: No registered users and 2 guests