Skip to content

Commit 37994a9

Browse files
committed
Fixed crash with FE and df>1
1 parent c8dc028 commit 37994a9

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

boottest.mata

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ class boottestModel {
5757
sqrt, cons, LIML, Fuller, K, IV, WRE, WREnonAR, ptype, twotailed, gridstart, gridstop, gridpoints, df, df_r, AR, d, cuepoint, willplot, NumH0s, p, NBootClust, BootCluster, NFE
5858
pointer (real matrix) scalar pZExcl, pR, pR0, pID, pFEID, pXEnd, pXEx, pG, pinfoExplode
5959
pointer (real colvector) scalar pr, pr0, pY, pSc, pwt, pW, pV
60-
real matrix numer, u, U, S, SAR, SAll, LAll_invRAllLAll, plot, CI
60+
real matrix numer, u, U, S, SAR, SAll, LAll_invRAllLAll, plot, CI, SWE
6161
string scalar wttype, madjtype
6262
real colvector Dist, DistCDR, s, sAR, plotX, plotY, sAll, beta, wtFE
6363
real rowvector peak
6464
struct boottest_clust colvector clust
6565
class AnalyticalModel scalar M_DGP
6666
pointer (class AnalyticalModel scalar) scalar pM_Repl, pM
6767
struct smatrix matrix denom, SZVR0
68-
struct smatrix colvector eUZVR0, XExZVR0, ZExclZVR0, XEndstar, XExXEndstar, ZExclXEndstar, XZi, eZi, SWE
68+
struct smatrix colvector eUZVR0, XExZVR0, ZExclZVR0, XEndstar, XExXEndstar, ZExclXEndstar, XZi, eZi
6969
pointer (struct structFE scalar) scalar FEs
7070
7171
void new(), set_dirty(), set_sqrt(), boottest(), make_DistCDR(), plot()
@@ -490,13 +490,16 @@ void _boottest_st_view(real matrix V, real scalar i, string rowvector j, string
490490
491491
492492
493+
494+
495+
493496
494497
495498
496499
497500
// main routine
498501
void boottestModel::boottest() {
499-
real colvector rAll, numer_l, _e, IDExplode, Ystar, _beta, betaEnd, wt, sortID, o, _FEID, WE
502+
real colvector rAll, numer_l, _e, IDExplode, Ystar, _beta, betaEnd, wt, sortID, o, _FEID
500503
real rowvector val, YstarYstar
501504
real matrix betadev, RAll, L, LAll, vec, combs, t, ZExclYstar, XExYstar, Subscripts, Zi, AVR0, eZVR0, eu, VR0, infoAll, IDCollapse, XExi
502505
real scalar i, j, l, c, r, minN
@@ -709,7 +712,6 @@ void boottestModel::boottest() {
709712
SZVR0[c,r].M = panelsum(_SZVR0[r].M, clust[c].info)
710713
}
711714
}
712-
SWE = smatrix(df)
713715
}
714716
}
715717
@@ -857,11 +859,8 @@ void boottestModel::boottest() {
857859
for (r=df;r;r--)
858860
eUZVR0[r].M = *pu :* (*peZVR0)[,r]
859861
860-
if (NFE & !FEboot) {
861-
WE = wtFE :* pM->e
862-
for (r=df;r;r--)
863-
SWE[r].M = _panelsum(crosstab(WE[,r]), clust[BootCluster].info)
864-
}
862+
if (NFE & !FEboot)
863+
SWE = _panelsum(crosstab(wtFE :* pM->e), clust[BootCluster].info)
865864
866865
for (c=1; c<=length(clust); c++) {
867866
if (rows(clust[c].order))
@@ -885,7 +884,7 @@ void boottestModel::boottest() {
885884
}
886885
887886
if (NFE & !FEboot)
888-
pG[r] = &( *pG[r] - cross(SWE[r].M * SZVR0[c,r].M', u) )
887+
pG[r] = &( *pG[r] - cross(SWE * SZVR0[c,r].M', u) )
889888
890889
for (j=r;j<=df;j++) {
891890
t = colsum(*pG[r] :* *pG[j]); if (clust[c].multiplier!=1) t = t * clust[c].multiplier; denom[j,r].M = c==1? t : denom[j,r].M + t

0 commit comments

Comments
 (0)