Announcement

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

  • #16
    Continue:

    Code:
      ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
        - version 9, missing
        - local version : di "version " string(_caller()) ", missing :"
        - if replay() {
          if _by() {
          error 190
          }
          `version' Display `0'
          exit
          }
        - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
        - local diopts0 `beta' `eform' `header' `table' `plus'
        = local diopts0     
        - if _by() {
          local BY `"by `_byvars'`_byrc0':"'
          }
        - if `:length local vce' {
        = if 0 {
          `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
          if "`s(exit)'" != "" {
          ereturn local cmdline `"regress `0'"'
          exit
          }
          _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
          if "`r(cluster)'" != "" {
          local cluster cluster(`r(cluster)')
          }
          else if "`r(vce)'" != "ols" {
          local robust = "`r(vce)'"
          }
          local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
          if "`hc2'`hc3'" != "" {
          if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
          opts_exclusive "vce(`vce') `hc2' `hc3'"
          }
          local vce `hc2' `hc3'
          local options `options' `vce'
          }
          }
        - else if "`cluster'" != "" {
        = else if "" != "" {
          local vce cluster
          }
        - else if "`weight'" == "pweight" | "`robust'" != "" {
        = else if "" == "pweight" | "" != "" {
          local vce robust
          }
        - else if "`hc2'`hc3'" != "" {
        = else if "" != "" {
          local vce `hc2' `hc3'
          local options `options' `vce'
          }
        - else local vce ols
        - _get_diopts diopts options, `options'
        = _get_diopts diopts options, 
        - if _by() {
          `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
          }
        - else {
        - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
        = version 13, missing : _regress __00000H  __00000G if __000044<=-11 & __000044>=-60  [],     
        - }
        - ereturn local vce `vce'
        = ereturn local vce ols
        - ereturn local marginsok "XB default"
        - ereturn hidden local marginsprop minus
        - ereturn local title "Linear regression"
        - ereturn local cmdline `"regress `0'"'
        = ereturn local cmdline `"regress __00000H  __00000G if __000044<=-11 & __000044>=-60"'
        - _post_vce_rank, checksize
        -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
      - tempvar ar_`z'_`i'
      = tempvar ar_1_3
      - qui predict `ar_`z'_`i'' , resid
      = qui predict __000049 , resid
        ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
        - version 8.2, missing
        - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
        = if "regress" == "rocreg" & "regres_p" == "" {
          di as err "predict not allowed after nonparametric ROC"
          exit 198
          }
        - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
        = if ""!="" & "matrix"!="matrix" {
          error 321
          }
        - if _caller()<=5 | "`e(predict)'"=="" {
        = if _caller()<=5 | "regres_p"=="" {
          _predict `0'
          }
        - else {
        - local v : display string(_caller())
        - version `v', missing
        = version 13, missing
        - `e(predict)' `0'
        = regres_p __000049 , resid
        - }
        -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
      - _crcslbl `ar_`z'_`i'' ``i''
      = _crcslbl __000049 pr_mitra
        ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
        - version 6
        - args dst src
        - local w : variable label `src'
        = local w : variable label pr_mitra
        - if `"`w'"' == "" {
        = if `""' == "" {
        - local w "`src'"
        = local w "pr_mitra"
        - }
        - label variable `dst' `"`w'"'
        = label variable __000049 `"pr_mitra"'
        ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
      - }
      - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
      = qui regress __00000M  __00000L if __000044<=-11 & __000044>=-60
        ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
        - version 9, missing
        - local version : di "version " string(_caller()) ", missing :"
        - if replay() {
          if _by() {
          error 190
          }
          `version' Display `0'
          exit
          }
        - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
        - local diopts0 `beta' `eform' `header' `table' `plus'
        = local diopts0     
        - if _by() {
          local BY `"by `_byvars'`_byrc0':"'
          }
        - if `:length local vce' {
        = if 0 {
          `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
          if "`s(exit)'" != "" {
          ereturn local cmdline `"regress `0'"'
          exit
          }
          _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
          if "`r(cluster)'" != "" {
          local cluster cluster(`r(cluster)')
          }
          else if "`r(vce)'" != "ols" {
          local robust = "`r(vce)'"
          }
          local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
          if "`hc2'`hc3'" != "" {
          if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
          opts_exclusive "vce(`vce') `hc2' `hc3'"
          }
          local vce `hc2' `hc3'
          local options `options' `vce'
          }
          }
        - else if "`cluster'" != "" {
        = else if "" != "" {
          local vce cluster
          }
        - else if "`weight'" == "pweight" | "`robust'" != "" {
        = else if "" == "pweight" | "" != "" {
          local vce robust
          }
        - else if "`hc2'`hc3'" != "" {
        = else if "" != "" {
          local vce `hc2' `hc3'
          local options `options' `vce'
          }
        - else local vce ols
        - _get_diopts diopts options, `options'
        = _get_diopts diopts options, 
        - if _by() {
          `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
          }
        - else {
        - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
        = version 13, missing : _regress __00000M  __00000L if __000044<=-11 & __000044>=-60  [],     
        - }
        - ereturn local vce `vce'
        = ereturn local vce ols
        - ereturn local marginsok "XB default"
        - ereturn hidden local marginsprop minus
        - ereturn local title "Linear regression"
        - ereturn local cmdline `"regress `0'"'
        = ereturn local cmdline `"regress __00000M  __00000L if __000044<=-11 & __000044>=-60"'
        - _post_vce_rank, checksize
        -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
      - tempvar ar_`z'_`i'
      = tempvar ar_1_4
      - qui predict `ar_`z'_`i'' , resid
      = qui predict __00004A , resid
        ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
        - version 8.2, missing
        - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
        = if "regress" == "rocreg" & "regres_p" == "" {
          di as err "predict not allowed after nonparametric ROC"
          exit 198
          }
        - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
        = if ""!="" & "matrix"!="matrix" {
          error 321
          }
        - if _caller()<=5 | "`e(predict)'"=="" {
        = if _caller()<=5 | "regres_p"=="" {
          _predict `0'
          }
        - else {
        - local v : display string(_caller())
        - version `v', missing
        = version 13, missing
        - `e(predict)' `0'
        = regres_p __00004A , resid
        - }
        -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
      - _crcslbl `ar_`z'_`i'' ``i''
      = _crcslbl __00004A pr_ptaras
        ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
        - version 6
        - args dst src
        - local w : variable label `src'
        = local w : variable label pr_ptaras
        - if `"`w'"' == "" {
        = if `""' == "" {
        - local w "`src'"
        = local w "pr_ptaras"
        - }
        - label variable `dst' `"`w'"'
        = label variable __00004A `"pr_ptaras"'
        ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
      - }
      - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
      = qui regress __00000R  __00000Q if __000044<=-11 & __000044>=-60
        ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
        - version 9, missing
        - local version : di "version " string(_caller()) ", missing :"
        - if replay() {
          if _by() {
          error 190
          }
          `version' Display `0'
          exit
          }
        - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
        - local diopts0 `beta' `eform' `header' `table' `plus'
        = local diopts0     
        - if _by() {
          local BY `"by `_byvars'`_byrc0':"'
          }
        - if `:length local vce' {
        = if 0 {
          `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
          if "`s(exit)'" != "" {
          ereturn local cmdline `"regress `0'"'
          exit
          }
          _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
          if "`r(cluster)'" != "" {
          local cluster cluster(`r(cluster)')
          }
          else if "`r(vce)'" != "ols" {
          local robust = "`r(vce)'"
          }
          local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
          if "`hc2'`hc3'" != "" {
          if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
          opts_exclusive "vce(`vce') `hc2' `hc3'"
          }
          local vce `hc2' `hc3'
          local options `options' `vce'
          }
          }
        - else if "`cluster'" != "" {
        = else if "" != "" {
          local vce cluster
          }
        - else if "`weight'" == "pweight" | "`robust'" != "" {
        = else if "" == "pweight" | "" != "" {
          local vce robust
          }
        - else if "`hc2'`hc3'" != "" {
        = else if "" != "" {
          local vce `hc2' `hc3'
          local options `options' `vce'
          }
        - else local vce ols
        - _get_diopts diopts options, `options'
        = _get_diopts diopts options, 
        - if _by() {
          `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
          }
        - else {
        - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
        = version 13, missing : _regress __00000R  __00000Q if __000044<=-11 & __000044>=-60  [],     
        - }
        - ereturn local vce `vce'
        = ereturn local vce ols
        - ereturn local marginsok "XB default"
        - ereturn hidden local marginsprop minus
        - ereturn local title "Linear regression"
        - ereturn local cmdline `"regress `0'"'
        = ereturn local cmdline `"regress __00000R  __00000Q if __000044<=-11 & __000044>=-60"'
        - _post_vce_rank, checksize
        -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
      - tempvar ar_`z'_`i'
      = tempvar ar_1_5
      - qui predict `ar_`z'_`i'' , resid
      = qui predict __00004B , resid

    Comment


    • #17
      Continue:

      Code:
          ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
          - version 8.2, missing
          - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
          = if "regress" == "rocreg" & "regres_p" == "" {
            di as err "predict not allowed after nonparametric ROC"
            exit 198
            }
          - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
          = if ""!="" & "matrix"!="matrix" {
            error 321
            }
          - if _caller()<=5 | "`e(predict)'"=="" {
          = if _caller()<=5 | "regres_p"=="" {
            _predict `0'
            }
          - else {
          - local v : display string(_caller())
          - version `v', missing
          = version 13, missing
          - `e(predict)' `0'
          = regres_p __00004B , resid
          - }
          -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
        - _crcslbl `ar_`z'_`i'' ``i''
        = _crcslbl __00004B pr_aeon
          ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
          - version 6
          - args dst src
          - local w : variable label `src'
          = local w : variable label pr_aeon
          - if `"`w'"' == "" {
          = if `""' == "" {
          - local w "`src'"
          = local w "pr_aeon"
          - }
          - label variable `dst' `"`w'"'
          = label variable __00004B `"pr_aeon"'
          ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
        - }
        - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
        = qui regress __00000W  __00000V if __000044<=-11 & __000044>=-60
          ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
          - version 9, missing
          - local version : di "version " string(_caller()) ", missing :"
          - if replay() {
            if _by() {
            error 190
            }
            `version' Display `0'
            exit
            }
          - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
          - local diopts0 `beta' `eform' `header' `table' `plus'
          = local diopts0     
          - if _by() {
            local BY `"by `_byvars'`_byrc0':"'
            }
          - if `:length local vce' {
          = if 0 {
            `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
            if "`s(exit)'" != "" {
            ereturn local cmdline `"regress `0'"'
            exit
            }
            _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
            if "`r(cluster)'" != "" {
            local cluster cluster(`r(cluster)')
            }
            else if "`r(vce)'" != "ols" {
            local robust = "`r(vce)'"
            }
            local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
            if "`hc2'`hc3'" != "" {
            if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
            opts_exclusive "vce(`vce') `hc2' `hc3'"
            }
            local vce `hc2' `hc3'
            local options `options' `vce'
            }
            }
          - else if "`cluster'" != "" {
          = else if "" != "" {
            local vce cluster
            }
          - else if "`weight'" == "pweight" | "`robust'" != "" {
          = else if "" == "pweight" | "" != "" {
            local vce robust
            }
          - else if "`hc2'`hc3'" != "" {
          = else if "" != "" {
            local vce `hc2' `hc3'
            local options `options' `vce'
            }
          - else local vce ols
          - _get_diopts diopts options, `options'
          = _get_diopts diopts options, 
          - if _by() {
            `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
            }
          - else {
          - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
          = version 13, missing : _regress __00000W  __00000V if __000044<=-11 & __000044>=-60  [],     
          - }
          - ereturn local vce `vce'
          = ereturn local vce ols
          - ereturn local marginsok "XB default"
          - ereturn hidden local marginsprop minus
          - ereturn local title "Linear regression"
          - ereturn local cmdline `"regress `0'"'
          = ereturn local cmdline `"regress __00000W  __00000V if __000044<=-11 & __000044>=-60"'
          - _post_vce_rank, checksize
          -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
        - tempvar ar_`z'_`i'
        = tempvar ar_1_6
        - qui predict `ar_`z'_`i'' , resid
        = qui predict __00004C , resid
          ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
          - version 8.2, missing
          - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
          = if "regress" == "rocreg" & "regres_p" == "" {
            di as err "predict not allowed after nonparametric ROC"
            exit 198
            }
          - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
          = if ""!="" & "matrix"!="matrix" {
            error 321
            }
          - if _caller()<=5 | "`e(predict)'"=="" {
          = if _caller()<=5 | "regres_p"=="" {
            _predict `0'
            }
          - else {
          - local v : display string(_caller())
          - version `v', missing
          = version 13, missing
          - `e(predict)' `0'
          = regres_p __00004C , resid
          - }
          -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
        - _crcslbl `ar_`z'_`i'' ``i''
        = _crcslbl __00004C pr_carlsbg
          ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
          - version 6
          - args dst src
          - local w : variable label `src'
          = local w : variable label pr_carlsbg
          - if `"`w'"' == "" {
          = if `""' == "" {
          - local w "`src'"
          = local w "pr_carlsbg"
          - }
          - label variable `dst' `"`w'"'
          = label variable __00004C `"pr_carlsbg"'
          ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
        - }
        - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
        = qui regress __000011  __000010 if __000044<=-11 & __000044>=-60
          ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
          - version 9, missing
          - local version : di "version " string(_caller()) ", missing :"
          - if replay() {
            if _by() {
            error 190
            }
            `version' Display `0'
            exit
            }
          - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
          - local diopts0 `beta' `eform' `header' `table' `plus'
          = local diopts0     
          - if _by() {
            local BY `"by `_byvars'`_byrc0':"'
            }
          - if `:length local vce' {
          = if 0 {
            `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
            if "`s(exit)'" != "" {
            ereturn local cmdline `"regress `0'"'
            exit
            }
            _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
            if "`r(cluster)'" != "" {
            local cluster cluster(`r(cluster)')
            }
            else if "`r(vce)'" != "ols" {
            local robust = "`r(vce)'"
            }
            local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
            if "`hc2'`hc3'" != "" {
            if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
            opts_exclusive "vce(`vce') `hc2' `hc3'"
            }
            local vce `hc2' `hc3'
            local options `options' `vce'
            }
            }
          - else if "`cluster'" != "" {
          = else if "" != "" {
            local vce cluster
            }
          - else if "`weight'" == "pweight" | "`robust'" != "" {
          = else if "" == "pweight" | "" != "" {
            local vce robust
            }
          - else if "`hc2'`hc3'" != "" {
          = else if "" != "" {
            local vce `hc2' `hc3'
            local options `options' `vce'
            }
          - else local vce ols
          - _get_diopts diopts options, `options'
          = _get_diopts diopts options, 
          - if _by() {
            `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
            }
          - else {
          - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
          = version 13, missing : _regress __000011  __000010 if __000044<=-11 & __000044>=-60  [],     
          - }
          - ereturn local vce `vce'
          = ereturn local vce ols
          - ereturn local marginsok "XB default"
          - ereturn hidden local marginsprop minus
          - ereturn local title "Linear regression"
          - ereturn local cmdline `"regress `0'"'
          = ereturn local cmdline `"regress __000011  __000010 if __000044<=-11 & __000044>=-60"'
          - _post_vce_rank, checksize
          -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
        - tempvar ar_`z'_`i'
        = tempvar ar_1_7
        - qui predict `ar_`z'_`i'' , resid
        = qui predict __00004D , resid
          ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
          - version 8.2, missing
          - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
          = if "regress" == "rocreg" & "regres_p" == "" {
            di as err "predict not allowed after nonparametric ROC"
            exit 198
            }
          - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
          = if ""!="" & "matrix"!="matrix" {
            error 321
            }
          - if _caller()<=5 | "`e(predict)'"=="" {
          = if _caller()<=5 | "regres_p"=="" {
            _predict `0'
            }
          - else {
          - local v : display string(_caller())
          - version `v', missing
          = version 13, missing
          - `e(predict)' `0'
          = regres_p __00004D , resid
          - }
          -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
        - _crcslbl `ar_`z'_`i'' ``i''
        = _crcslbl __00004D pr_cck
          ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
          - version 6
          - args dst src
          - local w : variable label `src'
          = local w : variable label pr_cck
          - if `"`w'"' == "" {
          = if `""' == "" {
          - local w "`src'"
          = local w "pr_cck"
          - }
          - label variable `dst' `"`w'"'
          = label variable __00004D `"pr_cck"'
          ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
        - }
        - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
        = qui regress __000016  __000015 if __000044<=-11 & __000044>=-60
          ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
          - version 9, missing
          - local version : di "version " string(_caller()) ", missing :"
          - if replay() {
            if _by() {
            error 190
            }
            `version' Display `0'
            exit
            }
          - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
          - local diopts0 `beta' `eform' `header' `table' `plus'
          = local diopts0     
          - if _by() {
            local BY `"by `_byvars'`_byrc0':"'
            }
          - if `:length local vce' {
          = if 0 {
            `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
            if "`s(exit)'" != "" {
            ereturn local cmdline `"regress `0'"'
            exit
            }
            _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
            if "`r(cluster)'" != "" {
            local cluster cluster(`r(cluster)')
            }
            else if "`r(vce)'" != "ols" {
            local robust = "`r(vce)'"
            }
            local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
            if "`hc2'`hc3'" != "" {
            if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
            opts_exclusive "vce(`vce') `hc2' `hc3'"
            }
            local vce `hc2' `hc3'
            local options `options' `vce'
            }
            }
          - else if "`cluster'" != "" {
          = else if "" != "" {
            local vce cluster
            }
          - else if "`weight'" == "pweight" | "`robust'" != "" {
          = else if "" == "pweight" | "" != "" {
            local vce robust
            }
          - else if "`hc2'`hc3'" != "" {
          = else if "" != "" {
            local vce `hc2' `hc3'
            local options `options' `vce'
            }
          - else local vce ols
          - _get_diopts diopts options, `options'
          = _get_diopts diopts options, 
          - if _by() {
            `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
            }
          - else {
          - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
          = version 13, missing : _regress __000016  __000015 if __000044<=-11 & __000044>=-60  [],     
          - }
          - ereturn local vce `vce'
          = ereturn local vce ols
          - ereturn local marginsok "XB default"
          - ereturn hidden local marginsprop minus
          - ereturn local title "Linear regression"
          - ereturn local cmdline `"regress `0'"'
          = ereturn local cmdline `"regress __000016  __000015 if __000044<=-11 & __000044>=-60"'
          - _post_vce_rank, checksize
          -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
        - tempvar ar_`z'_`i'
        = tempvar ar_1_8
        - qui predict `ar_`z'_`i'' , resid
        = qui predict __00004E , resid

      Comment


      • #18
        Continue:

        Code:
           ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
            - version 8.2, missing
            - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
            = if "regress" == "rocreg" & "regres_p" == "" {
              di as err "predict not allowed after nonparametric ROC"
              exit 198
              }
            - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
            = if ""!="" & "matrix"!="matrix" {
              error 321
              }
            - if _caller()<=5 | "`e(predict)'"=="" {
            = if _caller()<=5 | "regres_p"=="" {
              _predict `0'
              }
            - else {
            - local v : display string(_caller())
            - version `v', missing
            = version 13, missing
            - `e(predict)' `0'
            = regres_p __00004E , resid
            - }
            -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
          - _crcslbl `ar_`z'_`i'' ``i''
          = _crcslbl __00004E pr_fn
            ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
            - version 6
            - args dst src
            - local w : variable label `src'
            = local w : variable label pr_fn
            - if `"`w'"' == "" {
            = if `""' == "" {
            - local w "`src'"
            = local w "pr_fn"
            - }
            - label variable `dst' `"`w'"'
            = label variable __00004E `"pr_fn"'
            ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
          - }
          - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
          = qui regress __00001B  __00001A if __000044<=-11 & __000044>=-60
            ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
            - version 9, missing
            - local version : di "version " string(_caller()) ", missing :"
            - if replay() {
              if _by() {
              error 190
              }
              `version' Display `0'
              exit
              }
            - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
            - local diopts0 `beta' `eform' `header' `table' `plus'
            = local diopts0     
            - if _by() {
              local BY `"by `_byvars'`_byrc0':"'
              }
            - if `:length local vce' {
            = if 0 {
              `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
              if "`s(exit)'" != "" {
              ereturn local cmdline `"regress `0'"'
              exit
              }
              _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
              if "`r(cluster)'" != "" {
              local cluster cluster(`r(cluster)')
              }
              else if "`r(vce)'" != "ols" {
              local robust = "`r(vce)'"
              }
              local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
              if "`hc2'`hc3'" != "" {
              if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
              opts_exclusive "vce(`vce') `hc2' `hc3'"
              }
              local vce `hc2' `hc3'
              local options `options' `vce'
              }
              }
            - else if "`cluster'" != "" {
            = else if "" != "" {
              local vce cluster
              }
            - else if "`weight'" == "pweight" | "`robust'" != "" {
            = else if "" == "pweight" | "" != "" {
              local vce robust
              }
            - else if "`hc2'`hc3'" != "" {
            = else if "" != "" {
              local vce `hc2' `hc3'
              local options `options' `vce'
              }
            - else local vce ols
            - _get_diopts diopts options, `options'
            = _get_diopts diopts options, 
            - if _by() {
              `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
              }
            - else {
            - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
            = version 13, missing : _regress __00001B  __00001A if __000044<=-11 & __000044>=-60  [],     
            - }
            - ereturn local vce `vce'
            = ereturn local vce ols
            - ereturn local marginsok "XB default"
            - ereturn hidden local marginsprop minus
            - ereturn local title "Linear regression"
            - ereturn local cmdline `"regress `0'"'
            = ereturn local cmdline `"regress __00001B  __00001A if __000044<=-11 & __000044>=-60"'
            - _post_vce_rank, checksize
            -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
          - tempvar ar_`z'_`i'
          = tempvar ar_1_9
          - qui predict `ar_`z'_`i'' , resid
          = qui predict __00004F , resid
            ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
            - version 8.2, missing
            - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
            = if "regress" == "rocreg" & "regres_p" == "" {
              di as err "predict not allowed after nonparametric ROC"
              exit 198
              }
            - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
            = if ""!="" & "matrix"!="matrix" {
              error 321
              }
            - if _caller()<=5 | "`e(predict)'"=="" {
            = if _caller()<=5 | "regres_p"=="" {
              _predict `0'
              }
            - else {
            - local v : display string(_caller())
            - version `v', missing
            = version 13, missing
            - `e(predict)' `0'
            = regres_p __00004F , resid
            - }
            -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
          - _crcslbl `ar_`z'_`i'' ``i''
          = _crcslbl __00004F pr_fiamma
            ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
            - version 6
            - args dst src
            - local w : variable label `src'
            = local w : variable label pr_fiamma
            - if `"`w'"' == "" {
            = if `""' == "" {
            - local w "`src'"
            = local w "pr_fiamma"
            - }
            - label variable `dst' `"`w'"'
            = label variable __00004F `"pr_fiamma"'
            ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
          - }
          - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
          = qui regress __00001G  __00001F if __000044<=-11 & __000044>=-60
            ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
            - version 9, missing
            - local version : di "version " string(_caller()) ", missing :"
            - if replay() {
              if _by() {
              error 190
              }
              `version' Display `0'
              exit
              }
            - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
            - local diopts0 `beta' `eform' `header' `table' `plus'
            = local diopts0     
            - if _by() {
              local BY `"by `_byvars'`_byrc0':"'
              }
            - if `:length local vce' {
            = if 0 {
              `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
              if "`s(exit)'" != "" {
              ereturn local cmdline `"regress `0'"'
              exit
              }
              _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
              if "`r(cluster)'" != "" {
              local cluster cluster(`r(cluster)')
              }
              else if "`r(vce)'" != "ols" {
              local robust = "`r(vce)'"
              }
              local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
              if "`hc2'`hc3'" != "" {
              if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
              opts_exclusive "vce(`vce') `hc2' `hc3'"
              }
              local vce `hc2' `hc3'
              local options `options' `vce'
              }
              }
            - else if "`cluster'" != "" {
            = else if "" != "" {
              local vce cluster
              }
            - else if "`weight'" == "pweight" | "`robust'" != "" {
            = else if "" == "pweight" | "" != "" {
              local vce robust
              }
            - else if "`hc2'`hc3'" != "" {
            = else if "" != "" {
              local vce `hc2' `hc3'
              local options `options' `vce'
              }
            - else local vce ols
            - _get_diopts diopts options, `options'
            = _get_diopts diopts options, 
            - if _by() {
              `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
              }
            - else {
            - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
            = version 13, missing : _regress __00001G  __00001F if __000044<=-11 & __000044>=-60  [],     
            - }
            - ereturn local vce `vce'
            = ereturn local vce ols
            - ereturn local marginsok "XB default"
            - ereturn hidden local marginsprop minus
            - ereturn local title "Linear regression"
            - ereturn local cmdline `"regress `0'"'
            = ereturn local cmdline `"regress __00001G  __00001F if __000044<=-11 & __000044>=-60"'
            - _post_vce_rank, checksize
            -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
          - tempvar ar_`z'_`i'
          = tempvar ar_1_10
          - qui predict `ar_`z'_`i'' , resid
          = qui predict __00004G , resid
            ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
            - version 8.2, missing
            - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
            = if "regress" == "rocreg" & "regres_p" == "" {
              di as err "predict not allowed after nonparametric ROC"
              exit 198
              }
            - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
            = if ""!="" & "matrix"!="matrix" {
              error 321
              }
            - if _caller()<=5 | "`e(predict)'"=="" {
            = if _caller()<=5 | "regres_p"=="" {
              _predict `0'
              }
            - else {
            - local v : display string(_caller())
            - version `v', missing
            = version 13, missing
            - `e(predict)' `0'
            = regres_p __00004G , resid
            - }
            -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
          - _crcslbl `ar_`z'_`i'' ``i''
          = _crcslbl __00004G pr_beshom
            ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
            - version 6
            - args dst src
            - local w : variable label `src'
            = local w : variable label pr_beshom
            - if `"`w'"' == "" {
            = if `""' == "" {
            - local w "`src'"
            = local w "pr_beshom"
            - }
            - label variable `dst' `"`w'"'
            = label variable __00004G `"pr_beshom"'
            ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
          - }
          - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
          = qui regress __00001L  __00001K if __000044<=-11 & __000044>=-60
            ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
            - version 9, missing
            - local version : di "version " string(_caller()) ", missing :"
            - if replay() {
              if _by() {
              error 190
              }
              `version' Display `0'
              exit
              }
            - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
            - local diopts0 `beta' `eform' `header' `table' `plus'
            = local diopts0     
            - if _by() {
              local BY `"by `_byvars'`_byrc0':"'
              }
            - if `:length local vce' {
            = if 0 {
              `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
              if "`s(exit)'" != "" {
              ereturn local cmdline `"regress `0'"'
              exit
              }
              _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
              if "`r(cluster)'" != "" {
              local cluster cluster(`r(cluster)')
              }
              else if "`r(vce)'" != "ols" {
              local robust = "`r(vce)'"
              }
              local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
              if "`hc2'`hc3'" != "" {
              if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
              opts_exclusive "vce(`vce') `hc2' `hc3'"
              }
              local vce `hc2' `hc3'
              local options `options' `vce'
              }
              }
            - else if "`cluster'" != "" {
            = else if "" != "" {
              local vce cluster
              }
            - else if "`weight'" == "pweight" | "`robust'" != "" {
            = else if "" == "pweight" | "" != "" {
              local vce robust
              }
            - else if "`hc2'`hc3'" != "" {
            = else if "" != "" {
              local vce `hc2' `hc3'
              local options `options' `vce'
              }
            - else local vce ols
            - _get_diopts diopts options, `options'
            = _get_diopts diopts options, 
            - if _by() {
              `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
              }
            - else {
            - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
            = version 13, missing : _regress __00001L  __00001K if __000044<=-11 & __000044>=-60  [],     
            - }
            - ereturn local vce `vce'
            = ereturn local vce ols
            - ereturn local marginsok "XB default"
            - ereturn hidden local marginsprop minus
            - ereturn local title "Linear regression"
            - ereturn local cmdline `"regress `0'"'
            = ereturn local cmdline `"regress __00001L  __00001K if __000044<=-11 & __000044>=-60"'
            - _post_vce_rank, checksize
            -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
          - tempvar ar_`z'_`i'
          = tempvar ar_1_11
          - qui predict `ar_`z'_`i'' , resid
          = qui predict __00004H , resid

        Comment


        • #19
          Continue:

          Code:
              ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
              - version 8.2, missing
              - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
              = if "regress" == "rocreg" & "regres_p" == "" {
                di as err "predict not allowed after nonparametric ROC"
                exit 198
                }
              - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
              = if ""!="" & "matrix"!="matrix" {
                error 321
                }
              - if _caller()<=5 | "`e(predict)'"=="" {
              = if _caller()<=5 | "regres_p"=="" {
                _predict `0'
                }
              - else {
              - local v : display string(_caller())
              - version `v', missing
              = version 13, missing
              - `e(predict)' `0'
              = regres_p __00004H , resid
              - }
              -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
            - _crcslbl `ar_`z'_`i'' ``i''
            = _crcslbl __00004H pr_jaycorp
              ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
              - version 6
              - args dst src
              - local w : variable label `src'
              = local w : variable label pr_jaycorp
              - if `"`w'"' == "" {
              = if `""' == "" {
              - local w "`src'"
              = local w "pr_jaycorp"
              - }
              - label variable `dst' `"`w'"'
              = label variable __00004H `"pr_jaycorp"'
              ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
            - }
            - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
            = qui regress __00001Q  __00001P if __000044<=-11 & __000044>=-60
              ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
              - version 9, missing
              - local version : di "version " string(_caller()) ", missing :"
              - if replay() {
                if _by() {
                error 190
                }
                `version' Display `0'
                exit
                }
              - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
              - local diopts0 `beta' `eform' `header' `table' `plus'
              = local diopts0     
              - if _by() {
                local BY `"by `_byvars'`_byrc0':"'
                }
              - if `:length local vce' {
              = if 0 {
                `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
                if "`s(exit)'" != "" {
                ereturn local cmdline `"regress `0'"'
                exit
                }
                _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
                if "`r(cluster)'" != "" {
                local cluster cluster(`r(cluster)')
                }
                else if "`r(vce)'" != "ols" {
                local robust = "`r(vce)'"
                }
                local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
                if "`hc2'`hc3'" != "" {
                if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
                opts_exclusive "vce(`vce') `hc2' `hc3'"
                }
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
                }
              - else if "`cluster'" != "" {
              = else if "" != "" {
                local vce cluster
                }
              - else if "`weight'" == "pweight" | "`robust'" != "" {
              = else if "" == "pweight" | "" != "" {
                local vce robust
                }
              - else if "`hc2'`hc3'" != "" {
              = else if "" != "" {
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
              - else local vce ols
              - _get_diopts diopts options, `options'
              = _get_diopts diopts options, 
              - if _by() {
                `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
                }
              - else {
              - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
              = version 13, missing : _regress __00001Q  __00001P if __000044<=-11 & __000044>=-60  [],     
              - }
              - ereturn local vce `vce'
              = ereturn local vce ols
              - ereturn local marginsok "XB default"
              - ereturn hidden local marginsprop minus
              - ereturn local title "Linear regression"
              - ereturn local cmdline `"regress `0'"'
              = ereturn local cmdline `"regress __00001Q  __00001P if __000044<=-11 & __000044>=-60"'
              - _post_vce_rank, checksize
              -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
            - tempvar ar_`z'_`i'
            = tempvar ar_1_12
            - qui predict `ar_`z'_`i'' , resid
            = qui predict __00004I , resid
              ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
              - version 8.2, missing
              - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
              = if "regress" == "rocreg" & "regres_p" == "" {
                di as err "predict not allowed after nonparametric ROC"
                exit 198
                }
              - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
              = if ""!="" & "matrix"!="matrix" {
                error 321
                }
              - if _caller()<=5 | "`e(predict)'"=="" {
              = if _caller()<=5 | "regres_p"=="" {
                _predict `0'
                }
              - else {
              - local v : display string(_caller())
              - version `v', missing
              = version 13, missing
              - `e(predict)' `0'
              = regres_p __00004I , resid
              - }
              -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
            - _crcslbl `ar_`z'_`i'' ``i''
            = _crcslbl __00004I pr_rki
              ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
              - version 6
              - args dst src
              - local w : variable label `src'
              = local w : variable label pr_rki
              - if `"`w'"' == "" {
              = if `""' == "" {
              - local w "`src'"
              = local w "pr_rki"
              - }
              - label variable `dst' `"`w'"'
              = label variable __00004I `"pr_rki"'
              ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
            - }
            - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
            = qui regress __00001V  __00001U if __000044<=-11 & __000044>=-60
              ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
              - version 9, missing
              - local version : di "version " string(_caller()) ", missing :"
              - if replay() {
                if _by() {
                error 190
                }
                `version' Display `0'
                exit
                }
              - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
              - local diopts0 `beta' `eform' `header' `table' `plus'
              = local diopts0     
              - if _by() {
                local BY `"by `_byvars'`_byrc0':"'
                }
              - if `:length local vce' {
              = if 0 {
                `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
                if "`s(exit)'" != "" {
                ereturn local cmdline `"regress `0'"'
                exit
                }
                _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
                if "`r(cluster)'" != "" {
                local cluster cluster(`r(cluster)')
                }
                else if "`r(vce)'" != "ols" {
                local robust = "`r(vce)'"
                }
                local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
                if "`hc2'`hc3'" != "" {
                if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
                opts_exclusive "vce(`vce') `hc2' `hc3'"
                }
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
                }
              - else if "`cluster'" != "" {
              = else if "" != "" {
                local vce cluster
                }
              - else if "`weight'" == "pweight" | "`robust'" != "" {
              = else if "" == "pweight" | "" != "" {
                local vce robust
                }
              - else if "`hc2'`hc3'" != "" {
              = else if "" != "" {
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
              - else local vce ols
              - _get_diopts diopts options, `options'
              = _get_diopts diopts options, 
              - if _by() {
                `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
                }
              - else {
              - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
              = version 13, missing : _regress __00001V  __00001U if __000044<=-11 & __000044>=-60  [],     
              - }
              - ereturn local vce `vce'
              = ereturn local vce ols
              - ereturn local marginsok "XB default"
              - ereturn hidden local marginsprop minus
              - ereturn local title "Linear regression"
              - ereturn local cmdline `"regress `0'"'
              = ereturn local cmdline `"regress __00001V  __00001U if __000044<=-11 & __000044>=-60"'
              - _post_vce_rank, checksize
              -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
            - tempvar ar_`z'_`i'
            = tempvar ar_1_13
            - qui predict `ar_`z'_`i'' , resid
            = qui predict __00004J , resid
              ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
              - version 8.2, missing
              - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
              = if "regress" == "rocreg" & "regres_p" == "" {
                di as err "predict not allowed after nonparametric ROC"
                exit 198
                }
              - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
              = if ""!="" & "matrix"!="matrix" {
                error 321
                }
              - if _caller()<=5 | "`e(predict)'"=="" {
              = if _caller()<=5 | "regres_p"=="" {
                _predict `0'
                }
              - else {
              - local v : display string(_caller())
              - version `v', missing
              = version 13, missing
              - `e(predict)' `0'
              = regres_p __00004J , resid
              - }
              -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
            - _crcslbl `ar_`z'_`i'' ``i''
            = _crcslbl __00004J pr_ql
              ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
              - version 6
              - args dst src
              - local w : variable label `src'
              = local w : variable label pr_ql
              - if `"`w'"' == "" {
              = if `""' == "" {
              - local w "`src'"
              = local w "pr_ql"
              - }
              - label variable `dst' `"`w'"'
              = label variable __00004J `"pr_ql"'
              ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
            - }
            - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
            = qui regress __000020  __00001Z if __000044<=-11 & __000044>=-60
              ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
              - version 9, missing
              - local version : di "version " string(_caller()) ", missing :"
              - if replay() {
                if _by() {
                error 190
                }
                `version' Display `0'
                exit
                }
              - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
              - local diopts0 `beta' `eform' `header' `table' `plus'
              = local diopts0     
              - if _by() {
                local BY `"by `_byvars'`_byrc0':"'
                }
              - if `:length local vce' {
              = if 0 {
                `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
                if "`s(exit)'" != "" {
                ereturn local cmdline `"regress `0'"'
                exit
                }
                _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
                if "`r(cluster)'" != "" {
                local cluster cluster(`r(cluster)')
                }
                else if "`r(vce)'" != "ols" {
                local robust = "`r(vce)'"
                }
                local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
                if "`hc2'`hc3'" != "" {
                if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
                opts_exclusive "vce(`vce') `hc2' `hc3'"
                }
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
                }
              - else if "`cluster'" != "" {
              = else if "" != "" {
                local vce cluster
                }
              - else if "`weight'" == "pweight" | "`robust'" != "" {
              = else if "" == "pweight" | "" != "" {
                local vce robust
                }
              - else if "`hc2'`hc3'" != "" {
              = else if "" != "" {
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
              - else local vce ols
              - _get_diopts diopts options, `options'
              = _get_diopts diopts options, 
              - if _by() {
                `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
                }
              - else {
              - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
              = version 13, missing : _regress __000020  __00001Z if __000044<=-11 & __000044>=-60  [],     
              - }
              - ereturn local vce `vce'
              = ereturn local vce ols
              - ereturn local marginsok "XB default"
              - ereturn hidden local marginsprop minus
              - ereturn local title "Linear regression"
              - ereturn local cmdline `"regress `0'"'
              = ereturn local cmdline `"regress __000020  __00001Z if __000044<=-11 & __000044>=-60"'
              - _post_vce_rank, checksize
              -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
            - tempvar ar_`z'_`i'
            = tempvar ar_1_14
            - qui predict `ar_`z'_`i'' , resid
            = qui predict __00004K , resid
              ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
              - version 8.2, missing
              - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
              = if "regress" == "rocreg" & "regres_p" == "" {
                di as err "predict not allowed after nonparametric ROC"
                exit 198
                }
              - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
              = if ""!="" & "matrix"!="matrix" {
                error 321
                }
              - if _caller()<=5 | "`e(predict)'"=="" {
              = if _caller()<=5 | "regres_p"=="" {
                _predict `0'
                }
              - else {
              - local v : display string(_caller())
              - version `v', missing
              = version 13, missing
              - `e(predict)' `0'
              = regres_p __00004K , resid
              - }
              -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
            - _crcslbl `ar_`z'_`i'' ``i''
            = _crcslbl __00004K pr_dpharma
              ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
              - version 6
              - args dst src
              - local w : variable label `src'
              = local w : variable label pr_dpharma
              - if `"`w'"' == "" {
              = if `""' == "" {
              - local w "`src'"
              = local w "pr_dpharma"
              - }
              - label variable `dst' `"`w'"'
              = label variable __00004K `"pr_dpharma"'
              ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
            - }
            - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
            = qui regress __000025  __000024 if __000044<=-11 & __000044>=-60
              ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
              - version 9, missing
              - local version : di "version " string(_caller()) ", missing :"
              - if replay() {
                if _by() {
                error 190
                }
                `version' Display `0'
                exit
                }
              - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
              - local diopts0 `beta' `eform' `header' `table' `plus'
              = local diopts0     
              - if _by() {
                local BY `"by `_byvars'`_byrc0':"'
                }
              - if `:length local vce' {
              = if 0 {
                `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
                if "`s(exit)'" != "" {
                ereturn local cmdline `"regress `0'"'
                exit
                }
                _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
                if "`r(cluster)'" != "" {
                local cluster cluster(`r(cluster)')
                }
                else if "`r(vce)'" != "ols" {
                local robust = "`r(vce)'"
                }
                local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
                if "`hc2'`hc3'" != "" {
                if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
                opts_exclusive "vce(`vce') `hc2' `hc3'"
                }
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
                }
              - else if "`cluster'" != "" {
              = else if "" != "" {
                local vce cluster
                }
              - else if "`weight'" == "pweight" | "`robust'" != "" {
              = else if "" == "pweight" | "" != "" {
                local vce robust
                }
              - else if "`hc2'`hc3'" != "" {
              = else if "" != "" {
                local vce `hc2' `hc3'
                local options `options' `vce'
                }
              - else local vce ols
              - _get_diopts diopts options, `options'
              = _get_diopts diopts options, 
              - if _by() {
                `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
                }
              - else {
              - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
              = version 13, missing : _regress __000025  __000024 if __000044<=-11 & __000044>=-60  [],     
              - }
              - ereturn local vce `vce'
              = ereturn local vce ols
              - ereturn local marginsok "XB default"
              - ereturn hidden local marginsprop minus
              - ereturn local title "Linear regression"
              - ereturn local cmdline `"regress `0'"'
              = ereturn local cmdline `"regress __000025  __000024 if __000044<=-11 & __000044>=-60"'
              - _post_vce_rank, checksize
              -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
            - tempvar ar_`z'_`i'
            = tempvar ar_1_15
            - qui predict `ar_`z'_`i'' , resid
            = qui predict __00004L , resid

          Comment


          • #20
            Last:

            Code:
               ------------------------------------------------------------------------------------------------------------------------------------------ begin predict ---
                - version 8.2, missing
                - if "`e(cmd)'" == "rocreg" & "`e(predict)'" == "" {
                = if "regress" == "rocreg" & "regres_p" == "" {
                  di as err "predict not allowed after nonparametric ROC"
                  exit 198
                  }
                - if "`e(mi)'"!="" & "`e(b)'"!="matrix" {
                = if ""!="" & "matrix"!="matrix" {
                  error 321
                  }
                - if _caller()<=5 | "`e(predict)'"=="" {
                = if _caller()<=5 | "regres_p"=="" {
                  _predict `0'
                  }
                - else {
                - local v : display string(_caller())
                - version `v', missing
                = version 13, missing
                - `e(predict)' `0'
                = regres_p __00004L , resid
                - }
                -------------------------------------------------------------------------------------------------------------------------------------------- end predict ---
              - _crcslbl `ar_`z'_`i'' ``i''
              = _crcslbl __00004L pr_kossan
                ----------------------------------------------------------------------------------------------------------------------------------------- begin _crcslbl ---
                - version 6
                - args dst src
                - local w : variable label `src'
                = local w : variable label pr_kossan
                - if `"`w'"' == "" {
                = if `""' == "" {
                - local w "`src'"
                = local w "pr_kossan"
                - }
                - label variable `dst' `"`w'"'
                = label variable __00004L `"pr_kossan"'
                ------------------------------------------------------------------------------------------------------------------------------------------- end _crcslbl ---
              - }
              - qui regress `dv_`i'' `aux_index_list_`i'' if `event'<=`upp_bound' & `event'>=`low_bound'
              = qui regress __00002A  __000029 if __000044<=-11 & __000044>=-60
                ------------------------------------------------------------------------------------------------------------------------------------------ begin regress ---
                - version 9, missing
                - local version : di "version " string(_caller()) ", missing :"
                - if replay() {
                  if _by() {
                  error 190
                  }
                  `version' Display `0'
                  exit
                  }
                - syntax [anything] [if] [in] [aw fw iw pw] [, VCE(passthru) Robust CLuster(passthru) HC2 HC3 beta EForm(passthru) noHEader noTABle plus * ]
                - local diopts0 `beta' `eform' `header' `table' `plus'
                = local diopts0     
                - if _by() {
                  local BY `"by `_byvars'`_byrc0':"'
                  }
                - if `:length local vce' {
                = if 0 {
                  `version' `BY' _vce_parserun regress, mark(CLuster) eq(NOConstant) : `0'
                  if "`s(exit)'" != "" {
                  ereturn local cmdline `"regress `0'"'
                  exit
                  }
                  _vce_parse, argopt(CLuster) opt(OLS Robust HC2 HC3) old : [`weight'`exp'], `vce' `robust' `cluster'
                  if "`r(cluster)'" != "" {
                  local cluster cluster(`r(cluster)')
                  }
                  else if "`r(vce)'" != "ols" {
                  local robust = "`r(vce)'"
                  }
                  local vce = cond("`r(vce)'" != "", "`r(vce)'", "ols")
                  if "`hc2'`hc3'" != "" {
                  if !inlist("`vce'", "ols", "`robust'", "`hc2'`hc3'") {
                  opts_exclusive "vce(`vce') `hc2' `hc3'"
                  }
                  local vce `hc2' `hc3'
                  local options `options' `vce'
                  }
                  }
                - else if "`cluster'" != "" {
                = else if "" != "" {
                  local vce cluster
                  }
                - else if "`weight'" == "pweight" | "`robust'" != "" {
                = else if "" == "pweight" | "" != "" {
                  local vce robust
                  }
                - else if "`hc2'`hc3'" != "" {
                = else if "" != "" {
                  local vce `hc2' `hc3'
                  local options `options' `vce'
                  }
                - else local vce ols
                - _get_diopts diopts options, `options'
                = _get_diopts diopts options, 
                - if _by() {
                  `version' `BY' BYREG `anything' `if' `in' [`weight'`exp'], `options' `diopts0' `diopts' `robust' `cluster'
                  }
                - else {
                - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'
                = version 13, missing : _regress __00002A  __000029 if __000044<=-11 & __000044>=-60  [],     
            no observations
                  }
                -------------------------------------------------------------------------------------------------------------------------------------------- end regress ---
                tempvar ar_`z'_`i'
                qui predict `ar_`z'_`i'' , resid
                _crcslbl `ar_`z'_`i'' ``i''
                }
                if (`nvars' > 1 & "`commonevent'" != "") {
                local nvars=`nvars' + 1
                qui regress `portfolio_model' `aux_index_list_1' if `event'<=`upp_bound' & `event'>=`low_bound'
                tempvar ar_`z'_`nvars'
                qui predict `ar_`z'_`nvars'', resid
                _crcslbl `ar_`z'_`nvars'' `portfolio_model'
                }
                }
                else if "`modtype'" == "HMM" {
                local aux_nind 1
                tokenize "`varlist'"
                forvalues i = 1/`nvars' {
                qui sum `dv_`i'' if `event' <= `upp_bound' & `event' >= `low_bound'
                local hist_avg = r(mean)
                tempvar ar_`z'_`i'
                qui generate `ar_`z'_`i'' = `dv_`i'' - `hist_avg'
                _crcslbl `ar_`z'_`i'' ``i''
                }
                if (`nvars' > 1 & "`commonevent'" != "") {
                local nvars=`nvars' + 1
                qui sum `portfolio_model' if `event'<=`upp_bound' & `event'>=`low_bound'
                local hist_avg = r(mean)
                tempvar ar_`z'_`nvars'
                qui generate `ar_`z'_`nvars'' = `portfolio_model' - `hist_avg'
                _crcslbl `ar_`z'_`nvars'' `portfolio_model'
                }
                }
                else if "`modtype'" == "MAM" {
                if `nind' > 1 {
                disp as error "Only 1 index must be specified to adopt the Market Adjusted Model (MAM)"
                exit 103
                }
                tokenize "`varlist'"
                forvalues i = 1/`nvars' {
                tempvar ar_`z'_`i'
                qui generate `ar_`z'_`i'' = `dv_`i'' - `aux_index_list_`i''
                _crcslbl `ar_`z'_`i'' ``i''
                }
                if (`nvars' > 1 & "`commonevent'" != "") {
                local nvars=`nvars' + 1
                tempvar ar_`z'_`nvars'
                qui generate `ar_`z'_`nvars'' = `portfolio_model' - `aux_index_list_1'
                _crcslbl `ar_`z'_`nvars'' `portfolio_model'
                }
                }
                else if "`modtype'" != "" {
                disp as err "Model misspecified"
                exit 198
                }
                forvalues i = 1/`nvars' {
                qui sum `ar_`z'_`i'' if `event' <= `upp_bound' & `event' >= `low_bound'
                scalar variance = r(Var)
                scalar variance_`i'=variance
                scalar m_ret_`i' = r(N)
                if `i' <= `spec_vars' {
                if "`detail'" != "" {
                local warn_label : variable label ``i''
                if m_ret_`i' < 50 {
                disp as err "The variable " as result "`warn_label' of varlist n.`z'" as err " has " m_ret_`i' " observations in the estimation window" as text ""
                }
                else {
                disp as input "The variable " as result "`warn_label' of varlist n.`z' " as input " has " m_ret_`i' " observations in the estimation window" as text ""
                }
                }
                if "`commonevent'" == "" {
                qui levelsof `events_date_list' if `events_label_list' == "``i''", local(evntdts)
                scalar evntdts_`z'_`i' = `evntdts'
                if `i' == `spec_vars' {
                scalar evntdts_`z'_`=`i'+1' = "    -    "
                }
                }
                }
                forvalues j=1/`num_ev_wdws' {
                qui sum `ar_`z'_`i'' if (`event' >= `evlbound_`j'' & `event' <= `evubound_`j'')
                scalar carvalue_`z'_`i'_`j' = r(sum)
                local carvalue_`z'_`i'_`j' = r(sum)
                scalar num = r(N)
                scalar carvariance_`i'_`j' = num*variance
                if "`modtype'" == "" | "`modtype'" == "SIM" {
                if "`commonevent'" == "" {
                qui sum `idv_`i'_1' if `event' <= `upp_bound' & `event' >= `low_bound'
                }
                else{
                qui sum `idv_1' if `event' <= `upp_bound' & `event' >= `low_bound'
                }
                scalar mean_mkt_ret = r(mean)
                scalar var_mkt_ret = r(Var)
                scalar n_mkt_ret = r(N)
                scalar corr_fac_den = var_mkt_ret*n_mkt_ret
                tempvar mean_resid
                if "`commonevent'" == "" {
                qui gen `mean_resid' = `idv_`i'_1' - mean_mkt_ret
                }
                else{
                qui gen `mean_resid' = `idv_1' - mean_mkt_ret
                }
                qui sum `mean_resid' if `event' >= `evlbound_`j'' & `event' <= `evubound_`j''
                scalar corr_fac_num = r(sum)
                scalar corr_fac_num = corr_fac_num^2
                scalar carvariance_`i'_`j' = variance_`i' * (num + (num^2/m_ret_`i') + (corr_fac_num/corr_fac_den))
                }
                else if "`modtype'" == "HMM" {
                scalar carvariance_`i'_`j' = carvariance_`i'_`j' * (1 + num/m_ret_`i')
                }
                scalar sd = sqrt(carvariance_`i'_`j')
                local sd_`z'_`i'_`j' = sd
                qui scalar zstat = carvalue_`z'_`i'_`j'/sd
                local testat_`z'_`i'_`j' = zstat
                local pval_`z'_`i'_`j' = 2*ttail((`= m_ret_`i' - `aux_nind' - 1'),abs(zstat))
                qui scalar pval_`z'_`i'_`j' = "(" + string(`pval_`z'_`i'_`j'' , "%5.4f") + ")"
                scalar car_`z'_`i'_`j'=string(100 * carvalue_`z'_`i'_`j', "%12.`n_dec'f")
                if "`nostar'" == "" {
                if `pval_`z'_`i'_`j''<0.01 {
                scalar star_`z'_`i'_`j' = "`delimiter_3'%***"
                }
                else if `pval_`z'_`i'_`j''<0.05 {
                scalar star_`z'_`i'_`j' = "`delimiter_3'%**"
                }
                else if `pval_`z'_`i'_`j''<0.1 {
                scalar star_`z'_`i'_`j' = "`delimiter_3'%*"
                }
                else {
                scalar star_`z'_`i'_`j' = "`delimiter_3'%"
                }
                }
                else {
                scalar star_`z'_`i'_`j' = "`delimiter_3'%"
                }
                }
                }
                if `nvars' > 1 {
                local nvars = `nvars'+1
                tempvar ar_`z'_`nvars'
                qui gen `ar_`z'_`nvars'' = .
                label var `ar_`z'_`nvars'' "CAAR group `z' (`spec_vars' securities)"
                local avg_aux_varlist = ""
                local rowmean_aux_varlist = ""
                forvalues i = 1/`spec_vars' {
                capture drop `expar_`i''
                tempvar expar_`i'
                qui gen `expar_`i'' = exp(`ar_`z'_`i'')
                local rowmean_aux_varlist = "`rowmean_aux_varlist' `expar_`i''"
                }
                tempvar exp_avgabret
                tempvar avgabret
                qui egen `exp_avgabret' = rowmean(`rowmean_aux_varlist')
                qui gen `avgabret' = ln(`exp_avgabret')
                qui sum `avgabret' if `event' <= `upp_bound' & `event' >= `low_bound'
                scalar m_ret_`nvars' = r(N)
                qui replace `ar_`z'_`nvars'' = `avgabret'
                forvalues j=1/`num_ev_wdws' {
                qui sum `avgabret' if (`event' >= `evlbound_`j'' & `event' <= `evubound_`j'')
                scalar carvalue_`z'_`nvars'_`j' = r(sum)
                local carvalue_`z'_`nvars'_`j' = r(sum)
                scalar varsumcar_0_`j'=0
                forvalues k = 1/`spec_vars' {
                local kk = `k' - 1
                if carvariance_`k'_`j' == . {
                scalar varsumcar_`k'_`j' = varsumcar_`kk'_`j'
                }
                else {
                scalar varsumcar_`k'_`j' = varsumcar_`kk'_`j' + carvariance_`k'_`j'
                }
                }
                scalar car_`z'_`nvars'_`j'=string(100 * carvalue_`z'_`nvars'_`j', "%12.`n_dec'f")
                scalar varcaar = varsumcar_`spec_vars'_`j'/(`spec_vars'^2)
                if "`diagnosticsstat'" == "" | "`diagnosticsstat'" == "Norm" {
                local str_diagn = "under the Normality assumption"
                qui scalar zstat = carvalue_`z'_`nvars'_`j'/sqrt(varcaar)
                local testat_`z'_`nvars'_`j' = zstat
                local sd_`z'_`nvars'_`j' = sqrt(varcaar)
                local pval_`z'_`nvars'_`j' = 2*ttail((`=m_ret_`nvars' - `aux_nind' - 1'),abs(zstat))
                qui scalar pval_`z'_`nvars'_`j' = "(" + string(`pval_`z'_`nvars'_`j'' , "%5.4f") + ")"
                }
                else if "`diagnosticsstat'" == "Patell" | "`diagnosticsstat'" == "ADJPatell" {
                forvalues i=1/`spec_vars' {
                local ii = `i' - 1
                scalar l2_`j'=r(N)
                scalar csar_`i'_`j' = carvalue_`z'_`i'_`j' / sqrt(carvariance_`i'_`j')
                scalar sumcsar_0_`j' = 0
                if csar_`i'_`j' == . {
                scalar sumcsar_`i'_`j' = sumcsar_`ii'_`j'
                }
                else {
                scalar sumcsar_`i'_`j' = sumcsar_`ii'_`j' + csar_`i'_`j'
                }
                local exp_vars = 1
                if "`modtype'" == "MFM" {
                local exp_vars = `nind'
                }
                scalar var_csar_`i' = (m_ret_`i' - `exp_vars' - 1)/(m_ret_`i' - `exp_vars' - 3)
                scalar sum_var_csar_0 = 0
                if var_csar_`i' == . {
                scalar sum_var_csar_`i' = sum_var_csar_`ii'
                }
                else {
                scalar sum_var_csar_`i' = sum_var_csar_`ii' + var_csar_`i'
                }
                }
                scalar zpatell = sumcsar_`spec_vars'_`j' / sqrt(sum_var_csar_`spec_vars')
                if "`diagnosticsstat'" == "ADJPatell" {
                local str_diagn = "using the Patell test, with the Kolari and Pynnonen adjustment"
                mata: C = J(`spec_vars', `spec_vars',.)
                forvalues ppp = 1/`=`spec_vars'-1' {
                forvalues kkk = `=`ppp'+1'/`spec_vars' {
                qui corr `ar_`z'_`ppp'' `ar_`z'_`kkk'' if (`event' <= `upp_bound' & `event' >= `low_bound')
                mata: C[`kkk',`ppp'] = `r(rho)'
                }
                }
                mata : st_numscalar("rho_Kolari", mean(select(vech(C), vech(C) :< 1)))
                scalar zpatell = zpatell/sqrt(1+(`spec_vars'-1)*rho_Kolari)
                local sd_`z'_`nvars'_`j' = sqrt(sum_var_csar_`spec_vars')*sqrt(1+(`spec_vars'-1)*rho_Kolari)
                }
                else {
                local str_diagn = "using the Patell test"
                local sd_`z'_`nvars'_`j' = sqrt(sum_var_csar_`spec_vars')
                }
                local testat_`z'_`nvars'_`j' = zpatell
                local pval_`z'_`nvars'_`j'=2*(1-normal(abs(zpatell)))
                qui scalar pval_`z'_`nvars'_`j' = "(" + string(`pval_`z'_`nvars'_`j'' , "%5.4f") + ")"
                }
                else if "`diagnosticsstat'" == "BMP" | "`diagnosticsstat'" == "KP" {
                scalar sum_std_car_0_`j' = 0
                forvalues i=1/`spec_vars' {
                scalar std_car_`i'_`j' = carvalue_`z'_`i'_`j'/sqrt(carvariance_`i'_`j')
                local ii = `i' - 1
                if std_car_`i'_`j' == . {
                scalar sum_std_car_`i'_`j' = sum_std_car_`ii'_`j'
                }
                else {
                scalar sum_std_car_`i'_`j' = sum_std_car_`ii'_`j' + std_car_`i'_`j'
                }
                }
                scalar lined_scar_`j'=sum_std_car_`spec_vars'_`j'/`spec_vars'
                scalar sum_sq_dif_scar_0_`j' = 0
                forvalues i=1/`spec_vars' {
                scalar sq_dif_scar_`i'_`j' = (std_car_`i'_`j' - lined_scar_`j')^2
                local ii = `i' - 1
                if sq_dif_scar_`i'_`j' == . {
                scalar sum_sq_dif_scar_`i'_`j' = sum_sq_dif_scar_`ii'_`j'
                }
                else {
                scalar sum_sq_dif_scar_`i'_`j' = sum_sq_dif_scar_`ii'_`j' + sq_dif_scar_`i'_`j'
                }
                }
                scalar s_lined_scar_`j' = sqrt(sum_sq_dif_scar_`spec_vars'_`j'/(`spec_vars'-1))
                scalar zbmp = sqrt(`spec_vars')*(lined_scar_`j' / s_lined_scar_`j')
                if "`diagnosticsstat'" == "KP" {
                local str_diagn = "using the Boehmer, Musumeci, Poulsen test, with the Kolari and Pynnonen adjustment"
                mata: C = J(`spec_vars', `spec_vars',.)
                forvalues ppp = 1/`=`spec_vars'-1' {
                forvalues kkk = `=`ppp'+1'/`spec_vars' {
                qui corr `ar_`z'_`ppp'' `ar_`z'_`kkk'' if (`event' <= `upp_bound' & `event' >= `low_bound')
                mata: C[`kkk',`ppp'] = `r(rho)'
                }
                }
                mata : st_numscalar("rho_Kolari", mean(select(vech(C), vech(C) :< 1)))
                scalar zbmp = zbmp * sqrt((1-rho_Kolari)/(1+(`spec_vars'-1)*rho_Kolari))
                local sd_`z'_`nvars'_`j' = (s_lined_scar_`j'/sqrt(1-rho_Kolari))*sqrt(1/`spec_vars')*sqrt(1+(`spec_vars'-1)*rho_Kolari)
                }
                else {
                local str_diagn = "using the Boehmer, Musumeci, Poulsen test"
                local sd_`z'_`nvars'_`j' = s_lined_scar_`j'
                }
                local testat_`z'_`nvars'_`j' = zbmp
                local pval_`z'_`nvars'_`j'=2*(1-normal(abs(zbmp)))
                qui scalar pval_`z'_`nvars'_`j' = "(" + string(`pval_`z'_`nvars'_`j'' , "%5.4f") + ")"
                }
                else if "`diagnosticsstat'" == "GRANK" {
                local str_diagn = "using the Generalised Rank test by Kolari and Pynnonen"
                scalar sum_std_car_0_`j' = 0
                scalar sum_sq_dif_scar_0_`j' = 0
                local aux_num_lined_u = ""
                forvalues i=1/`spec_vars' {
                tempvar stdar_`i'_`j'
                qui gen `stdar_`i'_`j'' = .
                qui replace `stdar_`i'_`j'' = `ar_`z'_`i''/sqrt(variance_`i') if (`event' <= `upp_bound' & `event' >= `low_bound')
                qui scalar std_car_`i'_`j' = carvalue_`z'_`i'_`j'/sqrt(carvariance_`i'_`j')
                local ii = `i' - 1
                if std_car_`i'_`j' == . {
                scalar sum_std_car_`i'_`j' = sum_std_car_`ii'_`j'
                }
                else {
                scalar sum_std_car_`i'_`j' = sum_std_car_`ii'_`j' + std_car_`i'_`j'
                }
                }
                scalar lined_scar_`j'=sum_std_car_`spec_vars'_`j'/`spec_vars'
                scalar sum_sq_dif_scar_0_`j' = 0
                forvalues i=1/`spec_vars' {
                scalar sq_dif_scar_`i'_`j' = (std_car_`i'_`j' - lined_scar_`j')^2
                local ii = `i' - 1
                if sq_dif_scar_`i'_`j' == . {
                scalar sum_sq_dif_scar_`i'_`j' = sum_sq_dif_scar_`ii'_`j'
                }
                else {
                scalar sum_sq_dif_scar_`i'_`j' = sum_sq_dif_scar_`ii'_`j' + sq_dif_scar_`i'_`j'
                }
                }
                scalar csec_sd_scar_`j' = sqrt(sum_sq_dif_scar_`spec_vars'_`j'/(`spec_vars'-1))
                forvalues i=1/`spec_vars' {
                qui replace `stdar_`i'_`j'' = std_car_`i'_`j'/csec_sd_scar_`j' if `event' == `=`upp_bound'+1'
                qui tempvar u_`i'_`j'
                local aux_num_lined_u = "`aux_num_lined_u' `u_`i'_`j''"
                qui egen `u_`i'_`j'' = rank(`stdar_`i'_`j'')
                qui replace `u_`i'_`j'' = `u_`i'_`j''/(`upp_bound'-`low_bound'+2) - 0.5
                }
                tempvar lined_u_`j'
                tempvar num_lined_u_`j'
                tempvar den_lined_u_`j'
                tempvar sq_lined_u_`j'
                qui egen `num_lined_u_`j'' = rowtotal(`aux_num_lined_u')
                qui egen `den_lined_u_`j'' = rownonmiss(`aux_num_lined_u')
                qui gen `lined_u_`j'' = `num_lined_u_`j'' / `den_lined_u_`j''
                qui egen `sq_lined_u_`j'' = rownonmiss(`aux_num_lined_u')
                qui replace `sq_lined_u_`j'' = `sq_lined_u_`j'' /`spec_vars' * `lined_u_`j''^2
                qui sum `sq_lined_u_`j''
                scalar s_u_lined_`j' = sqrt(r(sum)/(`upp_bound'-`low_bound'+1))
                qui sum `lined_u_`j'' if `event' == `=`upp_bound'+1'
                scalar u_lined_0_`j' = r(mean)
                scalar z_`j' = u_lined_0_`j'/s_u_lined_`j'
                scalar t_grank_`j' = z_`j'*sqrt((`upp_bound'-`low_bound'-1)/(`upp_bound'-`low_bound'-z_`j'^2))
                scalar t_grank_dof_`j' = `upp_bound'-`low_bound' + 1 - 2
                local pval_`z'_`nvars'_`j'=2*ttail(t_grank_dof_`j',abs(t_grank_`j'))
                qui scalar pval_`z'_`nvars'_`j' = "(" + string(`pval_`z'_`nvars'_`j'' , "%5.4f") + ")"
                local testat_`z'_`nvars'_`j' = t_grank_`j'
                local sd_`z'_`nvars'_`j' = s_u_lined_`j'
                }
                else if "`diagnosticsstat'" == "Wilcoxon" {
                local str_diagn = "using the Generalised SIGN test by Wilcoxon"
                tempvar wilcox_`j'
                local aux_rank_varlist = ""
                forvalues i=1/`spec_vars' {
                tempvar abs_ar_`i'_`j'
                tempvar stdar_`i'_`j'
                tempvar rank_`i'_`j'
                qui gen `stdar_`i'_`j'' =.
                qui replace `stdar_`i'_`j'' = `ar_`z'_`i'' if (`event' <= `upp_bound' & `event' >= `low_bound')
                qui replace `stdar_`i'_`j'' = carvalue_`z'_`i'_`j' if `event' == `=`upp_bound'+1'
                qui gen `abs_ar_`i'_`j'' = abs(`stdar_`i'_`j'')
                qui egen `rank_`i'_`j'' = rank(`abs_ar_`i'_`j'')
                qui replace `rank_`i'_`j'' = . if `stdar_`i'_`j'' < 0
                local aux_rank_varlist = "`aux_rank_varlist' `rank_`i'_`j''"
                }
                qui egen `wilcox_`j'' = rowtotal(`aux_rank_varlist')
                qui sum `wilcox_`j'' if `event' == `=`upp_bound'+1'
                scalar wilcoxon_`j' = r(sum)
                scalar z_wilcoxon_`j' = (wilcoxon_`j'-`spec_vars'*(`spec_vars'+1)/4)/sqrt(`spec_vars'*(`spec_vars'+1)*(2*`spec_vars'+1)/24)
                local testat_`z'_`nvars'_`j' = z_wilcoxon_`j'
                local pval_`z'_`nvars'_`j'=2*(1-normal(abs(z_wilcoxon_`j')))
                qui scalar pval_`z'_`nvars'_`j' = "(" + string(`pval_`z'_`nvars'_`j'' , "%5.4f") + ")"
                local sd_`z'_`nvars'_`j' = sqrt(`spec_vars'*(`spec_vars'+1)*(2*`spec_vars'+1)/24)
                }
                else if "`diagnosticsstat'" != "" {
                disp as error "Diagnosticstat is incorrectly specified" as text ""
                exit 198
                }
                if "`nostar'" == "" {
                if `pval_`z'_`nvars'_`j''<0.01 {
                scalar star_`z'_`nvars'_`j' = "`delimiter_3'%***"
                }
                else if `pval_`z'_`nvars'_`j''<0.05 {
                scalar star_`z'_`nvars'_`j' = "`delimiter_3'%**"
                }
                else if `pval_`z'_`nvars'_`j''<0.1 {
                scalar star_`z'_`nvars'_`j' = "`delimiter_3'%*"
                }
                else {
                scalar star_`z'_`nvars'_`j' = "`delimiter_3'%"
                }
                }
                else {
                scalar star_`z'_`nvars'_`j' = "`delimiter_3'%"
                }
                }
                }
                if "`graph'" != "" {
                local aux_graph = "`graph'"
                gettoken gr_opt_left aux_graph : aux_graph , p(",")
                if "`aux_graph'" != "" {
                tokenize "`aux_graph'"
                if "`3'" != "" {
                disp as err "Too many arguments specified in the graph suboption"
                exit 198
                }
                else if "`2'" == "" {
                disp as err "Graph option incorrectly specified"
                exit 198
                }
                else if "`2'" == "save" {
                local gr_suboption = "`2'"
                }
                else {
                disp as err "Graph suboption incorrectly specified. Only save is allowed"
                exit 198
                }
                }
                tokenize `gr_opt_left'
                if ("`1'" =="" | "`2'" == "") {
                disp as err "Option graph incorrectly specified. Two integers required"
                exit 198
                }
                else if "`3'" != "" {
                disp as err "Two many arguments specified in the graph option"
                exit 198
                }
                capture confirm integer number `1'
                if _rc != 0 {
                disp as err "Option graph incorrecly specified. The lower bound must be an integer"
                exit 198
                }
                else {
                capture confirm integer number `2'
                if _rc != 0 {
                disp as err "Option graph incorrecly specified. The upper bound must be an integer"
                exit 198
                }
                }
                if `1' >= `2' {
                disp as err "Option graphs incorrectly specified. Lower bound must be lower than upper bound"
                exit 198
                }
                else if `1' < `upp_bound' {
                disp as err "Option graphs incorrectly specified. Lower bound must be higher than estimantion window's upper bound"
                exit 198
                }
                local first_graph = 1
                local last_graph = `nvars'
                if "`suppress'" == "ind" {
                if "`commonevent'" != "" {
                local first_graph = `nvars' - 1
                }
                else {
                local first_graph = `nvars'
                }
                }
                else if "`suppress'" == "group" {
                if "`commonevent'" != "" {
                local last_graph = `nvars' - 2
                }
                else {
                local last_graph = `nvars' - 1
                }
                }
                forvalues i = `first_graph'/`last_graph' {
                qui sum `event' if `ar_`z'_`i'' !=.
                if (`1' < `r(min)' | `1' > `r(max)') & (`2' < `r(min)' | `2' > `r(max)') {
                disp as err "Option graphs incorrectly specified. Both lower and upper bounds are out of range"
                exit 198
                }
                else if (`1' < `r(min)' | `1' > `r(max)') {
                disp as err "Option graphs incorrectly specified. The lower bound is out of range"
                exit 198
                }
                else if (`2' < `r(min)' | `2' > `r(max)') {
                disp as err "Option graphs incorrectly specified. The upper bound is out of range"
                exit 198
                }
                tempvar cumul_ar_`i'
                qui gen `cumul_ar_`i'' = sum(`ar_`z'_`i''*100) if (`event' >= `1' & `event' <= `2')
                local warn_label : variable label `ar_`z'_`i''
                if "`gr_suboption'" == "save" {
                qui graph twoway (line `cumul_ar_`i'' `event' if (`event' >= `1' & `event' <= `2')) , ytitle("CAR (%)") xtitle("Days") title("`warn_label'") name("varlist_`
            > z'_variable_`i'") saving("Varlist_`z'_`warn_label'" , replace)
                graph close "varlist_`z'_variable_`i'"
                }
                else {
                noisily graph twoway (line `cumul_ar_`i'' `event' if (`event' >= `1' & `event' <= `2')) , ytitle("CAR (%)") xtitle("Days") title("`warn_label'") name("varli
            > st_`z'_variable_`i'")
                }
                }
                }
                tempvar dim_label
                qui gen `dim_label' =.
                local i=1
                forvalues num = 1/`nvars' {
                tokenize "`varlist'"
                local div_label : variable label `ar_`z'_`num''
                if strpos(`"`div_label'"', ".") > 0 {
                disp as err "The label of the variable ``num'' contains the invalid character '.'"
                exit 198
                }
                local len_label : length local div_label
                if "`outputfile'" != "" | "`mydataset'" != "" {
                local max_lab_len 32
                }
                else {
                local max_lab_len 45
                }
                if `len_label' > `max_lab_len' {
                disp as err "Note: label of variable ``num'' truncated to `max_lab_len' characters" as text
                local div_label = substr(`"`div_label'"',1,`max_lab_len')
                label var `ar_`z'_`num'' `"`div_label'"'
                local len_label : length local div_label
                }
                qui capture set obs `num'
                qui replace `dim_label' = `len_label' in `num'
                if "`suppress'" == "group" {
                if "`commonevent'" != "" {
                if `=`nvars'-`num'' > 1 {
                local otp_r_label_`zzz' : variable label `ar_`z'_`num''
                local ++zzz
                }
                }
                else {
                if `=`nvars'-`num'' > 0 {
                local otp_r_label_`zzz' : variable label `ar_`z'_`num''
                local ++zzz
                }
                }
                }
                else if "`suppress'" == "ind" {
                if "`commonevent'" != "" {
                if `=`nvars'-`num'' < 2 {
                local otp_r_label_`zzz' : variable label `ar_`z'_`num''
                local ++zzz
                }
                }
                else {
                if `=`nvars'-`num'' < 1 {
                local otp_r_label_`zzz' : variable label `ar_`z'_`num''
                local ++zzz
                }
                }
                }
                else {
                local otp_r_label_`zzz' : variable label `ar_`z'_`num''
                local ++zzz
                }
                }
                local space = 4
                local dist_1=`n_dec' + 9 + `space'
                local dist_2=14 + `space'
                if `dist_1' > `dist_2' {
                local dist = `dist_1'
                }
                else{
                local dist = `dist_2'
                }
                forvalues name=1/`num_ev_wdws'{
                scalar namecol_`name' = "CAAR[`lb`name'',`ub`name'']"
                local namecol_`name' = "CAAR[`lb`name'',`ub`name'']"
                local opt_c_label_`name' = "CAAR(`lb`name'',`ub`name'')"
                }
                local num_cols = `num_ev_wdws' + 1
                qui sum `dim_label'
                local cols1_`z' = r(max) + `space'
                local dist3 = `n_dec' + 4
                local dist4 = `dist' - 10
                local start_nvars = 1
                if "`commonevent'" != "" {
                if "`suppress'" == "ind" {
                local start_nvars = `nvars'-1
                }
                else if "`suppress'" == "group" {
                local nvars = `nvars' - 2
                }
                }
                else {
                if "`suppress'" == "ind" {
                local start_nvars = `nvars'
                }
                else if "`suppress'" == "group" {
                local nvars = `nvars' - 1
                }
                }
                local nvars_`z' = `nvars'
                local start_nvars_`z' = `start_nvars'
                mata: CAR_`z' = J(`=`nvars'-`start_nvars'+1', `num_ev_wdws',.)
                mata: PVAL_`z' = J(`=`nvars'-`start_nvars'+1',`num_ev_wdws',.)
                mata: CARSD_`z' = J(`=`nvars'-`start_nvars'+1',`num_ev_wdws',.)
                mata: STTEST_`z' = J(`=`nvars'-`start_nvars'+1',`num_ev_wdws',.)
                forvalues iii = 1/`=`nvars'-`start_nvars'+1' {
                if (`z' ==1 & `iii' == 1) {
                mata: ARS = st_data(.,("`ar_`z'_`=`iii' + `start_nvars' -1''"))
                }
                else{
                capture mata: mata drop aux_ar_mat
                mata: aux_ar_mat = st_data(.,("`ar_`z'_`=`iii' + `start_nvars' -1''"))
                mata: ARS = ARS, aux_ar_mat
                }
                forvalues jjj=1/`num_ev_wdws' {
                mata: CAR_`z'[`iii',`jjj'] = `carvalue_`z'_`=`iii' + `start_nvars' -1'_`jjj''
                mata: PVAL_`z'[`iii',`jjj'] = `pval_`z'_`=`iii'+`start_nvars'-1'_`jjj''
                mata: CARSD_`z'[`iii',`jjj'] = `sd_`z'_`=`iii'+`start_nvars'-1'_`jjj''
                mata: STTEST_`z'[`iii',`jjj'] = `testat_`z'_`=`iii'+`start_nvars'-1'_`jjj''
                }
                }
                if `z' == 1{
                mata: CAR = CAR_`z'
                mata: PVAL = PVAL_`z'
                mata: CARSD = CARSD_`z'
                mata: STTEST = STTEST_`z'
                }
                else{
                mata: CAR = (CAR\CAR_`z')
                mata: PVAL = (PVAL\PVAL_`z')
                mata: CARSD = (CARSD\CARSD_`z')
                mata: STTEST = (STTEST\STTEST_`z')
                }
                }
              ----------------------------------------------------------------------------------------------------------------------------------------------- end estudy ---
            r(2000);
            
            end of do-file
            
            r(2000);

            Comment


            • #21
              I got much more than I asked for which was that

              we need to see a chunk of the code just before estudy kicks you out
              but what is throwing you out is this

              Code:
                - `version' _regress `anything' `if' `in' [`weight'`exp'], `diopts0' `diopts' `options' `robust' `cluster'    
              
              = version 13, missing : _regress __00002A  __000029 if __000044<=-11 & __000044>=-60  [],      
              
              no observations
              which looks as if the regress command can find nothing in some interval [-60, -11]

              Does that make any sense? It looks like something specific to your data.

              Comment


              • #22
                You previously told us that this failure of the estudy command occurs when it is run with the first year of your data. So I'd guess that for some event in your first year, any observations from 11 to 60 months earlier would all be in the previous year, for which you have no data.

                Comment


                • #23
                  Yes, you are right. I've managed to run the commands and got the same results as the other years. It's the date and mkt for one particular company. I included wrong data for the interval -60,-11 when they're supposed to be within the event date.

                  Thank you very much for your assistance and time, Mr Nick Cox and Mr William Lisowski.

                  Really appreciate it! Have a nice day to both of you.

                  Comment

                  Working...
                  X