Dear all,
I am using State 16.0 MP to run 50 ordered logistic regressions using a loop that excludes each US state one by one. My data is at the individual level and takes the following form:
where ID is in individual identifier, xvar and yvar are my main variables of interest and state is a variable for US states running from 1 to 50. This state variable has label values attached to it, such that 1 = "AL", 2 = "AK", and so on. The dataset contains several dozen individuals per state on average.
The command I use to run the loop is given by:
My problem arises when I am using coefplot to plot the stored coefficient estimates. Specifically, I would like to show the 2-digit state code from the labels of the state variable on the xaxis -- to indicate which US state is excluded in a given run of the regression model. In my understanding, the "valuelabel" option imposes that the label values are derived from the x or y variable’s value label, which is not the case here.
I am aiming for something that looks like the graph below, but has 2-digit state codes rather than numbers on the x axis. The code for the graph below is:
Thanks very much in advance for any suggestions.
Best regards,
Ben
I am using State 16.0 MP to run 50 ordered logistic regressions using a loop that excludes each US state one by one. My data is at the individual level and takes the following form:
ID | xvar | yvar | state |
1 | 12 | 32 | AL |
2 | 25 | 54 | AL |
3 | 13 | 33 | AK |
4 | 57 | 76 | AK |
5 | 24 | 22 | AZ |
The command I use to run the loop is given by:
Code:
forvalues k = 1(1)50 { ologit vary varx if state ~= `k' estimates store STATE`k' }
I am aiming for something that looks like the graph below, but has 2-digit state codes rather than numbers on the x axis. The code for the graph below is:
Code:
coefplot STATE*, keep(varx) levels(95) legend(off) \\\ ytitle("Coefficient estimates (95% confidence intervals)") ylabel(-0.5 -0.25 0 0.25 0.5) \\\ xtitle("Excluded state") mstyle(p1) mcolor(black) ciopts(lcolor(black)) \\\ xlabel(0.52(0.0192)1.48,labsize(*.75) angle(vertical)) vertical
Thanks very much in advance for any suggestions.
Best regards,
Ben