Announcement

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

  • error 102 "too few variables specified"

    Dear statalist members,

    I´m running an econometric analysis using the following code: "ivreg2 dv (x z1 z2) w, liml"

    The full command I´m typing on the prompt is (in accordance to the sintaxe above):
    ivreg2 coop1(Costs Knowledge Market Regulation = IV_POLICIES IV_POLICIES IV_ORGAN_FAILURE IV_MARK_FAILURE IV_PP_FAILURE IV_RD_SOURCES IV_MARKET_SOURCES IV_INST_SOURCES IV_OTHER_SOURCES IV_RD_FOUNDS IV_OTHER_FOUNDS) Dummy_Natural Dummy_Labor Dummy_Scale Firms_Size, liml.

    However, It is appearing the following message on my screen too few variables specified r (102) and I don´t know how to proceed from this.

    I would greatly appreciate any help on this.

    Best regards,
    Mateus

  • #2
    Show us the exact command you have typed in Stata. Your commands here showing line breaks without continuation forward slashes "///" and if this is the exact command you typed Stata will not pick it up as a complete instruction. On the point, you have incorporated IV_POLICIES twice as instrument. I had no problem running your command on a hypothetical data:


    Code:
    / / Generate hypothetical data
    
    loc all coop1 Costs Knowledge Market Regulation ///
    IV_POLICIES IV_ORGAN_FAILURE ///
    IV_MARK_FAILURE IV_PP_FAILURE IV_RD_SOURCES ///
    IV_MARKET_SOURCES IV_INST_SOURCES IV_OTHER_SOURCES ///
    IV_RD_FOUNDS IV_OTHER_FOUNDS
    set obs 10000
    set seed 37898
    foreach var of local all {
    gen `var'= runiform()+5
    
    }
    loc x Dummy_Natural Dummy_Labor Dummy_Scale Firms_Size
    
    
    foreach var of loc x {
    gen `var'=runiform()>.5
    }
    *******************************
    
    //Run the model:
    
    ivreg2 coop1 (Costs Knowledge Market Regulation = IV_POLICIES ///
    IV_POLICIES IV_ORGAN_FAILURE IV_MARK_FAILURE IV_PP_FAILURE ///
    IV_RD_SOURCES IV_MARKET_SOURCES IV_INST_SOURCES IV_OTHER_SOURCES IV_RD_FOUNDS IV_OTHER_FOUNDS) ///
    Dummy_Natural Dummy_Labor Dummy_Scale Firms_Size, liml
    
    //Results:
    
    Warning - duplicate variables detected
    Duplicates:         IV_POLICIES
    
    LIML estimation
    ---------------
    k               =1.00004
    lambda          =1.00004
    
    Estimates efficient for homoskedasticity only
    Statistics consistent for homoskedasticity only
    
                                                          Number of obs =    10000
                                                          F(  8,  9991) =     0.03
                                                          Prob > F      =   1.0000
    Total (centered) SS     =  856.1766542                Centered R2   = -64.9345
    Total (uncentered) SS   =  303292.1924                Uncentered R2 =   0.8139
    Residual SS             =  56451.60719                Root MSE      =    2.376
    
    -------------------------------------------------------------------------------
            coop1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    --------------+----------------------------------------------------------------
            Costs |   3.611278   10.64135     0.34   0.734    -17.24538    24.46793
        Knowledge |  -1.253558   4.241273    -0.30   0.768    -9.566301    7.059184
           Market |  -1.368845    4.97499    -0.28   0.783    -11.11965    8.381955
       Regulation |  -7.178747   20.06962    -0.36   0.721    -46.51449    32.15699
    Dummy_Natural |  -.0189444   .0930717    -0.20   0.839    -.2013616    .1634728
      Dummy_Labor |    -.01491   .0818909    -0.18   0.856    -.1754133    .1455933
      Dummy_Scale |  -.0803632    .254717    -0.32   0.752    -.5795994     .418873
       Firms_Size |   .0159943   .0917247     0.17   0.862    -.1637827    .1957713
            _cons |   39.57171   96.60697     0.41   0.682    -149.7745    228.9179
    -------------------------------------------------------------------------------
    Underidentification test (Anderson canon. corr. LM statistic):           0.560
                                                       Chi-sq(7) P-val =    0.9992
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):                0.056
    Stock-Yogo weak ID test critical values:                       <not available>
    ------------------------------------------------------------------------------
    Sargan statistic (overidentification test of all instruments):           0.431
                                                       Chi-sq(6) P-val =    0.9986
    ------------------------------------------------------------------------------
    Anderson-Rubin statistic (overidentification test of all instruments):   0.431
                                                       Chi-sq(6) P-val =    0.9986
    ------------------------------------------------------------------------------
    Instrumented:         Costs Knowledge Market Regulation
    Included instruments: Dummy_Natural Dummy_Labor Dummy_Scale Firms_Size
    Excluded instruments: IV_POLICIES IV_ORGAN_FAILURE IV_MARK_FAILURE
                          IV_PP_FAILURE IV_RD_SOURCES IV_MARKET_SOURCES
                          IV_INST_SOURCES IV_OTHER_SOURCES IV_RD_FOUNDS
                          IV_OTHER_FOUNDS
    Duplicates:           IV_POLICIES

    Last edited by Roman Mostazir; 09 Oct 2017, 14:44.
    Roman

    Comment


    • #3
      When I look at help ivreg2 I see the following syntax:
      Code:
              ivreg2 depvar [varlist1] (varlist2=varlist_iv) [weight] [if exp] [in
                    range] [, gmm2s bw(#) kernel(string) dkraay(integer) kiefer liml
                    fuller(#) kclass(#) coviv cue b0(matrix) robust cluster(varlist)
                    orthog(varlist_ex) endog(varlist_en) redundant(varlist_ex)
                    partial(varlist) small noconstant center smatrix(matrix)
                    wmatrix(matrix) first ffirst savefirst savefprefix(prefix) sfirst
                    savesfirst savesfprefix(prefix) rf saverf saverfprefix(prefix)
                    nocollin noid level(#) bvclean noheader nofooter eform(string)
                    depname(varname) plus ]
      which suggests to me that the variables you include after the parenthesized list of instrumental variables should instead be placed before the list, just after the dependent variable, as in the following.
      Code:
      ivreg2 coop1 Dummy_Natural Dummy_Labor Dummy_Scale Firms_Size (Costs Knowledge Market Regulation = IV_POLICIES IV_POLICIES IV_ORGAN_FAILURE IV_MARK_FAILURE IV_PP_FAILURE IV_RD_SOURCES IV_MARKET_SOURCES IV_INST_SOURCES IV_OTHER_SOURCES IV_RD_FOUNDS IV_OTHER_FOUNDS), liml
      But I could be wrong, I'm in no position to test this. But it can't hurt to try!

      Crossed with post #2, which shows that the syntax used can work, and points out a more likely source of the problem.

      Comment

      Working...
      X