> Tunga thinks it a "deficiency" that my -catplot- program, downloadable
from SSC, when faced with a subset of observations with categories 1 4 5 6 7
8 9 10 does not notice that elsewhere in the data there are categories 2 3,
which he wants to show on a graph. He wants a "better developed" command
which does notice that.
1 4 5 6 7 8 9 10 are not categories. They are the values a variable takes.
There is another variable which takes three values. Hence, for each of the 1
4 5 6 7 8 9 10, there are three bars.
> However, that is all quite unnecessary, as -histogram- (a command, not a
function) should prove capable of doing what he wants, or at least I have
seen no evidence to the contrary. -histogram- does support categorical
variables,
As far as I am aware of, histogram does not do what I want. That is why I
have first tried 'graph bar'. But since 'graph bar' works with row data I
turned to catplot which procudes frequencies of categories.
Put differently, I want the histogram command with "over(variablename)"
command of 'graph bar'.
Now, to avoid a misunderstanding I will repeat what I was trying to do:
Variable 1: takes values from 1 to 10.
Variable 1
----------------------------------------------------------------------
| Freq. Percent Valid Cum.
-------------------------+--------------------------------------------
1 helemaal niks | 19 0.95 4.53 4.53
2 | 6 0.30 1.43 5.97
3 | 11 0.55 2.63 8.59
4 | 29 1.45 6.92 15.51
5 | 53 2.64 12.65 28.16
6 | 85 4.24 20.29 48.45
7 | 107 5.34 25.54 73.99
8 | 73 3.64 17.42 91.41
9 | 18 0.90 4.30 95.70
10 ideaal | 18 0.90 4.30 100.00
----------------------------------------------------------------------
Variable 2: takes three values
Variable 2
-----------------------------------------------------------
| Freq. Percent Valid Cum.
--------------+--------------------------------------------
Valid 1 | 627 31.29 34.17 34.17
2 | 600 29.94 32.70 66.87
3 | 608 30.34 33.13 100.00
Total | 1835 91.57 100.00
-----------------------------------------------------------
What i am seeking is a frequency graph of variable 1, but each of its values
will have three bars.
I have achived this with catplot.
So up to here no problem.
The problem: Now, I have variable 3, just like variable 1, which takes 10
values but for values 2 and 3 there are no observations.
When I run catplot, 2 has three categories and 3 has three categories, etc
up to 8. There are no bars for 9 and 10.
This is the problem: the frequency that should stand for value '4' stands
for '2' in the graph. The frequency that should stand for value '5' stands
for '3' in the graph.
Now, if we agree on this -I mean if I was able to make my problem clear -
this is a deficiency of catplot for me: Catplot simply places the bars to
the wrong places.
Put differently: if catplot was able to eliminate values 2 and 3 in the
graph (because there are no observations for them) I would have no problem.
But instead, catplot displays values 2 and 3 on the horizontal axis, but the
associated bars beling to values 4 and 5.
Now, I call this deficieny, bug, etc. I don't know what you want to call it.
I am not trying to undermine the capabilities of catplot here. It is a
useful command.
But if it displays something wrong, then it is a deficiency.
(assuming that I could explain my problem clearly)
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/