By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. As I'm working with a very big dataset, I need an efficient solution: in particular, a solution that does not require me to sort or save the dataset. In the following example, I plot estimates for b1 to b6 :.

While scatteri efficiently plots the estimates, I can't get boundaries for the confidence interval similar to rcap. Here's token code for what you seem to want. The example is ridiculous.

It's my personal view that refining this would be pointless given the very accomplished previous work behind coefplot. The multiplier of 1. Learn more. Plot confidence interval efficiently Ask Question. Asked 4 years, 11 months ago. Active 4 years, 11 months ago. Viewed times. I want to plot confidence intervals for some estimates after running a regression model.

Is there a better way to do this? Matthew Matthew 2, 15 15 silver badges 31 31 bronze badges. I would look directly at coefplot Stata Journal and then decide whether to write your own. You can't recast scatteri to rcap : see help twoway. Can or can't? I tried to add the option recast rcap after lcolor navy but it did not change anything. Could you post your solution?

I said can't and meant it. I still recommend coefplot ; otherwise you need to make a dataset of the estimates. Active Oldest Votes. Nick Cox Nick Cox Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.Say that you were looking at writing scores broken down by race and ses.

You might want to graph the mean and confidence interval for each group using a bar chart with error bars as illustrated below.

This FAQ shows how you can make a graph like this, building it up step by step. Now we are ready to make a bar graph of the data The graph bar command makes a pretty good bar graph.

### Re: st: File not a Stata .gph file

But, this graph does not have the error bars in it. Unfortunately, as nice as the graph bar command is, it does not permit error bars. However, we can make a twoway graph that has error bars as shown below. Unfortunately, this graph is not as attractive as the graph from graph bar. So, we have a conundrum. The graph bar command will make a lovely bar graph, but will not support error bars.

The twoway bar command makes lovely error bars, but it does not resemble the nice graph that we liked from the graph bar command. However, we can finesse the twoway bar command to make a graph that resembles the graph bar command and then combine that with error bars. Here is a step by step process. First, we will make a variable sesrace that will be a single variable that contains the ses and race information.

Note how sesrace has a gap between the levels of ses at 5 and Now, we will make a graph using graph twoway. Notice how the bars are in three groups of four bars. The three groups correspond to the three levels of ses and the four bars within each group correspond to the four levels of race. You can relate this grouping to the way that we constructed raceses above. This kind of looks like what we want, but it would look nicer if each of the bars for the four different races were different colors.

We can do this by overlaying four separate bar graphs, one for each racial group. The legend labels the bars nicely, but would look cleaner if it were just one row and the x axis of the graph does not convey that the three groups of bars correspond to the three groups of ses. We can use the xlabel option to remedy that. We also add better titles for the x and y axes as well. Now we have a graph that looks like the kind of graph that we would get from graph bar but by finessing graph twoway bar into making this pretty graph, we could then overlay the rbar graph to get the error bars we desired.Login or Register Log in with.

Forums FAQ.

Search in titles only. Posts Latest Activity. Page of 1. Filtered by:. Tom Pepinsky. I am creating a custom scheme in order to save time in creating my Stata plots. I would like to set the scheme to draw shaded confidence intervals with no outline around them.

This is straightforward with commands such as lfitcibut I am having trouble when it comes to rarea and rspike plots, which I commonly use when creating marginal effects plots using margins The specific problem is that if set the scheme to erase the outlines on rarea graphs, by entering the following command in my scheme linewidth pother none then it also erases the lines on rspike and rcap graphs and probably some others too.

I would like to know if it is possible to write a scheme that erases those outlines for rarea plots but not for the others plots.

To illustrate what I have, and what I want, here is some simple code. Tags: None. Have you checked the documentation for brewscheme? I think confidence intervals might have difference references which could be why pother fails.

Comment Post Cancel. Thanks for sharing this. I tried to install brewscheme, and ran into trouble when giving it a test drive:. No further action Directory exists and rebuild option not specified. I'm running Stata SE Did you run the commands to build out the associated files required after installation?

Otherwise, if you could submit an issue with the exact steps you took so I can replicate the issue I can try to work on it as my time permits.

Ah yes, that fixed it. Brewscheme is remarkable--and the scheme files that it generates are tremendously useful as a guide. But I still don't see anything that allows me to specify unique attributes for rarearcapand related plots. As far as I can tell, both are controlled under p other. Previous Next. Yes No.

### How can I make a bar graph with error bars? | Stata FAQ

OK Cancel.Login or Register Log in with. Forums FAQ. Search in titles only. Posts Latest Activity. Page of 1. Filtered by:. Judson Peck. Creating twoway rcap with categorical data 17 Oct Also, a horizontal twoway graph would be ideal if possible. Attached Files. Tags: None. Nick Cox. The most obvious problem here is that you are putting x axis labels at positions 1 to 12 on your x axis whereas the x axis variable evidently covers a different range and isn't even equally spaced.

