Hi,
I am trying to produce a nice graph bar but with confidence interval. It looks pretty tedious but I found this method here. I have 1 y-variable (info_avoiding_ba) as well as 1 dummy (T_Meat). When I type the following code everything works up to the last line where I get the message "too few variables specified" from Stata. Can anyone help? Cheers!
collapse (mean) meaninfo_avoiding_ba= info_avoiding_ba (sd) sdinfo_avoiding_ba=info_avoiding_ba (count) n=info_avoiding_ba, by(T_Meat)
generate hiwrite = meaninfo_avoiding_ba + invttail(n-1,0.025)*(sdinfo_avoiding_ba / sqrt(n))
generate lowrite = meaninfo_avoiding_ba - invttail(n-1,0.025)*(sdinfo_avoiding_ba / sqrt(n))
graph twoway (bar meaninfo_avoiding_ba) (rcap hiwrite lowrite), by(T_Meat)
Also, if anyone knows how to add the significance value on the figure (above the bars for example)?
I am trying to produce a nice graph bar but with confidence interval. It looks pretty tedious but I found this method here. I have 1 y-variable (info_avoiding_ba) as well as 1 dummy (T_Meat). When I type the following code everything works up to the last line where I get the message "too few variables specified" from Stata. Can anyone help? Cheers!
collapse (mean) meaninfo_avoiding_ba= info_avoiding_ba (sd) sdinfo_avoiding_ba=info_avoiding_ba (count) n=info_avoiding_ba, by(T_Meat)
generate hiwrite = meaninfo_avoiding_ba + invttail(n-1,0.025)*(sdinfo_avoiding_ba / sqrt(n))
generate lowrite = meaninfo_avoiding_ba - invttail(n-1,0.025)*(sdinfo_avoiding_ba / sqrt(n))
graph twoway (bar meaninfo_avoiding_ba) (rcap hiwrite lowrite), by(T_Meat)
Also, if anyone knows how to add the significance value on the figure (above the bars for example)?
Comment