aspline.downscale {spatialEco}R Documentation

Raster Downscale using adaptive regression splines

Description

Downscales a raster to a higher resolution raster multivariate adaptive regression splines (MARS).

Usage

aspline.downscale(
  x,
  y,
  add.coords = TRUE,
  keep.model = FALSE,
  grid.search = FALSE,
  plot = FALSE,
  ...
)

Arguments

x

A terra SpatRaster object representing independent variable(s)

y

A terra SpatRaster object representing dependent variable

add.coords

(FALSE/TRUE) Add spatial coordinates to model

keep.model

(FALSE/TRUE) Keep MARS model (earth class object)

grid.search

(FALSE/TRUE) perform a hyper-parameter grid se

plot

(FALSE/TRUE) Plot results

...

Additional arguments passed to earth

Details

This function uses Multivariate Adaptive Regression Splines, to downscale a raster based on higher-resolution or more detailed raster data specified as covariate(s). This is similar to the raster.downsample function which uses a robust regression and is a frequentest model for fitting linear asymptotic relationships whereas, this approach is for fitting nonparametric functions and should be used when the distributional relationship are complex/nonlinear. Using add.coords adds spatial coordinates to the model, including creating the associated rasters for prediction.

Value

A list object containing:

Author(s)

Jeffrey S. Evans jeffrey_evans@tnc.org

References

Friedman (1991) Multivariate Adaptive Regression Splines (with discussion) Annals of Statistics 19(1):1–141

Examples


if (require(geodata, quietly = TRUE)) {
library(terra)
library(geodata)

# Download example data (requires geodata package)
  elev <- elevation_30s(country="SWZ",  path=tempdir())
    slp <- terrain(elev, v="slope")
	  x <- c(elev,slp)
        names(x) <- c("elev","slope")
  tmax <- worldclim_country(country="SWZ", var="tmax", 
                                     path=tempdir())
    tmax <- crop(tmax[[1]], ext(elev))
	  names(tmax) <- "tmax"
	  
tmax.ds <- aspline.downscale(x, tmax, add.coords=TRUE, keep.model=TRUE)
  plot(tmax.ds$model) 

  # plot prediction and parameters	
  opar <- par(no.readonly=TRUE)
    par(mfrow=c(2,2))
      plot(tmax, main="Original Temp max")
      plot(x[[1]], main="elevation")
      plot(x[[2]], main="slope")
      plot(tmax.ds$downscale, main="Downscaled Temp max")
  par(opar)

} else { 
  cat("Please install geodata package to run example", "\n")
}



[Package spatialEco version 2.0-2 Index]