Golden Software Blog

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.

Numerically Verifying Grid Results Through Surfer's Graphing Software

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.

Overlay a  contour and class post to visually compare.
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.

  1. Click the Grid | Residuals command.
  2. In the first dialog, select the grid file and click Open.
  3. In the second dialog, select the original data file and click Open.
  4. 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,

  1. Click on the Residuals column to select it.
  2. Click the Data | Statistics command.
  3. 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.

View the Statistics results.
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 R2 value. To calculate this value, you need to make several calculations.

  1. Calculate the sum of the squares of the residuals:
    1. Highlight the first blank column and click the Data | Transform command.
    2. 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.
    3. Highlight the new column.
    4. Click the Data | Statistics command.
    5. In the Statistics dialog, select only Sum and click OK.
    6. In the Statistics Results dialog, click Copy and Close.
    7. 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.
  2. Calculate the Z mean value:
    1. Highlight the original Z data column.
    2. Click the Data | Statistics command.
    3. In the Statistics dialog, select only Mean and click OK.
    4. In the Statistics Results dialog, click Copy and Close.
    5. 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.
  3. Calculate the sum of the squares of the total difference between the mean and the original Z value:
    1. Highlight the first blank column and click the Data | Transform command.
    2. 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.
    3. Highlight the first blank column and click the Data | Transform command.
    4. 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 Zmean column calculated in the previous step.Click OK.
    5. Highlight the new column.
    6. Click the Data | Statistics command.
    7. In the Statistics dialog, select only Sum and click OK.
    8. In the Statistics Results dialog, click Copy and Close.
    9. 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.
  4. Calculate R2:
    1. First, note which cells contain the sum of the residual squares (E18 for me) and the sum of the Z-Zmean squares (G18 for me).
    2. In a new cell, click the Data | Transform command. Make sure you note which cell you are in first (F20 for me).
    3. In the Transform dialog, change the Transform with to Cell variables (e.g., C3=A1+B2).
    4. Type F20 = 1 – (E18/G18) and click OK.
    5. The R2 value is displayed in the specified cell. This is 0.99957 for me.

Calculate the R square value
Calculate the R2 value in the worksheet to obtain
a numerical value indicating goodness of fit.

This R2 value can be included in a report to give a numerical indicator of how well the grid fits the original data. The R2 value should be between zero and one using the method outlined above. If the R2 value were exactly equal to 0, then the model would fit none of the data points. If the R2 value were equal to 1.00, then the model would exactly predict the data points. Generally, the higher the R2 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:

  1. Click back on the plot window that contains the contour map and classed post map.
  2. Click the Grid | Data command.
    1. Select the data file from the bottom of the dialog, in the Open worksheets section. Click Open.
    2. Change the Z column to the Residuals column.
    3. Change the Output Grid File name to include Residuals in the name.
    4. Click OK and the residual grid is created.
  3. Uncheck the box next to the Contours layer in the Object Manager.
  4. Click on the existing classed post map to select it.
  5. Add a new contour map:
    1. Click the Map | Add | Contour Layer command.
    2. Select the Residuals grid file and click Open.
  6. Change the contour properties:
    1. Click on the residuals Contours layer in the Object Manager to select it.
    2. 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.
    3. Check the box next to Fill contours.
    4. Click the … button next to Fill colors.
    5. In the Colormap dialog,
      1. Click on the black node. Change the Color to red.
      2. Click on the white node. Change the Color to red.
      3. 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.
      4. Click somewhere in the center of the color bar. A new node is created.
      5. Highlight the Value and type 0. This is a node with no variation between the contour and data Z value.
      6. Change the Color to White.

        Set the colors in the Colormap dialog.
        The dialog should look similar to the above, with the
        Minimum
        and Maximum values reflective of the variation in your grid file.

      7. Click OK.

The residual contour map updates.

Display the residual map.
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!

 

Comments

No comments made yet. Be the first to submit a comment
Guest
Wednesday, 22 November 2017

Captcha Image

Subscribe To Our Blog

Most Popular

This week's new feature series is a tutorial on how to use the new coordinate system dialogs in MapV...
Over the years, one of the most common questions asked is “How can I get my contour map out of Surfe...
For more than 20 years, Surfer mapping software has been used by representatives of nearly all indus...

Exceeding expectations

Go to top