Helping you learn more about the latest product information, tips, tricks, techniques, and customer stories so you can visualize data and communicate results with ease.

You’ve used Surfer mapping software to grid your data and created a great looking map. You put it in the final report for your presentation. And you think, *that was easy and I’m all done now*. And then someone asks you, *how do you know that map is accurate? *You start to wonder. How do I know if it is correct? Is there any way to verify the gridding? If the grid file matches the original data, then I could confidently say the map is correct. But, how do I know if the grid file matches the data?

In the previous blog, we discussed visually inspecting a grid to see if the grid created is a good representation of the original data. To do this, we compared a contour map from the grid to a classed post map from the data.

* Visually inspect the original data to the grid by overlaying a class post map and contour map.*

This gave us a first visual look at how well the data was fit by the gridding. So, you know that the grid is a good fit. But, you would still like some kind of number to determine how good of a fit the grid really is. One way to do this is by calculating the residuals for the grid. Once the residuals are calculated, you could perform statistics on the residual values to get an estimate of the goodness of the fit. Or you could grid the residuals and create a residual map to see where the grid is further away from the data. This may indicate areas where more data may be needed.

To calculate the residuals, you need a worksheet with at least three columns: X, Y, and Z for all of the areas that you want to check. For this example, let’s compare the gridded value with the original value.

- Click the
**Grid | Residuals**command. - In the first dialog, select the grid file and click
*Open*. - In the second dialog, select the original data file and click
*Open*. - The
**Grid Residuals**dialog then opens. This dialog allows you to set the X, Y, and Z*Data Columns*. Because we are using the data we gridded, the columns should be the same. Select the columns that were used in the**Grid Data**dialog. The residuals are stored in the next available empty column in the data file. Click*OK*and the residuals are calculated.

The worksheet automatically opens. You can scroll over to the residuals column and look at the values. Residuals are the difference between the gridded value and the data value in the worksheet. This can be positive or negative. To see some statistics about the column,

- Click on the
*Residuals*column to select it. - Click the
**Data | Statistics**command. - In the
**Statistics**dialog, select which options are most important to you. For instance, you may want*Minimum*,*Maximum*,*Mean*,*Standard error of the mean*, and*Standard deviation*. After selecting the options, click*OK*. The values are shown in a dialog.

The calculated statistics are displayed in the dialog.

This shows that the gridded Z value furthest away from the actual data point Z value is 409.35 Z units. This may seem like a lot initially, but recall that the grid covers Z=0 to 24000. So, 409.35 is less than a 2% variation. The mean (average value) is 4.91. Because the mean is fairly close to zero, the gridded value is fairly close to the original Z data value, for most of the grid. The standard deviation is 155.29. This shows that the grid shows some variation in how accurate the original data points are represented depending on where the data point is located. You can close this dialog by clicking the *Close* button.

Another common numerical value that is used to determine the goodness of fit is the R^{2} value. To calculate this value, you need to make several calculations.

- Calculate the sum of the squares of the residuals:
- Highlight the first blank column and click the
**Data | Transform**command. - In the
**Transform**dialog, type*E=D*D*for the*Transform equation*. E is the new column where the value will be displayed. D is the residual column. Click*OK*. - Highlight the new column.
- Click the
**Data | Statistics**command. - In the
**Statistics**dialog, select only*Sum*and click*OK*. - In the
**Statistics Results**dialog, click*Copy*and*Close*. - Click below the last row of data in the new column. Click
**Edit | Paste**to paste the value. This is the sum of the squares of the residuals. In my case, this value is 289699.71.

- Highlight the first blank column and click the
- Calculate the Z mean value:
- Highlight the original Z data column.
- Click the
**Data | Statistics**command. - In the
**Statistics**dialog, select only*Mean*and click*OK*. - In the
**Statistics Results**dialog, click*Copy*and*Close*. - Click below the last row of data in the new column. Click
**Edit | Paste**to paste the value. This is the mean Z value. In my case, this value is 4847.22.

- Calculate the sum of the squares of the total difference between the mean and the original Z value:
- Highlight the first blank column and click the
**Data | Transform**command. - In the
**Transform**dialog, type*F=C – mean*. F is the new column where the value will be displayed. C is the original Z data column.*Mean*is value calculated in the previous step. So, my equation looks like*F=C – 4847.22*. Click*OK*. This is the difference between the Z value and the mean. - Highlight the first blank column and click the
**Data | Transform**command. - In the
**Transform**dialog, type*G=F*F*. G is the new column where the value will be displayed. F is the difference between Z and Z_{mean}column calculated in the previous step.Click*OK*. - Highlight the new column.
- Click the
**Data | Statistics**command. - In the
**Statistics**dialog, select only*Sum*and click*OK*. - In the
**Statistics Results**dialog, click*Copy*and*Close*. - Click below the last row of data in the new column. Click
**Edit | Paste**to paste the value. This is the sum of the squares of the total difference between the mean and the original Z value. In my case, this value is 678166457.48.

