VINTERPOLATE procedure

Performs linear & inverse linear interpolation between variates (R.J. Reader).


Options

METHOD = string
Type of interpolation required (interval, value): for METHOD=value, y-values are interpolated for each point in the NEWINTERVALS variates and stored in the NEWVALUES variates, while for METHOD=interval, x-values are estimated for the y-values in the NEWVALUES variates and stored in the NEWINTERVALS variates; default inte

RANGE = string
Whether the smallest value, largest value or the mean of the two is returned if more than one value is valid (first, middle, last); default midd


Parameters

OLDVALUES = pointers
Each one contains variates specifying the y-values (data values) with which an interpolation is to be carried out

NEWVALUES = pointers
For METHOD=value, each pointer contains variates to store the results of an interpolation; for METHOD=interval, it contains either variates or scalars to specify y-values for which inverse interpolation is to be carried out

OLDINTERVALS = variates
Contains the x-values (intervals) corresponding to the variates in the OLDVALUES pointer

NEWINTERVALS = pointers
For METHOD=interval, each pointer contains variates to store the results of an inverse interpolation; for METHOD=value, it contains either variates or scalars to specify x-values at which interpolation is to be performed


Description

VINTERPOLATE performs linear interpolation and inverse linear interpolation between variates, as was given by the Genstat 4 functions LINT and INLINT. The y-values (or data values) are given in a set of variates, contained in the pointer specified by the OLDVALUES parameter. The corresponding x-values (intervals) are specified by the OLDINTERVALS parameter, in a variate with one value for each variate of the OLDVALUES pointer. For interpolation (METHOD=value), values are interpolated at the x-values specified by the variates or scalars contained in the NEWINTERVALS pointer, and are stored in variates contained in the NEWVALUES parameter. For inverse interpolation (METHOD=interval), x-values are estimated for the y-values specified by the variates or scalars contained in the NEWVALUES pointer, and are stored in variates contained in the NEWINTERVALS pointer. Where two or more successive OLDINTERVALS or OLDVALUES are the same, there is no unique solution to the interpolation; the RANGE option allows the smallest (RANGE=first), largest (RANGE=last) or the mean of these two (RANGE=middle) values or intervals to be selected.


Options: METHOD, RANGE.

Parameters: OLDVALUES, NEWVALUES, OLDINTERVALS, NEWINTERVALS.


Method

An estimate of the required value is calculated from each successive pair of points. If this estimate is between the two points from which it was calculated, it is a valid answer i.e. it was produced by interpolation not extrapolation. If it does not satisfy this condition it is set to missing. If the curve is horizontal or vertical at the point of interpolation, more than one point will satisfy the above condition. In this case the value returned will depend on the setting of the option RANGE. This will determine whether the smallest value found, the largest value found, or the mean of these two values is returned. The default is to return the mean value.


Action with RESTRICT

If any of the variates in the OLDVALUES pointer is restricted, the other variates in the pointer must either have the same restriction or be unrestricted. Missing values are then returned for the units excluded by the restriction. The OLDINTERVALS variate must not be restricted.