Announcement

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

  • UK Stata Conference (London, 7-8 Sept): programme and registration info now available

    The Conference programme is now live on the conference site, and registration is now open. Here are the links to the pages:

    Conference Programme - https://www.statauk.timberlake-confe...ata-conference.

    Register link - https://www.statauk.timberlake-confe...ata-conference

    The conference is being held in the LSE's Marshall Building in the heart of central London. (See MAR building on map at https://www.lse.ac.uk/lse-information/campus-map. The link also has directions.)

    We are looking forward to seeing you in September.

    Stephen Jenkins Stephen Jenkins , Tim Collier Tim Collier , Roger Newson Roger Newson (scientific co-organisers)
    David Corbett (on behalf of Timberlake, UK Stata distributors, and conference logistics organisers and financial supporters)

  • #2
    Dear Prof Stephen

    I am running an MVP coorected for selection bias using the syntax in the paper you wrote with Lorenzo Cappellari and my results are not converging. I tries technique after ml model and difficult after ml maximize and reducd number of drows as you suggested in that paper but the problem persists. Please help me other idea to solve this problem

    Here are the resuts I found and under those tables its where it is written convergence not achieved


    . *! version 1.0.0 27apr2006
    . clear

    . set more off

    . cap log close

    .
    .
    . * cd d:\home\stephenj\MYProjects\cappellari\egen\plugin \sj3
    .
    . cd D:\flo
    D:\flo

    .
    . log using test_trial_dta_100.log,replace
    --------------------------------------------------------------------------------------------------
    name: <unnamed>
    log: D:\flo\test_trial_dta_100.log
    log type: text
    opened on: 19 Jul 2023, 10:18:36

    .
    .
    . ********* test_trial_dta_100 **********************
    . *
    . * Three binary outcomes, one of which is incidentally truncated
    . *
    . * 100 halton draws, with antithetics
    . *
    . ************************************************** *
    . which _gmvnp
    c:\ado\plus\_\_gmvnp.ado
    *! version 3.0.7 30march2006 Cappellari & Jenkins (aa option dropped; use -mdraws- instead)
    *! version 3.0.6 30march2006 Cappellari & Jenkins (antithetic var type double in adoonly code)
    *! version 3.0.5 24march2006 Cappellari & Jenkins (draws vble names altered so can have M>=10)
    *! version 3.0.4 15march2006 Cappellari & Jenkins (cholesky matrix checking altered again)
    *! version 3.0.3 11feb2006 Cappellari & Jenkins (more cholesky matrix checking)
    *! version 3.0.2 08feb2006 Cappellari & Jenkins (mucked with by Gutierrez for plugin)
    *! version 3.0.1 06dec2005 Cappellari & Jenkins (cholesky factors not corrs, drop means option)
    *! version 2.2.0 01aug2005 Cappellari & Jenkins (means option as matrix not list)
    *! version 2.1.0 01june2005 Cappellari & Jenkins (aa option added)
    *! version 2.0.0 19apr2005 Cappellari & Jenkins
    *! Multivariate normal probabilities by method of MSL

    . which mdraws
    c:\ado\plus\m\mdraws.ado
    *! version 1.3.0 30march2006 Add option to create antithetic draws; make rclass
    *! version 1.2.0 24march2006 Fix vble names for M >= 10 case
    *! version 1.1.0 26jan2006 Cappellari & Jenkins
    *! Create Halton and pseudo-random std uniform draws
    *! for use in maximum simulated likelihood estimation
    *! Code for Halton draws based on do file code
    *! from Arne Uhlendorff which in turn uses a program
    *! posted on Statalist by Nick Cox in August 2004
    *! http://www.stata.com/statalist/archi.../msg00222.html

    .
    . use Data

    .
    . ta manureC inter_manC, missing

    | inter_manC
    manureC | 0 1 | Total
    -----------+----------------------+----------
    0 | 128 75 | 203
    1 | 239 0 | 239
    -----------+----------------------+----------
    Total | 367 75 | 442

    .
    . // gets initial values
    . quietly{

    .
    .
    . **********************
    . * PLUGIN & antithetics
    . **********************
    .
    . set rmsg on
    r; t=0.00 10:18:36

    . mdraws, dr(50) neq(3) prefix(z) burn(10) antithetics
    Created 50 Halton draws per equation for 3 dimensions. Number of initial draws dropped per
    dimension = 10 . Primes used:

    2 3 5
    Also created 50 antithetic draws per dimension for 3 dimensions. Note: there are now 100
    draws per equation
    r; t=3.95 10:18:40

    . set rmsg off

    .
    . global dr = r(n_draws)

    .
    .
    . capture program drop myll

    . program define myll
    1. args lnf x1 x2 x3 c21 c31 c32
    2. tempvar sp2 sp3 k1 k2 k3
    3. quietly {
    4.
    . gen double `k1' = 2*$ML_y1 - 1
    5. gen double `k2' = 2*$ML_y2 - 1
    6. gen double `k3' = 2*$ML_y3 - 1
    7.
    . tempname cf21 cf22 cf31 cf32 cf33 C1 C2
    8.
    . su `c21', meanonly
    9. scalar `cf21' = r(mean)
    10. su `c31', meanonly
    11. scalar `cf31' = r(mean)
    12. su `c32', meanonly
    13. scalar `cf32' = r(mean)
    14.
    . scalar `cf22' = sqrt(1 - `cf21'^2)
    15. scalar `cf33' = sqrt(1 - `cf31'^2 - `cf32'^2)
    16.
    . mat `C1' = (1, 0 , 0 \ `cf21', `cf22', 0 \ `cf31', `cf32', `cf33')
    17. mat `C2' = (1, 0 \ `cf21', `cf22')
    18.
    . egen `sp3' = mvnp(`x1' `x2' `x3') if $ML_y1==1, ///
    > chol(`C1') dr($dr) prefix(z) signs(`k1' `k2' `k3') adoonly
    19.
    . egen `sp2' = mvnp(`x1' `x2') if $ML_y1==0, ///
    > chol(`C2') dr($dr) prefix(z) signs(`k1' `k2') adoonly
    20.
    . replace `lnf'= cond($ML_y1, ln(`sp3'), ln(`sp2'), .)
    21. }
    22.
    . end

    .
    .
    . ml model lf myll (ncvC: ncvC = educ exp famlab farmsiz ext_01 lnagricrevenue Locbutu Locki
    > te Locmuha) ///
    > (manureC: manureC = awareman01 satisf_01 Locbutu farmsiz ext_01 Lockite Lo
    > cmuha) ///
    > (inter_manC : inter_manC = cred_01 distinputmarket ext_01 awareInt01 Lockite
    > Locmuha ) ///
    > /c21 /c31 /c32 ///
    > , missing title("3-var probit, 1 selection, MSL, $dr Halton draws") vce (robust)
    > technique(bhhh 10 nr 1000)

    .
    . ml init b0

    .
    . set rmsg on
    r; t=0.00 10:18:40

    . ml maximize, iterate (0) tolerance(1e-6) nrtolerance(1e-5) skip difficult
    (setting technique to bhhh)
    Iteration 0: log pseudolikelihood = -335.51128
    convergence not achieved

    3-var probit, 1 selection, MSL, 100 Halton draws

    Number of obs = 442
    Wald chi2(9) = 20.61
    Log pseudolikelihood = -335.51128 Prob > chi2 = 0.0145

    ---------------------------------------------------------------------------------
    | Robust
    | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    ----------------+----------------------------------------------------------------
    ncvC |
    educ | .0069802 .0218712 0.32 0.750 -.0358865 .049847
    exp | .0068288 .0071027 0.96 0.336 -.0070922 .0207498
    famlab | -.0653329 .0735925 -0.89 0.375 -.2095715 .0789058
    farmsiz | .0032898 .004385 0.75 0.453 -.0053047 .0118843
    ext_01 | .054433 .2162168 0.25 0.801 -.3693442 .4782101
    lnagricrevenue | -.0546966 .0236302 -2.31 0.021 -.1010111 -.0083822
    Locbutu | -.3966469 .2820462 -1.41 0.160 -.9494472 .1561535
    Lockite | .3043674 .2203512 1.38 0.167 -.1275129 .7362477
    Locmuha | -.346528 .2686993 -1.29 0.197 -.8731689 .180113
    _cons | -.7903151 .4210578 -1.88 0.061 -1.615573 .034943
    ----------------+----------------------------------------------------------------
    manureC |
    awareman01 | -2.997981 .392281 -7.64 0.000 -3.766837 -2.229124
    satisf_01 | -.3888688 .1534958 -2.53 0.011 -.6897151 -.0880224
    Locbutu | .4200682 .2017698 2.08 0.037 .0246067 .8155298
    farmsiz | -.007984 .0055719 -1.43 0.152 -.0189048 .0029367
    ext_01 | .0127077 .149652 0.08 0.932 -.2806048 .3060201
    Lockite | .0131511 .1936978 0.07 0.946 -.3664896 .3927917
    Locmuha | .5131335 .1945027 2.64 0.008 .1319153 .8943517
    _cons | .418877 .1488437 2.81 0.005 .1271488 .7106052
    ----------------+----------------------------------------------------------------
    inter_manC |
    cred_01 | -.1184758 .6315677 -0.19 0.851 -1.356326 1.119374
    distinputmarket | .0011843 .0066376 0.18 0.858 -.0118251 .0141937
    ext_01 | .6654291 .796351 0.84 0.403 -.8953902 2.226248
    awareInt01 | .240178 .4297007 0.56 0.576 -.60202 1.082376
    Lockite | -.3308501 .6010304 -0.55 0.582 -1.508848 .8471479
    Locmuha | -.0717019 1.095897 -0.07 0.948 -2.219621 2.076217
    _cons | -1.230877 . . . . .
    ----------------+----------------------------------------------------------------
    /c21 | 0 .1303736 0.00 1.000 -.2555276 .2555276
    /c31 | 0 .8136434 0.00 1.000 -1.594712 1.594712
    /c32 | 0 (constrained)
    ---------------------------------------------------------------------------------
    Warning: convergence not achieved
    r; t=8.16 10:18:48

    . set rmsg off

    . ml, coeflegend

    3-var probit, 1 selection, MSL, 100 Halton draws

    Number of obs = 442
    Wald chi2(9) = 20.61
    Log pseudolikelihood = -335.51128 Prob > chi2 = 0.0145

    ---------------------------------------------------------------------------------
    | Coef. Legend
    ----------------+----------------------------------------------------------------
    ncvC |
    educ | .0069802 _b[ncvC:educ]
    exp | .0068288 _b[ncvC:exp]
    famlab | -.0653329 _b[ncvC:famlab]
    farmsiz | .0032898 _b[ncvC:farmsiz]
    ext_01 | .054433 _b[ncvC:ext_01]
    lnagricrevenue | -.0546966 _b[ncvC:lnagricrevenue]
    Locbutu | -.3966469 _b[ncvC:Locbutu]
    Lockite | .3043674 _b[ncvC:Lockite]
    Locmuha | -.346528 _b[ncvC:Locmuha]
    _cons | -.7903151 _b[ncvC:_cons]
    ----------------+----------------------------------------------------------------
    manureC |
    awareman01 | -2.997981 _b[manureC:awareman01]
    satisf_01 | -.3888688 _b[manureC:satisf_01]
    Locbutu | .4200682 _b[manureC:Locbutu]
    farmsiz | -.007984 _b[manureC:farmsiz]
    ext_01 | .0127077 _b[manureC:ext_01]
    Lockite | .0131511 _b[manureC:Lockite]
    Locmuha | .5131335 _b[manureC:Locmuha]
    _cons | .418877 _b[manureC:_cons]
    ----------------+----------------------------------------------------------------
    inter_manC |
    cred_01 | -.1184758 _b[inter_manC:cred_01]
    distinputmarket | .0011843 _b[inter_manC:distinputmarket]
    ext_01 | .6654291 _b[inter_manC:ext_01]
    awareInt01 | .240178 _b[inter_manC:awareInt01]
    Lockite | -.3308501 _b[inter_manC:Lockite]
    Locmuha | -.0717019 _b[inter_manC:Locmuha]
    _cons | -1.230877 _b[inter_manC:_cons]
    ----------------+----------------------------------------------------------------
    /c21 | 0 _b[/c21]
    /c31 | 0 _b[/c31]
    /c32 | 0 _b[/c32]
    ---------------------------------------------------------------------------------
    Warning: convergence not achieved

    .
    . // Derive correlations from cholesky factors
    . // C is lower triangular, with 1s on the leading diagonal
    . // r21 = c21, r31 = c31, r32 = c21*c31 + c22*c32
    .
    . nlcom (r21: _b[/c21]) ///
    > (r31: _b[/c31]) ///
    > (r32: _b[/c21]*_b[/c31] ///
    > + sqrt(1 - _b[/c21]^2 )*_b[/c32]) ///
    > , post

    r21: _b[/c21]
    r31: _b[/c31]
    r32: _b[/c21]*_b[/c31] + sqrt(1 - _b[/c21]^2 )*_b[/c32]

    ------------------------------------------------------------------------------
    | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    r21 | 0 .1303736 0.00 1.000 -.2555276 .2555276
    r31 | 0 .8136434 0.00 1.000 -1.594712 1.594712
    r32 | 0 (omitted)
    ------------------------------------------------------------------------------

    .
    .
    . // sample selection ignorable if r21 = r31 = 0
    .
    . test r21 r31

    ( 1) r21 = 0
    ( 2) r31 = 0

    chi2( 2) = 0.00
    Prob > chi2 = 1.0000

    .
    . log close
    name: <unnamed>
    log: D:\flo\test_trial_dta_100.log
    log type: text
    closed on: 19 Jul 2023, 10:18:49


    Regards
    Florence Bwiza, PhD student at University of Nairobi




    Comment

    Working...
    X