Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: RE: Graphing the median of a list of variables

 From "Nick Cox" To Subject RE: st: RE: Graphing the median of a list of variables Date Wed, 28 Apr 2010 11:30:33 +0100

```It now does sound like a -reshape- before you draw a graph.

Nick
n.j.cox@durham.ac.uk

Jeremy Voros

-collapse- looks like it might be the tool I'm looking for. But, the
data I have are self-assessments of competency in a variety of areas.
The mean increases as the year increases. I'm trying to devise a method
of visualizing the responses to all the questions improving over time.
Putting the year along the x-axis would require a separate graph line
for each question, of which I have approximately 50, which is too many
for such a graph.

-grmeanby- is useful too, but it also will only summarize data for a
single variable.

I'm thinking if I could turn my column variables into row values I'd be
able to get what I want. So I could have a table like so:

|   question   |   median_1999   |   median_2001   |   etc, for each
year
|      1       |       2         |       3         |
|      2       |       4         |       5         |

then the line graph would be trivial.

I might need to consider another visualization method.

And thanks for the suggestion on the mean.

On Apr 27, 2010, at 2:12 PM, Nick Cox wrote:

> No; I would use -collapse- first.
>
> collapse (p50) question*, by(year)
>
> After that, it's just a -line- plot. I'd put year on the x axis; any
>
> By the way, even though the data are Likert scales, in my experience
> means in practice often do a much better job of summarising level
> (regardless of measurement theory).

Jeremy Voros

> Stata newbie here with a question I'm having trouble finding an answer
> for. I would like to create a line graph with variables along the
x-axis
> and their median on the y-axis, with a different line for each
variable
> based on the cohort year. Here's the details:
>
> My database of likert-scale survey data looks basically like this:
>
> |      id     |     year     |     question1     |      question2
|
> question3     |     etc...
> |      5      |     1999     |         1         |          4
|
> 3         |
> |      5      |     2001     |         3         |          4
|
> 2         |
> |      6      |     1999     |         3         |          5
|
> 4         |
>
>
> So ultimately I'd like a graph with question1, question2...questionX
> along the x-axis, and the median of each variable on the y-axis, with
a
> different line for each year.
>
> I feel like it should involve tabstat or reshape somehow, but can't
> manage to work it out. Any help appreciated.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```