I have a variable which describes the number of months between two incidents (start of incarceration and self-harm). It looks like this (where for observation 1 the person self harmed 43 months after the start of incarceration):
. list diff_months in 1/10
+----------+
| diff_m~s |
|----------|
1. | 43 |
2. | 24 |
3. | 10 |
4. | 2 |
5. | 11 |
|----------|
6. | 10 |
7. | 2 |
8. | 19 |
9. | 6 |
10. | 24 |
+----------+
The variable is summarized as follows:
. summarize diff_months
Variable | Obs Mean Std. dev. Min Max
-------------+---------------------------------------------------------
diff_months | 880 25.40114 35.31061 0 276
And here is an excerpt of its tabulation:
. tab diff_months
Number of |
months |
between |
sentence |
start & |
incident | Freq. Percent Cum.
------------+-----------------------------------
0 | 72 8.18 8.18
1 | 55 6.25 14.43
2 | 43 4.89 19.32
3 | 48 5.45 24.77
4 | 40 4.55 29.32
5 | 44 5.00 34.32
I want to create a frequency chart such as a line graph or a histogram that depicts how many individuals self-harmed after x months. So the x-axis should depict the variable from 0 to 276 and the y-axis should depict the frequency, say in % (so for 0 it would be 8.18%, for 1 it would be 6.25%, etc.).
I have tried the command below but it produces strange frequencies as you can see in the attachment (the graph depicts 45% for 0 months when it should be 8% for example)
. hist diff_months, percent
(bin=29, start=0, width=9.5172414)
What am I doing wrong? Thank you.
. list diff_months in 1/10
+----------+
| diff_m~s |
|----------|
1. | 43 |
2. | 24 |
3. | 10 |
4. | 2 |
5. | 11 |
|----------|
6. | 10 |
7. | 2 |
8. | 19 |
9. | 6 |
10. | 24 |
+----------+
The variable is summarized as follows:
. summarize diff_months
Variable | Obs Mean Std. dev. Min Max
-------------+---------------------------------------------------------
diff_months | 880 25.40114 35.31061 0 276
And here is an excerpt of its tabulation:
. tab diff_months
Number of |
months |
between |
sentence |
start & |
incident | Freq. Percent Cum.
------------+-----------------------------------
0 | 72 8.18 8.18
1 | 55 6.25 14.43
2 | 43 4.89 19.32
3 | 48 5.45 24.77
4 | 40 4.55 29.32
5 | 44 5.00 34.32
I want to create a frequency chart such as a line graph or a histogram that depicts how many individuals self-harmed after x months. So the x-axis should depict the variable from 0 to 276 and the y-axis should depict the frequency, say in % (so for 0 it would be 8.18%, for 1 it would be 6.25%, etc.).
I have tried the command below but it produces strange frequencies as you can see in the attachment (the graph depicts 45% for 0 months when it should be 8% for example)
. hist diff_months, percent
(bin=29, start=0, width=9.5172414)
What am I doing wrong? Thank you.

Comment