# Assess the quality (goodness of fit) of gridded data in Surfer

Surfer supports a few methods that can be used to determine or assess the quality of the gridded data. Learn how to use all available methods below:

- Method 1: Use R
^{2}when Gridding with Polynomial Regression (Planar) - Method 2: Calculate Residuals and R
^{2}Value - Method 3: Cross Validate the Data
- Method 4: Create a Grid of Kriging Standard Deviations

**Method 1: Use R ^{2} when Gridding with Polynomial Regression (Planar)**

The closest thing to a calculated goodness of fit is the Coefficient of Multiple Determination (R^{2}), but this is only calculated when gridding with planar polynomial regression, i.e. the first order polynomial. To calculate R^{2} with planar regression, follow these steps:

- Click
**Home |****Grid Data | Grid Data.** - On the
**Grid Data - Select Data**page choose a data file from the dropdown or by clicking select the data file and click*Open*. - In the
*Gridding Method*section, select the*Polynomial Regression*. - Click the
*Next*button. - In
*Polynomial Regression Parameters*section, make sure the*Surface Definition*is set to*Simple planar**surface*. - Set any other gridding parameters you wish.
- Click
*Next*for additional gridding parameters, or*Skip to End>>*to skip to the**Grid Data - Output**page. - Make sure the
*Grid Report*check box is checked and click*Finish*. - In the
**Grid Report**, a little more than halfway down, under the*Planar Regression*section, the*Coefficient of Multiple Determination (R^2)*value is displayed.

Surfer does not calculate the R-squared value for any polynomial order other than the first order. You can calculate the higher order R-squared values using the Grid Residuals option, described below.

**Method 2: Calculate Residuals and R ^{2} Value**

If you want to calculate a “goodness-of-fit” for the gridding method (to see how well the grid honors the original data points), you might consider using **Grids | Calculate | Residuals **instead. The **Grids | Calculate | Residuals** calculation returns the differences between the calculated grid and the actual data values. The sum of squares of the residuals can be used to compare gridding methods, with smaller values indicating better goodness-of-fit.

- Choose an existing grid file, or, grid your data using any method you'd like using the
**Home | Grid Data | Grid Data.** - Once you have a grid, click
**Grids | Calculate | Residuals.** - Click
*Browse*in the*Input Grid*section, select the grid file just created and click*Open.* - Click
*Browse*in the*XYZ Data*section, select the data file containing the original data points and click*Open.* - Ensure the X, Y, and Z Data columns are assigned correctly.
- Choose the column in the worksheet to contain the calculated residual values.
- Click
*OK*and the data file opens in the worksheet and the residuals are displayed in the designated column. Lower residual values indicate a better fit with the original data.

Once you have the residuals, you can either:

- Save the data and create a classed post map using the residuals as the Z column. Apply different colored symbols to illustrate the different amounts of error.
- Generate a single value, such as the sum of the squares of the residuals, to represent the residuals of the entire gridded surface.
- When viewing the data in the worksheet, click
**Data |****Data | Transform.** - Square the residuals data by entering the function:
*E=D*D*(where D is the column letter containing the residuals and E is an empty column). Click*OK*and the data is calculated*.* - Find the sum of squares of the residuals by selecting the column containing the square of the residuals and clicking
**Data |****Data | Statistics**. - Make sure
*Sum*is checked and click*OK*. The*Sum*is displayed. Compare this result with the result for other grids and their residuals. A smaller value indicates less error.

- When viewing the data in the worksheet, click
- Calculate R
^{2}, an indication of the goodness of fit of the model, with the equation: R^{2}= 1 - (SS_{res}/ SS_{tot}).

Where:

SS

_{res}= Sum of the squares of the residuals.SSt

_{ot}= Sum of squares of the differences from the mean, S(Z_{i}- Z_{mean})^{2}.

