Breusch-Pagan LM Test for Random Effects

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

jma
Posts: 9
Joined: Mon Jan 12, 2009 9:46 am

Breusch-Pagan LM Test for Random Effects

Postby jma » Mon Jan 12, 2009 10:15 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Breusch-Pagan LM Test for Random Effects

Postby EViews Gareth » Mon Jan 12, 2009 10:31 am

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.

jma
Posts: 9
Joined: Mon Jan 12, 2009 9:46 am

Re: Breusch-Pagan LM Test for Random Effects

Postby jma » Tue Jan 13, 2009 2:53 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Breusch-Pagan LM Test for Random Effects

Postby EViews Gareth » Tue Jan 13, 2009 9:07 am

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

Postby estrella bernabeu » Thu Apr 15, 2010 3:12 pm

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 :)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Breusch-Pagan LM Test for Random Effects

Postby EViews Gareth » Thu Apr 15, 2010 3:20 pm

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

Postby estrella bernabeu » Thu Apr 15, 2010 4:22 pm

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Breusch-Pagan LM Test for Random Effects

Postby EViews Gareth » Thu Apr 15, 2010 4:51 pm

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

Postby estrella bernabeu » Fri Apr 16, 2010 5:03 am

this is my workfile, i hope that the problem can be resolved
Attachments
trade.wf1
(29.21 KiB) Downloaded 1216 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Breusch-Pagan LM Test for Random Effects

Postby EViews Gareth » Fri Apr 16, 2010 6:49 am

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

Postby estrella bernabeu » Fri Apr 16, 2010 7:13 am

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
Attachments
trade.wf1
(29.21 KiB) Downloaded 1026 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Breusch-Pagan LM Test for Random Effects

Postby EViews Gareth » Fri Apr 16, 2010 7:59 am

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.

estrella bernabeu
Posts: 16
Joined: Thu Mar 25, 2010 8:00 am

Re: Breusch-Pagan LM Test for Random Effects

Postby estrella bernabeu » Sat Apr 17, 2010 3:22 pm

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: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Breusch-Pagan LM Test for Random Effects

Postby EViews Gareth » Sat Apr 17, 2010 3:27 pm

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

Postby estrella bernabeu » Sat Apr 17, 2010 4:00 pm

Ok i get it now :D
My problem now is that the msg Error is Xpor is not defined .
Attachments
bp.prg
(943 Bytes) Downloaded 1461 times


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests