.\" -*- nroff -*- generated from .Rd format
.BG
.FN ksline
.TL
Performs spatial interpolation (kriging) with fixed covariance
parameters using global or moving neighborhood
.DN
This function performs spatial prediction for fixed covariance
parameters. It can produce results which corresponds to the following
kriging types:
SK (simple kriging), OK (ordinary kriging),
KTE (external trend kriging), UK (universal kriging).
.IP "" 
The function `krige.conv' should be preferred for most
kriging calculations. An exception is for the case where the moving
neighborhood is adopted.
.CS

ksline(geodata, coords=geodata$coords, data=geodata$data, locations,
       cov.pars=stop("cov. parameters (sigmasq and phi) needed"),
       nugget=0, micro.scale=0,
       cov.model = c("exponential", "matern", "gaussian",
                   "spherical", "circular", "cubic", "wave",
                   "powered.exponential", "cauchy", "gneiting",
                   "gneiting.matern", "pure.nugget"),
       kappa=0.5, lambda=1, m0="ok", nwin="full",
       n.samples.backtransform=500, trend=1, d=2,
       ktedata=NULL, ktelocations=NULL, aniso.pars=NULL,
       signal=FALSE, dist.epsilon=1e-10, messages.screen=TRUE)

.RA
.AG geodata
a list containing elements `$coords' and
`$data' as described next. If not provided the arguments
`coords' and `data' must be provided instead.
.AG coords
an n x 2 matrix where each row have the 2-D
coordinates of the n data locations.
By default it takes the
element `$coords' of the argument `geodata', if provided.
.AG data
a vector with n data values. By default it takes the
element `$data' of the argument `geodata', if provided.
.AG locations
an N x 2 matrix or data-frame with the 2-D
coordinates of the N locations to be predicted.
.AG cov.pars
a vector with 2 elements or an n x 2 matrix with the covariance parameters
sigma^2 (sill)  and phi (range). If a
vetor the sill must be the first element and the range is the second. If a matrix,
corresponding to a model with several structures, the sill values
are placed in the first column and the range values in the second column.
.AG nugget
a number corresponding to the nugget variance.
.AG micro.scale
micro-scale variance. If different from zero, the
nugget variance is divided in 2 terms: micro-scale variance
and measurement error. This might affect the precision of the estimates.
In practice, these two are usually indistinguishable but it can be
set here when possible.
.AG cov.model
model for the correlation function. See options in the
function call and/or documentation for the function `cov.spatial'.
.AG kappa
additional parameter needed for some of the correlation
functions: 
.br
 (`"matern"', `"powered.exponential"', `"gneiting"' and
`"gneiting.matern"'). For more details see documentation for the
function `cov.spatial'.
.AG lambda
Box-Cox transformation parameter. If lambda = 1 no transformation is used, otherwise the Box-Cox
data transformation is performed before the analysis.
The kriging results are returned in the same scale as the original data.
If lambda = 0 the log-transformation is performed.
If lambda < 0 the mean predictor doesn't make sense
(the resulting distribution has no expectation).
.AG m0
The default value `"ok"' indicates that ordinary
kriging will be performed. Other options are `"kt"' for kriging
with a trend model (universal kriging) and `"kte"' for kriging
with external trend (covariates). If a numeric value is provided, this
value is assumed to be the know mean and simple kriging is
performed.
If `"av"' the arithmetic mean of the data is assumed to be the
know mean for simple kriging algorithm.
.AG nwin
If `"full"', all data values are used in the
prediction at each prediction locations. An integer number specifies
the number of closest neighbors be used for the prediction.
.AG n.samples.backtransform
When transformations are used
(specified by the argument `lambda'), back-transformations
are usually performed by sampling the predictive distribution and
back-transforming the sampled values. The exceptions are for
lambda = 0 (log-transformation)  and
lambda = 1 (no transformation). 
This options defines how many samples are taken to perform the
back-transformation.
.AG trend
Required only if `m0="kt"' (universal kriging).
Possible values are 1 or 2 corresponding to a first or second degree
polynomial trend on the coordinates respectively.
.AG d
Spatial dimension, `1' defines a prediction on a line, 2 on
a plane (the default).
.AG ktedata
Required only if `m0="kte"'. Values of the
external trend (covariates) at the data locations.
.AG ktelocations
Required only if `m0="kte"'. Values of the
external trend (covariates) at the prediction locations.
.AG aniso.pars
fixed parameters for geometric anisotropy
correction. If `aniso.pars = F' no correction is done otherwise
a vector with 2 values, anisotropy angle and ratio of ranges,
must be provided. Anisotropy correction consists of a
transformation in the data and prediction coordinates performed
by the function `coords.aniso'.
.AG signal
if `TRUE' the signal is predict, otherwise the
variable is predict. If no transformation is performed the
expectations are the same in both cases and the difference is only in
the kriging variance, if nugget is different form zero.
.AG dist.epsilon
a value defining a distance such that points
which are closed that this are considered co-located.
.AG messages.screen
a flag `TRUE' or `FALSE' indicating
whether or not messages are printed on the screen (or output file)
while the function is running.
.RT
A list with components:
.AG predict
predicted values
.AG krige.var
kriging variances
.AG dif
the difference between the predicted value and the global
mean. Represents the contribution to the neighboring data to
the prediction at each point.
.AG summary
values of the arithmetic and weighted mean of the data and standard
deviations. The weighted mean corresponds to the estimated value of
the global mean. 
.AG ktrend
stores the matrix with trend if `mo="kt"'
(universal kriging).
.AG ktetrend
stores the matrix with trend if `mo="kt"'
(universal kriging).
.AG beta
the value of the mean which is implicitly estimated for
`m0="ok", "kte"' or `"kt"'.
.AG wofmean
weight of mean. The prediction can be seen as a
weighted  average between the global mean and the the neighbors.
The recorded value is the weight given to the mean.
.AG locations
store the prediction locations.
.AG message
status messages returned by the algorithm.
.AG call
the function call.
Note
This is a preliminary and inefficient function.
For predictions using global neighborhood the function
`krige.conv' should be used instead..SH REFERENCES
Further information about `geoR/geoS' can be found at:
.br
<URL: http://www.maths.lancs.ac.uk/~ribeiro/geoR.html>
.SA
`krige.conv', `krige.bayes'.
.EX

data(s100)   # R only
loci <- expand.grid(seq(0,1,l=31), seq(0,1,l=31))
kc <- ksline(s100, loc=loci, cov.pars=c(1, .25))
par(mfrow=c(1,2))
image.kriging(kc, loc=loci, main="kriging estimates")
image.kriging(kc, loc=loci, val=sqrt(kc$krige.var),
              main="kriging std. errors")

.KW spatial
.WR
