Dear all,
I'd like to display glm model outputs using the postfile commend in stata (then transfer to tables in excel). Previously I have used the codes to display standard coef, 95%CI and p values from regression models. How do I modify the codes to get the results displaying as IRR instead of standard coef.?

Any help is appreciated!
Maggie
I'd like to display glm model outputs using the postfile commend in stata (then transfer to tables in excel). Previously I have used the codes to display standard coef, 95%CI and p values from regression models. How do I modify the codes to get the results displaying as IRR instead of standard coef.?
glm chapmsss latitude sex age, fam(poi) link(log) nolog robust eform
matrix b = e(b)
matrix V= e(V)
local beta: display %3.1f b[1,1]
local l95: display %3.1f b[1,1] - invnormal(0.975)*sqrt(V[1,(1)])
local u95: display %3.1f b[1,1] + invnormal(0.975)*sqrt(V[1,1])
/* A little code to display the p value as <0.001 if appropriate: NOTE: This can be expanded to the format you desire, for example if you want *s for significance*/
local pval = 2*normprob(-abs(b[1,1]/sqrt(V[1,1])))
if `pval' <= 0.001 {
local pval = "p<0.001"
}
else if `pval' <= 0.10 {
local pval: display %4.3f 2*normprob(-abs(b[1,1]/sqrt(V[1,1])))
local pval = "p=`pval'"
}
else if `pval' <= 1 {
local pval: display %4.3f 2*normprob(-abs(b[1,2]/sqrt(V[1,1])))
local pval = "p=`pval'"
}
post temp ("`var'") ("`beta' [`l95', `u95']") ("`pval'")
}
matrix b = e(b)
matrix V= e(V)
local beta: display %3.1f b[1,1]
local l95: display %3.1f b[1,1] - invnormal(0.975)*sqrt(V[1,(1)])
local u95: display %3.1f b[1,1] + invnormal(0.975)*sqrt(V[1,1])
/* A little code to display the p value as <0.001 if appropriate: NOTE: This can be expanded to the format you desire, for example if you want *s for significance*/
local pval = 2*normprob(-abs(b[1,1]/sqrt(V[1,1])))
if `pval' <= 0.001 {
local pval = "p<0.001"
}
else if `pval' <= 0.10 {
local pval: display %4.3f 2*normprob(-abs(b[1,1]/sqrt(V[1,1])))
local pval = "p=`pval'"
}
else if `pval' <= 1 {
local pval: display %4.3f 2*normprob(-abs(b[1,2]/sqrt(V[1,1])))
local pval = "p=`pval'"
}
post temp ("`var'") ("`beta' [`l95', `u95']") ("`pval'")
}
Any help is appreciated!
Maggie
Comment