cdom_fit_exponential {cdom}R Documentation

Fit an exponential model to CDOM data.

Description

Fit an exponential model to CDOM data.

Usage

cdom_fit_exponential(wl, absorbance, wl0 = 350, startwl, endwl)

Arguments

wl

The wavelength vector.

absorbance

The absorbance vector.

wl0

The reference wavelength (ex.: 350).

startwl

The starting wavelength (ex.: 240).

endwl

The ending wavelength (ex.: 600).

Details

y = a0 + e^{(-S(x - \lambda_0))} + K

Value

A list containing:

params

A data frame with values of fitted parameters.

r2

R2 of the nls model.

data

A data frame with fitted (predicted) values of the model.

The function will return NULL if the model did not converged.

Examples

# Fit an exponential model using the reference wavelength 350 between 190 and 900 nm.

data(spectra)

fit <- cdom_fit_exponential(spectra$wavelength, spectra$spc1, 350, 190, 900)
str(fit)

plot(spectra$wavelength, spectra$spc1)
lines(spectra$wavelength, fit$data$.fitted, col = "red")

[Package cdom version 0.1.0 Index]