# \donttest{
# Walker & Ort (2015) model
library(broom)
library(dplyr)
library(photosynthesis)
acq_data = system.file("extdata", "A_Ci_Q_data_1.csv", package = "photosynthesis") |>
read.csv()
fit = fit_photosynthesis(
.data = acq_data,
.photo_fun = "r_light",
.model = "walker_ort_2015",
.vars = list(.A = A, .Q = Qin, .C = Ci),
C_upper = 300,
# Irradiance levels used in experiment
Q_levels = c(1500, 750, 375, 125, 100, 75, 50, 25),
)
# The 'fit' object inherits class 'lm' and many methods can be used
## Model summary:
summary(fit)
## Estimated parameters:
coef(fit)
## 95% confidence intervals:
## n.b. these confidence intervals are not correct because the regression is fit
## sequentially. It ignores the underlying data and uncertainty in estimates of
## slopes and intercepts with each A-C curve. Use '.method = "brms"' to properly
## calculate uncertainty.
confint(fit)
## Tidy summary table using 'broom::tidy()'
tidy(fit, conf.int = TRUE, conf.level = 0.95)
## Calculate residual sum-of-squares
sum(resid(fit)^2)
# Yin et al. (2011) model
fit = fit_photosynthesis(
.data = acq_data,
.photo_fun = "r_light",
.model = "yin_etal_2011",
.vars = list(.A = A, .phiPSII = PhiPS2, .Q = Qin),
Q_lower = 20,
Q_upper = 250
)
# The 'fit' object inherits class 'lm' and many methods can be used
## Model summary:
summary(fit)
## Estimated parameters:
coef(fit)
## 95% confidence intervals:
confint(fit)
## Tidy summary table using 'broom::tidy()'
tidy(fit, conf.int = TRUE, conf.level = 0.95)
## Calculate residual sum-of-squares
sum(resid(fit)^2)
# Kok (1956) model
fit = fit_photosynthesis(
.data = acq_data,
.photo_fun = "r_light",
.model = "kok_1956",
.vars = list(.A = A, .Q = Qin),
Q_lower = 20,
Q_upper = 150
)
# The 'fit' object inherits class 'lm' and many methods can be used
## Model summary:
summary(fit)
## Estimated parameters:
coef(fit)
## 95% confidence intervals:
confint(fit)
## Tidy summary table using 'broom::tidy()'
tidy(fit, conf.int = TRUE, conf.level = 0.95)
## Calculate residual sum-of-squares
sum(resid(fit)^2)
# }
Run the code above in your browser using DataLab