View source: R/Photosynthesis_functions.R
f.fitting | R Documentation |
Function to fit model to data. The parameters to fit have to be described in the list Start. All the other parameters of the f.Aci functions have to be in param. If the parameters from Start are repeated in param, the later ones will be ignored. This function uses two methods to fit the data. First by minimizing the residual sum-of-squares of the residuals and then by maximizing the likelihood function. The first method is more robust but the second one allows to calculate the confident interval of the parameters.
f.fitting(
measures,
id.name = NULL,
Start = list(JmaxRef = 90, VcmaxRef = 70, RdRef = 1),
param = f.make.param(),
modify.init = TRUE,
do.plot = TRUE,
type = "Aci"
)
measures |
Data frame of measures obtained from gas exchange analyser with at least the columns A, Ci, Qin (the light at the leaf surface in micro mol m-2 s-1) and Tleaf (in K). If RHs, Tair, Patm, VPDleaf are also present, their mean will be added in the output, but those columns are not needed to estimate the parameters. |
id.name |
Name of the column in the data frame measures with the name for the curve. |
Start |
List of parameters to fit with their initial values. |
param |
See f.make.param() for details. |
modify.init |
TRUE or FALSE, allows to modify the Start values before fitting the data |
do.plot |
TRUE or FALSE, plot data and fitted curves ? |
Return a list with 3 components, 1 the result of the optim function which is used to estimate the parameters, 2 the output of the function bbmle, 3 the mean variable of the environment during the measurement
##Simulation of a CO2 curve
data=data.frame(Tleaf=rep(300,20),
Ci=seq(40,1500,75),Qin=rep(2000,20),Tair=300,RHs=70,VPDleaf=2,Patm=101,A=f.Aci(PFD=2000,Tleaf=300,ci=seq(40,1500,75),
param=f.make.param())$A+rnorm(n = 20,mean = 0,sd = 0.5))
f.fitting(measures=data,id.name=NULL,Start=list(JmaxRef=90,VcmaxRef=70,RdRef=1),param=f.make.param())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.