The Stata -poisson- can be used to model count variables/incidence rate. However, the default predicted margin is a predicted number of events. We need use the -predict(ir)- option to get the predicted incidence rate.
-n-, the default, calculates the predicted number of events. -ir- calculates the incidence rate exp(Xjbeta), which is the predicted number of events when exposure is 1. Specifying -ir- is equivalent to specifying -n- when neither -offset()- nor -exposure()- was specified when the model was fit. For example:
webuse nhanes2, clear
svy: poisson hlthstat age i.region
margins region, predict(ir) at(age=50) vce(svy)
Factor variable operators
- i. unary operator to specifiy indicators
- c. unary operator to treat as continuous
- o. unary operator to omit a variable or indicator
- # binary operator to specify interactions
- ## binary operator to specify full-factorial interactions
- use ib#., ib(first)., ib(last)., ib(freq). to set base level
- ibn. means no baselevel
- ".fvset base 3 group" sets the base for group to be 3
- ".list if 3.group" to list all when group is equal to 3.
- ".gen over_age=cond(3.group, age-21, 0)"
No comments:
Post a Comment