Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • One Histogram to show distribution (%) of population according to two categorical variables for longitudinal data

    Hi,
    I am analysing longitudinal data. I would like to have just one histogram graph which shows the distribution of children (%) with a disability according to their motor ability classifications. The children are classified according to both macs (manual ability-5 categories) and gmfcs (gross motor skills-5 categories). So far I can only manage commands which show multiple graphs to show this information.

    histogram gmfcs_t, discrete by (macs)

    histogram gmfcs_t , discrete by(macs, total) xlabel(1 2 3 4 5)

    Is there a way to get all this information onto just one graph. Eg. The x-axis shows macs categories, and the y axis shows the distribution (%) of gmfcs within each of the 5 categories of macs.



    The output from data ex is below

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int patientid byte appt_type int macs byte gmfcs_t
    1448 30 2 1
    1448 48 2 2
    1455 48 4 4
    1455 36 4 4
    1455 60 4 4
    1455 30 4 5
    1456 48 5 5
    1456 18 5 5
    1456 36 5 5
    1456 24 5 5
    1457 18 5 5
    end
    label values appt_type appt_type_labels
    label def appt_type_labels 18 "18 months", modify
    label def appt_type_labels 24 "24 months", modify
    label def appt_type_labels 30 "30 months", modify
    label def appt_type_labels 36 "36 months", modify
    label def appt_type_labels 48 "48 months", modify
    label def appt_type_labels 60 "60 months", modify
    label values macs macs_labels
    label def macs_labels 2 "MACS 2", modify
    label def macs_labels 4 "MACS 4", modify
    label def macs_labels 5 "MACS 5", modify
    Kind regards,
    Andrea Burgess
Working...
X