logo

1 303 279 1021

Loading

Live Chat

All Issues

Golden Software Newsletter

Our newsletters are filled with interesting technical tips, news of how people are using Surfer, Grapher, Voxler, MapViewer, Didger and Strater, and (of course!) great illustrations.

Subscribe to Our Newsletter

Issue 65

Customizing Fit Curves and Confidence Intervals in Grapher 9

Oftentimes, data contains some variability across the full range of values in a plot. As a researcher, you still want to show those values on the graph, but you might not want to include them in your fit curves because you know before creating the fit curve that the points are outside your accepted confidence interval. Grapher 9 can help with limiting the data that is used to calculate the fit curve and confidence interval and in limiting the display of the fit curve and confidence interval to only a section of interest.

Creating the Scatter Plot

The first step is to create the line/scatter plot. In this case, we want only a scatter plot, with no line connecting the points. To create a scatter plot, follow these steps:

1. Click the Graph | 2D XY Graphs | Line/Scatter command.
2. In the Open dialog, select the data file, located here, and click Open. A line plot is created.
3. With the Line/Scatter Plot 1 selected, click on the Line tab in the Property Manager.
4. Click on the existing line style, next to the Style command and select Invisible, the second option in the list. The line connecting the points is now removed.
5. Click on the Symbol tab in the Property Manager
6. Next to Symbol frequency, highlight the zero and type the value 1. Alternatively, click the up arrow once. Press ENTER and the default symbol will appear at each data point in the data file.
7. Make any further changes to the symbols, such as making the Size smaller, or changing the Fill colorand Line color. I’m going to leave the size at 0.10 inches and make the Fill color 20% Black.

Just visually examining the scatter plot data locations gives us a good idea of where the trend line should be located. It also gives us a good idea of a large section of variability when X is above approximately 1.5. This variability could be due to many issues, such as inaccurate data sampling, faulty meter readings, or incorrect preprocessing of the data. Regardless of the reason, we can visually determine that we do not want to include this data in any fit curves or statistics generated by the fit curve.

j

The scatter plot of the raw data gives a general idea of where a fit curve should be located.

Creating a Curve that Fits the Data

To add a fit curve to the plot:

  1. Click on the Line/Scatter Plot 1 to select it, if it is not already selected.
  2. In the Property Manager, click on the Plot tab.
  3. Scroll all the way down and click the <Click here to add/edit fits> text next to the Fits command.
  4. In the Fits dialog, click on the Linear, Y = B * X + A text. In the list, select Power, ln(Y) = B * ln(X) + A. Click the Add button.
  5. Click OK and the fit curve is added to the graph.
  6. You can change any properties of the fit curve in the Property Manager. For ease of visually determining if the fit curve is a good fit, I’ve changed the line color to red and the line width to 0.030 inches.

j
The red fit curve fits some of the data, but is skewed because of the variability in the data above X = 1.5.


Creating and Editing a Confidence Interval

To create a confidence interval:

1. Click on the Fit 1: Power to select the fit curve.
2. In the Property Manager, click on the Plot tab.
3. Next to the Confidence command, click the text <Click here to add interval>.
4. Click on the Confidence 2 to select the confidence interval.
5. In the Property Manager, click on the Plot tab.
6. Change the Level to 99.99% to give a wide confidence interval. To change the value, highlight the existing 95% and type 99.99%. Press ENTER on the keyboard to make the change.
7. Finally, fill the confidence plot to that the confidence area is easy to determine. Click on the Fill tab in the Property Manager.
8. Change the Pattern to Solid by clicking on the existing pattern and selecting the Solid black box in the list.

jj
The green confidence interval is added to the plot. Note that the confidence interval is very wide and does not include all the data, despite the high confidence percentage.

9. Change the Foreground color to a lighter color, such Dull Green by clicking on the existing color and selecting a new color from the list.
10. Finally, set the Foreground Opacity to 50% so that you can see through the confidence interval. Highlight the existing 100% and type 50. Press ENTER to make the change.
11. You may also choose to move the confidence interval behind the other plots by clicking the Arrange | Order Objects | Move to Back command.

Limiting the Fit Curve to Specific Data

Initially the fit curve and confidence interval use all of the data. This gives a skewed result to the fit curve and confidence interval because we know that we want to exclude the upper data points. In the lower section of the plot, the fit curve does not fit the data as well as it could because of this skew. To limit the fit curve to only the desired data:

  1. Click on the Fit 1: Power curve to select it.
  2. In the Property Manager, click on the Plot tab.
  3. Open the Data limits section by clicking on the + next toData limits.
  4. Uncheck the box next to the Use curve limits command.
  5. Change the Maximum value to 1.65. This value was determined by trying various X values between 1.5 and 2.0 and seeing how the fit curve matched the lower section of data.

j
The confidence interval fits the data slightly better now, after removing the right section of data from the fit curve data input.

Finalizing the Graph

Although this limited fit curve fits the data better, the final result can be made to make an even better representation of the data. To do so will require removing a few extreme outliers from the data:

  1. Click the Tools | Options command.
  2. On the left side of the dialog, click Plots. On the right side of the dialog, check the boxes next to Display value on click and Highlight worksheet. Click OK. These options allow you to click on a point on the graph and have that value selected in the worksheet.
  3. If the Worksheet Manager is not currently visible, selectView | Managers | Worksheet Manager. Viewing the data and worksheet simultaneously helps when removing data points.
  4. Click on the Line/Scatter Plot 1 to select it.
  5. On the lower left end of the plot, click on the first point that is above the confidence band. Row 5 is highlighted in theWorksheet Manager.
  6. Click on the row 5 in the Worksheet Manager, and press the Delete key on the keyboard. Notice that the data point is immediately removed from the plot and the fit curve is updated.
  7. Repeat steps 5 and 6 as necessary until the fit curve fits the data appropriately. I’ve deleted only two points (row 5 and 10) that are visually outside the limits in the image to the right.

j
After modifying the data slightly, the fit curve and confidence interval show a much better fit to the original data points.

Removing data or altering a fit curve is highly subjective and should be used only when the data obviously support doing so. It can increase the goodness of fit of the resulting fit curve and confidence interval and make the graph more representative of known circumstances.

 

Trusted by over 10,000 Companies and Schools


Label Your 3D Point Cloud with Voxler 3

Image Voxler 3 has added the ability to label your 3D point cloud. You can use numbers or text to label your scatter plot, apply a uniform offset in the X... Read More

Subscribe to Our Newsletter

Enter your email address below to receive email notifications of product updates and our newsletter, filled with helpful technical tips and case studies.