Skip to contents

This function uses the equation: $$\text{NEE} \sim r_0 \cdot \exp \left( \alpha \cdot T + \beta \cdot T^2 \right)$$

Where NEE is nighttime NEE, that is, ecosystem respiration (\(\mu\)mol CO2 m-2 s-1), TA is air temperature (°C), \(r_0\) is ecosystem respiration at TA = 0 °C, and alpha and beta are coefficients.

The equation requires air temperature (TA) in degrees Celsius, photosynthetically active radiation (PAR) in \(\mu\)mol m-2 s-1, and net ecosystem exchange (NEE) in \(\mu\)mol m-2 s-1.

Usage

TRC_PARMS_02(
  data.frame = NULL,
  iterations = NULL,
  priors.trc = brms::prior("normal(1, 5)", nlpar = "r0", lb = 0, ub = 5) +
    brms::prior("normal(0.07, 0.1)", nlpar = "alpha", lb = 0, ub = 0.2) +
    brms::prior("normal(0, 0.05)", nlpar = "beta", lb = -0.1, ub = 0.1),
  idx.colname = NULL,
  NEE.colname = NULL,
  PAR.colname = NULL,
  TA.colname = NULL
)

Arguments

data.frame

(dataframe) A dataframe that contains net ecosystem exchange (NEE), an index, air temperature (TA), and photosynthetically active radiation (PAR).

iterations

(numeric) The number of iterations to run brms::brm().

priors.trc

(brmsprior dataframe) The priors for brms::brm() to use. Default priors are as follows:

brms::prior("normal(1, 5)", nlpar = "r0", lb = 0, ub = 5) +
brms::prior("normal(0.07, 0.1)", nlpar = "alpha", lb = 0, ub = 0.2) +
brms::prior("normal(0, 0.05)", nlpar = "beta", lb = -0.1, ub = 0.1)

idx.colname

(character) The name of the column containing the index.

NEE.colname

(character) The name of the column containing NEE.

PAR.colname

(character) The name of the column containing PAR.

TA.colname

(character) The name of the column containing air temperature.

Value

(dataframe) Dataframe of parameter values by the index used to fit them.

Details

Model parameters are fit using the R package brms.

Rhat (Potential Scale Reduction Factor): Indicates how well the different Markov chains in your analysis have converged to the same posterior distribution. Ideally, Rhat should be close to 1 for all parameters. A high Rhat value suggests potential convergence issues and the need to run the chains longer.

Bulk ESS (Effective Sample Size - Bulk): Estimates the effective number of independent samples from the central part of the posterior distribution.

Tail ESS (Effective Sample Size - Tail): Estimates the effective number of independent samples from the tails of the posterior distribution. Important for assessing the reliability of quantile estimates (e.g., 95% confidence intervals).

Key points to remember: Aim for Rhat close to 1 and high values for both Bulk ESS and Tail ESS.

Examples

# Import flux tower data
tower.data <- read.csv(system.file("extdata", "AMF_US-Skr_BASE_HH_2-5_Formatted.csv",
                                   package = "CarbonExchangeParameters"))

# Fit curve parameters for each YearMon:
Example_TRC_PARMS_02 <- TRC_PARMS_02(data.frame = tower.data,
                                     iterations = 1000,
                                     priors.trc = brms::prior("normal(1, 5)",
                                                    nlpar = "r0", lb = 0, ub = 5) +
                                                  brms::prior("normal(0.07, 0.1)",
                                                    nlpar = "alpha", lb = 0, ub = 0.2) +
                                                  brms::prior("normal(0, 0.05)",
                                                    nlpar = "beta", lb = -0.1, ub = 0.1),
                                     idx.colname = 'YearMon',
                                     NEE.colname = 'NEE_PI',
                                     PAR.colname = 'SW_IN',
                                     TA.colname = 'TA_1_1_1')
#> [1] "GREAT JOB! your dataframe contains idx"
#> [1] "YIPEE! your dataframe contains nee"
#> [1] "Hooray! your dataframe contains PAR"
#> [1] "Hooray! your dataframe contains TA"
#>  Your dataframe looks good and you are now ready to start fitting models
#> [1] "2004-07"
#> Warning: Rows containing NAs were excluded from the model.
#> Error : CmdStan path has not been set yet. See ?set_cmdstan_path.
#> Error in TRC_PARMS_02(data.frame = tower.data, iterations = 1000, priors.trc = brms::prior("normal(1, 5)",     nlpar = "r0", lb = 0, ub = 5) + brms::prior("normal(0.07, 0.1)",     nlpar = "alpha", lb = 0, ub = 0.2) + brms::prior("normal(0, 0.05)",     nlpar = "beta", lb = -0.1, ub = 0.1), idx.colname = "YearMon",     NEE.colname = "NEE_PI", PAR.colname = "SW_IN", TA.colname = "TA_1_1_1"): object 'model.brms' not found