Page 1 of 2
Breusch-Pagan LM Test for Random Effects
Posted: Mon Jan 12, 2009 10:15 am
by jma
Hello folks,
one basic test for the relevance of Random Effects to be incorporated in a panel model is the Lagrangian multiplier test proposed Breusch/Pagan (1980).
The null hypothesis is that Var(ai) = 0, i.e. random effects are not needed. I am using eviews 6 but unfortunately I do not find a way to automatically compute this test statistic.
Does anyone know the shortcut or if this test is not included: is there a way of easily computing this manually based on the OLS results? And: Does the test statistic/computation change if I have an unbalanced panel?
Thanks for your help in advance!
Best
Jörn
Re: Breusch-Pagan LM Test for Random Effects
Posted: Mon Jan 12, 2009 10:31 am
by EViews Gareth
Digging around my computer, I found this program that computes the BP-LM test, and replicates one of the examples from Greene (2003, page 299):
Copy and paste this code into a new EViews program (File->New->Program)
Code: Select all
'uses workfile containing Greene data (page 299 of Greene 2003)
wfopen "http://www.stern.nyu.edu/~wgreene/Text/tables/TableF7-1.txt"
rename c01 cost
pagestruct i t
'estimate equation and store N and T
equation e1.ls() log(cost) c log(q) log(pf) lf
!n=e1.@ncross
!t=e1.@npers
'make residual series from equation
e1.makeresids e1resids
'make squared residuals
series e1residssq=e1resids*e1resids
!sum_resid_sq = @sum(e1residssq)
'Find sum of cross section sums squared
!sum_sq_sums=0
for !i=1 to !n
smpl if @crossid=!i
!sum=@sum(e1resids)
!sum_sq_sums=!sum_sq_sums+!sum^2
smpl @all
next
delete e1resids
delete e1residssq
'Results
Table BP
bp.setwidth(1) 25
BP(2,1)="Breusch-Pagan LM Test:"
BP(1,2)="Value"
BP(1,3)="Prob."
!LM=!n*!t/(2*(!t-1)) * (!sum_sq_sums/!sum_resid_sq - 1)^2
BP(2,2)=!lm
!prob=1-@cchisq(!lm,1)
bp(2,3)=!prob
Show bp
I have no idea how it changes with unbalanced data.
Re: Breusch-Pagan LM Test for Random Effects
Posted: Tue Jan 13, 2009 2:53 am
by jma
Gareth,
thanks very much for your quick reply. The program works well and can be easily adapted to other equations.
Meanwhile I read in Greene that the front term of the Breusch-Pagan test changes for an unbalanced panel. Do you also have an analog program for this case by any chance :)?
Thanks
Jörn
Re: Breusch-Pagan LM Test for Random Effects
Posted: Tue Jan 13, 2009 9:07 am
by EViews Gareth
Unfortunately not, but I'm sure it shouldn't be too hard for you to change my program to do it - it is a simple program.
Re: Breusch-Pagan LM Test for Random Effects
Posted: Thu Apr 15, 2010 3:12 pm
by estrella bernabeu
I want to use the BP test, but when i enter this code there is an error msg telling me that "BP is not defined" :(
The solution Please :)
Re: Breusch-Pagan LM Test for Random Effects
Posted: Thu Apr 15, 2010 3:20 pm
by EViews Gareth
Are you sure you copied all of the code, exactly as it is in that program?
Re: Breusch-Pagan LM Test for Random Effects
Posted: Thu Apr 15, 2010 4:22 pm
by estrella bernabeu
Yes i did and the same error msh appeared :? i don't understand why !!!
i'm using Eviews 5.0 and 6.0 and it's the same problem
Re: Breusch-Pagan LM Test for Random Effects
Posted: Thu Apr 15, 2010 4:51 pm
by EViews Gareth
Save the program, then attach the program to a post here, so we can look at it.
Re: Breusch-Pagan LM Test for Random Effects
Posted: Fri Apr 16, 2010 5:03 am
by estrella bernabeu
this is my workfile, i hope that the problem can be resolved
Re: Breusch-Pagan LM Test for Random Effects
Posted: Fri Apr 16, 2010 6:49 am
by EViews Gareth
Save your program, then attach that to your post.
Re: Breusch-Pagan LM Test for Random Effects
Posted: Fri Apr 16, 2010 7:13 am
by estrella bernabeu
here is the program with the following equation :
Log(xpor) c log(pibhi*popi) log(pibh_tn*poptn) log(volt) log(tc) log(dst) comlangij
Re: Breusch-Pagan LM Test for Random Effects
Posted: Fri Apr 16, 2010 7:59 am
by EViews Gareth
I don't think you're understanding.
The code I posted is an EViews program. You need to copy the text and paste it into an EViews program, which you can then run.
I want you to save that EViews program (click on File->Save) and then attach that EViews program to a post here, so I can look at the program.
All you have done so far is post your EViews workfile.
Re: Breusch-Pagan LM Test for Random Effects
Posted: Sat Apr 17, 2010 3:22 pm
by estrella bernabeu
Sorry i don't understand what are you meaning by Program, can you please explain more :)
Re: Breusch-Pagan LM Test for Random Effects
Posted: Sat Apr 17, 2010 3:27 pm
by EViews Gareth
I'n not sure how it can be explained any better than has already been done so in this thread. Perhaps you should spend some time reading the EViews manual chapter on Programs
Re: Breusch-Pagan LM Test for Random Effects
Posted: Sat Apr 17, 2010 4:00 pm
by estrella bernabeu
Ok i get it now :D
My problem now is that the msg Error is Xpor is not defined .