Learn R Programming

geosptdb (version 1.0-1)

rbfST: gaussian, exponential, trigonometric, thin plate spline, inverse multiquadratic, and multiquadratic radial basis function for spatio-temporal prediction

Description

Function for spatio-temporal interpolation from radial basis function (rbfST), where rbfST is in a local neighbourhood.

exponential (EXPON) $$ \phi(\delta)=e^{-\eta \delta}, \eta>0 $$

gaussiano (GAU) $$ \phi(\delta)=e^{-\eta \delta^{2}}, \eta\neq0 $$

multiquadratic (M) $$ \phi(\delta)=\sqrt{\eta^2+\delta^2}, \eta\neq0 $$

inverse multiquadratic (IM) $$ \phi(\delta)=1/\sqrt{\eta^2+\delta^2}, \eta\neq0 $$

thin plate spline (TPS) $$\phi(\delta)=(\eta\cdot\delta)^{2}log(\eta\cdot\delta), if: \delta>0, \eta>0$$ $$\phi(\delta) = 0, otherwise$$

completely regularized spline (CRS) $$\phi(\delta) = \ln(\eta\cdot \delta/2)^{2}+E_{1}(\eta\cdot \delta/2)^{2}+C_{E}, if: \delta>0, \eta>0$$ $$\phi(\delta) = 0, otherwise$$ where \(\ln\) is natural logarithm, \(E_{1}(x)\) is the exponential integral function, and \(C_{E}\) is the Euler constant.

spline with tension (ST) $$ \phi(\delta)=\ln(\eta\cdot \delta/2)+K_{0}(\eta\cdot \delta)+C_{E}, if: \delta>0 $$ $$\phi(\delta) = 0, otherwise$$ where \(K_{0}(x)\) is the modified Bessel function and \(C_{E}\) is the Euler constant.

Usage

rbfST(formula, data, eta, rho, newdata, n.neigh, func, progress)

Arguments

formula

formula that defines the dependent variable as a linear model of independent variables (covariates or principal coordinates); suppose the dependent variable has name \(z_{st}\) for a rbfST detrended use \(z_{st}\)~1; for a rbfST with trend suppose \(z_{st}\) is linearly dependent on x and y, use the formula \(z_{st}\)~x+y (linear trend).

data

SpatialPointsDataFrame: should contain the spatio-temporal dependent variable, independent variables (statics and/or dynamics), spatial coordinates and the time as an integer or numerical variable.

eta

the optimal smoothing parameter, we recommend using the parameter found by minimizing the root-mean-square prediction errors using cross-validation

rho

optimal robustness parameter, we recommend using the value obtained by minimizing the root-mean-square prediction errors with cross-validation. eta and rho parameters can be optimized simultaneously, through the bobyqa function from nloptr or minqa packages

newdata

data frame or spatial object with prediction/simulation spatio-temporal locations; should contain attribute columns with the independent variables (if present) and (if locations is a formula) the coordinates and time with names, as defined in locations where you want to generate new predictions

n.neigh

number of nearest observations that should be used for a rbfST prediction, where nearest is defined in terms of the spatio-temporal locations

func

spatio-temporal radial basis function; model type: "GAU", "EXPON", "TRI", "TPS", "CRS", "ST", "IM" and "M", are currently available

progress

whether a progress bar shall be printed for spatio-temporal radial basis functions; default=TRUE

Value

Attributes columns contain coordinates, time, predictions, and the variance column contains NA's

Details

rbf.st function generates individual spatio-temporal predictions from gaussian (GAU), exponential (EXPON), trigonometric (TRI) thin plate spline (TPS), completely regularized spline (CRS), spline with tension (ST), inverse multiquadratic (IM), and multiquadratic (M) functions

References

Melo, C. E. (2012). Analisis geoestadistico espacio tiempo basado en distancias y splines con aplicaciones. PhD. Thesis. Universitat de Barcelona. 276 p. [link]

Examples

Run this code
# NOT RUN {
# considering 10 principal coordinates (constructed from a distance-based regression model)
data(croatia.temp)
data(croatiadb)

# prediction case: one point
point <- data.frame(670863,5043464,5,170,200,15.7,3)
names(point) <- c("x","y","t","dem","dsea","twi","est")

croatia.temp[,7] <- as.factor(croatia.temp[,7])
dblm1 <- dblm(data=croatia.temp,y=croatiadb$MTEMP)         
newdata1 <- t(cp.xnews(newdata=point,eigenvalues=dblm1$ev, data=croatia.temp,trend=dblm1$cp))
colnames(newdata1) <- c("X1","X2","X3","X4","X5","X6","X7","X8","X9","X10")
newdata1 <- data.frame(point[,1:3],newdata1)

data(croatiadb)
coordinates(croatiadb) <- ~x+y
coordinates(newdata1) <- ~x+y
rbfST(MTEMP~X1+X2+X3+X4+X5+X6+X7+X8+X9+X10, data=croatiadb, eta=0.010076, rho=0.00004, 
       newdata=newdata1, n.neigh=60, func="TPS")

# prediction case: a grid of points Croatia (month july)
data(croatia.grid7cp)
coordinates(croatia.grid7cp) <- ~x+y
rbf.t <- rbfST(MTEMP~X1+X2+X3+X4+X5+X6+X7+X8+X9+X10, croatiadb, eta=0.01076, rho=0.00004, 
                newdata=croatia.grid7cp, n.neigh=30, func="TPS")                  
coordinates(rbf.t) <- c("x", "y")
gridded(rbf.t) <- TRUE

# show prediction map
spplot(rbf.t["var1.pred"], cuts=30, col.regions=bpy.colors(40), main = "Earth's average 
       temperature TPS map\n (july month)", key.space=list(space="right", cex=0.8))
# }

Run the code above in your browser using DataLab