We recommend using fit_photosynthesis()
with argument .photo_fun = "aq_response"
rather than calling this function directly.
fit_aq_response2(
.data,
.model = "default",
.method = "ls",
usealpha_Q = FALSE,
alpha_Q = 0.84,
quiet = FALSE,
brm_options = NULL
)
A data frame containing plant ecophysiological data. See required_variables()
for the variables required for each model.
A character string of model name to use. See get_all_models()
.
A character string of the statistical method to use: 'ls' for least-squares and 'brms' for Bayesian model using brms::brm()
. Default is 'ls'.
Flag. Should light intensity be multiplied by alpha_Q
before fitting? Default is FALSE (i.e. assume that '.Q' is absorbed light).
Number. Absorbance of incident light. Default value is 0.84. Ignored if usealpha_Q = FALSE
.
Flag. Should messages be suppressed? Default is FALSE.
A list of options passed to brms::brm()
if .method = "brms"
. Default is NULL.
If .method = 'ls'
: an stats::nls()
object.
If .method = 'brms'
: a brms::brmsfit()
object.
Rd fitted in this way is essentially the same as the Kok (1956) method, and represents a respiration value in the light that may not be accurate. Rd output should thus be interpreted more as a residual parameter to ensure an accurate fit of the light response parameters. Model originally from Marshall & Biscoe (1980).
Marshall B, Biscoe P. 1980. A model for C3 leaves describing the dependence of net photosynthesis on irradiance. J Ex Bot 31:29-39
# \donttest{
library(broom)
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
library(photosynthesis)
# Read in your data
dat = system.file("extdata", "A_Ci_Q_data_1.csv", package = "photosynthesis") |>
read.csv() |>
# Set grouping variable
mutate(group = round(CO2_s, digits = 0)) |>
# For this example, round sequentially due to CO2_s set points
mutate(group = as.factor(round(group, digits = -1)))
# Fit one light-response curve
fit = fit_photosynthesis(
.data = filter(dat, group == 600),
.photo_fun = "aq_response",
.vars = list(.A = A, .Q = Qabs),
)
# The 'fit' object inherits class 'nls' and many methods can be used
## Model summary:
summary(fit)
#>
#> Formula: .A ~ marshall_biscoe_1980(Q_abs = .data[[".Qabs"]], k_sat, phi_J,
#> theta_J) - Rd
#>
#> Parameters:
#> Estimate Std. Error t value Pr(>|t|)
#> k_sat 21.170337 0.154428 137.09 1.70e-08 ***
#> phi_J 0.061543 0.001218 50.52 9.19e-07 ***
#> theta_J 0.775752 0.014526 53.40 7.36e-07 ***
#> Rd 0.666320 0.063490 10.49 0.000466 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Residual standard error: 0.0539 on 4 degrees of freedom
#>
#> Number of iterations to convergence: 5
#> Achieved convergence tolerance: 1.49e-08
#>
## Estimated parameters:
coef(fit)
#> k_sat phi_J theta_J Rd
#> 21.17033721 0.06154348 0.77575157 0.66631987
## 95% confidence intervals:
confint(fit)
#> Waiting for profiling to be done...
#> 2.5% 97.5%
#> k_sat 20.75337772 21.60612987
#> phi_J 0.05835624 0.06501655
#> theta_J 0.73285635 0.81306156
#> Rd 0.49523165 0.84311606
## Tidy summary table using 'broom::tidy()'
tidy(fit, conf.int = TRUE, conf.level = 0.95)
#> # A tibble: 4 × 7
#> term estimate std.error statistic p.value conf.low conf.high
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 k_sat 21.2 0.154 137. 0.0000000170 20.8 21.6
#> 2 phi_J 0.0615 0.00122 50.5 0.000000919 0.0584 0.0650
#> 3 theta_J 0.776 0.0145 53.4 0.000000736 0.733 0.813
#> 4 Rd 0.666 0.0635 10.5 0.000466 0.495 0.843
# Fit multiple curves with **photosynthesis** and **purrr**
library(purrr)
#>
#> Attaching package: ‘purrr’
#> The following object is masked from ‘package:magrittr’:
#>
#> set_names
fits = dat |>
split(~ group) |>
map(fit_photosynthesis, .photo_fun = "aq_response", .vars = list(.A = A, .Q = Qabs))
# }