Announcement

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

  • Using bayesstats summary on pooled multiple chain data.

    Dear Statalisters,
    Is there a way to summarize amalgamated data from multiple chains with bayesstats summary that is undocumented?. I generated composite data using three chains as described in code below. On multiple attempts, bayesstats summary summarized third set of estimates only.

    cd I:\
    use http://fmwww.bc.edu/repec/bocode/m/m...ample_data.dta, clear

    set seed 1356
    gen num1 = tn+fp
    gen num2 = tp+fn
    gen study=_n
    gen parameter1 = tn
    gen parameter2 = tp
    reshape long num parameter, i(study) j(dtruth)
    tabulate dtruth, generate(mu)

    forvalues nchain=1/3 {
    bayes, remargl mcmcsize(10000) burnin(20000) initrandom thin(2) nomodelsummary saving( "I:\sim`nchain'.dta", replace): meglm parameter mu1 mu2, ///
    noconstant || study: mu1 mu2, noconstant ///
    cov(uns) family(binomial num) link(logit)
    estimates store sim`nchain'
    local estid : di "sim`nchain'" ""
    local estnames "`estnames' `estid'"
    }

    nois grubin {parameter:mu2} {parameter:mu1} {U:Sigma_1_1} {U:Sigma_2_1} ///
    {U:Sigma_2_2}, estnames("`estnames'")

    forvalues i=1/3 {
    use "I:\sim`i'.dta", clear
    gen chain=`i'-1
    qui save "I:\sim`i'.dta", replace
    }
    use "I:\sim1.dta", clear
    forvalues i=2/3 {
    append using "I:\sim`i'.dta"
    }
    nois bayesstats summary (sen:invlogit({parameter:mu2})) ///
    (spe:invlogit({parameter:mu1})) ///
    (logdor{parameter:mu2}+{parameter:mu1})) ///
    (lrp:invlogit({parameter:mu2})/(1-invlogit({parameter:mu1}))) ///
    (lrn1-invlogit({parameter:mu2}))/invlogit({parameter:mu1})), hpd noleg

    Thank you,
    Ben
Working...
X