View source: R/calculate_attenuation.R
calculate_attenuation | R Documentation |
calculate_attenuation
fits a loess model between depth and light using an AICc-based span selection model adapated from fANCOVA::loess.as
, then estimates the first derivative of the resultant model slope to approximate the diffuse attenuation coefficient of downwelling irradiance (vertical attenuation coefficient).
calculate_attenuation( x, light.col = "trans_llight", depth.col = "cdepth", loess.criterion = "aicc", loess.degree = 1, kz.binsize = 0.2, min.range = 10, light.predict = F, ... )
x |
Data frame containing depth and light for a single cast. |
loess.criterion |
Criterion for choosing the most parsimonious model. Options are bias-corrected Akaike's Information Criterion ("aicc") or generalized cross-validation ("gcv"). |
loess.degree |
Degrees for loess model. Default = 1. |
kz.binsize |
Depth interval for estimating instantaneous diffuse attenuation coefficient of downwelling irradiance. Default = 0.2. |
min.range |
Minimum range of depths necessary for model fitting. Default = 10. |
light.predict |
Logical indicating whether predicted values for light should be returned. |
... |
Additional arguments passed to loess fitting function |
Returns a list containing three data frames: attenuation
contains depth and fitted values of vertical diffuse attenuation coefficient, loess.fit
contains the model summary statistics, and fit_residuals
contains model fit residuals.
Sean Rohan sean.rohan@noaa.gov
Hurvich, C.M., Simonoff, J.S., and Tsai, C.-L. 1998. Smoothing parameter selection in nonparametric regression using an improved Akaike information criterion. J. R. Stat. Soc. B 60(2): 271-293.
Xiao-Feng Wang (2010). fANCOVA: Nonparametric Analysis of Covariance. R package version 0.5-1. https://CRAN.R-project.org/package=fANCOVA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.