Learn R Programming

fluxfinder (version 1.1.0)

ffi_fit_models: Fit various models to gas concentration data

Description

Fit various models to gas concentration data

Usage

ffi_fit_models(time, conc, area, volume)

Value

A wide-form data.frame with fit statistics for linear ("lin", lm), robust linear ("rob", rlm), polynomial ("poly"), and H&M1981 ("HM81", ffi_hm1981) models. The latter is based on an exponential model drawn from one-dimensional diffusion theory; see Hutchinson and Mosier (1981) and Nakano et al. (2004).

For each model type, the following columns are returned:

  • Model statistics AIC, r.squared, RMSE, and p.value;

  • Flux (slope) statistics flux.estimate and flux.std.error;

  • Intercept statistics int.estimate and int.std.error;

  • For the robust linear regression model only, a logical value converged.

Arguments

time

Relative time of observation (typically seconds), numeric

conc

Greenhouse gas concentration (typically ppm or ppb), numeric

area

Area covered by the measurement chamber (typically cm2), numeric

volume

Volume of the system (chamber + tubing + analyzer, typically cm3), numeric

Details

If a linear model cannot be fit, NULL is returned. If the robust linear and/or polynomial models cannot be fit, then NA is returned for their particular statistics. The HM1981 approach is only valid for saturating (exponential) data and NA is returned otherwise.

References

Nakano, T., Sawamoto, T., Morishita, T., Inoue, G., and Hatano, R.: A comparison of regression methods for estimating soil–atmosphere diffusion gas fluxes by a closed-chamber technique, Soil Biol. Biochem., 36, 107–113, 2004. tools:::Rd_expr_doi("10.1016/j.soilbio.2003.07.005")

Hutchinson, G. L. and Mosier, A. R.: Improved soil cover method for field measurement of nitrous oxide fluxes, Soil Sci. Soc. Am. J., 45, 311-316, 1981. tools:::Rd_expr_doi("10.2136/sssaj1981.03615995004500020017x")

Examples

Run this code
# Toy data - linear
ffi_fit_models(cars$speed, cars$dist)

# Toy data - nonlinear
ffi_fit_models(Puromycin$conc, Puromycin$rate)

# Real data
f <- system.file("extdata/TG10-01087.data", package = "fluxfinder")
dat <- ffi_read_LI7810(f)[1:75,] # isolate first observation
dat$SECONDS <- dat$SECONDS - min(dat$SECONDS) # normalize time to start at 0
plot(dat$SECONDS, dat$CO2)
ffi_fit_models(dat$SECONDS, dat$CO2)

Run the code above in your browser using DataLab