NDFE.fit | R Documentation |
Fit the the non-steady-state diffusive flux extimator model using the Golub-Pereyra algorithm for partially linear least-squares models.
NDFE.fit(
t,
C,
A = 1,
V,
serie = "",
k = log(0.01),
verbose = TRUE,
plot = FALSE,
maxiter = 100,
...
)
t |
time values (usually in hours) |
C |
concentration values |
A |
area covered by the chamber |
V |
effective volume of the chamber |
serie |
id of the flux measurement |
k |
starting value for nls function |
verbose |
logical, TRUE prints message after each flux calculation |
plot |
logical, mainly intended for use in |
maxiter |
see |
... |
further parameters, currently none |
The NDFE model (Livingston et al., 2006) is C(t)=C_0+f_0\tau \frac{A}{V}\left [\frac{2}{\sqrt{\textup{pi}}}\sqrt{t/\tau}+e^{t/\tau}\textup{erfc}(\sqrt{t/\tau})-1\right ]
.
To ensure the lower bound \tau > 0
, the substituion \tau = e^k
is used. The resulting reparameterized model is then
fit using nls
with algorithm = "plinear"
.
Note that according to the reference the model is not valid for negative fluxes. Warning: This function does not check if fluxes are positive. It's left to the user to handle negative fluxes.
The default starting value k = log(\tau)
assumes that time is in hours. If you use a different time unit, you should adjust it accordingly.
Note that nls
is used internally and thus this function should not be used with artificial "zero-residual" data.
A list of
f0 |
flux estimate |
f0.se |
standard error of flux estimate |
f0.p |
p-value of flux estimate |
C0 , tau |
other parameters of the NDFE model |
AIC |
Akaike information criterion |
AICc |
Akaike information criterion with small sample correction |
RSE |
residual standard error (sigma from summary.nls) |
diagnostics |
error or warning messages |
Livingston, G.P., Hutchinson, G.L., Spartalian, K., 2006. Trace gas emission in chambers: A non-steady-state diffusion model. Soil Sci. Soc. Am. J. 70(5), 1459-1469.
#a single fit
t <- c(0, 1/3, 2/3, 1)
C <- c(320, 340, 355, 362)
print(fit <- NDFE.fit(t, C, 1, 0.3, "a"))
plot(C ~ t)
curve({fit$C0+fit$f0*fit$tau*1/0.3*(2/sqrt(pi)*sqrt(x/fit$tau)+
exp(x/fit$tau)*erfc(sqrt(x/fit$tau))-1)},
from = 0, to = 1, add = TRUE)
#note that the flux estimate is very uncertain because
#there are no data points in the region of high curvature
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.