Announcement

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

  • cmp and mprobit - two step Heckman correction (command structure)

    Dear all,

    I am trying to estimate a model that explains farmers' decision to start keeping hogs. There are three different alternatives: farmers that don't change anything about their farms, farmers who start keeping hogs (entry), farmers who leave the agricultural sector / the dataset (exit).
    I started to use a mlogit and mprobit, but the IIA is violated (Hausman and Suest Test). I don't have any alternative specific variables; therefore, i decided to use cmp and mprobit instead of asmprobit.
    The first step works fine (estimating the probabilities with mprobit and cmp), but i can't figure out the right command structure to estimate a second linear model explaining the amount of hogs the farmers in the entry group start keeping. Does anyone know what is wrong with my command line? Is it possible to perform a two step heckman approach using cmp and a multinominal probit?

    Command line:
    cmp (v2003Reg =vHHI_bj2003 vEmz_bj2003 vLF_bj2003 vDGL_Anteil_bj2003 vGVEha_bj2003 vAgrarbildung_bj2003 vAlter_bj2003 vFamAK_bj2003 vZinssatz_bj2003 vOrErg_AK_bj2003 vASKKD2003Stufen Viehdichte_gvha_2003 v2003BIP bevdichte_10km_2003 vSauenD_bj2003 vFerkelD_bj2003 vKuheD_bj2003 ) (Einstieg2003 = vHHI_bj2003 vEmz_bj2003 vLF_bj2003 vDGL_Anteil_bj2003 vGVEha_bj2003 vAgrarbildung_bj2003 vAlter_bj2003 vFamAK_bj2003 vZinssatz_bj2003 vOrErg_AK_bj2003 vASKKD2003Stufen Viehdichte_gvha_2003 v2003BIP bevdichte_10km_2003 vSauenD_bj2003 vFerkelD_bj2003 vKuheD_bj2003), ind(v2003Reg*$cmp_mprobit Einstieg2003*$cmp_ivregress) nodrop nonrtolerance

    Error message:
    Indicator for v2003Reg must only evaluate to integers between 0 and 10. invalid syntax
    r(198);

    Does anyone know what the right syntax structure for mprobit is? Can I use the two step Heckamnn correction with mprobit and cmp? I tried quite a lot of different alternatives.
    Regards Insa

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    You may need to contact the author.


    Comment


    • #3
      Dear Statalisters,
      i have two problems concerning cmp. I am working with a quite large Dataset (10.000 Observations, 23 variables, Stata version 13). I am trying to estimate a twostep Modell that explains the investment behavior of livestock keeping farmers (without hogs):
      1st step: Estimation of the probabilities of belonging to the following classes:
      • Keeping the farm as it is (group 0)
      • Starting to keep hogs (group 1)
      • Stop keeping livestock, but keep operating the farm (group 2)
      • Growth in operational branches that already exist f.e. dairy (group 3)
      • Quitting farming (group 6)
      2st step: Estimation of the amount of hogs the farmers start keeping, using the same explanatory variables as above (linear regression).
      I am using cmp, because I would like to estimate a two-step model and because the IIA is violated in one of the datasets and I don’t have alternative specific variables, therefore asmprobit is not an option. Here is an example of my data:
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float(vEmz_bj2003 vLF_bj2003 vZinssatz_bj2003) double v2003BIP float(v2003Reg Einstieg2003 dup)
            30     56.54  5.000152  33.28 6    .  1
      24.53333 125.96667 1.2972398  33.28 1 2000  2
            45  87.37334  6.855236 34.631 0    .  3
            45 34.376667  7.929277 34.631 0    .  4
            45  93.15334  5.067279 34.631 6    .  5
            45    111.32   6.32209 34.631 0    .  6
            41     66.32  5.202801 28.733 0    .  7
            41    107.76  4.303344 28.733 0    .  8
            41     30.95  5.263186 28.733 0    .  9
            41   183.265 1.8575726 28.733 6    . 10
      end
      My first problem is, that it works when I am trying to estimate the choices between three of the groups above f.e. group 0, group 1, group 3. Strangely it doesn’t seems to matter which groups I am using, I does not converge when I am using four or five groups. I tried to solve the model using different options structural and / or tech(dfp nr) and / or robust and deleted quite a lot of variables out of the model.
      Code:
      ‘cannot compute an improvement -- flat region encountered convergence not achieved convergence not achieved r(430);’
      My second problem is, that I am having troubles to figure out the right syntax for the two step heckman approach. In the example below the IIA is not violated, I am estimating a model with three groups, therefore it solves without the two step approach. When I try to do the Heckman estimation, I get the following error message:
      Code:
      `Indicator for Einstieg2003 must only evaluate to integers between 0 and 10.invalid syntax’
      I used the following syntax:
      Code:
      drop if v2003Reg==1 & (Einstieg2003==.)
      constraint 1 [lnsig_3]_cons
      constraint 2 [atanhrho_23]_cons
      .cmp (Einstieg2003 = `varlist_1st_step' `varlist_1st_step_reg' `varlist_1st_step_bz' `varlist_1st_step_Land')         (v2003Reg                =             `varlist_1st_step'             `varlist_1st_step_reg' `varlist_1st_step_bz'         `varlist_1st_step_Land'), ind(Einstieg2003*$cmp_mprobit v2003Reg*$cmp_mprobit)        constraint (1 2)

      I would be grateful for your help!
      Last edited by Insa Thiermann; 06 Feb 2019, 06:09.

      Comment


      • #4
        Hi Insa,

        May I ask do you find the solution of two-step Heckman using -cmp-? I find -cmp- results are always different from Heckman two-step results.

        Also, I have the same situation as you: IIA violated and thus mprobit for the first step of Heckman. But I am struggling findingthe correct -cmp- code for doing so.

        Best wishes,
        Mengqian

        Comment

        Working...
        X