Dear Stata users,
I am having trouble with exporting odds ratios, confidence intervals and p-values from 230 different logistic regressions using filewrite. Exporting estimated beta coefficients, confidence intervals, and p-values works fine, but I would rather report the exponentiated betas (odds ratios) and associated confidence intervals as well as p-values.
The code that works but gives me beta coefficients instead of exponentiated beta coefficients (odds ratios) and confidence intervals instead of exponentiated confidence intervals is given below. The question is how do I change the code below to provide the exponentiated betas (odds ratios), confidence intervals, and p-values?
foreach bp of varlist disease2 {
cd "\\my documents\data"
file open table2 using "mytable1.txt", replace write
file write table2 _tab _tab "not adjusted" _tab _tab "Multiple adjusted" _n
file write table2 "Variable" _tab "Beta1" _tab "P-value1" _tab "Beta2" _tab "P-value2" _n
foreach lipid of varlist lipid1-lipid230 {
quietly: logistic `bp' `lipid'
file write table2 "`lipid'" _tab (round(_b[`lipid'],0.001)) " (" (round(_b[`lipid']- invnormal(0.975)*_se[`lipid'],0.001)) ", " (round(_b[`lipid']+ invnormal(0.975)*_se[`lipid'],0.001)) ")" _tab (round(2*normal(-abs(_b[`lipid']/_se[`lipid']))),0.0000000001) _tab
quietly: logistic `bp' `lipid' age sex weight
file write table2 (round(_b[`lipid'],0.001)) " (" (round(_b[`lipid']- invnormal(0.975)*_se[`lipid'],0.001)) ", " (round(_b[`lipid']+ invnormal(0.975)*_se[`lipid'],0.001)) ")" _tab (round(2*normal(-abs(_b[`lipid']/_se[`lipid']))),0.00000000001) _n
}
file close table2
}
/// Sam
Related Posts with Exporting odds ratios, confidence intervals, and p-values from multiple logistic regression models using filewrite
Heckprobit model with no outputHi everyone, I'm working on a project about internet lending which focuses on the relationship betw…
Does minbound run with logs?I am using minbound to find the solution to an equation the involves log (equivalent to solver in Ex…
capture a change over time within idHi I have a panel data of N couples (id) over 6 time periods the variable h_child is equal to "1" if…
Plotting Quantile treatment effects with 95% confidence intervalDear statalist, I am using the following code to plot the QTE along with 95 % CI. capture postuti…
tsspell problemDear All, I found this question here (https://bbs.pinggu.org/thread-9071118-1-1.html). The data set …
Subscribe to:
Post Comments (Atom)
0 Response to Exporting odds ratios, confidence intervals, and p-values from multiple logistic regression models using filewrite
Post a Comment