Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bootstrap two stages

    Hi all,

    I am trying to perform the following: extract n bootstrap samples from a strongly balanced panel dataset with the following structure:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(idatc3 Year tot_count y)
     1 2004  0 16.353962
     1 2005  1 16.340631
     1 2006  0 16.286907
     1 2007  0 16.273083
     1 2008  0 16.255836
     1 2009  0 15.925304
     1 2010  0 15.859792
     2 2004  0 18.146786
     2 2005  1 18.185635
     2 2006  0 18.199041
     2 2007  0 18.194345
     2 2008  0 18.213171
     2 2009  0 18.345274
     2 2010  0 18.226433
     3 2004  3 13.705626
     3 2005  7  15.13613
     3 2006  1 16.208109
     3 2007  3 16.591629
     3 2008  0 16.917368
     3 2009  2 17.030642
     3 2010  5 17.209492
     4 2004 25  16.50014
     4 2005  8 16.745003
     4 2006  6  16.75969
     4 2007 14 17.048187
     4 2008  2 17.244335
     4 2009  0 17.343176
     4 2010  2 17.933966
     5 2004  0 17.868816
     5 2005  0 17.693306
     5 2006  2 17.696056
     5 2007  4 17.748852
     5 2008  0  17.76949
     5 2009  0 17.838858
     5 2010  0  17.91857
     6 2004  0  19.07523
     6 2005  0 18.995157
     6 2006  0 18.959908
     6 2007  1 18.898798
     6 2008  0  18.66919
     6 2009  0 18.642822
     6 2010  0 18.255278
     7 2004  1 22.090456
     7 2005  0 22.101965
     7 2006  2 22.116083
     7 2007  0  22.14667
     7 2008  2   22.0739
     7 2009  0  22.06895
     7 2010  0  21.95814
     8 2004  2 17.097506
     8 2005  2  16.42637
     8 2006  0  16.32611
     8 2007  0 16.537579
     8 2008  0 16.272715
     8 2009  0 16.364277
     8 2010  0  15.86466
     9 2004  2 18.293467
     9 2005  0  18.54712
     9 2006  0 18.760092
     9 2007  0 17.585657
     9 2008  1  15.65171
     9 2009  0 15.918745
     9 2010  0 18.139769
    10 2004  0  20.34576
    10 2005  2  20.38664
    10 2006  1  20.52285
    10 2007  0  20.07849
    10 2008  0 19.609467
    10 2009  1  19.61134
    10 2010  0  19.63593
    11 2004  0 15.633678
    11 2005  0 16.186264
    11 2006  2  16.36874
    11 2007  0 16.868628
    11 2008  0 16.864525
    11 2009  0  16.66895
    11 2010  0 16.688057
    12 2004  2 18.850607
    12 2005  0 18.661394
    12 2006  0 18.685404
    12 2007  0 18.935335
    12 2008  0 19.289694
    12 2009  0 19.490005
    12 2010  0 18.965286
    13 2004  1 15.167782
    13 2005  0 15.652504
    13 2006  0 16.465668
    13 2007  0 16.760597
    13 2008  0 16.878334
    13 2009  0  17.17612
    13 2010  0  18.00114
    14 2004  2 19.100143
    14 2005  0 18.629805
    14 2006  0  18.49677
    14 2007  0  18.35715
    14 2008  0 18.183216
    14 2009  0 18.108658
    14 2010  0  18.07056
    15 2004  0 17.956966
    15 2005  0 18.202034
    end
    Then for each of the n panel bootstrap generated datasets I would like to perform the 2 following steps:
    Code:
    xtset idatc3 Year
    xtreg y x, fe vce(cluster idatc3)
    predict residuals, e
    xtpoisson tot_count residuals x, fe vce(robust)
    where x are various coefficients which I did not report for sake of space in dataex command.
    Then, I would like to save the coefficients for each of the n samples and compute the standard errors of the n coefficients.

    Is it possible to perform it within STATA?

    Thank you,

    Federico

  • #2
    I solved the issue.
    Thanks anyway
    Last edited by Federico Nutarelli; 06 Mar 2020, 03:36.

    Comment


    • #3
      Federico:
      I actually missed your post, that was clearly written.
      In my opinion, you did not receive replies because your query was a bit computationally demanding (that's not your fault, obviously).
      In addition, it seems to me that the attention to resampling methods had decreased during the last 10 years and, perhaps, a smaller proportion of listers is familiar with -bootstrap-, -simulate- and permutation tests in general.
      That said, it would be interesting to see how you managed the issue. Thanks.

      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Carlo Lazzaro
        Many thanks for your kind replay.
        So actually I thought I did but I still have problems. In particular what I tried to do is defining a program which constructs bootstrap samples (bsample) generating new ids. This is managed with the option idcluster() of bsample. The coin is that the resampling is with replacements and therefore one need to build up news for each new repetition so that if an id is drawn more than once in a repetition, it will be considered as two (or more) separate individuals. Then I performed the two steps I was interested in clustering at the new level and extract the standard error and coefficient from the xtpoisson. Finally I performed several repetitions of the program through a Monte-Carlo experiment with the simulate command. The code is displayed below:

        Code:
        *****PROVA DI BOOTSTRAP
        bysort idatc3 (Year): gen byte panelsize = _N
        
        cap program drop onebootrep
        program define onebootrep, rclass
            preserve
                rename tot_count trials
                bsample, cluster(idatc3) idcluster(newid) 
                xtset newid Year 
                quietly xtreg y L.major_recalls_norm average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year, fe vce(cluster newid)
                predict residuals, e
                quietly xtpoisson trials y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year, fe vce(robust)
                local xvars y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented 
                local i = 1
                foreach var in `xvars'{
                    return scalar b`i'= _b[`var']
                    return scalar s`i'= _se[`var']*sqrt(e(N))
                    local ++i
                }    
            restore
        end 
        
        
        preserve
            simulate, seed(123) reps(200)  nodots saving(coeff_se, replace): onebootrep //this should compute the coefficients for N times WITHOUT exploiting the results stored in r() thanks to the above defined program.
        restore
        The problem is that when I checked the mean of the resulting coefficients, it is totally out of bound with respect to the "true" values of the coefficients obtained buy directly performing the two step procedure (e.g. the bootstrap coefficient of y is .52, while the true coefficient is -.013 or so). Now what I am guessing is that this is due to the fact that values of the variables are repeated within a bootstrap sample when an individual is drawn more than once. So that for instance it happens that in the following the values of the variable mean_agef repeat themselves three times since individual 1 have been drawn three times:

        Code:
        mean_agef newid idatc3
        3422.25 1 1
        3540.25 1 1
        3660.25 1 1
        3782.25 1 1
        1965.444 1 1
        3364 1 1
        3481 1 1
        
        3422.25 2 1
        3540.25 2 1
        3660.25 2 1
        3782.25 2 1
        1965.444 2 1
        3364 2 1
        3481 2 1
        
        3422.25 3 1
        3540.25 3 1
        3660.25 3 1
        3782.25 3 1
        1965.444 3 1
        3364 3 1
        3481 3 1
        I don't know how to solve the issue (actually I do not even know if this is the issue) and still need the kind help of the community.

        Thanks a lot!

        ​​​​​​​Federico

        Comment


        • #5
          Federico:
          I see that issue but I think that your "weird" results are probably due to the way the bootstrap works.
          Perhaps you can find some answers in https://www.cambridge.org/core/books...63566DC09CBD6A.
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment


          • #6
            Thank you Carlo!
            I see also this past post https://www.statalist.org/forums/for...-not-bootstrap but cannot actually understand how `1' and `2' (year and var) are modeled...

            Federico

            Comment


            • #7
              Carlo Lazzaro
              I tag you since you replied me last time. I read some parts of the book and build up a code on my own to proceed. I wanted to share the code and ask a question. The code seems to me correct but it gives me different results when I use xtposisson, fe and xtreg, fe instead of reg and poisson with the identifier dummies i.nrewid, which looks weird to me. The code in the two cases is the following:

              Code:
              ****** CODE WITH XT COMMANDS
              ***********************************************
              ***********************************************
              
              set seed 1234
              set matsize 11000
              global filedata "DB_atc3.dta"
              global varx "y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented"
              global resid "residuals"
              global filename "bootexcel.xlsx"
              global nrepl 300
              
              
              local nx=0
              set more off
              
              foreach var in $varx {
                  local nx=`nx'+1
              }
              
              global ncol= `nx' +2
              mat coeff = J($nrepl ,$ncol,.)
              
              set more off
              forval i=1/$nrepl {
                  use "$filedata", clear
                  rename tot_count trials
                  *bysort idatc3 (Year): gen byte panelsize = _N
                  bsample, cluster(idatc3) idcluster(newid)
                  xtset, clear
                  xtset newid Year
                  quietly xtreg y L.major_recalls_norm average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year, fe vce(cluster newid)
                  predict residuals, e
                  capture quietly xtpoisson trials y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year, fe vce(robust)
                  if ( _rc ) {
                  
                  continue
                  }
                  di "... the return code is " _rc " and the # of iterations is reported to be `i'"
                  local conta=0
                  set more off
                  foreach var in $varx {
                      local conta=`conta'+1
                      mat coeff[`i',`conta']=_b[`var']
                  
                  mat coeff[`i',`conta'+1]=_b[$resid]
                  }
              
                  *di as text " Replication # `i'"
                  
                  mat coeff[`i',$ncol]=`i'
              
              }
              
              
              ****** CODE WITH reg and poisson COMMANDS
              ***********************************************
              ***********************************************
              
              set seed 1234
              set matsize 11000
              global filedata "DB_atc3.dta"
              global varx "y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented"
              global resid "residuals"
              global filename "bootexcel.xlsx"
              global nrepl 300
              
              
              local nx=0
              set more off
              
              foreach var in $varx {
                  local nx=`nx'+1
              }
              
              global ncol= `nx' +2
              mat coeff = J($nrepl ,$ncol,.)
              
              set more off
              forval i=1/$nrepl {
                  use "$filedata", clear
                  rename tot_count trials
                  *bysort idatc3 (Year): gen byte panelsize = _N
                  bsample, cluster(idatc3) idcluster(newid)
                  xtset, clear
                  xtset newid Year //necessario poichè estraiamo un sample con un nuovo id che non si ripete per atc3 estratti più volte (l'estrazione è infatti con ripetizione)
                  quietly reg y L.major_recalls_norm average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year i.newid,  vce(cluster newid)
                  predict residuals, residu
                  capture quietly poisson trials y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year i.newid, vce(robust)
                  if ( _rc ) {
                  
                  continue
                  }
                  di "... the return code is " _rc " and the # of iterations is reported to be `i'"
                  local conta=0
                  set more off
                  foreach var in $varx {
                      local conta=`conta'+1
                      mat coeff[`i',`conta']=_b[`var']
                  
                  mat coeff[`i',`conta'+1]=_b[$resid]
                  }
              
                  *di as text " Replication # `i'"
                  
                  mat coeff[`i',$ncol]=`i'
              
              }
              I cannot see any difference...maybe in the residuals part. Is there any explanation for the reason why the estimates in the two cases differ? Am I doing something wrong with bsample command or maybe in the use of predict in the xt case (e.g. maybe predict, e with xtreg is not thee same as predict, residuals with reg)?

              hanks a lot,

              Federico

              Comment


              • #8
                Federico:
                actually, residuals after -regress- with -panelid- indicator and -xtreg,fe- differ:
                Code:
                . use "https://www.stata-press.com/data/r16/nlswork.dta"
                (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
                
                . reg ln_wage age i.idcode if idcode<=2
                
                      Source |       SS           df       MS      Number of obs   =        24
                -------------+----------------------------------   F(2, 21)        =     22.23
                       Model |  2.97534125         2  1.48767063   Prob > F        =    0.0000
                    Residual |  1.40565657        21  .066936027   R-squared       =    0.6791
                -------------+----------------------------------   Adj R-squared   =    0.6486
                       Total |  4.38099782        23  .190478166   Root MSE        =    .25872
                
                ------------------------------------------------------------------------------
                     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                         age |   .0510045    .008836     5.77   0.000      .032629    .0693799
                    2.idcode |  -.4033833   .1059909    -3.81   0.001    -.6238036   -.1829631
                       _cons |   .6973154   .2443736     2.85   0.010     .1891127    1.205518
                ------------------------------------------------------------------------------
                
                . predict res, res
                (24 missing values generated)
                
                . xtreg ln_wage age if idcode<=2, fe
                
                Fixed-effects (within) regression               Number of obs     =         24
                Group variable: idcode                          Number of groups  =          2
                
                R-sq:                                           Obs per group:
                     within  = 0.6134                                         min =         12
                     between = 1.0000                                         avg =       12.0
                     overall = 0.4578                                         max =         12
                
                                                                F(1,21)           =      33.32
                corr(u_i, Xb)  = -0.0834                        Prob > F          =     0.0000
                
                ------------------------------------------------------------------------------
                     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                         age |   .0510045    .008836     5.77   0.000      .032629    .0693799
                       _cons |   .4956238   .2429093     2.04   0.054    -.0095338    1.000781
                -------------+----------------------------------------------------------------
                     sigma_u |  .28523509
                     sigma_e |  .25871998
                         rho |  .54862949   (fraction of variance due to u_i)
                ------------------------------------------------------------------------------
                F test that all u_i=0: F(1, 21) = 14.48                      Prob > F = 0.0010
                
                . predict xt_res, res
                (24 missing values generated)
                
                . list res xt_res if idcode<=2
                
                       +-----------------------+
                       |       res      xt_res |
                       |-----------------------|
                    1. | -.1641822    .0375095 |
                    2. | -.6377808   -.4360892 |
                    3. | -.1274277    .0742639 |
                    4. |  .0118632    .2135549 |
                    5. | -.0934069    .1082847 |
                       |-----------------------|
                    6. |  -.193747    .0079447 |
                    7. |  .4705439    .6722355 |
                    8. |  .4262744     .627966 |
                    9. |  .1418069    .3434986 |
                   10. |  .2337091    .4354007 |
                       |-----------------------|
                   11. |  .0539012    .2555929 |
                   12. |  -.121554    .0801377 |
                   13. |  .0973309   -.1043607 |
                   14. | -.1078243    -.309516 |
                   15. |  .1848566    -.016835 |
                       |-----------------------|
                   16. |  .3655459    .1638543 |
                   17. |  .1576768   -.0440148 |
                   18. |  .0698614   -.1318303 |
                   19. |  .0049065   -.1967852 |
                   20. | -.0157781   -.2174697 |
                       |-----------------------|
                   21. | -.0116541   -.2133458 |
                   22. | -.1877135   -.3894051 |
                   23. | -.2325587   -.4342504 |
                   24. | -.3246495   -.5263411 |
                       +-----------------------+
                
                .
                Kind regards,
                Carlo
                (Stata 18.0 SE)

                Comment


                • #9
                  Thank you very much Carlo. Is there a way to obtain the same residuals?

                  Comment


                  • #10
                    Federico:
                    no, because the fitted values also differ.
                    Kind regards,
                    Carlo
                    (Stata 18.0 SE)

                    Comment


                    • #11
                      Ok thank you a lot and sorry for the disturb. In any case the code provided can be useful as a "brute force" approach to bootstrap. Hope it helps

                      Comment


                      • #12
                        Federico:
                        as a partial correction to my previous reply, there's actually a relationship between fitted values and residuals obtained vi -regress- with -panelid- and -xtreg, fe- (this is something I've never challenged nyself with and is really good to know).
                        Elaborating a bit on the toy-example I posted previously:
                        Code:
                        quietly xtreg ln_wage age if idcode<=2, fe
                        predict ran_com, u
                        . list ln_wage ran_com xt_fitted xt_res in 1
                        
                             +-------------------------------------------+
                             |  ln_wage    ran_com   xt_fit~d     xt_res |
                             |-------------------------------------------|
                          1. | 1.451214   .2016917   1.413705   .0375095 |
                             +-------------------------------------------+
                        
                        . di .2016917  + 1.413705
                        1.6153967
                        
                        . list ln_wage fitted res in 1
                        
                             +---------------------------------+
                             |  ln_wage     fitted         res |
                             |---------------------------------|
                          1. | 1.451214   1.615396   -.1641822 |
                             +---------------------------------+
                        
                        .
                        As an aside, no disturb at all: we're simply try to improve our knowledge on statistical issues.
                        Kind regards,
                        Carlo
                        (Stata 18.0 SE)

                        Comment


                        • #13
                          Carlo Lazzaro I see. That's interesting. Thanks again. I think that this is due to the fact that "u" should be the prediction of the fixed effects. Since fixed effects cancel out heterogeneity, its fitted results (i.e. when you predict the fitted of xtreg) do not take into account the incidental term (which is indeed dropped). reg with panelid, instead, estimates heterogeneity consistently (indeed being a linear model it does not encounter the incidental parameter issue) and displays it also in the fitted values.

                          Elaborating on my past posts, however, the issue persists and I guess it's more involved than I thought. In particular: since I know that averaged bootstrap results should tend toward true results (i.e. results that I have by performing the two step procedure xtreg and xtpoisson), I tried to perform first original two steps and then bootstrap procedure but after summarizing the resulting coefficients they differ a lot from original results. The reason is still unknown to me. I share the code below together with the comparison.

                          The original estimates look as follows:
                          Code:
                          xtset idatc3 Year
                          xtreg y lag_maj_rec average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year,fe vce(cluster idatc3)
                           predict residuals, e
                              
                           xtpoisson trials y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year, fe vce(robust)
                          note: 16 groups (96 obs) dropped because of all zero outcomes
                          
                          Iteration 0:   log pseudolikelihood = -662.80877  
                          Iteration 1:   log pseudolikelihood = -536.13751  
                          Iteration 2:   log pseudolikelihood = -531.42644  
                          Iteration 3:   log pseudolikelihood = -531.38266  
                          Iteration 4:   log pseudolikelihood = -531.38265  
                          
                          Conditional fixed-effects Poisson regression    Number of obs      =       492
                          Group variable: idatc3                          Number of groups   =        82
                          
                                                                          Obs per group: min =         6
                                                                                         avg =       6.0
                                                                                         max =         6
                          
                                                                          Wald chi2(14)      =    165.22
                          Log pseudolikelihood  = -531.38265              Prob > chi2        =    0.0000
                          
                                                                     (Std. Err. adjusted for clustering on idatc3)
                          ----------------------------------------------------------------------------------------
                                                 |               Robust
                                          trials |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          -----------------------+----------------------------------------------------------------
                                               y |   -.013124   1.117276    -0.01   0.991    -2.202944    2.176696
                                       residuals |   .6477263   1.169505     0.55   0.580    -1.644462    2.939914
                          average_age_prodbyatc3 |   .0808345   .1003047     0.81   0.420    -.1157592    .2774281
                                      avg_prd_sq |  -.0020083   .0047398    -0.42   0.672    -.0112981    .0072816
                              mean_agefirm_byatc |   .1352506   .1185617     1.14   0.254     -.097126    .3676272
                            mean_agefirm_squared |  -.0022593   .0013686    -1.65   0.099    -.0049418    .0004232
                                             hhi |  -.0051958   1.332918    -0.00   0.997    -2.617668    2.607276
                                   share_expired |   .6503668   1.769393     0.37   0.713     -2.81758    4.118313
                                  share_patented |  -1.808324   2.323622    -0.78   0.436    -6.362538    2.745891
                                                 |
                                            Year |
                                           2006  |  -.1769479   .2048165    -0.86   0.388    -.5783808     .224485
                                           2007  |  -.0474872   .2311147    -0.21   0.837    -.5004637    .4054892
                                           2008  |  -.7286098   .2858094    -2.55   0.011    -1.288786   -.1684336
                                           2009  |  -1.156776   .2913193    -3.97   0.000    -1.727751   -.5858004
                                           2010  |  -1.710206   .3746907    -4.56   0.000    -2.444586   -.9758254
                          ----------------------------------------------------------------------------------------
                          The bootstrap estimates instead:

                          Code:
                          set seed 1234
                          set matsize 11000
                          global filedata "DB_atc3.dta"
                          global varx "y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented"
                          global resid "residuals"
                          global filename "bootexcel.xlsx"
                          global nrepl 500
                          
                          
                          local nx=0
                          set more off
                          
                          foreach var in $varx {
                              local nx=`nx'+1 //nx quindi andrà a contare il numero di variabili; il +1 è perchè si parte da 0
                          }
                          
                          global ncol= `nx' +2 // forse più due perchè contano una colonna per costante e una per residui?!
                          mat coeff = J($nrepl ,$ncol,.)
                          
                          set more off
                          forval i=1/$nrepl {
                              drop _all
                              use "$filedata", clear
                              xtset, clear
                              xtset idatc3 Year
                              rename tot_count trials
                              gen lag_maj_rec = L.major_recalls_norm
                              *bysort idatc3 (Year): gen byte panelsize = _N
                              bsample, cluster(idatc3) idcluster(newid)
                              xtset, clear
                              xtset newid Year //necessario poichè estraiamo un sample con un nuovo id che non si ripete per atc3 estratti più volte (l'estrazione è infatti con ripetizione)
                              xtreg y lag_maj_rec average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year,fe vce(cluster newid)
                              predict residuals, e
                              xtpoisson trials y residuals average_age_prodbyatc3 avg_prd_sq mean_agefirm_byatc mean_agefirm_squared hhi share_expired share_patented i.Year, fe vce(robust)
                              
                              di "... the return code is " _rc " and the # of iterations is reported to be `i'"
                              local conta=0
                              set more off
                              foreach var in $varx {
                                  local conta=`conta'+1 //conta quindi andrà a contare il numero di variabili
                                  mat coeff[`i',`conta']=_b[`var']
                              
                              mat coeff[`i',`conta'+1]=_b[$resid]
                              }
                          
                              *di as text " Replication # `i'"
                              
                              mat coeff[`i',$ncol]=`i' // questo comando setta l'ultima colonna a colonna che tiene il conto delle ripetizioni.
                          
                          }
                          
                          
                          sum _all // results of summarizing:
                          
                              Variable |       Obs        Mean    Std. Dev.       Min        Max
                          
                          -------------+--------------------------------------------------------
                          
                                     A |       494    .3611457    5.130059  -32.17217   29.44407
                          
                                     B |       494    .3349674     5.12483  -28.58649    32.8156
                          
                                     C |       494    .0052883    .4578338    -3.4639   3.640835
                          
                                     D |       494    .0024553    .0224125   -.149159   .1644048
                          
                                     E |       494    .0689239    .3264411  -3.457498   2.688154
                          
                          -------------+--------------------------------------------------------
                          
                                     F |       494   -.0014377    .0042038  -.0362368   .0467434
                          
                                     G |       494   -.4351782    5.421608  -40.58364   36.06022
                          
                                     H |       494    1.020604    5.319493  -30.74711   42.10214
                          
                                     I |       494   -1.037221    12.14937  -60.82576    123.775
                          
                                     J |       494    .3349674     5.12483  -28.58649    32.8156
                          
                          -------------+--------------------------------------------------------
                          
                                     K |       494    250.3664    144.8643          1        500
                          As you can see from the column "mean" (mean of the bootstrap coefficient), the mean of the bootstrapped coefficient is completely different from the original ones given in the output of the xtpoisson command. I guess the explanation lies on something that happens by passing from a loop to the other or maybe the fact that clusters are repeated...but still...if you spot a mistake please don't esitate

                          Federico
                          Last edited by Federico Nutarelli; 11 Mar 2020, 04:18.

                          Comment

                          Working...
                          X