Learn R Programming

geodiv (version 1.1.0)

bestfitplane: 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)

Value

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

Arguments

x

A raster or matrix.

Examples

Run this code

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

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

# plot the fit
terra::plot(poly)

Run the code above in your browser using DataLab