- Highlight the first blank column and click the
- Calculate R
^{2}:- First, note which cells contain the sum of the residual squares (E18 for me) and the sum of the Z-Z
_{mean}squares (G18 for me). - In a new cell, click the
**Data | Transform**command. Make sure you note which cell you are in first (F20 for me). - In the
**Transform**dialog, change the*Transform with*to*Cell variables (e.g., C3=A1+B2).* - Type
*F20 = 1 – (E18/G18)*and click*OK*. - The R
^{2}value is displayed in the specified cell. This is 0.99957 for me.

- First, note which cells contain the sum of the residual squares (E18 for me) and the sum of the Z-Z

Calculate the R^{2} value in the worksheet to obtain

a numerical value indicating goodness of fit.

This R^{2} value can be included in a report to give a numerical indicator of how well the grid fits the original data. The R^{2} value should be between zero and one using the method outlined above. If the R^{2} value were exactly equal to 0, then the model would fit none of the data points. If the R^{2} value were equal to 1.00, then the model would exactly predict the data points. Generally, the higher the R^{2} value is, the better the fit of the grid.

Finally, you can take the original residual values and create a map. This can show where taking obtaining more data (if possible) may be useful to fitting the grid better. To create this map:

- Click back on the plot window that contains the contour map and classed post map.
- Click the
**Grid | Data**command.- Select the data file from the bottom of the dialog, in the
*Open worksheets*section. Click*Open*. - Change the Z column to the Residuals column.
- Change the
*Output Grid File*name to include*Residuals*in the name. - Click
*OK*and the residual grid is created.

- Select the data file from the bottom of the dialog, in the
- Uncheck the box next to the
*Contours*layer in the**Object Manager**. - Click on the existing classed post map to select it.
- Add a new contour map:
- Click the
**Map | Add | Contour Layer**command. - Select the Residuals grid file and click
*Open*.

- Click the
- Change the contour properties:
- Click on the residuals
*Contours*layer in the**Object Manager**to select it. - On the
**Levels**tab in the**Property Manager**, change the*Contour interval*to a reasonable value. For example, I have set my*Contour interval*to 50. - Check the box next to
*Fill contours*. - Click the … button next to
*Fill colors*. - In the
**Colormap**dialog,- Click on the black node. Change the
*Color*to red. - Click on the white node. Change the
*Color*to red. - Change the
*Minimum*or*Maximum*value at the bottom of the dialog. The values should be the same, with the minimum being negative and the maximum being positive. - Click somewhere in the center of the color bar. A new node is created.
- Highlight the
*Value*and type 0. This is a node with no variation between the contour and data Z value. - Change the
*Color*to White.

Minimum

The dialog should look similar to the above, with the

*and*Maximum*values reflective of the variation in your grid file.* - Click
*OK*.

- Click on the black node. Change the

- Click on the residuals

The residual contour map updates.

The residual map is displayed. This map shows the difference

between the original Z value and the gridded Z value.

Areas with higher positive or negative Z contour values are filled red. By evaluating these areas, you can get a better understanding of how well the grid fits the data. These areas may need additional data points to more effectively control the gridding, or you may want to use a different gridding method or use different grid geometry.

Surfer's graphing software has many tools available to answer the question: *does this grid fit my data?* You don’t have to take our word for it. Calculate the results yourself. Do you have another favorite method that you use to determine if your grid is accurate? Please share it with us!

No comments made yet. Be the first to submit a comment

Over the years, one of the most common questions asked is “How can I get my contour map out of Surfe...

I'm pleased to introduce our first ever guest blogger, Scott Carter, Owner and Creative Director of ...

Creating a map of slopes is common practice when looking at slope stability. Some examples of when y...

Our Customers

logo-Golder_Associates.png

http://www.goldensoftware.com/images/logos/logo-Golder_Associates.png

logo-USGS.png

logo-TetraTech.png

http://www.goldensoftware.com/images/logos/logo-TetraTech.png

logo-Laguna_Geosciences.png

http://www.goldensoftware.com/images/logos/logo-Laguna_Geosciences.png

logo-Arcadis.png

logo-RockSolidGroup.png

http://www.goldensoftware.com/images/logos/logo-RockSolidGroup.png

logo-StanleyConsultants.png

https://www.goldensoftware.com/images/logos/logo-StanleyConsultants.png

logo-Arm_Geophysics.png

http://www.goldensoftware.com/images/logos/logo-Arm_Geophysics.png