bestfitplane: Finds the Best Fit Polynomial Surface

View source: R/utilities.R

bestfitplaneR Documentation

Finds the Best Fit Polynomial Surface

Description

Finds the best fit polynomial surface for a raster or matrix. This function tests least squares polynomial fits with orders of 0 - 3 and determines which order minimizes the error when the fit is subtracted from the original image.

Usage

bestfitplane(x)

Arguments

x

A raster or matrix.

Value

A raster or matrix of the same size as the input with values predicted from the best polynomial fit.

Examples


# import raster image
data(orforest)
orforest <- terra::unwrap(orforest)

# find the least squares polynomial surface
poly <- bestfitplane(orforest)

# plot the fit
terra::plot(poly)

geodiv documentation built on Oct. 6, 2023, 1:07 a.m.