one-way unbalanced random effect model

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

Posts: 19
Joined: Thu Dec 03, 2015 3:20 am

one-way unbalanced random effect model

Postby Gude » Mon Jun 12, 2017 7:37 am

I noticed that for the one-way unbalanced random effect model with the Swamy-Arora method, the results given by EViews 9.5 diverge from the values printed in text book of Baltagi (2013), table 9.1 (Hedonic housing data), e.g. the coefficient for variable 'crim' is -0.72 in the text book but -0.74 in EViews.
The data is commonly used in text book literature and examples, even in the EViews documentation for panel data here: ... mples.html
But in this example, only the Wallace-Hussien method is used (which corresponds to the text book numbers), not Swamy-Arora.

EViews replicates the numbers in table 2 of Baltagi/Chang (1994), column SA. Table 9.1 in the current text book of Baltagi (3rd+ editions) claims to be a copy of that table from the paper, but, in fact, it isn't an exakt copy because the numbers in column SA have been changed silently.

So, what is reason for the difference for the Swamy-Arora method?
Is it a bug in EViews? Wrong numbers in the text book? Please note: Stata seems to replicate Baltagi's figures as there is also example output of Stata in the text book

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

Re: one-way unbalanced random effect model

Postby EViews Glenn » Mon Jun 12, 2017 9:51 am

I don't know why the third edition of Baltagi has different numbers. EViews matches the numbers in Baltagi 2 and (without going back and looking myself) from what you say, the numbers from the original paper.

From all of that and the fact that Stata matches the book, my best guess is that Stata was used to obtain the SA results in Table 9.1, but I want to emphasize that this is only a guess. Alternately, there may have been a revision in the suggested procedure since we implemented the procedure, and if so, we'd certainly look into it, but as of now, we are computing the SA and matching results as in Baltagi 2.

Posts: 19
Joined: Thu Dec 03, 2015 3:20 am

Re: one-way unbalanced random effect model

Postby Gude » Sat Jun 17, 2017 1:29 am

Well, the desription of the method has not been changed. But the numbers.

The sentence below formula (9.20) is only true if one takes the u^b residuals to stem from the "full length" between regression ("Note that u^b' * P * u^b can be obtained as the OLS residual sum of squares from the regression involving sqrt(T_i) * yb_i on sqrt(T_i) * Zb_i"). Maybe this is the reason?

Here is some R code to demonstrate It calculates the quantity u^b' * P * u^b in the differnent ways:

What do you think?

Code: Select all

pG <- Grunfeld[1:199, ] # make it unbalanced

# estimate between model, just to get the between transformation of the data and the residuals
mod1 <- plm(inv ~ value + capital, model = "between", data = pG)

Xb <- model.matrix(mod1)
yb <- pmodel.response(mod1)

XB <- model.matrix(mod1, model = "Between")    # "full length" data
yB <- pmodel.response(mod1, model = "Between") # "full length" data

pdim <- pdim(pG) # get dimensions

XbTi <- sqrt(pdim$Tint$Ti) * Xb
ybTi <- sqrt(pdim$Tint$Ti) * yb

print(sum(, ybTi)$residuals^2),  digits = 15) # 1012046.85102916
print(sum(mod1$residuals^2 * pdim$Tint$Ti), digits = 15) # 1012046.89823139
print(sum(, yB)$residuals^2),  digits = 15)     # 1012046.85102916

## unbalanced
JTi <- lapply(pdim$Tint$Ti, function(x) matrix(rep(1, x^2), x))
JTib <- mapply(function(x, y) x / y, JTi, pdim$Tint$Ti)
P <- Matrix::bdiag(JTib) # 199 x 199

resid_full_length <- mod1$residuals[as.character(index(mod1)[[1]])] # length: 199 in unbalanced case
print(as.vector(resid_full_length %*% P %*% resid_full_length), digits = 15) # 1012046.89823139 - matches Ti-weighted squared residuals
print(as.vector(, yB)$residuals %*% P %*%, yB)$residuals), digits = 15) # 1012046.85102916 - matches sum of squared residuals of OLS with Ti-weigted data

Last edited by Gude on Thu Jun 29, 2017 4:45 am, edited 1 time in total.

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

Re: one-way unbalanced random effect model

Postby EViews Glenn » Thu Jun 22, 2017 9:42 am

At this point, I think your issue is with the results in Baltagi and not with EViews. I'm not sure I can answer for the author.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests