I am conducting a latent class analysis of a set of 9 questions about vaccine hesitancy. I’m creating bar graphs to describe each of four resultant classes from my model, to describe the pattern of responses to these 9 questions within each class. Responses range from 1 to 3 (corresponding to “Agree”, “Neither Agree nor Disagree”, and “Disagree”). I need four identical bar graphs, with x axis representing each of the 9 questions, and y axis representing responses and set to display values between 1 and 3 (inclusive). I'm having difficulty using options to separate the bars so they are visually distinct. I have tried "bargap" and "gap" and "barwidth" and "ascategory" options, but keep getting the "option X not allowed" error message
How do I separate the bars, so a small amount of empty space appears between each bar? marginsplot doesn't appear to be working like the traditional graph bar command (or, perhaps more likely, I'm putting my options in the wrong place?).
Here’s my code, an example from one of the four classes from my LCA:
margins, predict(outcome(vhs_lf_important_recode2) class(4)) predict(outcome(vhs_lf_community_recode2) class(4)) predict(outcome(vhs_lf_beneficial_recode2) class(4)) predict(outcome(vhs_lf_reliableinfo_recode2) class(4)) predict(outcome(vhs_lf_protect_recode2) class(4)) predict(outcome(vhs_lf_doctor_reccomend_recode2) class(4)) predict(outcome(vhs_lf_notcommon2) class(4)) predict(outcome(vhs_lf_adverseevents2) class(4)) predict(outcome(vhs_lf_morerisks2) class(4))
marginsplot, recast(bar) xtitle("") ytitle("") xlabel(1 "Important" 2 "Community" 3 "Beneficial" 4 "Reliable Info" 5 "Protect" 6 "Dr Recommend" 7 "Not Common" 8 "AEs" 9 "More Risks", angle(45)) title("Lassa Fever VHS Responses For Vaccine Skeptics Class with 95% CI") ylabel(1 2 3) saving(vaccine_skeptics_lca, replace)
I've attached the resultant graph
Thanks for any help you can offer.
How do I separate the bars, so a small amount of empty space appears between each bar? marginsplot doesn't appear to be working like the traditional graph bar command (or, perhaps more likely, I'm putting my options in the wrong place?).
Here’s my code, an example from one of the four classes from my LCA:
margins, predict(outcome(vhs_lf_important_recode2) class(4)) predict(outcome(vhs_lf_community_recode2) class(4)) predict(outcome(vhs_lf_beneficial_recode2) class(4)) predict(outcome(vhs_lf_reliableinfo_recode2) class(4)) predict(outcome(vhs_lf_protect_recode2) class(4)) predict(outcome(vhs_lf_doctor_reccomend_recode2) class(4)) predict(outcome(vhs_lf_notcommon2) class(4)) predict(outcome(vhs_lf_adverseevents2) class(4)) predict(outcome(vhs_lf_morerisks2) class(4))
marginsplot, recast(bar) xtitle("") ytitle("") xlabel(1 "Important" 2 "Community" 3 "Beneficial" 4 "Reliable Info" 5 "Protect" 6 "Dr Recommend" 7 "Not Common" 8 "AEs" 9 "More Risks", angle(45)) title("Lassa Fever VHS Responses For Vaccine Skeptics Class with 95% CI") ylabel(1 2 3) saving(vaccine_skeptics_lca, replace)
I've attached the resultant graph
Thanks for any help you can offer.
Comment