Announcement

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

  • Option osample not working in teffects dialog box for nnmatch

    This thread is a follow up to the problem described in this post ,

    I am on Stata/IC 14.2 for Windows (64-bit x86-64) with Revision 29 Jan 2018.
    The option "osample" in the tab "Advanced" is not processed by the dialog box for the command teffects when selecting/using "Nearest neighbour matching" as the estimator.
    According to the help file of teffects, the option "osample" is supported by this estimator. In fact, calling teffects nnmatch something, osample(varname) does not give an error on the command line.
    The lines below are taken from the official teffects.dlg and show where the call to set the option is forgotten. The problem is in the program adv_output which is in lines 1155 to 1611. I omitted the comments in the code and try to highlight the problem.

    If you look at the code, then you see that for all other estimators there is a line optionarg adv.ed_osample, which is missing for nnmatch.

    Code:
    PROGRAM adv_output
    BEGIN
        if model.cb_est.iseq("ra") | model.cb_est.iseq("ipw") | ///
           model.cb_est.iseq("ipwra") | model.cb_est.iseq("aipw") {
               optionarg /hidedefault adv.ed_tol
               optionarg adv.ed_ctrl
               optionarg adv.ed_lvl
               optionarg adv.ed_osample
        }
        if model.cb_est.iseq("nnmatch") {
    
            optionarg adv.ed_cal
            optionarg /hidedefault adv.ed_dtol
            optionarg /hidedefault adv.ed_pstol
            optionarg adv.ed_stub
            optionarg adv.ed_ctrl_ps
            optionarg adv.ed_lvl_ps
    HERE MISSING optionarg adv.ed_osample
            if adv.ck_metric {
                put "metric("
                if adv.rb_mah {
                    put "mahalanobis"
                }
                if adv.rb_iva {
                    put "ivariance"
                }
                if adv.rb_euc {
                    put "euclidean"
                }
                if adv.rb_user {
                    put "matrix "
                    require adv.cb_user
                    put adv.cb_user
                }
                put ")"
            }
        }
    
        if model.cb_est.iseq("psmatch") {
            optionarg adv.ed_cal
            optionarg /hidedefault adv.ed_pstol
            optionarg adv.ed_stub
            optionarg adv.ed_ctrl_ps
            optionarg adv.ed_lvl_ps
            optionarg adv.ed_osample
        }
    END
    To reproduce just use any dataset and try to use the "osample" option for teffects nnmatch in the dialog box. The command will be sent but without the said option.
    If needed, I could provide a walk-through of the dialog box code from where the edit field of the option is defined until the actual command gets issued.
    I found the same missing line also in Stata 13. I don't have Stata 15, but looking at whatsnew file for Stata 15 I did not see this missing line fixed.
    PS: Forgive for the formatting, I did not see any guidelines how to highlight things in a post.
    Edit: Minor spelling mistakes corrected and information about other Stata versions added.
    Last edited by Sven-Kristjan Bormann; 15 Jul 2018, 14:20.

  • #2
    Using
    Code:
    Stata/SE 15.1 for Mac (64-bit Intel)
    Revision 27 Jun 2018
    I can confirm that
    Code:
    use http://www.stata-press.com/data/r15/cattaneo3
    teffects nnmatch (bweight mage prenatal1 mmarried fbaby) (mbsmoke), osample(wjl1)
    creates a variable wjl1, but that using the dialog box and specifying wjl2 in the advanced tab generates the command shown in my Results window as
    Code:
    teffects nnmatch (bweight mage prenatal1 mmarried fbaby) (mbsmoke)
    lacking the osample option.

    So the problem has not been fixed in the latest revision of Stata 15. In reporting this "oversight" to Stata Technical Services, you can link to this topic and save yourself the effort of rewriting the problem.

    Comment

    Working...
    X