gboot_cross: Cross-validation bootstrap

View source: R/gboot_cross.R

gboot_crossR Documentation

Cross-validation bootstrap

Description

Performs a boostrap based on error from the cross-validation

Usage

gboot_cross(data,var,model,B)

Arguments

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).

Details

We can define the error of prediction by \epsilon({s_i})=Z({s_i})-\hat Z({s_i}), where \hat Z({s_i}) are obtained from cross-validation. The steps of the algorithm are:

  1. Set {s_i}^*={s_i};

  2. Obtain \hat Z({s_i}) from \hat Z({s_i})=\sum\limits_{j \ne i}^{n - 1}{{\lambda _j}Z({s_j})};

  3. Calculate \epsilon({s_i})=Z({s_i})-\hat Z({s_i})

  4. Sample with replacement \epsilon^*(s_i) from \epsilon (s_i) - \bar \epsilon (s_i);

  5. The new data will be Z^*({s_i})=\hat Z({s_i})+ \epsilon^*(s_i);

  6. Calculate the new variogram;

  7. Calculate and save the statistics of interest;

  8. Return to step 4 and repeat the process at least 1000 times.

Value

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.

Author(s)

Diogo Francisco Rossoni dfrossoni@uem.br

Vinicius Basseto Felix felix_prot@hotmail.com

Examples



# 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



geotoolsR documentation built on Sept. 11, 2024, 9:34 p.m.