reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

BPagan.m (712B)


      1 % BPagan.m  function [LM,pval]=BPagan(u);
      2 %
      3 %     Breusch-Pagan Test in Panel data of the null hypothesis that the
      4 %     variance of the Fixed Effects is zero (one restriction).  (Contrast
      5 %     this with the usual F test of H0:  mui=mu).
      6 %     Follows Greene (1990), page 491ff.
      7 %
      8 %          u:     TxN matrix of data
      9 
     10 function [LM,pval]=BPagan(u);
     11 
     12 num=sum((sum(u).^2)');
     13 [T N]=size(u);
     14 u2=reshape(u,N*T,1);
     15 den=u2'*u2;
     16 ratio=num/den;
     17 
     18 if ratio>=1;
     19    LM=N*T/2/(T-1)*(ratio-1)^2;
     20    pval=1-chicdf(LM,1);
     21    fprintf('B/Pagan Test of H0:Var(mui)=0: LM= %6.2f  P-Value=%4.2f\n',...
     22          [LM pval]);
     23 else;
     24    disp 'B/Pagan Test:  Variance ratio is less than 1.  Returning Pval=1.';
     25    pval=1;
     26    LM=-999;
     27 end;