Announcement

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

  • Two-step fractioal logitstic regression model

    Hello, I am trying to fit a two-step model where the first equation is a binary logit and the second equation is a fractional logit. I don't think the command -twopm- has the option for a fractional logit in the second stage, so I was wondering if the commands below would properly implement the model. I have also included the -dataex- output for the variables. For more background, I am interested in modeling the variable avrg_prop_dental_cost, which represents the proportion of out-of-pocket dental costs to household income.




    Code:
    ****creating a proportion variable and estimating using fractional logit model**** 
    gen oopdental_proportion_wave1 = oopdental_costs_wave1/HouseholdIncome_wave1 
    replace oopdental_proportion_wave1=0 if oopdental_costs_wave1==0 & HouseholdIncome_wave1==0 
    drop if oopdental_proportion_wave1 >1  
    
    gen oopdental_proportion_wave2 = oopdental_costs_wave2/HouseholdIncome_wave2 
    replace oopdental_proportion_wave2 = 0 if oopdental_costs_wave2 ==0 & HouseholdIncome_wave2==0 
    drop if oopdental_proportion_wave2>1 
    
    ***generating an average variable**** 
    egen avrg_prop_dental_cost = rowmean(oopdental_proportion_wave1 oopdental_proportion_wave2) 
    
    
    **first step logit model**** 
    logit r11dentst inc_d i.endentulism i.race i.age_cat i.male i.education i.veteran i.mothered i.dentalinsurance_w1 i.QuantHI_wave1 i.Quant_wealth_wave1 /// 
    i.smoke_now c.chronicdisease i.r11dentst
    
    **second fractional logit*** 
    fracreg logit avrg_prop_dental_cost r11dentst inc_d i.endentulism i.race i.age_cat i.male i.education i.veteran i.mothered i.dentalinsurance_w1 i.QuantHI_wave1 i.Quant_wealth_wave1 if avrg_prop_dental_cost >0

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float avrg_prop_dental_cost byte r11dentst float(inc_d endentulism race age_cat) byte(male education veteran) float(mothered dentalinsurance_w1) byte(QuantHI_wave1 Quant_wealth_wave1)
      .003784648 1 0 0 1 3 0 5 0 1 0 3 4
               0 1 0 0 1 1 0 5 0 1 1 1 3
      .021537896 1 0 0 1 2 0 3 0 0 1 4 4
       .09236358 1 0 0 1 2 0 4 0 1 0 1 4
     .0046232087 1 0 0 1 3 1 5 1 1 1 4 4
       .04624664 1 0 0 1 2 0 5 0 0 1 4 4
     .0019889215 1 0 0 4 3 0 5 0 1 1 4 4
               0 0 0 0 3 3 0 1 0 . 1 1 1
       .16542825 1 0 0 3 3 0 1 0 0 1 1 1
      .033333335 1 0 0 1 2 0 1 0 1 1 1 4
       .02422194 1 0 0 1 4 1 5 1 0 0 3 4
               0 1 0 0 3 3 0 1 0 0 1 1 1
               0 0 0 1 4 3 1 1 0 0 1 1 1
               0 1 0 1 2 3 0 3 0 0 1 1 1
               0 0 0 0 2 3 1 1 0 . 0 1 1
       .01634702 1 0 0 1 3 0 4 0 1 1 4 1
               0 0 1 1 2 3 0 1 0 . 1 2 1
       .04144562 1 0 0 1 3 0 4 0 1 1 3 4
     .0035514846 1 0 0 1 3 1 5 1 1 1 4 4
       .14424561 1 0 0 1 3 0 1 0 1 0 2 4
               0 0 0 0 1 3 0 3 0 1 0 1 3
      .002596046 1 0 1 4 3 0 5 0 0 1 4 3
      .002776852 0 0 0 4 3 1 5 1 0 1 4 3
     .0032806755 1 0 0 1 3 0 3 0 0 1 3 4
               0 0 0 1 1 3 1 4 1 . 1 3 3
      .020654306 1 0 0 1 2 0 5 0 1 1 3 3
        .3813447 1 0 0 1 4 0 5 0 1 0 4 4
      .016246201 1 0 0 1 3 1 5 1 1 0 1 4
       .10871864 1 0 0 1 3 0 3 0 1 0 1 4
       .01777209 1 0 0 1 3 1 5 0 0 1 4 3
       .00951611 1 0 0 1 3 0 5 0 1 1 4 3
               0 1 0 0 2 3 0 1 0 0 1 2 3
               0 0 0 0 2 3 0 5 0 1 0 2 1
               0 0 0 1 2 3 0 1 0 0 0 1 3
               0 0 0 1 2 2 0 3 0 0 0 3 1
       .02071823 1 0 0 2 3 1 3 1 1 1 2 3
               0 1 0 0 2 3 0 3 0 1 1 2 3
       .10893247 0 0 0 2 3 1 3 0 0 0 1 1
       .00540276 1 0 0 3 1 0 3 0 1 1 2 4
      .001699293 1 0 0 4 3 0 1 0 0 1 3 3
     .0029537205 1 0 0 4 4 1 5 0 0 1 3 3
       .05338598 1 0 0 3 3 1 4 1 1 1 1 3
      .001384535 1 0 0 1 2 0 4 0 1 1 1 3
      .012099246 1 0 0 1 2 0 4 0 0 0 4 4
        .8439155 1 0 0 2 3 0 5 0 0 1 1 1
               0 0 0 1 4 3 0 4 0 0 1 2 1
      .004110477 1 1 0 1 3 1 1 0 1 1 2 4
       .01130746 1 0 0 1 3 0 5 0 1 1 2 4
      .004008539 1 0 0 1 3 1 3 1 0 1 3 4
               0 0 0 0 2 3 0 4 0 0 0 2 3
      .004610162 1 0 0 1 4 1 5 1 1 1 4 4
       .05020221 1 0 0 3 3 0 3 0 0 0 2 2
               0 0 0 1 3 3 1 2 1 0 0 2 2
     .0020562997 1 0 0 4 3 0 5 0 0 0 2 2
               0 0 0 0 2 3 0 1 0 0 0 1 1
      .017711425 1 0 0 2 3 0 3 0 0 0 1 1
               0 0 0 0 2 3 0 1 0 . 0 1 1
      .013680274 1 0 0 1 3 1 4 1 0 0 3 1
        .0292491 1 1 0 4 2 0 1 0 1 1 3 1
        .0445552 1 0 0 1 4 1 3 1 1 0 3 4
      .007221488 1 0 0 1 3 0 1 0 1 0 3 4
      .014167874 1 0 0 1 3 0 5 0 1 1 3 4
               0 0 0 0 1 3 0 3 0 1 0 2 2
       .04431479 1 0 0 1 4 0 4 0 0 0 3 4
      .016026935 1 0 0 1 4 1 5 1 . 1 3 4
       .02799761 1 0 0 1 4 1 4 1 1 0 2 3
       .01935859 1 0 0 1 3 0 3 0 0 0 2 3
               0 1 0 0 1 2 0 3 0 1 1 2 2
               0 1 0 0 1 3 0 2 0 0 1 1 4
    .00057418464 1 0 0 3 3 0 3 0 . 0 1 1
               0 0 0 1 2 3 0 4 0 1 0 1 2
               0 0 0 0 1 3 0 1 0 0 0 1 1
      .018763967 1 0 0 1 3 1 4 1 1 1 3 3
       .00919189 1 0 0 1 3 1 3 0 . 0 2 3
               0 0 0 0 1 3 0 3 0 1 0 1 4
     .0022878346 1 0 0 1 4 1 1 1 0 1 3 3
     .0089355465 1 0 0 1 3 1 5 1 1 0 4 4
      .002441883 0 0 0 1 3 1 5 0 0 1 2 4
       .01016793 1 0 0 1 1 0 5 0 1 1 2 4
               0 0 0 1 1 3 1 2 0 0 0 2 2
      .017079419 1 0 0 3 2 0 1 0 0 0 2 2
               0 0 0 0 1 4 1 1 0 0 1 2 3
      .015497336 1 0 0 1 4 0 4 0 0 0 1 2
               0 0 0 1 2 3 0 3 0 0 0 1 1
               0 0 0 0 2 3 1 2 0 1 0 1 1
               0 0 1 1 2 3 1 3 0 1 0 1 2
               0 0 0 0 2 3 0 4 0 0 0 1 1
     .0003999116 1 0 0 2 3 1 4 1 0 1 4 2
     .0004577078 1 1 0 2 1 0 4 0 0 1 4 2
      .007543103 1 0 0 2 3 1 1 0 1 0 2 2
               0 0 0 1 1 3 1 1 1 0 0 3 4
       .03690508 1 0 0 1 3 0 1 0 0 0 3 4
               0 0 0 1 2 3 1 1 1 . 0 1 2
               0 0 0 0 2 2 0 3 0 1 0 2 3
               0 0 0 1 1 2 0 3 0 . 0 2 1
               0 0 1 1 1 3 1 4 0 1 0 3 3
               0 0 0 0 1 2 0 3 0 1 0 3 3
      .010373444 1 0 0 1 3 0 4 0 1 1 1 1
               0 0 0 0 1 3 0 3 0 0 0 2 3
               0 0 0 0 1 3 0 1 0 1 0 1 1
    end
    label values r11dentst YESNO
    label def YESNO 0 "0.no", modify
    label def YESNO 1 "1.yes", modify
    label values inc_d inc_d
    label def inc_d 0 "No", modify
    label def inc_d 1 "Yes", modify
    label values endentulism endentulism
    label def endentulism 0 "No", modify
    label def endentulism 1 "Yes", modify
    label values race race
    label def race 1 "White", modify
    label def race 2 "Black", modify
    label def race 3 "Hispanic", modify
    label def race 4 "Other", modify
    label values age_cat age_cat
    label def age_cat 1 "50-59", modify
    label def age_cat 2 "60-69", modify
    label def age_cat 3 "70-79", modify
    label def age_cat 4 "80+", modify
    label values male male
    label def male 0 "Female", modify
    label def male 1 "Male", modify
    label values education EDUC
    label def EDUC 1 "1.lt high-school", modify
    label def EDUC 2 "2.ged", modify
    label def EDUC 3 "3.high-school graduate", modify
    label def EDUC 4 "4.some college", modify
    label def EDUC 5 "5.college and above", modify
    label values veteran veteran
    label def veteran 0 "No", modify
    label def veteran 1 "Yes", modify
    label values mothered mothered
    label def mothered 0 "Less than High School", modify
    label def mothered 1 "High School or Higher", modify
    label values dentalinsurance_w1 dentalinsurance_w1
    label def dentalinsurance_w1 0 "No", modify
    label def dentalinsurance_w1 1 "Yes", modify

  • #2
    When I try to run your code I get the error "oopdental_costs_wave1 not found". When you use dataex, make sure that the data and code provided actually work.

    Roodman's cmp command (available from SSC) seems to be able to estimate 98% of all the statistical models known to humankind as well as several that aren't. ;-) Perhaps it could handle your task? It lets you specify probit and fractional probit models in one command, but I am not sure if that is the same as a 2 step model.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Ok, check this article:

      https://journals.sagepub.com/doi/10....36867X19854017

      Generalized two-part fractional regression with cmp

      Abstract

      Researchers who model fractional dependent variables often need to consider whether their data were generated by a two-part process. Two-part models are ideal for modeling two-part processes because they allow us to model the participation and magnitude decisions separately. While community-contributed commands currently facilitate estimation of two-part models, no specialized command exists for fitting two-part models with process dependency. In this article, I describe generalized two-part fractional regression, which allows for dependency between models’ parts. I show how this model can be fit using the community-contributed cmp command (Roodman, 2011, Stata Journal 11: 159–206). I use a data example on the financial leverage of firms to illustrate how cmp can be used to fit generalized two-part fractional regression. Furthermore, I show how to obtain predicted values of the fractional dependent variable and marginal effects that are useful for model interpretation. Finally, I show how to compute model fit statistics and perform the RESET test, which are useful for model evaluation.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://www3.nd.edu/~rwilliam

      Comment

      Working...
      X