I am trying to check for autocorrelation in a variable "max" over a 60 month window. I am using rangestat(corr), however I would like a code that can also permit me to compute LM statistic as well as bgodfrey autocorrelation measure. My data is panel data but the max computation were based on firm time series. Here is how my data looks:
PERMNO year RET me me_lag max gvkey yyyymm month
10001 1986 .020408163 6156.25 6033.125 .0120816203 012994 198602 1986m2
10001 1986 .025200004 6217.8125 6156.25 .0090400008 012994 198603 1986m3
10001 1986 .00990099 6279.375 6217.8125 .001980198 012994 198604 1986m4
10001 1986 -.009803922 6217.8125 6279.375 0 012994 198605 1986m5
10001 1986 -.013069307 6033.125 6217.8125 .0033939391 012994 198606 1986m6
10001 1986 -.010204081 5971.5625 6033.125 .01072981 012994 198607 1986m7
10001 1986 .072164945 6402.5 5971.5625 .0121645024 012994 198608 1986m8
10001 1986 -.003076924 6317.625 6402.5 .0417151004 012994 198609 1986m9
PERMNO year RET me me_lag max gvkey yyyymm month
10001 1986 .020408163 6156.25 6033.125 .0120816203 012994 198602 1986m2
10001 1986 .025200004 6217.8125 6156.25 .0090400008 012994 198603 1986m3
10001 1986 .00990099 6279.375 6217.8125 .001980198 012994 198604 1986m4
10001 1986 -.009803922 6217.8125 6279.375 0 012994 198605 1986m5
10001 1986 -.013069307 6033.125 6217.8125 .0033939391 012994 198606 1986m6
10001 1986 -.010204081 5971.5625 6033.125 .01072981 012994 198607 1986m7
10001 1986 .072164945 6402.5 5971.5625 .0121645024 012994 198608 1986m8
10001 1986 -.003076924 6317.625 6402.5 .0417151004 012994 198609 1986m9