# VRes: Precomputed Variogram for residuals of monthly precipitation In STMedianPolish: Spatio-Temporal Median Polish

## Description

Precomputed Variogram for residuals of monthly precipitation `Metadb`. For this, the 'variogram' [package "gstat"] function is used.

## Usage

 `1` ```data(VRes) ```

## Format

The format is: 'StVariogram' 'data.frame'

## References

Martínez, W. A., Melo, C. E., & Melo, O. O. (2017). Median Polish Kriging for space–time analysis of precipitation Spatial Statistics, 19, 1-20. [link]

Pebesma, E.J. (2004). Multivariable geostatistics in S: the gstat package. Computers & Geosciences, 30: 683-691 [link]

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ```#Empirical variogram #VRes = variogram(values ~ 1, rain_residual, cutoff=90000,tlags=0:24,width=2650, # assumeRegular=TRUE, na.omit=TRUE) data(VRes) plot(VRes) FitPar_st = function(p, gfn, v, trace = FALSE, ...) { mod = gfn(v\$spacelag, v\$timelag,p, ...) resid = v\$gamma - mod if (trace) print(c(p, MSE = mean(resid^2))) mean(resid^2) } ModSpatial = function(h,p){p[2]*(1-exp(-h/p[3]))} ModTemporal = function(u,p){p[4]*(1-exp(-u/p[5]))+ p[6]*(1-cos(pi*u/180))+ p[7]*abs(sin(pi*u/180))} VariogST=function(h,u,p) {ModTemporal(u,p)+ModSpatial(h,p)+p[8]*ModTemporal(u,p)*ModSpatial(h,p)} #Parametros Iniciales p1<-c(2,14.5,13900,5.9,29,1.55,3.7,-0.07) pars.st = optim(p1, FitPar_st, method = "BFGS", gfn = VariogST, v = VRes, hessian=TRUE) fit_Variog_ST<-VRes fit_Variog_ST\$gamma<-VariogST(VRes\$spacelag, VRes\$timelag, pars.st\$par) plot(fit_Variog_ST) ```

STMedianPolish documentation built on May 2, 2019, 10:14 a.m.