Breusch-Pagan LM Test for Random Effects
Moderators: EViews Gareth, EViews Moderator
Breusch-Pagan LM Test for Random Effects
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
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
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Breusch-Pagan LM Test for Random Effects
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)
I have no idea how it changes with unbalanced data.
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
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
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
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Breusch-Pagan LM Test for Random Effects
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.
-
estrella bernabeu
- Posts: 16
- Joined: Thu Mar 25, 2010 8:00 am
Re: Breusch-Pagan LM Test for Random Effects
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 :)
The solution Please :)
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Breusch-Pagan LM Test for Random Effects
Are you sure you copied all of the code, exactly as it is in that program?
-
estrella bernabeu
- Posts: 16
- Joined: Thu Mar 25, 2010 8:00 am
Re: Breusch-Pagan LM Test for Random Effects
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
i'm using Eviews 5.0 and 6.0 and it's the same problem
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Breusch-Pagan LM Test for Random Effects
Save the program, then attach the program to a post here, so we can look at it.
-
estrella bernabeu
- Posts: 16
- Joined: Thu Mar 25, 2010 8:00 am
Re: Breusch-Pagan LM Test for Random Effects
this is my workfile, i hope that the problem can be resolved
- Attachments
-
- trade.wf1
- (29.21 KiB) Downloaded 1217 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Breusch-Pagan LM Test for Random Effects
Save your program, then attach that to your post.
-
estrella bernabeu
- Posts: 16
- Joined: Thu Mar 25, 2010 8:00 am
Re: Breusch-Pagan LM Test for Random Effects
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
Log(xpor) c log(pibhi*popi) log(pibh_tn*poptn) log(volt) log(tc) log(dst) comlangij
- Attachments
-
- trade.wf1
- (29.21 KiB) Downloaded 1027 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Breusch-Pagan LM Test for Random Effects
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.
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.
-
estrella bernabeu
- Posts: 16
- Joined: Thu Mar 25, 2010 8:00 am
Re: Breusch-Pagan LM Test for Random Effects
Sorry i don't understand what are you meaning by Program, can you please explain more :)
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Breusch-Pagan LM Test for Random Effects
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
-
estrella bernabeu
- Posts: 16
- Joined: Thu Mar 25, 2010 8:00 am
Re: Breusch-Pagan LM Test for Random Effects
Ok i get it now :D
My problem now is that the msg Error is Xpor is not defined .
My problem now is that the msg Error is Xpor is not defined .
- Attachments
-
- bp.prg
- (943 Bytes) Downloaded 1462 times
Who is online
Users browsing this forum: No registered users and 2 guests
