Announcement

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

  • Jackknife with user written cluster program

    Dear all,
    I would like to use the jackknife with a user written program and use clustering (paneldata). However, my program fails and I am not sure why. With a bootstrap this works fine. Can someone point out my folly?

    Code:
    clear all
    webuse pig
    gen newid = id
    xtset newid week
    
    cap program drop xtest
    program define xtest, rclass
        xtreg weight c.week
        return scalar coef = r(table)[1,1]
    end
    
    *Test program
    xtest
    return list
    
    *Jackknife
    jackknife r(coef), cluster(id) idcluster(newid): xtest
    The output of the program:

    Code:
    . jackknife r(coef), cluster(id) idcluster(newid): xtest
    (running xtest on estimation sample)
    
    Jackknife replications (48)
    1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
    insufficient observations to compute jackknife standard errors
    no results will be saved
    r(2000);
    Best wishes

    (Stata 16.1 MP)

  • #2
    Felix, jackknife needs the user-written program to allow for the if qualifier.

    Code:
    program define xtest, rclass
        syntax [if]
        xtreg weight c.week `if'
        return scalar coef = r(table)[1,1]
    end

    Comment


    • #3
      Thanks, much appreciated!
      Best wishes

      (Stata 16.1 MP)

      Comment

      Working...
      X