Dear Stataforum,
Does anyone know how to produce a graph that looks like Nick's dot plot example using multiple outcome variables and only one "over" variable?
The goal is to plot two group means (with different markers for the two groups) on each line of a dot plot that examines the means for multiple variables.
The over() and by() options seem to be headed in the right direction, but I can't figure out how to put the two group means for each variable on the same line.
I have pasted Nick's code below along with two of my failed attempts.
In the graph I wish to make, all the variables have the same range of possible values so a single axis will work just fine.
This is not the case in the examples below using mvalue, invest, and kstock, so the example may present some difficulties that I will not need to address.
Thanks,
Jeremy
Does anyone know how to produce a graph that looks like Nick's dot plot example using multiple outcome variables and only one "over" variable?
The goal is to plot two group means (with different markers for the two groups) on each line of a dot plot that examines the means for multiple variables.
The over() and by() options seem to be headed in the right direction, but I can't figure out how to put the two group means for each variable on the same line.
I have pasted Nick's code below along with two of my failed attempts.
In the graph I wish to make, all the variables have the same range of possible values so a single axis will work just fine.
This is not the case in the examples below using mvalue, invest, and kstock, so the example may present some difficulties that I will not need to address.
Thanks,
Jeremy
Code:
webuse grunfeld, clear *Nick's code: two means on each horizontal line with different markers for the two years graph dot (asis) mvalue if inlist(year, 1953, 1954), over(year) over(company, sort(1) desc) /// marker(1, ms(Oh)) marker(2, ms(+)) asyvars /// linetype(line) lines(lcolor(gs12) lw(vthin)) ytitle(Market value (units???)) ysc(alt) *What if I have multiple variables (mvalue invest kstock) rather than one (mvalue) *and care about year differences but not company differences? *one mean on each horizontal line but with two panels graph dot mvalue invest kstock if inlist(year, 1953, 1954), ascat over(year) /// marker(1, ms(Oh)) marker(2, ms(+)) asyvars /// linetype(line) lines(lcolor(gs12) lw(vthin)) ytitle(Market value (units???)) ysc(alt) *one mean on each horizontal line but with two subgraphs graph dot mvalue invest kstock if inlist(year, 1953, 1954), ascat by(year) /// marker(1, ms(Oh)) marker(2, ms(+)) asyvars /// linetype(line) lines(lcolor(gs12) lw(vthin)) ytitle(Market value (units???)) ysc(alt)
Comment