Title: | Tools to Improve the Use of Geostatistic |
---|---|
Description: | The basic idea of this package is provides some tools to help the researcher to work with geostatistics. Initially, we present a collection of functions that allow the researchers to deal with spatial data using bootstrap procedure. There are five methods available and two ways to display them: bootstrap confidence interval - provides a two-sided bootstrap confidence interval; bootstrap plot - a graphic with the original variogram and each of the B bootstrap variograms. |
Authors: | Diogo Francisco Rossoni [aut, cre] , Vinicius Basseto Felix [aut], Ricardo Puziol de Oliveira [ctb] |
Maintainer: | Diogo Francisco Rossoni <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.2.1 |
Built: | 2024-11-19 06:53:54 UTC |
Source: | CRAN |
Performs a bootstrap based on subdivision of data in blocks
gboot_block(data,var,model,B,L1,L2)
gboot_block(data,var,model,B,L1,L2)
data |
object of the class geodata. |
var |
object of the class variogram. |
model |
object of the class variomodel. |
B |
number of the bootstrap that will be performed (default B=1000). |
L1 |
number of cuts in the vertical (L1xL2 blocks). |
L2 |
number of cuts in the horizontal (L1xL2 blocks). |
The algorithm for the block bootstrap is an adaptation of the time series bootstrap. Consider that your data presents the second order stationarity, so, we can subdivide them into small blocks. The steps of the algorithm are:
Subdivide the data into L1xL2 blocks;
Realocate each block with probability ;
Calculate the new variogram from the new data;
Calculate and save the statistics of interest;
Return to step 2 and repeat the process at least 1000 times.
variogram_boot gives the variogram of each bootstrap.
variogram_or gives the original variogram.
pars_boot gives the estimatives of the nugget, sill, contribution, range and practical range for each bootstrap.
pars_or gives the original estimatives of the nugget, sill, contribution, range and practical range.
Invalid arguments will return an error message.
Diogo Francisco Rossoni [email protected]
Vinicius Basseto Felix [email protected]
DAVISON, A.C.; HINKLEY, D. V. Bootstrap Methods and their Application. [s.l.] Cambridge University Press, 1997. p. 582
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_block(data,var,mod,B=10, L1=2, L2=2) ## For better Confidence Interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- boot<- gboot_block(data,var,mod,B=10, L1=2, L2=2) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_block(data,var,mod,B=10, L1=2, L2=2) ## For better Confidence Interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- boot<- gboot_block(data,var,mod,B=10, L1=2, L2=2) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
Provides a two-sided bootstrap confidence interval.
gboot_CI(x,alpha=0.05,digits=3)
gboot_CI(x,alpha=0.05,digits=3)
x |
object generate by functions |
alpha |
significance level (Default=0.05). |
digits |
number of decimal places. |
Examples of this function can be found in gboot_block
,
gboot_cloud
, gboot_cross
,
gboot_solow
, gboot_variogram
Invalid arguments will return an error message.
Diogo Francisco Rossoni [email protected]
Vinicius Basseto Felix [email protected]
Performs a boostrap based on the variogram cloud
gboot_cloud(data,var,model,B)
gboot_cloud(data,var,model,B)
data |
object of the class geodata. |
var |
object of the class variogram. |
model |
object of the class variomodel. |
B |
number of the bootstrap that will be performed (default B=1000). |
The variogram cloud is computed by the function variog
.
It provides all the possible pairs that will generate the classical variogram.
The algorithm performs a classical bootstrap in each lag of the variogram.
The steps are:
Calculate the variogram cloud;
Obtain the number of lags (See details in variog
: defining the bins);
Sample with replacement in each lag;
Create a new variogram using the average of all pairs in each lag;
Calculate and save the statistics of interest;
Return to step 3 and repeat the process at least 1000 times.
variogram_boot gives the variogram of each bootstrap.
variogram_or gives the original variogram.
pars_boot gives the estimatives of the nugget, sill, contribution, range and practical range for each bootstrap.
pars_or gives the original estimatives of the nugget, sill, contribution, range and practical range.
Invalid arguments will return an error message.
Diogo Francisco Rossoni [email protected]
Vinicius Basseto Felix [email protected]
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cloud(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cloud(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cloud(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cloud(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
Performs a boostrap based on error from the cross-validation
gboot_cross(data,var,model,B)
gboot_cross(data,var,model,B)
data |
object of the class geodata. |
var |
object of the class variogram. |
model |
object of the class variomodel. |
B |
number of the bootstrap that will be performed (default B=1000). |
We can define the error of prediction by ,
where
are obtained from cross-validation. The steps of the algorithm are:
Set ;
Obtain from
;
Calculate
Sample with replacement from
;
The new data will be ;
Calculate the new variogram;
Calculate and save the statistics of interest;
Return to step 4 and repeat the process at least 1000 times.
variogram_boot gives the variogram of each bootstrap.
variogram_or gives the original variogram.
pars_boot gives the estimatives of the nugget, sill, contribution, range and practical range for each bootstrap.
pars_or gives the original estimatives of the nugget, sill, contribution, range and practical range.
Invalid arguments will return an error message.
Diogo Francisco Rossoni [email protected]
Vinicius Basseto Felix [email protected]
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cross(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cross(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cross(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_cross(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
A graphic with the original variogram and each of the B bootstrap variograms.
gboot_plot(x)
gboot_plot(x)
x |
object generate by functions |
Examples of this function can be found in gboot_block
,
gboot_cloud
, gboot_cross
,
gboot_solow
, gboot_variogram
Invalid arguments will return an error message.
Diogo Francisco Rossoni [email protected]
Vinicius Basseto Felix [email protected]
Performs a spatial boostrap proposed by Solow(1985).
gboot_solow(data,var,model,B)
gboot_solow(data,var,model,B)
data |
object of the class geodata. |
var |
object of the class variogram. |
model |
object of the class variomodel. |
B |
number of the bootstrap that will be performed (default B=1000). |
The basic idea involves transforming correlated observation to uncorrelated
quantities, forming a bootstrap sample from these quantities, and transforming back to a
bootstrap sample form the original observations (SOLOW, 1985). Suppose that
is an
vector of observations from a realization of a second-order stationary
random process,
, and the covariance matrix for
is
. Suppose
further that
, where
is an
vector of zeroes.
In practice
can be centered by subtracting an estimate of the stationary mean from
each observation. So, the steps of the algorithm are:
Obtain ;
Apply the Cholesky decomposition in , obtaining
, where
is lower triangular;
Obtain ;
Sample with replacement from
;
The new data will be ;
Calculate the new variogram;
Calculate and save the statistics of interest;
Return to step 4 and repeat the process at least 1000 times.
variogram_boot gives the variogram of each bootstrap.
variogram_or gives the original variogram.
pars_boot gives the estimatives of the nugget, sill, contribution, range and practical range for each bootstrap.
pars_or gives the original estimatives of the nugget, sill, contribution, range and practical range.
Invalid arguments will return an error message.
Diogo Francisco Rossoni [email protected]
Vinicius Basseto Felix [email protected]
Solow, A. R. (1985). Bootstrapping correlated data. Journal of the International Association for Mathematical Geology, 17(7), 769-775. https://doi.org/10.1007/BF01031616
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_solow(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_solow(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_solow(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_solow(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
Perform a boostrap based on error from the fitted model of the variogram.
gboot_variogram(data,var,model,B)
gboot_variogram(data,var,model,B)
data |
object of the class geodata. |
var |
object of the class variogram. |
model |
object of the class variomodel. |
B |
number of the bootstrap that will be performed (default B=1000). |
The algorithm for the bootstrap variogram is the same presented for
Davison and Hinkley (1997) for the non linear regression. We can write the
variogram as , where
is the fitted model. The steps of the algorithm are:
Set ;
Sample with replacement from
;
The new variogram will be ;
Calculate and save the statistics of interest;
Return to step 2 and repeat the process at least 1000 times.
variogram_boot gives the variogram of each bootstrap.
variogram_or gives the original variogram.
pars_boot gives the estimatives of the nugget, sill, contribution, range and practical range for each bootstrap.
pars_or gives the original estimatives of the nugget, sill, contribution, range and practical range.
Invalid arguments will return an error message.
Diogo Francisco Rossoni [email protected]
Vinicius Basseto Felix [email protected]
DAVISON, A.C.; HINKLEY, D. V. Bootstrap Methods and their Application. [s.l.] Cambridge University Press, 1997. p. 582
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_variogram(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_variogram(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
# Example 1 ## transforming the data.frame in an object of class geodata data<- as.geodata(soilmoisture) points(data) ## data visualization var<- variog(data, max.dist = 140) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(2,80),nugget = 2,cov.model = "sph") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_variogram(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot # Example 2 ## transforming the data.frame in an object of class geodata data<- as.geodata(NVDI) points(data) ## data visualization var<- variog(data, max.dist = 18) ## Obtaining the variogram plot(var) ## Fitting the model mod<- variofit(var,ini.cov.pars = c(0.003,6),nugget = 0.003,cov.model = "gaus") lines(mod, col=2, lwd=2) ##fitted model ## Bootstrap procedure boot<- gboot_variogram(data,var,mod,B=10) ## For better Confidence interval, try B=1000 gboot_CI(boot,digits = 4) ## Bootstrap Confidence Interval gboot_plot(boot) ## Bootstrap Variogram plot
Field experiment, realized in CTI (Tecnical Center of Irrigation), in an area of 3 m x 24 m, with 88 observations in a regular grid.
data(soilmoisture)
data(soilmoisture)
An object of class data.frame
x a vector containing the sample locations(in cm) in the horizontal.
y a vector containing the sample locations(in cm) in the vertical.
z a vector containing the value of normalized difference vegetation index (NDVI).
HARA. A. T., GONÇALVES, A. C. A. Temporal stability of the spatial pattern of water storage in the soil at different spatial scales. (Doctoral thesis). Retrieved from url http://www.pga.uem.br/dissertacao-tese/710
Field experiment, realized in CTI (Tecnical Center of Irrigation), in an area of 350 cm x 150 cm, with 355 observations in a regular grid.
data(soilmoisture)
data(soilmoisture)
An object of class data.frame
x a vector containing the sample locations(in cm) in the horizontal.
y a vector containing the sample locations(in cm) in the vertical.
z a vector containing the value of soil moisture in percents.
HARA. A. T., GONÇALVES, A. C. A. Temporal stability of the spatial pattern of water storage in the soil at different spatial scales. (Doctoral thesis). Retrieved from url http://www.pga.uem.br/dissertacao-tese/710