fit_trend_surface: Fits a trend surface by least-squares to a RasterLayer.

Description Usage Arguments Details Value Examples

View source: R/fit_trend_surface.R

Description

Fits a trend surface by least-squares to a RasterLayer.

Usage

1
fit_trend_surface(x, size = ncell(x), np = 3)

Arguments

x

RasterObject.

size

positive integer giving the number of items to choose

np

degree of polynomial surface

sampleProportion

numeric. Fraction. Approximate proportion of pixels that will be passed on to surf.ls as xyz coordinates. sampleRandom is used with the argument size as ncell(x) * sampleProportion.

Details

Fits a trend surface by least-squares to an object of class RasterLayer. This function is powered by surf.ls.

Value

RasterObject.

Examples

1
2
3
4
5
6
7
8
r <- raster()
r[] <- seq(1, ncell(r)) + rnorm(ncell(r), 20000, 10000)
plot(r)
s <- fit_trend_surface(r, np = 1)
plot(s)
par(mfrow = c(1,2))
plot(r, legend = FALSE)
plot(r - s, legend = FALSE)

GastonMauroDiaz/rdemtools documentation built on Sept. 30, 2018, 8:22 p.m.