Chapter Contents

Previous

Next
The G3GRID Procedure

GRID Statement


Specifies the three numeric variables for interpolation or smoothing. Optionally specifies the number of observations (x and y values) in the output data set; output values for the two horizontal variables x,y; and the interpolation method for the vertical variables.

Requirements: Exactly one grid request is required.



Syntax

GRID grid-request </option(s)>;
grid-requestmust be:
y*x=z(s)

grid-request must be

y*x=z(s)

option(s) can be one or more options from any or all of the following categories:


Required Arguments

y*x=z(s)
specifies three or more numeric variables from the input data set:

y
is one of the variables that forms the horizontal (x-y) plane.

x
is another of the variables that forms the horizontal (x-y) plane.

z(s)
is one or more vertical variables for the interpolation.

Although the GRID statement can specify only two horizontal variables, it can include multiple vertical variables. Separate vertical variables with blanks:

grid x*y=z w u v;


Options

AXIS1=ascending-value-list
specifies a list of numeric values to assign to the first (y) variable in the grid request for the output data set. Numbers that you specify with this option determine the number of values for y and override a value that you specify with the NAXIS1= option. Ascending-value-list must be in ascending order. It is either an explicit list of values, or a starting and an ending value with an interval increment, or a combination of both forms:
n <...n>
n TO n <BY increment>
n <...n> TO n <BY increment > <n <...n> >
Featured in: Using the Default Interpolation Method and Using Spline Interpolation

AXIS2=ascending-value-list
specifies a list of numeric values to assign to the second (x) variable in the grid request for the output data set. Numbers that you specify with this option determine the number of values for x and override a value that you specify with the NAXIS2= option. Ascending-value-list must be in ascending order. It is either an explicit list of values, or a starting and an ending value with an interval increment, or a combination of both forms:
n <...n>
n TO n <BY increment>
n <...n> TO n <BY increment > <n <...n> >
Featured in: Using the Default Interpolation Method and Using Spline Interpolation

JOIN
uses a linear interpolation within a set of triangular regions that are formed from the input data set. This interpolation method creates values in the range of the initial values of the vertical variable, but the resulting interpolated surface may not be smooth.

NAXIS1=n
specifies the number of values for the first (y) variable in the grid request for the output data set. You can determine the actual values used for y by taking the minimum and maximum values of y and dividing the range into n-1 equal sections. By default, NAXIS1=11.

A value specified with NAXIS1= is ignored if values are also specified with AXIS1=.

NAXIS2=n
specifies the number of values for the second (x) variable in the grid request for the output data set. You can determine the actual values that are used for x by taking the minimum and maximum values of x and dividing the range into n-1 equal sections. By default, NAXIS2=11.

A value specified with NAXIS2= is ignored if values are also specified with AXIS2=.

NEAR=n
specifies the number of nearest data points to use for computing the estimates of the first and second derivatives. As NEAR= values become larger, time and computation costs increase significantly. NEAR= is ignored if you specify SPLINE. The value of n must be greater than or equal to 3. By default, NEAR=3.

If the number of input data points is insufficient for the number that you specify with NEAR=, a smaller number of data points is used.
Featured in: Using Partial Spline Interpolation

NOSCALE
specifies that the x and y variables not be scaled to the same range before interpolation. By default, the interpolation is performed after both variables are similarly scaled because the interpolation methods assume that the scales of x and y are comparable.

PARTIAL
specifies that a spline be used to estimate the derivatives for the biquintic polynomial interpolation. A bivariate spline is fit to the nearest neighbors and used to estimate the needed derivatives. This option produces results that are less smooth than those produced by the SPLINE option and uses fewer computer resources. However, the results produced by PARTIAL are smoother than those that are produced by the default. If you use both PARTIAL and the SPLINE option, PARTIAL is ignored.
Featured in: Using Partial Spline Interpolation

SMOOTH=ascending-value-list
specifies a list of numbers for smoothing parameters. Use this option only when you also use the SPLINE option. Ascending-value-list must be in ascending order. It is either an explicit list of values, or a starting and an ending value with an interval increment, or a combination of both forms:
n <...n>
n TO n <BY increment>
n <...n> TO n <BY increment > <n <...n> >

For each value [lambda] of the smoothing parameter, a function u (x, y) is formed that minimizes

[IMAGE]

where n is the number of data points and the pairs (xj, yj ) are the available points, with corresponding function values zj (Wahba 1979).

The higher the value of the smoothing parameter, the smoother the resulting interpolation. The lower the smoothing parameter, the closer the resulting surface is to the original data points. A smoothing parameter of 0 produces the same results as the SPLINE option without SMOOTH=.

This procedure repeats for each value of the smoothing parameter. The output data set that you specify in the OUT= option contains the interpolated values, the values of the grid points, and the values of the smoothing parameter in the variable _SMTH_. The output data set contains a separate grid for each value of the smoothing parameter.
Featured in: Using Spline Interpolation and a Smoothed Spline

SPLINE
specifies the use of a bivariate spline (Harder and Desmarais 1972, Meinguet 1979) to interpolate or to form a smoothed estimate if you also use the SMOOTH= option. This option results in the use of an order n 3 algorithm, where n is the number of input data points. Consequently, this method can be time-consuming. If you use more than 100 input points, the procedure may use excessive time.
Featured in: Using Spline Interpolation and a Smoothed Spline and Using Spline Interpolation


Controlling Observations in the Output Data Set

By default, the G3GRID procedure produces a data set with 121 observations for combinations of 11 values for each of the horizontal variables, x and y. To create a data set with a different number of observations, use the GRID statement's NAXIS1= or NAXIS2= options to specify the number of the values of y or x, respectively. Or, use the GRID statement's AXIS1= or AXIS2= options to specify the actual values for y or x, respectively.

Number of Observations Contained in the Output Data Set shows the number of observations that will be in the output data set if you use any of these options.

Number of Observations Contained in the Output Data Set
Options Specified Number of Observations in Output Data Set
None 121
AXIS1= (number of values for AXIS1=) * 11
AXIS2= (number of values for AXIS2=) * 11
NAXIS1= (value of NAXIS1=) * 11
NAXIS2= (value of NAXIS2=) * 11
AXIS1=, AXIS2= (number of values for AXIS1=) * (number of values for AXIS2=)
AXIS1=, NAXIS1= (number of values for AXIS1=) * 11
AXIS1=, NAXIS2= (number of values for AXIS1=) * (value of NAXIS2=)
AXIS2=, NAXIS1= (number of values for AXIS2=) * (value of NAXIS1=)
AXIS2=, NAXIS2= (number of values for AXIS2=) * 11
NAXIS1=, NAXIS2= (value of NAXIS1=) * (value of NAXIS2=)

If you specify multiple smoothing parameters, the number of observations in the output data set will be the number shown in Number of Observations Contained in the Output Data Set multiplied by the number of smoothing values that you specify in the SMOOTH= option. If you use BY-group processing, multiply the number in the table by the number of BY groups.

Depending on the shape of the original data and the options that you specify, the output data set may contain values for the vertical (z) values that are outside of the range of the original values in the data set.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.