Announcement

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

  • Significant coefficients from logit model not showing in collect results

    Significant coefficients are not showing for reasons not clear to me. All the bold intervals in the table below do not have their coefficients showing. They are actually statistically significant but not showing along with their asterisks. Also, how do I include the base categories in the collect results.
    Kindly assist. Here is the dataset: sample2.dta

    Code:
     
    Logistic Regressions
    PP118:- During pregnancy, women may encounter severe problems or illnesses and s PP120:- During the whole pregnancy, did you take any tablets or a syrup as nutri
    OR [95% CI] OR [95% CI]
    Program exposure
    Intervention 0.83 [0.60, 1.16] [3.29, 7.23]
    Age (categories)
    16 0.92 [0.43, 1.95] 1.47 [0.67, 3.24]
    17 1.19 [0.69, 2.05] [1.18, 3.73]
    18 0.76 [0.45, 1.31] [1.58, 4.77]
    19 0.76 [0.43, 1.35] [2.00, 6.87]
    Educational level
    Primary 0.67 [0.42, 1.07] [0.37, 0.97]
    Secondary 0.59 [0.19, 1.84] 0.91 [0.27, 3.11]
    Higher 1.04 [0.60, 1.83] 0.82 [0.43, 1.56]
    Multi-dimensional poverty head count (% of participants from deprived households
    Yes 0.72 [0.51, 1.04] 0.82 [0.53, 1.26]
    Parity: Number of previous live births
    Been pregnant but no live births 1.31 [0.69, 2.47] [0.22, 0.92]
    Had a single previous live birth 1.17 [0.78, 1.77] 0.97 [0.58, 1.62]
    Had two or more previous live birth [1.36, 101.82] [0.06, 0.89]
    Distance from nearest health facility
    11-30 min (Close) 1.26 [0.83, 1.90] 1.09 [0.67, 1.78]
    31-60 min (Moderate) 0.83 [0.50, 1.37] 0.91 [0.51, 1.62]
    >60 min (Far) 0.73 [0.20, 2.59] 0.35 [0.10, 1.19]
    * p<.05
    Code:
    local univar pp118 pp120 //pp202 pp209 pp214 pp216 pp218 pp302 pp303 pp304 pp501 pp504 pp508 pp510
    foreach v of local univar {
        replace `v' = 0 if `v'==2
        replace `v' = 0 if `v'==98
        replace `v' = . if `v'==99
    }
    // logit pp118 i.p203 i.age i.edu i.mdp i.par i.hfd i.state [pweight=psweight], robust or base nocons
    
    *--------------------------------------------
    * Step 1: Estimate Models and Store Results
    *--------------------------------------------
    foreach v of local univar {
    logit `v' i.p203 i.age i.edu i.mdp i.par i.hfd [pweight=psweight], robust or base nocons
    estimates store `v'
    }
    *--------------------------------------------
    * Step 2: Generate etable and store in collect
    *--------------------------------------------
    collect clear
    etable,  estimates(pp118 pp120) cstat(_r_b) cstat(_r_p) cstat(_r_ci, cidelimiter(,)) mstat(_hide) ///
     eqrecode(pp118=xb pp120=xb) noshoweq stars(0.05 "*", attach(_r_b)) ///
     title("Logistic Regressions") ///
     titlestyles(font(, bold)) ///
     showstars ///
     showstarsnote ///
     notestyles(font(, italic)) ///
     varlabel ///
     column(dvlabel) ///
    
    *--------------------------------------------
    * Step 3: Format and Style the Table using collect
    *--------------------------------------------
    *collect stars _r_p 0.05 "*", attach(_r_b) shownote
    collect style cell result, nformat(%8.2f)
    collect composite define blu = _r_lb _r_ub, delimiter(", ") trim replace
    collect style cell result[blu], sformat("[%s]")
    collect composite define bci = _r_b blu, trim replace
    collect style cell result[bci], sformat("%s")
    collect label levels result bci "OR [95% CI]"
    collect style header result, title(hide)
    collect layout (colname) (etable_dvlabel#result[bci])

  • #2
    Modifications to your code are highlighted in red. The bits that have been commented out can be deleted.

    Code:
    *--------------------------------------------
    * Step 1: Estimate Models and Store Results
    *--------------------------------------------
    foreach v of local univar {
    logit `v' i.p203 i.age i.edu i.mdp i.par i.hfd [pweight=psweight], robust or base nocons
    estimates store `v'
    }
    *--------------------------------------------
    * Step 2: Generate etable and store in collect
    *--------------------------------------------
    collect clear
    etable,  estimates(pp118 pp120) cstat(_r_b) cstat(_r_p) cstat(_r_ci, cidelimiter(,)) mstat(_hide) ///
     eqrecode(pp118=xb pp120=xb) noshoweq /* stars(0.05 "*", attach(_r_b)) */ ///
     title("Logistic Regressions") ///
     titlestyles(font(, bold)) ///
     showstars ///
     showstarsnote ///
     notestyles(font(, italic)) ///
     varlabel ///
     column(dvlabel) ///
    
    *--------------------------------------------
    * Step 3: Format and Style the Table using collect
    *--------------------------------------------
    /* * */ collect stars _r_p 0.05 "*", attach(_r_b) shownote result
    collect style cell result, nformat(%8.2f)
    collect composite define blu = _r_lb _r_ub, delimiter(", ") trim replace
    collect style cell result[blu], sformat("[%s]")
    collect composite define bci = _r_b blu, trim replace
    collect style cell result[bci], sformat("%s")
    collect label levels result bci "OR [95% CI]"
    collect style header result, title(hide)
    collect layout (colname) (etable_dvlabel#result[bci])

    Comment

    Working...
    X