Announcement

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

  • option vce() not allowed

    Hello everyone,


    I having some trouble with some regressions lately. I have a dataset with 1400 observations. Cross-sectional. Stata version 16, updated.


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(var_1 var_2) int iv float weight
    1.0869565  -.6574075 166  .02777778
     1.195652  .11661406 102 .015384615
     1.246377 -1.9730076 175 .015151516
    1.2608695  .53105706 184 .037037037
    1.2826087  -.6574075 166  .02777778
    1.2971015  -.1605494 204 .012658228
     1.326087  .11661406 102 .015384615
     1.347826  .11661406 102 .015384615
     1.362319  -.6574075 166  .02777778
    1.3768116  .52166766 121  .01234568
    end


    I run this command from the do-file:

    Code:
    use "project_data.dta", clear
    
    reg var_1 var_2  [aweight=weight], vce(cluster iv)


    and I get the error
    "option vce() not allowed
    r(198);

    "


    I went and copied the same command into the command window, and I got the same error. The weird thing is that if I type there

    reg var_1 var_2 [aweight=weight]

    then

    reg var_1 var_2 [aweight=weight], robust

    then reg var_1 var_2 [aweight=weight], vce(robust)

    and finally

    reg var_1 var_2 [aweight=weight], vce(cluster iv)

    it does work. This is the output

    . reg var_1 var_2 [aweight=weight], vce(cluster iv)
    (sum of wgt is 23.80889513716102)

    Linear regression Number of obs = 1,261
    F(1, 26) = 5.29
    Prob > F = 0.0297
    R-squared = 0.0394
    Root MSE = .47606

    (Std. err. adjusted for 27 clusters in iv)
    ------------------------------------------------------------------------------
    | Robust
    var_1 | Coefficient std. err. t P>|t| [95% conf. interval]
    -------------+----------------------------------------------------------------
    var_2 | .0969326 .0421414 2.30 0.030 .0103098 .1835554
    _cons | 2.366665 .0478555 49.45 0.000 2.268297 2.465034
    ------------------------------------------------------------------------------

    .


    Do you have any idea why?






  • #2
    Maria:
    it works at my end:
    Code:
    . input float(var_1 var_2) int iv float weight
    
             var_1      var_2        iv     weight
      1. 
    . 1.0869565  -.6574075 166  .02777778
      2. 
    .  1.195652  .11661406 102 .015384615
      3. 
    .  1.246377 -1.9730076 175 .015151516
      4. 
    . 1.2608695  .53105706 184 .037037037
      5. 
    . 1.2826087  -.6574075 166  .02777778
      6. 
    . 1.2971015  -.1605494 204 .012658228
      7. 
    .  1.326087  .11661406 102 .015384615
      8. 
    .  1.347826  .11661406 102 .015384615
      9. 
    .  1.362319  -.6574075 166  .02777778
     10. 
    . 1.3768116  .52166766 121  .01234568
     11. 
    . end
    
    . reg var_1 var_2 [aweight=weight], vce(cluster iv)
    (sum of wgt is .2066796468570828)
    
    Linear regression                               Number of obs     =         10
                                                    F(1, 5)           =       2.38
                                                    Prob > F          =     0.1837
                                                    R-squared         =     0.0462
                                                    Root MSE          =     .09486
    
                                         (Std. err. adjusted for 6 clusters in iv)
    ------------------------------------------------------------------------------
                 |               Robust
           var_1 | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           var_2 |   .0275348   .0178552     1.54   0.184    -.0183635    .0734331
           _cons |   1.275964   .0141159    90.39   0.000     1.239678     1.31225
    ------------------------------------------------------------------------------
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X