I was working with a large dataset and I am working with trends over time. I was trying to figure out the % change per year between one year to the next for different outcomes. Through my data and trend analysis, I've determined that there are non-linear relationships between time and the outcome. I determined the ideal "knots" in between the years, and so the slope of the % change may vary between segments of the knots.
For continuous outcomes, I can use a log-transformed variable to determine the annual percent change in time, using (eb - 1)*100%, where b is the coefficient of the time segment. However, for binary outcomes, this doesn't seem so obvious to me in terms of how to figure out the annual percent change over time of different slopes, since a logistic model for binary outcomes, the % change would represent at % change in the odds (if I'm not mistaken). When describing the results for binary outcomes, stating that the odds of an outcome increases/decreases by __% doesn't seem intuitive.
I modified one of stata's example datasets to give an example of the code that I've been using so far.
In this case, I'm pretending that grade 14 is one of the "knots". Continuous outcome is wage; binary outcome is married (0 or 1).
Code:
sysuse nlsw88 *set the knot gen r=0 replace r=grade if grade <= 14 replace r=14 if grade > 14 gen r2=0 replace r2=(grade-14) if grade>14 ***Continuous variable**** *log transform gen logwage=log(wage) *regress the log transformed variable regress logwage r r2 *Determine the % change of each segment; can also determine the 95% CI using the SE lincom r local r = 100*(exp(_b[r])-1) di `r' local rse = r(se) local upper_ci = (exp(_b[r]+invnormal(0.975)*`rse')-1)*100 local lower_ci = (exp(_b[r]-invnormal(0.975)*`rse')-1)*100 di `dseg1se' di "Upper CI:"`upper_ci' di "Lower CI:"`lower_ci' *repeat for segment 2 lincom r2 local r2 = 100*(exp(_b[r2])-1) di `r2' *test for differences between segments lincom r2-r ****Binary variable**** logit married r r2 lincom r local r = 100*(exp(_b[r])-1) di `r' lincom r2 local r2 = 100*(exp(_b[r2])-1) di `r2'
However, determining the % change per 1-unit increase in grade in segment 1 and segment 2 for the probability of being married does not (as I think the % change is for the log odds?)
My question is: is there anyway to transform the binary outcome to get a similar % change per 1-unit increase for the probability of being married? (and to obtain the results for each segment?). If not, then would it be better just to express the segments as odds ratios (per 1-unit increase in grade).
Perhaps this is an easy question, but I've been reading quite a bit around this and haven't figured it out.
Thanks
E
0 Response to Determining annual percent change in binary variable
Post a Comment