\frametitle{Loading Data}
Statistics
Statistics on observations
Elevation |
87.974 |
Temperature |
2.815 |
Statistics on the grid
Elevation |
241.152 |
Observations
Map of the elevations on Grid
Temperature vs. Elevation
Temperature vs. Elevation (statistiques)
tab <- dbStatisticsMultiT(dat, c("Temperature", "Elevation"),
oper=EStatOption_MEAN(), flagMono=FALSE)
knitr::kable(tab$toTL(), caption = "Statistics on the grid", digits=3)
Statistics on the grid
Temperature |
2.815 |
2.815 |
Elevation |
87.974 |
146.441 |
Variograms and Non-stationarity
Directional variograms (N-S and E-W): no drift or with first order global trend
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
Global Trend
Find the coefficients of the global regression (first order polynomial)
err = regression(dat, name0="Temperature", mode=2, model=model, verbose=TRUE)
##
## Linear Regression
## -----------------
## - Calculated on 151 active values
## - Explanatory Variable #1 = 3.521360
## - Explanatory Variable #2 = -0.007466
## - Explanatory Variable #3 = 0.001978
## - Initial variance = 1.019788
## - Variance of residuals = 0.735557
Modelling Variogram of Raw Data with Anisotropy
Ordinary Kriging - Cross-Validation
Perform Cross-validation (using Ordinary Kriging) and calculate the Mean Squared Error.
err = xvalid(dat, fitmod, unique_neigh,
namconv=NamingConvention("OK",TRUE,TRUE,FALSE))
Cross-validation with Ordinary Kriging
OK.Temperature.esterr |
-0.041 |
OK.Temperature.stderr |
-0.044 |
Ordinary Kriging - Estimation
err = kriging(dat, target, fitmod, unique_neigh,
namconv=NamingConvention("OK"))
Ordinary Kriging - Statistics
Statistics on the Ordinary Kriging
OK.Temperature.estim |
3092 |
0.599 |
5.084 |
2.806 |
0.910 |
OK.Temperature.stdev |
3092 |
0.064 |
0.883 |
0.460 |
0.127 |
Fitting Variogram of Residuals
fitmodUK = Model()
err = fitmodUK$fit(vario_res2dir,
types=ECov_fromKeys(c("SPHERICAL")),
optvar=Option_VarioFit(FALSE,FALSE))
p = ggplot()
p = p + plot.varmod(vario_res2dir, fitmodUK)
p = p + plot.decoration(title="Temperature (°C)")
ggPrint(p)
Note that the residuals seem isotropic, hence use isotropic option for Fitting.
Universal Kriging - Cross-Validation
Perform Cross-validation (using Universal Kriging) and calculate the Mean Squared Error.
err = xvalid(dat, fitmodUK, unique_neigh,
namconv=NamingConvention("UK",TRUE,TRUE,FALSE))
Cross-validation with Ordinary Kriging
UK.Temperature.esterr |
151 |
-4.336 |
1.397 |
-0.352 |
0.939 |
UK.Temperature.stderr |
151 |
-4.820 |
3.781 |
-0.499 |
1.432 |
Universal Kriging - Estimation
err = kriging(dat, target, fitmodUK, unique_neigh,
namconv=NamingConvention("UK"))