Announcement

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

  • Problems trying to estimate a dose response function (doseresponse2)

    Hi all. I have a panel dataset with socio-economic and political information on Brazilian municipalities (2002-2006-2010-2014-2018). I want to verify whether the number of higher education institutions in a municipality causes an increase in voting support for the left.

    My outcome variable is “voto_pt_pres_perc” (vote for the Workers’ Party’s candidate for president) and my treatment variable is ”n_he_inst” (number of higher education institutions in a given municipality and year).

    To that end, I want to estimate a dose response function with the command “doseresponse2”.

    I have perused Guardabascio and Ventura’s (2013) paper “Estimating the dose-response function through the GLM approach” (https://mpra.ub.uni-muenchen.de/45013/), to no avail.

    When I run the command, the estimation is not completed. The unsuccessful estimation follows below.

    Can someone offer a help?

    Thank you


    Code:
    qui egen max_p = max(n_he_inst)
    gen fraction = n_he_inst/max_p
    qui gen  cut1 = 50/max_p if fraction<=50/max_p 
    qui replace cut1 = 100/max_p if fraction>50/max_p & fraction<=100/max_p
    qui replace cut1 = 158/max_p if fraction>100/max_p
    mat def tp1 = (0.10\0.20\0.30\0.40\0.50\0.60\0.70\0.80)
    
    doseresponse2 coal_pres idhm pol_pi ln_r_pib_per_cap transfers pop_urb_perc ln_pop_tot schooling, outcome(voto_pt_pres_perc) t(fraction) gpscore(pscore) predict(hat_treat_nb) sigma(sd_nb) cutpoints(n_he_inst_cat) index(mean) nq_gps(5) t_transf(ln) dose_response(dose_response) tpoints(tp1) delta(1) reg_type_t(quadratic) family(binomial) link(logit) reg_type_gps(quadratic) interaction(1) bootstrap(yes) boot_reps(100) filename("output") analysis(yes) graph("graph_output") detail

    ********************************************
    ESTIMATE OF THE GENERALIZED PROPENSITY SCORE
    ********************************************

    Generalized Propensity Score
    By agreement we assume that the logarithm of 0 is 0

    ************************************************** ****
    Algorithm to estimate the generalized propensity score
    ************************************************** ****



    Estimation of the propensity score

    The log transformation of the treatment variable fraction is used

    T
    -------------------------------------------------------------
    Percentiles Smallest
    1% -5.062595 -5.062595
    5% -5.062595 -5.062595
    10% -3.676301 -5.062595 Obs 27,744
    25% 0 -5.062595 Sum of wgt. 27,744

    50% 0 Mean -.5273679
    Largest Std. dev. 1.46311
    75% 0 0
    90% 0 0 Variance 2.140691
    95% 0 0 Skewness -2.493764
    99% 0 0 Kurtosis 7.40458
    dependent variable T has negative values
    r(499);



  • #2
    -doseresponse2- is not an official Stata command. You are expected to source name the user written programme as per the forum rules. I am not familiar with it however, looking at the output error message (again see the forum rules for posting resutls using code delimiters), it seems the problem lies with the 'fraction' (T) variable. It cannot have negative values.
    Roman

    Comment

    Working...
    X