Announcement

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

  • test post for code entry

    Code:
     *====================================================================*
    *WIERSEMA & BOWEN SMJ Limited Dependent Variable (2007) procedures      *
    *====================================================================*
    
    * Estimate Logit model
    logit    patent ceo_dst
    * Predict probability of patent, store values in variable pprob
    predict pprob
    * Define expression for X’s marginal effect to use in predictnl command
    * Save marginal effect values in meX; standard error values in meX se
    local vb b[ cons] + b[X]*X + b[Z]*Z
    local phat (exp(‘vb’)/(1+exp(‘vb’)))
    predictnl meX = ‘phat’*(1-‘phat’)* b[X], se(meX se)
    * Compute z-statistic values and store in variable z stat
    gen z stat = meX/meX se
    * print summary statistics for marginal effect and z-statistic values
    tabstat meX z stat, stats(mean min max)
    * Graph marginal effect and z-statistic values (Figure 1)
    graph twoway (scatter meX pprob) || ///
    (scatter z stat pprob, yaxis(2)yline
    (−1.96 1.96, axis(2)))
    * Compute and save sample means of variables X and Z
    egen meanX = mean(X)
    egen meanZ = mean(Z)
    * Determine value and significance of marginal effect at data means
    local vb b[ cons] + b[X]*meanX + b[Z] *meanZ
    local phat (exp(‘vb’)/(1+exp(‘vb’)))
    nlcom meX means: ‘phat’*(1-‘phat’)* b[X]
    nlcom meZ means: ‘phat’*(1-‘phat’)* b[Z]

  • #2
    I am working int Stata/SE 15.1 to replicate a user-contributed command published in Strategic Management Journal (SMJ) by Wiersema and Bowen (2007)- citation and link provided below. On page 690 the authors provide suggested code to compute, at each observation, the value of the marginal effect given by Equation 2 presented in their paper, its standard error, and implied z-statistic value. Summary statistics for the marginal effect and z-statistic values are computed, the marginal effect and z-statistic values are plotted as in Figure 1 of thier paper, and the marginal effect at the variable means and its associated z-statistic are computed for each model variable. I am trying to replicate this procedure for my data.
    Reference
    Wiersema, M. F., & Bowen, H. P. (2009). The use of limited dependent variable techniques in strategy research: Issues and methods. Strategic management journal, 30(6), 679-692. https://doi.org/10.1002/smj.758

    Here is an example of my data.
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte patent long ceo_dst
    0   2
    0   0
    0   0
    0  15
    0   .
    0   0
    0   5
    0 400
    0   3
    0   .
    0   .
    0   1
    0   .
    0   2
    0   3
    0   0
    0   .
    0   1
    0   2
    0   3
    0   0
    0   4
    0   4
    0   .
    0   4
    0   .
    0   1
    0   2
    0   .
    0   .
    0   5
    0   .
    0   .
    0   5
    0   4
    0   0
    0 200
    0   6
    0   2
    0   1
    0   1
    0   0
    0   3
    0   .
    0   5
    0   2
    0   .
    0   2
    0   1
    0   1
    0   3
    0 100
    0   5
    0   0
    0   6
    0   0
    0   0
    0   4
    0   .
    0   0
    0   2
    0   0
    0   3
    0   .
    0   0
    0  30
    0   1
    0   8
    0   .
    0   3
    0   5
    0   5
    0   2
    0   0
    0   .
    0   4
    0   1
    0   1
    0   2
    0   .
    0   2
    0   2
    0   2
    0   .
    0   .
    0   .
    0   0
    0   1
    0   3
    0 100
    0   .
    0   2
    0   4
    0   2
    0   5
    0   2
    0   .
    0   2
    0   1
    0   0
    end
    Here is the code from the Appendix of the SMJ paper.
    Code:
    *====================================================================*
    *WIERSEMA & BOWEN SMJ Limited Dependent Variable (2007) procedures                     *
    *====================================================================*
    
    * Estimate Logit model
    logit    patent ceo_dst
    * Predict probability of patent, store values in variable pprob
    predict pprob
    * Define expression for X’s marginal effect to use in predictnl command
    * Save marginal effect values in meX; standard error values in meX se
    local vb b[ cons] + b[X]*X + b[Z]*Z
    local phat (exp(‘vb’)/(1+exp(‘vb’)))
    predictnl meX = ‘phat’*(1-‘phat’)* b[X], se(meX se)
    * Compute z-statistic values and store in variable z stat
    gen z stat = meX/meX se
    * print summary statistics for marginal effect and z-statistic values
    tabstat meX z stat, stats(mean min max)
    * Graph marginal effect and z-statistic values (Figure 1)
    graph twoway (scatter meX pprob) || ///
    (scatter z stat pprob, yaxis(2)yline
    (−1.96 1.96, axis(2)))
    * Compute and save sample means of variables X and Z
    egen meanX = mean(X)
    egen meanZ = mean(Z)
    * Determine value and significance of marginal effect at data means
    local vb b[ cons] + b[X]*meanX + b[Z] *meanZ
    local phat (exp(‘vb’)/(1+exp(‘vb’)))
    nlcom meX means: ‘phat’*(1-‘phat’)* b[X]
    nlcom meZ means: ‘phat’*(1-‘phat’)* b[Z]
    However, I get the following message after I attempt to run the program.
    Code:
    . do "/var/folders/q3/qcf4ctpn0192x8czkl8x7fth0000gn/T//SD14010.000000"
    
    . * Estimate Logit model
    . logit   patent ceo_dst
    
    Iteration 0:   log likelihood = -397.95179  
    Iteration 1:   log likelihood = -397.92964  
    Iteration 2:   log likelihood = -397.92947  
    Iteration 3:   log likelihood = -397.92947  
    
    Logistic regression                             Number of obs     =        913
                                                    LR chi2(1)        =       0.04
                                                    Prob > chi2       =     0.8327
    Log likelihood = -397.92947                     Pseudo R2         =     0.0001
    
    ------------------------------------------------------------------------------
          patent |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         ceo_dst |   .0000492   .0002269     0.22   0.828    -.0003955    .0004939
           _cons |  -1.677191   .0912855   -18.37   0.000    -1.856107   -1.498275
    ------------------------------------------------------------------------------
    
    . * Predict probability of patent, store values in variable pprob
    . predict pprob
    (option pr assumed; Pr(patent))
    (1,131 missing values generated)
    
    . * Define expression for X’s marginal effect to use in predictnl command
    . * Save marginal effect values in meX; standard error values in meX se
    . local vb b[ cons] + b[X]*X + b[Z]*Z
    
    . local phat (exp(‘vb’)/(1+exp(‘vb’)))
    
    . predictnl meX = ‘phat’*(1-‘phat’)* b[X], se(meX se)
    may only specify one se variable
    r(103);
    
    end of do-file
    
    r(103);
    I am certain the error is in this line of code.
    Code:
    predictnl meX = ‘phat’*(1-‘phat’)* b[X], se(meX se)
    Can anyone provide guidance how to debug?

    Comment

    Working...
    X