After calculating the residuals, calculate a new column containing the squares of the residuals (SS_{res}):- When viewing the data in the worksheet, click
**Data | Data | Transform**. - Square the residuals data by entering the function:
*E=D*D*(where D is the column letter containing the residuals and E is an empty column). Click*OK*and the data is calculated. - Find the sum the squares of the residuals by selecting the column containing the square of the residuals and clicking
**Data | Data | Statistics**. - In the
**Statistics**dialog, only have*Sum*checked in the list of items to compute, and in the*Results*section choose*Show in a window*. - In the
**Statistics Results**window, click the*Copy*button and click*Close*. - Select an empty cell at the bottom of the square residuals column and click
**Home | Clipboard****| Paste**. This is SS_{res}.

Then, calculate SS

_{tot}:- Calculate the Z
_{mean}by selecting the Z column (often column C), choosing**Data | Data | Statistics**. Check*Mean*in the list of items to compute and click*OK*. Write down the*Mean*value (Z_{mean}) and click*Close*. - Calculate Z
_{i}- Z_{mean}by clicking**Data | Data | Transform**, entering the function:*F = C - Z*, where F is the next empty column._{mean} - Calculate (Z
_{i}- Z_{mean})^{2}by clicking**Data |****Data | Transform**, entering the function:*G = F*F*, where G is the next empty column. - Sum (Z
_{i}- Z_{mean})^{2}by selecting column G (or whatever column the square of the data is in), and clicking**Data | Data | Statistics**. - In the
**Statistics**dialog, only have*Sum*checked in the list of items to compute, and in the*Results*section choose*Show in a window*. - In the
**Statistics Results**window, click the*Copy*button and click*Close*. - Select an empty cell at the bottom of the square Z column and click
**Home | Clipboard****| Paste**. This is SS_{tot}.

- When viewing the data in the worksheet, click

Use a calculator to calculate R^{2 }: 1 - (SS_{res} / SS_{tot})

**Method 3: Cross Validate the Data**

Another method to assess the quality of the grid is to cross validate the grid with the data. Cross validation can be considered an objective method of assessing the quality of a gridding method, or to compare the relative quality of two or more candidate gridding methods.

Cross validation calculates the differences in the grid file when data points are omitted. You can access this feature by following these steps:

- Click
**Home |****Grid Data | Grid Data.** - On the
**Grid Data - Select Data**page choose a data file from the dropdown or by clicking select the data file and click*Open*. - In the
*Gridding Method*section, select any gridding method you'd like. - Depending on the gridding method chosen, the next pages of the Grid Data dialog will change. Click
*Next*until you reach the**Grid Data - <gridding method> - Cross Validation**page. - Enter the cross validation parameters you wish, and note the file path and name of the cross validation results file.
- Click
*Next*to reach the**Grid Data - <gridding method> - Output**page. - Make any desired changes and click
*Finish.*The cross validate results file is created.

This method is mostly designed to measure how well a data point value is predicted by the surrounding data points, so other goodness-of-fit methods may be more appropriate if your data is spiky or has high variability between data points.

**Method 4: Create a ****Grid of Kriging Standard Deviations**

You can generate a standard deviation grid with the Kriging gridding method. Note that this is more geared towards experienced variogram modelers. There are several cases where a standard deviation grid is incorrect or meaningless, so please see the Kriging help topic for more information.

To create the Kriging Standard Deviation grid, follow these steps:

- Click
**Home |****Grid Data | Grid Data.** - On the
**Grid Data - Select Data**page choose a data file from the dropdown or by clicking select the data file and click*Open*. - In the
*Gridding Method*section, select*Kriging*. - Click the
*Next*button twice. - On the
**Grid Data - Kriging - Options**page in the*Kriging Parameters*section, click the*Save*button to the right of*Standard Deviations*grid. - In the
**Save Grid As**dialog, name the new grid and click*Save.* - Give the file a name and click
*Save*. - Click
*Skip to End>>*. - Enter any other gridding options you wish and click
*Finish*. The grid is created.

From here, you can create a map and view the areas with high or low standard deviations.

*Updated November 2021*

## Comments

0 comments

Please sign in to leave a comment.