KNOWLEDGEBASE - ARTICLE #1404

Graph tip - Showing error or confidence envelope

This example shows how to plot an error or confidence envelope for a curve generated with nonlinear regression.


How to do it:

Start by creating an  XY data table to enter the data. You can set up your data table with replicates and have Prism calculate your error values, or you can enter your error values directly. For this example, we'll create an XY data table, and choose the option "Enter 3 replicate values in side-by-side subcolumns" for the "Y" options.

After clicking Create, the XY table will be shown and the data can be entered (as shown below)

Once the data are entered, click the Analyze button in the toolbar and select "Nonlinear regression (curve fit)" (or use the Nonlinear regression button in the Toolbar). This will bring up the Parameters: Nonlinear Regression dialog. Select the regression model to use (for this data, we'll select "One phase decay" from the Exponential family of models).

Next, click on the "Confidence" tab of the parameters dialog. On this tab, check the box next to "Plot confidence/prediction bands", specify the confidence level (we'll use 95%), and be sure that the "Confidence bands" option is selected.

Click OK, and then click on the Graph sheet in the Navigator. The Change Graph Type dialog should appear since this is the first time viewing the new graph. On this dialog, select the graph type "Individual replicates" in the XY family, and click "OK". If you're using the example data shown above, the default graph should look like this:

Now we can use the Format Graph dialog to set the colors for the curve and the confidence bands, and to select a fill for the area between the upper and lower confidence bands. To access the Format Graph dialog, double-click on the curve itself (or use the corresponding toolbar button). On the Appearance tab of the Format Graph dialog, check the box beside "Show area fill". In this section, select the color to use to shade the area between the upper and lower confidence bands, and use the "Position" dropdown menu in this section to select "Within error bands".

Some additional options that can be used to customize the graph with the Format Graph dialog:

  • The color of the curve
  • The color of the error bands (using the "Color" dropdown menu in the "Show error bars section")
  • The style/pattern of the error bands (using the "Style" dropdown menu in the "Show error bars section")
  • The size and color of the symbols from the data (use the "Data set" dropdown menu at the top of the Appearance tab to select the Data instead of the curve generated by the analysis)

After customization, the graph should look something like this:

(Optional): If using the example data, we can improve the appearance of this graph a bit more by making some changes to the axes. To do this, double click on the Y axis or click the Format Axes toolbar button and select the "Left Y axis" tab. Uncheck the box beside "Automatically determine the range and interval
 and then type in the value "10000" for the Maximum.

Next, select the "Frame and Origin" tab of this dialog. In the "Frame and Grid Line" section, use the "Frame style" dropdown menu to select "Offset X & Y axes", and click OK.

The final resulting graph should look like this:


Additional graph variations

Error envelope only

For some graphs, the problem is too many error bars. In a case like this plotting an error envelope can be more effective.

To start, double-click on the graph to bring up the Format Graph dialog. On the Appearance tab, change the error bar style from individual error bars to a solid line. This creates an error envelope (or error bands) rather than individual error bars at each X value. You can even ask Prism to shade the area between the error bands.

Applying these settings creates a graph that is easier to interpret, and looks like the following:

Selected error bars only

If you want to create error bars on selected points only, you can do so with a bit of fussing.

Go to the data table and highlight the columns for your error values and right mouse-click to exclude those columns from your graph. If you've entered replicates, use the Row Statistics analysis calculate mean and error values for each row in a new table and graph, then exclude the values there. This will remove all the error bars from the graph.

Now simply select the rows that contain the error bars that you want to be displayed and un-exclude these error values

Download this file to see the data that was used to generate each of these additional graphs.

Explore the Knowledgebase

Analyze, graph and present your scientific work easily with GraphPad Prism. No coding required.