# interp: Fast linear interpolation of a regular grid In npsp: Nonparametric Spatial Statistics

 interp R Documentation

## Fast linear interpolation of a regular grid

### Description

Computes a linear interpolation of multidimensional regularly gridded data.

### Usage

``````interp(object, ...)

## S3 method for class 'grid.par'
interp(object, data, newx, ...)

## S3 method for class 'data.grid'
interp(object, data.ind = 1, newx, ...)

## S3 method for class 'locpol.bin'
predict(object, newx = NULL, hat.data = FALSE, ...)

## S3 method for class 'np.den'
predict(object, newx = NULL, ...)
``````

### Arguments

 `object` (gridded data) object used to select a method. `...` further arguments passed to or from other methods. `data` vector or array of data values. `newx` vector or matrix with the (irregular) locations to interpolate. Columns correspond with dimensions and rows with data. `data.ind` integer (or character) with the index (or name) of the data component. `hat.data` logical; if `TRUE` (and possible), the hat matrix corresponding to the (original) data is returned.

### Details

`interp` methods are interfaces to the fortran routine `interp_data_grid` (in `grid_module.f90`).

`predict.locpol.bin` is an interface to the fortran routine `predict_lp` (in `lp_module.f90`).

### Value

A list with two components:

 `x` interpolation locations. `y` interpolated values.

If `newx == NULL`, `predict.locpol.bin` returns the estimates (and optionally the hat matrix) corresponding to the data (otherwise `interp.data.grid` is called).

### Note

Linear extrapolation is performed from the end nodes of the grid.

WARNING: May fail with missing values (especially if `object\$locpol\$ncv > 0`).

`interp.surface`.