Breush-Pagan LM test for Random Effects

For posting your own programs to share with others

Moderators: EViews Gareth, EViews Moderator

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

Breush-Pagan LM test for Random Effects

Postby EViews Gareth » Mon Jan 12, 2009 12:45 pm

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
Follow us on Twitter @IHSEViews

Return to “Program Repository”

Who is online

Users browsing this forum: No registered users and 11 guests