Announcement

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

  • using jackknifeopts in the bootstrap command

    Hi,

    Please see the code below

    Code:
    webuse pig, clear
    bootstrap, reps(20) bca ties mse cluster(id) idcluster(xid) jackknifeopts(): mixed weight week || id: week
    I am running bootstrap command with bca option with clustered data and there is a need to specify cluster(id) idcluster(xid)

    Because I specify the option bca command it does seem that stata runs jacknife. When I looked at the jackknifeopts(), I am unclear whether I need to specify also the options cluster(id) idcluster(xid) within jackknifeopts(). When I do the following there is an error

    Code:
    webuse pig, clear
    bootstrap, reps(20) bca ties mse cluster(id) idcluster(xid) jackknifeopts(, cluster(id) idcluster(xid)): mixed weight week || id: week
    Please could anyone help me with this?

    Additionally, I tried to run the jacknife command directly and it does not seem to allow the options and produces error

    Code:
    jacknife eclass, cluster(id) idcluster(xid): mixed weight week || id: week
    jacknife rclass, cluster(id) idcluster(xid): mixed weight week || id: week
    However, if I run the command without any option, the command runs fine

    Code:
    jacknife, cluster(id) idcluster(xid): mixed weight week || id: week
    Please could anyone clarify this?

    Thanks

    Andrew

  • #2
    You don't need jacknifeopts() at all with -bootsrap, bca-. Yes, it does run a jackknife to calculate the "acceleration factor", but that is handled for you in the background. Additionally, if you plan to cluster, then you do need -cluster()- and -idcluster()- as options to -bootstrap-.

    Comment


    • #3
      Does the jacknife run in the background when I use "bootsrap, bca" take into account the options cluster and idclusterid, such as in the example below?

      Code:
       
       bootstrap, reps(20) bca ties mse cluster(id) idcluster(xid): mixed weight week || id: week
      Thanks
      Andrew

      Comment


      • #4
        As far as I'm aware, yes. Does the number of iterations equal the number of clusters minus 1?

        Alternatively, use cluster robust variance estimates with REML and ditch bootstrapping.

        Comment


        • #5
          Thank you

          I don't want to use the bootstrap facilities within the mixed command because I am trying to understand how the bootstrap command works


          When I run the code

          Code:
           
           webuse pig, clear bootstrap, reps(20) bca ties mse cluster(id) idcluster(xid) jackknifeopts(): mixed weight week || id: week
          This is the output I get

          HTML Code:
          Jackknife replications (48)
          ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
          ................................................
          
          Bootstrap replications (20)
          ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
          ....................
          
          Mixed-effects ML regression                     Number of obs     =        432
          Group variable: id                              Number of groups  =         48
                                                          Obs per group:
                                                                        min =          9
                                                                        avg =        9.0
                                                                        max =          9
                                                          Wald chi2(1)      =   16898.21
          Log likelihood = -869.03825                     Prob > chi2       =     0.0000
          
                                               (Replications based on 48 clusters in id)
          ------------------------------------------------------------------------------
                       |   Observed   Bstrap *
                weight | coefficient  std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                  week |   6.209896    .047771   129.99   0.000     6.116266    6.303525
                 _cons |   19.35561    .333134    58.10   0.000     18.70268    20.00854
          ------------------------------------------------------------------------------
          
          ------------------------------------------------------------------------------
                                       |   Observed   Bstrap *          Normal-based
            Random-effects parameters  |   estimate   std. err.     [95% conf. interval]
          -----------------------------+------------------------------------------------
          id: Independent              |
                             var(week) |   .3680668    .058867      .2690229    .5035749
                            var(_cons) |   6.756364   1.445921      4.441692    10.27727
          -----------------------------+------------------------------------------------
                         var(Residual) |   1.598811   .3296255      1.067347    2.394907
          ------------------------------------------------------------------------------
          LR test vs. linear model: chi2(2) = 764.42                Prob > chi2 = 0.0000
          
          Note: LR test is conservative and provided only for reference.

          Jackknife replications seems to be 48 and there are 48 subjects and a total of 432 observations

          Thanks

          Andrew

          Comment


          • #6
            Thank you

            I don't want to use the bootstrap facilities within the mixed command because I am trying to understand how the bootstrap command works


            When I run the code

            Code:
             
             webuse pig, clear bootstrap, reps(20) bca ties mse cluster(id) idcluster(xid) jackknifeopts(): mixed weight week || id: week
            This is the output I get

            HTML Code:
            Jackknife replications (48)
            ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
            ................................................
            
            Bootstrap replications (20)
            ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
            ....................
            
            Mixed-effects ML regression                     Number of obs     =        432
            Group variable: id                              Number of groups  =         48
                                                            Obs per group:
                                                                          min =          9
                                                                          avg =        9.0
                                                                          max =          9
                                                            Wald chi2(1)      =   16898.21
            Log likelihood = -869.03825                     Prob > chi2       =     0.0000
            
                                                 (Replications based on 48 clusters in id)
            ------------------------------------------------------------------------------
                         |   Observed   Bstrap *
                  weight | coefficient  std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                    week |   6.209896    .047771   129.99   0.000     6.116266    6.303525
                   _cons |   19.35561    .333134    58.10   0.000     18.70268    20.00854
            ------------------------------------------------------------------------------
            
            ------------------------------------------------------------------------------
                                         |   Observed   Bstrap *          Normal-based
              Random-effects parameters  |   estimate   std. err.     [95% conf. interval]
            -----------------------------+------------------------------------------------
            id: Independent              |
                               var(week) |   .3680668    .058867      .2690229    .5035749
                              var(_cons) |   6.756364   1.445921      4.441692    10.27727
            -----------------------------+------------------------------------------------
                           var(Residual) |   1.598811   .3296255      1.067347    2.394907
            ------------------------------------------------------------------------------
            LR test vs. linear model: chi2(2) = 764.42                Prob > chi2 = 0.0000
            
            Note: LR test is conservative and provided only for reference.

            Jackknife replications seem to be 48 and there are 48 subjects and a total of 432 observations

            Thanks

            Andrew

            Comment

            Working...
            X