Learn R Programming

FeedbackTS (version 1.5)

krige: Kriging function

Description

Variogram analysis and kriging prediction used to analyze feedback and change-in-feedback across space. This function is grounded on the function autoKrige in the automap package, grounded itself on the gstat package.

Usage

krige(coordinates, statistic, grid, krige.param=NULL, plots=TRUE,
    variog.param=list(npoints=50,nsim=99,plot.numbers=0.04))

Arguments

coordinates

a 2-column matrix with latitudes and longitudes of observation sites.

statistic

a numeric vector specifying the values, at observation sites, of the statistic to be predicted.

grid

a list of arguments defining the grid over which the statistic is predicted:

x:

a numeric vector of longitudes.

y:

a numeric vector of latitudes.

border:

a character string that names the region in the world within which the statistic will be predicted. This is a character string in the database world; see the function map in the maps package.

proj:

a projection definition; see the function project in the proj4 package.

degrees:

a logical indicating if the lat/long coordinates are assumed to be in degrees (if degrees = TRUE), or in radians (if degrees = FALSE).

krige.param

a character string equal either to "x+y", "x" or "y" indicating whether the coordinates (and which coordinates) have to be accounted for in the trend in universal kriging; default is NULL, indicating that ordinary kriging without trend is performed.

plots

a logical indicating if plots characterizing the variogram analysis and the kriging prediction are produced (if plots = TRUE) or not (if plots = FALSE), default is TRUE.

variog.param

a list of arguments used to display the variography, :

npoints:

a numeric value specifying the number of points at which the variogram model is calculated, default is 50.

nsim:

a numeric value specifying the number of Monte Carlo simulations used to compute the envelope, default is 99.

plot.numbers:

a numeric value specifyng the relative distance to be used between circles representing the empirical semivariogram and texts providing the number of point pairs used for computing each value of the empirical semivariogram, default is 0.04 (if plot.numbers = 0, these texts are not displayed).

Value

a list of items characterizing the variogram analysis and the kriging prediction:

input

the list of arguments in the call of the krige function except the argument plots.

MAP

a list allowing to draw the border of the study region that can be made of several polygons. This is the output of the function map in the maps package.

grid

a 2-column matrix providing the coordinates (in degrees) of the nodes of the prediction locations.

in.region

a logical vector indicating, for each grid node whose coordinates are given in the 2-column matrix grid, if the node is in the study region or not. The study region is defined by MAP.

krige

a list providing the result the variography and the spatial prediction. This is the output of the function autoKrige in the automap package.

Details

If plots = TRUE, four plots are produced. Plot 1: Estimation of the semivariogram of the statistic (dots: sample semivariogram; solid curve: theoretical semivariogram; dashed curves: Monte-Carlo envelopes. Plot 2: Boxplots of kriging prediction (left) and kriging standard error (right). Plot 3: Kriging prediction. Plot 4: Kriging standard error.

References

Soubeyrand, S., Morris, C. E. and Bigg, E. K. (2014). Analysis of fragmented time directionality in time series to elucidate feedbacks in climate data. Environmental Modelling and Software 61: 78-86.

See Also

rain.feedback.stats, map in the maps package, autoKrige and autofitVariogram in the automap package

Examples

Run this code
# NOT RUN {
#### load data of feedback and change-in-feedback indices in 88 sites across Australia
data(rain.feedback.stats)

#### spatial coordinates of the 88 sites
coord=rain.feedback.stats[,3:4]

#### feedback index
stat1=rain.feedback.stats[["Feedback.whole.period"]]

#### variogram analysis and kriging of feedback index
## computer intensive stage
# }
# NOT RUN {
par(mfrow=c(2,2), mar=c(5.1,4.1,4.1,4.1))
kr1=krige(coordinates=coord, statistic=stat1,
   grid=list(x=seq(110,155,0.25),y=seq(-45,-11,0.25),border="Australia", 
      proj="+proj=lcc +lat_1=-18 +lat_2=-36 +lat0=-25 +lon_0=140",degrees=TRUE),
   plots=TRUE)

## the plot style from the \code{automap} package can be obtained as follows:
plot(kr1$krige)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab