Announcement

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

  • Mata run-time error

    I am using the IVreg2 command to run an IV regression of a sub-sample of my data but I keep getting the message Mata run-time error 3351. The same model worked well for the full sample. When I dropped half of the sample because I need to re-run the same model on a sub-sample, I got the error. before that I tried to add the the conditional command at the end of the model by using "if sub-sample varname", but I got the same message. I dropped part of the sample using "drop if varname". I also tried "drop if varname ==0" , all these bring the same error. Please help

    Teopista

  • #2
    If you search the return code 3351 (search rc 3351) you will get the following explanation: "argument has missing values". So when you reduce the sample to half of the orginal size you might introduce missing values in your models which cause the model to break down. So check for missing values patterns in your subsample of the data.
    It is also more likely to get help if you give the full syntax of the command and what Stata has returned when the error occured (if there are more details than just Mata run-time error 3351).

    Comment


    • #3
      Teopista - you should also make sure you are using the latest versions of ivreg2, ranktest, etc., and when you report the problem in more detail (as per Christophe's advice) you should also report the versions of these programs (just use the which command). There have been updates recently to ivreg2 et al. so it's worthwhile checking even if you installed them not long ago.

      Comment


      • #4
        Dear Christophe, Mark thanks for the advice. Apologies if I was not clear enough. I have now re-installed stata 14. The version of Ivreg2 am using is this - c:\ado\plus\i\ivreg2.ado; *! ivreg2 4.0.02 9Feb2015; *! authors cfb & mes; Still the same error. I have a total sample of 600 households and I run the following model: ivreg2 lnTot_hhincome (cert_utz cert_FT_org = KCL_radius_d GCE_invillage BCU_yrs) educ_head fem_head age_hhead age_hhead2 HHsize_adults HHsize_children Total_area_cult Total_area_cult2 livestock_unit value_agequipment hmstd_forest_km hmstd_river_km hmstd_road_km, robust first endog(cert_utz cert_FT_org) savefirst - which worked very well. I created a sub sample using the command:"drop if certified ==0", so I remained with a sub-sample of 300 then run the very model and the error message 3351 came and it still comes. I then used "mdesc" on all those variables to check for missing values and there is none. I hope this is clear and someone can help me with some other advice.
        Teopista

        Comment


        • #5
          Teopista - that's not the latest version of ivreg2. The most recent one is 4.1.09. You should update ivreg2 and ranktest (ssc install ivreg2, replace and similarly for ranktest) and see if the problem is still there.

          Comment


          • #6
            Thanks Mark, Now I have the right version of ivreg2 and ranktest as well c:\ado\plus\i\ivreg2.ado *! ivreg2 4.1.09 23Aug2015 *! authors cfb & mes. It has finally worked.

            Thanks a lot
            Teopista

            Comment

            Working...
            X