Skip to contents

[Experimental]

Usage

simulate_error(
  ph_out,
  chamber_pars,
  n = 1L,
  use_tealeaves = ("T_air" %in% colnames(ph_out))
)

Arguments

ph_out

A data frame of output from photo() or photosynthesis() with units.

chamber_pars

A data frame with a single row of chamber parameters. See Note below for table of required parameters.

n

Integer. Number of replicated simulations per row of ph_out.

use_tealeaves

Flag. The tealeaves package uses a slightly different equation to calculate the saturating water content of air as a function temperature and pressure than LI-COR. If FALSE, the function uses LI-COR's equation in the LI6800 manual. If TRUE, it uses the tealeaves function for internal consistency. The function attempts to guess whether ph_out was run with tealeaves, but this can be manually overridden by providing a value for the argument.

Value

A data frame with n * nrow(ph_out) rows. It contains all the original output in ph_out as well as a column .rep indicating replicate number from 1 to n. Other new columns are assumed or measured chamber parameters and 'measured' values estimated from synthetic data with measurement error:

column nameassumed or derived?description
flowassumedchamber flow rate
leaf_areaassumedleaf area in chamber
sigma_CO2_rassumedstandard deviation of measurement error in CO2_r
sigma_CO2_sassumedstandard deviation of measurement error in CO2_s
sigma_H2O_rassumedstandard deviation of measurement error in H2O_r
sigma_H2O_sassumedstandard deviation of measurement error in H2O_s
c_0derivedCO\(_2\) concentration before entering chamber [\(\mu\)mol / mol]
w_iderivedWater vapor concentration within leaf [mmol / mol]
w_aderivedWater vapor concentration in chamber [mmol / mol]
w_0derivedWater vapor concentration before entering chamber [mmol / mol]
g_twderivedLeaf conductance to water vapor [mol/m\(^2\)/s]
E_areaderivedEvaporation rate per area [mmol/m\(^2\)/s]
EderivedTotal evaporation rate [mmol/s]
CO2_rderivedCO\(_2\) concentration before entering chamber with measurement error [\(\mu\)mol / mol]
CO2_sderivedCO\(_2\) concentration in chamber with measurement error [\(\mu\)mol / mol]
H2O_sderivedWater vapor concentration in chamber with measurement error [mmol / mol]
H2O_rderivedWater vapor concentration before entering chamber with measurement error [mmol / mol]
E_measderivedTotal evaporation rate (measured) [mmol/s]
E_area_measderivedEvaporation rate per area (measured) [mmol/m\(^2\)/s]
g_tw_measderivedLeaf conductance to water vapor (measured) [mol/m\(^2\)/s]
g_sc_measderivedStomatal conductance to CO\(_2\) (measured) [mol/m\(^2\)/s]
g_tc_measderivedLeaf conductance to CO\(_2\) (measured) [mol/m\(^2\)/s]
A_measderivedNet photosynthetic CO\(_2\) assimilation (measured) [\(\mu\)mol/m\(^2\)/s]
C_iderivedIntercellular CO\(_2\) concentration (measured) [\(\mu\)mol/mol]

Note

The required parameters for the chamber_pars argument are:

  • flow [\(\mu\)mol / s]: chamber flow rate

  • leaf_area [cm ^ 2]: leaf area in chamber

  • sigma_CO2_s [\(\mu\)mol / mol]: standard deviation of sample [CO\(_2\)] measurement error

  • sigma_CO2_r [\(\mu\)mol / mol]: standard deviation of reference [CO\(_2\)]

  • sigma_H2O_s [mmol / mol]: standard deviation of sample [H\(_2\)O] measurement error

  • sigma_H2O_r [mmol / mol]: standard deviation of sample [H\(_2\)O] measurement error

Units for flow and leaf_area should be provided; units are implied for sigma's but not necessary to specify because rnorm() drop units.

To evaluate the accuracy and precision of parameter estimation methods, it may be useful to simulate data with realistic measurement error. This function takes output from from photo() or photosynthesis() models, adds measurement error in CO\(_2\) and H\(_2\)O concentrations, and calculates parameter estimates with synthetic data. Currently, the function assumes a simplified 1-dimensional CO\(_2\) and H\(_2\)O conductance model: zero cuticular conductance, infinite boundary layer conductance, and infinite airspace conductance. Other assumptions include:

  • chamber flow rate, leaf area, leaf temperature, and air pressure are known without error

  • measurement error is normally distributed mean 0 and standard deviation specified in chamber_pars

This function was designed with the LI-COR LI6800 instrument in mind, but in principle applies to any open path gas exchange system.

[CO2ibq4GEPEdMeOTR4IAIgxYuB3iZgESFR-5-]: R:CO2ibq4GEPEdMeOTR4IAIgxYuB3iZgESFR-5-%5C

Examples

library(photosynthesis)

# Use photosynthesis() to simulate 'real' values
# `replace = ...` sets parameters to meet assumptions of `simulate_error()`
lp = make_leafpar(replace = list(
  g_sc = set_units(0.1, mol/m^2/s),
  g_uc = set_units(0, mol/m^2/s),
  k_mc = set_units(0, 1),
  k_sc = set_units(0, 1),
  k_uc = set_units(0, 1)
  ),
  use_tealeaves = FALSE)
   
 ep = make_enviropar(replace = list(
   wind = set_units(Inf, m/s)
 ), use_tealeaves = FALSE) 
 bp = make_bakepar()
 cs = make_constants(use_tealeaves = FALSE)
 
 chamber_pars = data.frame(
   flow = set_units(600, umol / s),
   leaf_area = set_units(6, cm ^ 2),
   sigma_CO2_s = 0.1,
   sigma_CO2_r = 0.1,
   sigma_H2O_s = 0.1,
   sigma_H2O_r = 0.1
 )
   
ph = photosynthesis(lp, ep, bp, cs, use_tealeaves = FALSE, quiet = TRUE) |>
  simulate_error(chamber_pars, n = 1L)