Announcement

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

  • G-formula error at bootstrapping step

    Hello, I have been trying to use the gformula command by Daniels and DeStavola. When trying tu use the command I face error r(322), I traced the code to try to analyze the problem but I could not figure it out.

    Here is the command I use and the output:
    Code:
     gformula dtrans treatment eta area5 id ylag1 yfamlag1 fam ypers stumcf stumco, out(dtrans) com(dtrans:logit,  ypers:regress, fam:regress)  ///
    eq(dtrans: treatment area5 ylag1 yfamlag1 fam ypers stumcf stumco, ypers: treatment area5 ylag1, fam: yfamlag1 stumco stumcf)   ///
    exposure(treatment) mediation mediator(ypers) base_confs(stumcf stumco fam) post_confs(fam) obe impute(ylag1 yfamlag1)    ///
    imp_eq(ylag1:ypers, yfamlag1:fam) imp_cmd(ylag1:regress, yfamlag1:regress) graph
    
    "'r(pm)' evaluated to missing in full sample"'
    'r(pm)' evaluated to missing in full sample
          - exit 322
            }
            }
          ----------------------------------------------------------------------------------------------------------------- end bootstrap.BootStrap ---
        ----------------------------------------------------------------------------------------------------------------------------- end bootstrap ---
      -------------------------------------------------------------------------------------------------------------------------------- end gformula ---
    r(322);
    
    end of do-file
    
    r(322);
    Does anybody have any idea of why it stops? As far as I understood from traced output the formula estimates 5 values (tce, nde, nie, pm, cde), yet I have not understand what pm stands for.

    I post a part of the traced output that I think might be useful for solving the problem:

    Code:
     -------------------------------------------------------------------------------------------------------------------- end _prefix_expand ---
          - local k_eq `s(k_eq)'
          = local k_eq 1
          - local k_exp `s(k_exp)'
          = local k_exp 5
          - local k_eexp `s(k_eexp)'
          = local k_eexp 0
          - local K = `k_exp' + `k_eexp'
          = local K = 5 + 0
          - local k_extra `s(k_extra)'
          = local k_extra 0
          - local names `"`s(enames)' `s(names)'"'
          = local names `" _bs_1 _bs_2 _bs_3 _bs_4 _bs_5"'
          - local express `"`s(explist)'"'
          = local express `"(r(tce)) (r(nde)) (r(nie)) (r(pm)) (r(cde))"'
          - local eexpress `"`s(eexplist)'"'
          = local eexpress `""'
          - local coleq `"`s(ecoleq)' `s(coleq)'"'
          = local coleq `" "_" "_" "_" "_" "_""'
          - local colna `"`s(ecolna)' `s(colna)'"'
          = local colna `" _bs_1 _bs_2 _bs_3 _bs_4 _bs_5"'
          - forval i = 1/`K' {
          = forval i = 1/5 {
          - local exp`i' `"`s(exp`i')'"'
          = local exp1 `"r(tce)"'
          - if missing(`b'[1,`i']) {
          = if missing(__000003[1,1]) {
            di as err `"'`exp`i''' evaluated to missing in full sample"'
            exit 322
            }
          - }
          - local exp`i' `"`s(exp`i')'"'
          = local exp2 `"r(nde)"'
          - if missing(`b'[1,`i']) {
          = if missing(__000003[1,2]) {
            di as err `"'`exp`i''' evaluated to missing in full sample"'
            exit 322
            }
          - }
          - local exp`i' `"`s(exp`i')'"'
          = local exp3 `"r(nie)"'
          - if missing(`b'[1,`i']) {
          = if missing(__000003[1,3]) {
            di as err `"'`exp`i''' evaluated to missing in full sample"'
            exit 322
            }
          - }
          - local exp`i' `"`s(exp`i')'"'
          = local exp4 `"r(pm)"'
          - if missing(`b'[1,`i']) {
          = if missing(__000003[1,4]) {
          - di as err `"'`exp`i''' evaluated to missing in full sample"'
          = di as err `"'r(pm)' evaluated to missing in full sample"'
    'r(pm)' evaluated to missing in full sample
          - exit 322
            }
            }
Working...
X