I am trying to see the relationship between diet and exercise with mental health disorder with all my dependent and independent variables are categorical. For that purpose, I built an ordered logistic regression model (ologit). I want to represent the resulted coefficients using coefplot and I want to show some of the categorical features with different levels as stacked in the coefplot. As an example, I am interested to show coefficients for different levels of fish oil consumption or sleep duration as stacked in my coefplot. I am wondering if it is possible to do so and how?
Thank you in advance.
Code:
ologit mental_disorder_score i.gender exercise_freq_per_week eat_breakfast_past_week eat_whole_grain_per_day \\\ caffeine_per_day fruits_per_day meat_chicken_turkey vegetables beans sea_food fast_food i.fish_oil multivitamins \\\ i.exercise_dur_per_week i.sleep_time eastern_diet _39 _49 above_50 graduate_student asian_diet korean_diet \\\ mediterranean_diet greek_life estimates store depression coefplot (depression, keep(1.gender exercise_freq_per_week eat_breakfast_past_week fruits_per_day vegetables \\\ sea_food multivitamins 1.fish_oil 4.fish_oil _39 _49 above_50 graduate_student 1.exercise_dur_per_week 2.exercise_dur_per_week\\\ 3.exercise_dur_per_week 4.exercise_dur_per_week 2.sleep_time 3.sleep_time 4.sleep_time mediterranean_diet greek_life korean_diet)\\\ xlabel(, ang(v)) recast(bar) color(green)) (dep1, keep(2.gender eat_whole_grain_per_day caffeine_per_day beans 2.fish_oil 3.fish_oil 5.fish_oil \\\ 5.sleep_time fast_food eastern_diet asian_diet) xlabel(, ang(v)) recast(bar) color(red)) , vertical coeflabels(1.gender= "Female" \\\ exercise_freq_per_week= "Exercise Frequency per Week" eat_breakfast_past_week= "Eat Breakfast Past Week" fruits_per_day= "Fruits per Day" \\\ vegetables= "Vegetables" sea_food= "Sea Food" multivitamins= "Multivitamins" 1.fish_oil= "None" 4.fish_oil= "Fish Oil 3 Times per Week" _39="Age 30 - 39" \\\ _49= "Age 40 - 49" above_50= "Age More than 50" graduate_student=" Graduate Student" 1.exercise_dur_per_week= "Excercisng Less than 1 Hour" \\\ 2.exercise_dur_per_week= "Excecising 1-2 Hours" 3.exercise_dur_per_week= "Excercising 3-4 Hours" 4.exercise_dur_per_week= "Excecising 5-6 Hours" \\\ 2.sleep_time= "Sleep & Hours" 3.sleep_time= "Sleep 8 Hours" 4.sleep_time= "Sleep 9 Hours" mediterranean_diet= "Mediterranean Diet" greek_life= "Greek Life Style" \\\ korean_diet= "Korean Diet" 2.gender= "Male" eat_whole_grain_per_day= "Eat Whole Grain per Day" caffeine_per_day= "Eat Caffeine per Day" beans= "Beans" \\\ 2.fish_oil= "Fish Oil Once per Week" 3.fish_oil= "Fish Oil Twice per Week" 5.fish_oil= "Fish Oil 5 Times per Week" 5.sleep_time= "Sleep More Than 10 Hours " \\\ fast_food= "Fast Food" eastern_diet= "Eastern Diet" asian_diet= "Asian Diet") nooffsets plotlabels("Negative Coef" "Positive Coef") /// xtitle("Factors") ytitle("Coefficients") xlabel(, ang(v))
0 Response to Represent different levels of categorical variables in coefplot as Stacked
Post a Comment