Hello,
I'm struggling with a following problem:
Here is 4 first rows of my data:
I have estimated yearly data on b, and lower and upper are the lower and upper values of 95 % confidence intervals of b. Variable mavy is the maximum value of upper in whole dataset, i.e. egen maxy=max(upper).
I would like to draw a figure, where b is plotted with its confidence intervals, and addition to that, I would like to add in the same graph bars denoting those years, when the coefficient b is statistically significant at 5% significance level. This is my code so far:
. twoway (bar maxy year if lower>=0) (line b year) (rline lower upper year) , title(65f)
And this is the graph that I get:
I wonder why do the bars "start" at 0? First I thought that it is because I have in the code "if lower>=0", but I also tried following: I generated a new variable signif, which gets value 1 if lower>=0 and 0 otherwise, i.e.
. gen signif=.
. replace signif=1 if lower>=0
and tried following code:
. twoway (bar upper year if signif==1) (line b year) (rline lower upper year) , title(65f)
But the graph was the same.
Could someone, please, help me on this one? How could I get the bars "starting" from the x-axis?
With best regards,
Sanna Huikari
I'm struggling with a following problem:
Here is 4 first rows of my data:
year | b | lower | upper | maxy |
1979 | -.0003847 | -.0010128 | .0002433 | .0031357 |
1980 | -.0004005 | -.0010922 | .0002913 | .0031357 |
1981 | -.0004458 | -.0011484 | .0002569 | .0031357 |
1982 | -.000402 | -.0011498 | .0003458 | .0031357 |
I have estimated yearly data on b, and lower and upper are the lower and upper values of 95 % confidence intervals of b. Variable mavy is the maximum value of upper in whole dataset, i.e. egen maxy=max(upper).
I would like to draw a figure, where b is plotted with its confidence intervals, and addition to that, I would like to add in the same graph bars denoting those years, when the coefficient b is statistically significant at 5% significance level. This is my code so far:
. twoway (bar maxy year if lower>=0) (line b year) (rline lower upper year) , title(65f)
And this is the graph that I get:
I wonder why do the bars "start" at 0? First I thought that it is because I have in the code "if lower>=0", but I also tried following: I generated a new variable signif, which gets value 1 if lower>=0 and 0 otherwise, i.e.
. gen signif=.
. replace signif=1 if lower>=0
and tried following code:
. twoway (bar upper year if signif==1) (line b year) (rline lower upper year) , title(65f)
But the graph was the same.
Could someone, please, help me on this one? How could I get the bars "starting" from the x-axis?
With best regards,
Sanna Huikari
Comment