If you want equal spacing, then conversely you have to define a variable that takes on the values 1 to 12 and nothing in twoway does that for you. This is a key difference from graph bar or graph dot and similar commands which have a built-in tendency to regard one axis as categorical. If you Code:. Comment Post Cancel. Thank you for your help. I am still unclear - is it possible to create a twoway with one axis as categorical? I am aware rcap has a horizontal option, but scatter does not to my knowledge.

Thus, I am leaning towards using a dot graph instead and just plotting min and max dots instead of rcap. However, I am unable to adjust the x-axis labels RTA2 as the axis does not exist? Please advise. Maarten Buis.

## Graphics:Overview of Twoway Plots | Stata Learning Modules

Originally posted by Judson Peck View Post. General remarks You are in confusing territory, where changing the design slightly means using quite different graph commands. I can well imagine that the designers of graph put a lot of time and effort into trying to avoid this problem, the result of other decisions, but this outcome was the downside of a decision with more upsides.Login or Register Log in with.

Forums FAQ. Search in titles only. Posts Latest Activity. Page of 1. Filtered by:. Zach Goldberg. How can I add confidence intervals to a two-way line graph? Greetings, I'm running Stata I'd like to graph the average number of male sex partners by political ideology and overtime. I then generated a line chart with the following syntax: Code:. Tags: None. Clyde Schechter. Comment Post Cancel. Dimitriy V. This seems much easier in a regression setting with margins and marginsplot.

Hey Clyde, Attempted what you suggested and entered the following Code:. All that -rcap- does is plot the confidence limits contained in variables. It does not create variables containing the confidence limits.

**Using Stata to evaluate assumptions of simple linear regression**

So your full graph command will have the -line- component and three -rcap- components. What command do I use to create the hi and lo variables? That depends on how you got the mean variables in the first place. You need to show the code that created them. Okay, here's what I did: Code:. Carole J. Your example is difficult to follow since there are so many missing values. I agree with Dimitriy V.

Masterov in 3. The following is much easier. Note that you will need to specify the type of weight you are using where you see?? Deniz Civril. You can also use statsby:ci but when I was trying different options with an example sample, I run in to a weird result. In the example below, CI for age 46 is so different in statsby:ci compared to margins. Previous Next. Yes No.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Some people prefer rspike to rcap.

I'd recommend legend off and putting suitable text in the Figure caption you would supply for a paper. Learn more. Stata - Scatter plot confidence interval Ask Question.

Asked 5 years, 8 months ago. Active 5 years, 8 months ago. Viewed 13k times. I am trying to connect two dots to represent a confidence interval of the following dataset. CJ12 CJ12 1 1 gold badge 8 8 silver badges 23 23 bronze badges. Active Oldest Votes. Nick Cox Maarten Buis Maarten Buis 2, 8 8 silver badges 16 16 bronze badges. This is read the fine manual stuff. Nick Cox Nick Cox Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Email Required, but never shown. The Overflow Blog. Featured on Meta. Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow. Dark Mode Beta - help us root out low-contrast and un-converted bits. Question Close Updates: Phase 1. Related 2. Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.This module shows examples of the different kinds of graphs that can be created with the graph twoway command.

This is illustrated by showing the command and the resulting graph. For more information, see the Stata Graphics Manual available over the web and from within Stata by typing help graphand in particular the section on Two Way Scatterplots. Click here to report an error on this page or leave a comment Your Name required.

Your Email must be a valid email for us to receive the report! How to cite this page. Click here to report an error on this page or leave a comment. Basic twoway scatterplot sysuse sp graph twoway scatter close date.

Line Plot graph twoway line close date. Connected Line Plot graph twoway connected close date. Bar plot graph twoway bar close date. Spike plot graph twoway spike close date. Dropline plot graph twoway dropline close date. Dot plot graph twoway dot change date. Range plot with area shading graph twoway rarea high low date. Range plot with bars graph twoway rbar high low date. Range plot with spikes graph twoway rspike high low date. Range plot with capped spikes graph twoway rcap high low date.

Range plot with spikes capped with symbols graph twoway rcapsym high low date. Range plot with markers graph twoway rscatter high low date. Range plot with lines graph twoway rline high low date. Range plot with lines and markers graph twoway rconnected high low date.

Spline line plot graph twoway mspline read write. Linear prediction plot graph twoway lfit read write.

## comments so far

## Nalar Posted on 10:12 pm - Oct 2, 2012

Sie irren sich. Ich biete es an, zu besprechen. Schreiben Sie mir in PM, wir werden umgehen.