FD_optimal_design {SpatFD}R Documentation

Optimal Spatial Design For Functional Data

Description

Given a variogram model and a set of points in which we want to predict certain variable optimally, this function finds where must be placed the stations in which the information will be collected for functional or scalar data.

Usage

FD_optimal_design(k, s0, model, fixed_stations = NULL,
                   scalar = FALSE, nharm = NULL,
                   method = "lambda", grid = NULL,
                   map = NULL, plt = FALSE)

Arguments

k

The number of new stations that are going to be located.

s0

matrix, array, data.frame, or SpatialPoints object that contains the coordinates of the points in which we want to optimally predict using functional kriging. Each row corresponds to each point. If you want to predict optimally in a certain area, you must create a random sample large enough of points of that area and pass it to this function.

model

A VariogramModel from gstat package or a list of VariogramModels objects if a distinct model is going to be used for each harmonic. For scalar data only one model is needed.

fixed_stations

If there are already some stations on the field that are not going to be removed, here should be passed their coordinates. The object must be of class matrix, array, data.frame, SpatialPoints, SpatFD, or NULL if there are no fixed stations.

scalar

Boolean that indicates if the optimization is for functional data (FALSE) or scalar data (TRUE). If TRUE, nharm is set to 1.

nharm

Number of harmonics of the functional principal components that will be used in the prediction. If it is not specified it will be set to the number of models passed, then this parameter shouldn't be specified for scalar data.

method

Functional kriging method that will be used. Currently available "lambda" and "scores". See details bellow.

grid

Coordinates in which the new stations can be located. grid must be of type matrix, array, data.frame, SpatialPoints. If you don't pass grid, you must pass map; if you pass both, map will be used.

map

Spatial object from sp package such as Line, Lines, Polygon, SpatialPolygons, SpatialGrid or SpatialPixels in which the new stations will be located. This object will also be used for creating the plot.

plt

TRUE or FALSE. If TRUE, a nice ggplot2 plot with the result will be generated. Se example bellow.

Details

Bohorquez, M., Giraldo, R., Mateu, J. (2016) present several methods for finding the best combination predictor-design according to the kriging prediction error variance for functional data. They show different functional kriging methods and two of them are implemented on this function.

If method is "lambda", optimal spatial sampling using FPCA and simple kriging will be used (see section 3.2 of Bohorquez, M., Giraldo, R., Mateu, J. (2016)). If method is "scores", simple kriging will be applied on each harmonic and the total variance will be minimized. This total variance is computed as follows:

TotVar = \sum_{j=1}^{nharm}V_j

where V_j is the variance of the simple kriging prediction of j-th score.

Value

The function returns an OptimalSpatialDesign object that is a list with the following elements:

new_stations

matrix array object with the coordinates of the new stations.

fixed_stations

matrix array object with the coordinates of the fixed stations.

plot

ggplot2 plot.

Warning

When method is 'lambda', the minimized value is not the variance, but the negative of expression (12) in Bohorquez, M., Giraldo, R., & Mateu, J. (2016), that is

-\sum_{l = 1}^L \varsigma_l'\Omega^{-1}\varsigma_l

Note

'lambda' method tends to be faster than 'scores' method.

Author(s)

Nathaly Vergel Serrano nvergel@unal.edu.co & Samuel Sánchez Gutiérrez ssanchezgu@unal.edu.co.

References

Bohorquez, M., Giraldo, R., & Mateu, J. (2016). Optimal sampling for spatial prediction of functional data. Statistical Methods & Applications, 25(1), 39-54.

See Also

print.OptimalSpatialDesign

Examples


library(gstat)
s0 <- cbind(2*runif(100),runif(100)) # random coordinates on (0,2)x(0,1)
fixed_stations <- cbind(2*runif(4),runif(4))
x_grid <- seq(0,2,length = 30)
y_grid <- seq(0,1,length = 30)
grid <- cbind(rep(x_grid,each = 30),rep(y_grid,30))
model  <- vgm(psill = 5.665312,
                  model = "Exc",
                  range = 8000,
                  kappa = 1.62,
                  add.to = vgm(psill = 0.893,
                               model = "Nug",
                               range = 0,
                               kappa = 0))
FD_optimal_design(k = 10, s0 = s0, model = model,
                  grid = grid, nharm = 2, plt = TRUE,
                  fixed_stations = fixed_stations) -> OSD
OSD$new_stations
OSD$fixed_stations
OSD$plot
class(OSD)


[Package SpatFD version 0.0.1 Index]