Description Usage Arguments Details Value References See Also Examples

For a fixed value of the smoothing parameter or the covariance function some nonparametric curve estimates are linear functions of the observed data. This is a intermediate level function that computes the linear weights to be applied to the observations to estimate the curve at a particular point. For example the predicted values can be represented as Ay where A is an N X N matrix of coefficients and Y is the vector of observed dependent variables. For linear smoothers the matrix A may depend on the smoothing parameter ( or covariance function and the independent variables (X) but NOT on Y.

1 2 | ```
Krig.Amatrix(object, x0 = object$x, lambda=NULL,
eval.correlation.model = FALSE,...)
``` |

Output object from fitting a data set using a FIELD regression method. Currently this is supported only for Krig ( and Tps) functions.

`object` |
A Krig object produced by the Krig ( or Tps) function. |

`x0` |
Locations for prediction default is the observation locations. |

`lambda` |
Value of the smoothing parameter. |

`eval.correlation.model` |
This applies to a correlation model where the observations have been standardized – e.g. y standardized = (yraw - mean) / (standard deviation). If TRUE the prediction in the correlation scale is transformed by the standard deviation and mean to give a prediction in the raw scale. If FALSE predictions are left in the correlation scale. |

`...` |
Other arguments that can used by predict.Krig. |

The main use of this function is in finding prediction standard errors.

For the Krig ( and Tps) functions the A matrix is constructed based on the representation of the estimate as a generalized ridge regression. The matrix expressions are explained in the references from the FIELDS manual. For linear regression the matrix that gives predicted values is often referred to as the "hat" matrix and is useful for regression diagnostics. For smoothing problems the effective number of parameters in the fit is usually taken to be the trace of the A matrix. Note that while the A matrix is usually constructed to predict the estimated curve at the data points Amatrix.Krig does not have such restrictions. This is possible because any value of the estimated curve will be a linear function of Y.

The actual calculation in this function is simple. It invovles loop through the unit vectors at each observation and computation of the prediction for each of these delta functions. This approach makes it easy to handle different options such as including covariates.

A matrix where the number of rows is equal to the number of predicted points and the number of columns is equal to the length of the Y vector.

Nychka (2000) "Spatial process estimates as smoothers."

Krig, Tps, predict.Krig

1 2 3 4 5 6 7 8 | ```
# Compute the A matrix or "hat" matrix for a thin plate spline
# check that this gives the same predicted values
tps.out<-Tps( ChicagoO3$x, ChicagoO3$y)
A<-Krig.Amatrix( tps.out, ChicagoO3$x)
test<- A%*%ChicagoO3$y
# now compare this to predict( tps.out) or tps.out$fitted.values
# they should be the same
stats( test- tps.out$fitted.values)
``` |

```
Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.2-2 (2019-03-07) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
Attaching package: 'spam'
The following objects are masked from 'package:base':
backsolve, forwardsolve
Loading required package: maps
See https://github.com/NCAR/Fields for
an extensive vignette, other supplements and source code
[,1]
N 2.000000e+01
mean -1.172396e-14
Std.Dev. 7.740815e-15
min -2.131628e-14
Q1 -2.131628e-14
median -1.065814e-14
Q3 -7.105427e-15
max 0.000000e+00
missing values 0.000000e+00
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.