Title: Nonlinear Least Squares Models for Photosynthetic Light Response
Version: 1.0.6
Description: Provides functions for modeling, comparing, and visualizing photosynthetic light response curves using established mechanistic and empirical models like the rectangular hyperbola Michaelis-Menton based models ((eq1 (Baly (1935) <doi:10.1098/rspb.1935.0026>)) (eq2 (Kaipiainenn (2009) <doi:10.1134/S1021443709040025>)) (eq3 (Smith (1936) <doi:10.1073/pnas.22.8.504>))), hyperbolic tangent based models ((eq4 (Jassby & Platt (1976) <doi:10.4319/LO.1976.21.4.0540>)) (eq5 (Abe et al. (2009) <doi:10.1111/j.1444-2906.2008.01619.x>))), the non-rectangular hyperbola model (eq6 (Prioul & Chartier (1977) <doi:10.1093/oxfordjournals.aob.a085354>)), exponential based models ((eq8 (Webb et al. (1974) <doi:10.1007/BF00345747>)), (eq9 (Prado & de Moraes (1997) <doi:10.1007/BF02982542>))), and finally the Ye model (eq11 (Ye (2007) <doi:10.1007/s11099-007-0110-5>)). Each of these nonlinear least squares models are commonly used to express photosynthetic response under changing light conditions and has been well supported in the literature, but distinctions in each mathematical model represent moderately different assumptions about physiology and trait relationships which ultimately produce different calculated functional trait values. These models were all thoughtfully discussed and curated by Lobo et al. (2013) <doi:10.1007/s11099-013-0045-y> to express the importance of selecting an appropriate model for analysis, and methods were established in Davis et al. (in review) to evaluate the impact of analytical choice in phylogenetic analysis of the function-valued traits. Gas exchange data on 28 wild sunflower species from Davis et al.are included as an example data set here.
Maintainer: Rebekah Davis <rebekah.davis.evoecophys@gmail.com>
Depends: R (≥ 4.2), dplyr (≥ 1.1.4), tidyr (≥ 1.3.1), stats (≥ 4.2.3), graphics (≥ 4.2.3)
LazyData: true
URL: https://github.com/heliotropichuman/photosynthesisLRC
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-02-24 19:54:01 UTC; rebek
Author: Rebekah Davis [aut, cre], Eric Goolsby [aut]
Repository: CRAN
Date/Publication: 2025-02-25 17:50:07 UTC

Calculate Photosynthetic Rates Using a Nonlinear Model EQ1

Description

Uses the nonlinear least squares Michaelis-Menton model equation 1 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~((phi_I0)(PARi)(Pgmax))/(phi_I0*PARi+Pgmax))-Rd The function will return predicted values, calculated quantities, or both.

Usage

eq1(pars = c(Pgmax = 19.5,phi_I0 = .0899,Rd = 1.8),
     data,
     PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
     return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax = 19.5, phi_I0 = 0.0899, and Rd = 1.8. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. These values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the measured photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, phi_I0, and Rd by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Baly, E.C.C. 1935 The kinetics of photosynthesis. Proc. R. Soc. Lond. B. 117: 218-239.

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq1(pars = c(Pgmax = 20, phi_I0 = 0.09, Rd = 2),
                       PARi = c(0, 100, 200, 400, 800), return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate
    # linear parameters
    result <- eq1(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq1(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ11

Description

Uses the nonlinear least squares Ye model equation 11 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~phi_I0_Icomp((1-beta(PARi))/(1+gamma(PARi)))(PARi-Icomp) The function will return predicted values, calculated quantities, or both.

Usage

eq11(pars = c(phi_I0_Icomp = .0756, beta = .0000432, gamma = .0039, Icomp = 22.6),
     data,
     PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
     return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are phi_I0_Icomp = .0756, beta = .0000432, gamma = .0039, Icomp = 22.6. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. The empirical values beta and gamma range between 0 and 1, and are not explicitly described by Ye (2007) but are independent coefficients of I implemented to incorporate a more dynamic response to light. All of these values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters phi_I0_Icomp, Icomp, and empirical parameters beta and gamma by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Ye, Z.-P. 2007 A new model for relationship between irradiance and the rate of photosynthesis in *Oryza sativa*. Photosynthetica 45: 637-640.

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    data(sunflowers)
    example_data <- sunflowers |> filter(SampleID==SampleID[1])
    # Predict photosynthetic rates given the parameters
    predicted_values <- eq11(return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate linear parameters
    result <- eq11(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq11(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ2

Description

Uses the nonlinear least squares Michaelis-Menton model equation 2 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~((Pgmax*PARi)/(PARi+I50))-Rd The function will return predicted values, calculated quantities, or both.

Usage

eq2(pars = c(Pgmax = 19.5,I50 = 216.4,Rd = 1.8),
    data,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax = 19.5,I50 = 216.4, and Rd = 1.8. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. These values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, assimilation at half the maximum assimilation rate (I50), and Rd by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Kaipiainen, E.L. 2009 Parameters of photosynthesis light curve in *Salix dasyclados* and their changes during the growth season. Russ. J. Plant Physiol. 56: 445-453

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

# Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq2(pars = c(Pgmax = 20, I50 = 216.4, Rd = 2),
                       PARi = c(0, 100, 200, 400, 800), return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate
    # linear parameters
    result <- eq2(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq2(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ3

Description

Uses the nonlinear least squares Michaelis-Menton model equation 3 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~((phi_I0)(PARi)(Pgmax))/(((Pgmax^2)+(phi_I0^2)*(PARi^2))^0.5)-Rd The function will return predicted values, calculated quantities, or both.

Usage

eq3(pars = c(Pgmax = 19.5,phi_I0 = .0493,Rd = 1.8),
    data,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax = 19.5, phi_I0 = .0493, and Rd = 1.8. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. These values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, phi_I0, and Rd by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Smith, E. L. 1936 Photosynthesis in relation to light and carbon dioxide. PNAS 22: 504-511.

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq3(pars = c(Pgmax = 20, phi_I0 = .0493, Rd = 2),
                       PARi = c(0, 100, 200, 400, 800), return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate
    # linear parameters
    result <- eq3(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq3(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ4

Description

Uses the nonlinear least squares hyperbolic tangent model equation 4 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~Pgmax*tanh((phi_I0)PARi/Pgmax)-Rd The function will return predicted values, calculated quantities, or both.

Usage

eq4(pars = c(Pgmax = 19.5,phi_I0 = .0493,Rd = 1.8),
    data,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax = 19.5, phi_I0 = 0.0493, and Rd = 1.8. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. These values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return.Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, phi_I0, and Rd by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Abe, M., K. Yokota, A. Kurashima, M. Maegawa 2009 High water temperature tolerance in photosynthetic activity of *Zostera japonica* Ascherson and Graebner seedlings from Ago Bay, Mio Prefecture, central Japan. – Fish. Sci. 75: 1117-1123

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq4(pars = c(Pgmax = 20, phi_I0 = 0.09, Rd = 2),
                       PARi = c(0, 100, 200, 400, 800), return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate
    # linear parameters
    result <- eq4(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq4(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ5

Description

Uses the nonlinear least squares hyperbolic tangent model equation 5 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~Pgmax*tanh(PARi/Isat)-Rd The function will return predicted values, calculated quantities, or both.

Usage

eq5(pars = c(Pgmax = 15.5,Isat = 359.2,Rd = .9),
    data,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax = 15.5, Isat = 359.2, and Rd = 0.9. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. These values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, Isat, and Rd by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Jassby, A.D. and T. Platt 1976 Mathematical formulation of the relationship between photosynthesis and light for phytoplankton. Limnol. Oceanogr. 21: 540-547.

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq5(pars = c(Pgmax = 15.5, Isat = 360, Rd = .9),
                       PARi = c(0, 100, 200, 400, 800), return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate linear parameters
    result <- eq5(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq5(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ6

Description

Uses the nonlinear least squares non-rectangular hyperbola model equation 6 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~((((PARi)(phi_I0)+Pgmax)-((((phi_I0)(PARi)+Pgmax)^2)- (4(phi_I0)(Pgmax)(theta)(PARi))^0.5))/(2*theta))-exp(Rd) The function will return predicted values, calculated quantities, or both.

Usage

eq6(pars = c(Pgmax = 15.5,phi_I0 = .0493,theta = .433,Rd = .9),
    data,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax= 15.5, phi_I0= 0.0493, theta= 0.433, and Rd= 0.9. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. The empirical coefficient theta falls between 0 and 1, and represents the various resistances faced by CO2 as it diffuses through the leaf mesophyll and is eventually bound by carboxylation enzymes. All of these values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, phi_I0, and Rd by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Prioul, J. L., P. Chartier 1977 Partitioning of transfer and carboxylation components of intracellular resistance to photosynthetic CO2 fixation: A critical analysis of the methods used. Ann. Bot. 41: 789-800.

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq6(pars = c(Pgmax = 15.5, phi_I0 = .0493,
      theta = .433,Rd = .9),PARi = c(0, 100, 200, 400, 800),
      return= "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate linear parameters
    result <- eq6(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq6(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ8

Description

Uses the nonlinear least squares exponential model equation 8 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~(Pgmax*(1-exp(-phi_I0(PARi)/Pgmax)))-Rd The function will return predicted values, calculated quantities or both.

Usage

eq8(pars = c(Pgmax = 16.2,phi_I0 = .0597,Rd = 1.3),
    data,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax = 16.2, phi_I0 = .0597, and Rd = 1.3. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. These values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, phi_I0, and Rd by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Webb, W. L., M. Newton, D. Starr 1974 Carbon dioxide exchange of *Alnus rubra*: a mathematical model. Oecologia 17: 281- 291.

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq8(pars = c(Pgmax = 16, phi_I0 = .0597, Rd = 1.3),
                       PARi = c(0, 100, 200, 400, 800), return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate linear parameters
    result <- eq8(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq8(data = example_data, return = "calc")
    print(calculated_quantities)


Calculate Photosynthetic Rates Using a Nonlinear Model EQ9

Description

Uses the nonlinear least squares exponential model equation 9 from Lobo et. al (2013) to transform measured photosynthetic data into a smoothed function-valued trait with the following function: A~Pgmax((1-exp(-k*(PARi-Icomp))))-Rd The function will return predicted values, calculated quantities, or both.

Usage

eq9(pars = c(Pgmax = 22,Icomp = 10,k = .0015,Rd = .1),
    data,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    return = c("predict","calc","all")[1])

Arguments

pars

A named vector of parameters. Default values are Pgmax = 22, Icomp = 10, k = .0015, and Rd = .1. These serve as initial starting parameters for the function to rapidly assess your data through an iterative process. The coefficient k relates the photosynthetic capacity of a plant to the specific leaf mass, and may increase with an increasing potential for photosynthetic activity per unit leaf mass. All initial parameter values may be changed to fall within the minimum and maximum parameter values of your study system.

data

A data frame containing the experimental data with at least two columns: 'PARi' for the incident light and 'A' for the photosynthetic rate.

PARi

A numeric vector of incident light values. Defaults to a sequence from 0 to 2500.

return

Character string indicating what the function should return. Options are "predict" for predicted values, "calc" for calculated quantities, and "all" for both. Defaults to "predict".

Details

The function uses the provided data to estimate the parameters Pgmax, Icomp, Rd, and k by minimizing the squared differences between observed and predicted photosynthetic rates. The model is then used to calculate a range of derived functional trait quantities such as the dark respiration rate (Rd), light compensation point (Icomp), maximum photosynthetic rate (Pmax), and curve derived parameters (Ix) among other calculated quantities.

Value

Depending on the 'return' argument, the function returns:

References

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin, W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz 2013 Fitting net photosynthetic light-response curves with Microsoft Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Prado, C. H. B. A., J. P. A. P. V. de Moraes 1997 Photosynthetic capacity and specific leaf mass in twenty woody species of cerrado vegetation under field conditions. Photosynthetica 33: 103-112.

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of photosynthetic light response curve: approaches and pitfalls in phylogenetic modeling of a function-valued trait. IJPS, in review

Examples

    # Example dataset
    example_data <- data.frame(
      PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
      A = c(1.8, 4.2, 7.5, 12.8, 16.2, 18.5, 19.3, 19.4, 19.5)
    )

    # Predict photosynthetic rates given the parameters
    predicted_values <- eq9(pars= c(Pgmax = 20,Icomp = 20,k = .0015,Rd = .2),
                       PARi = c(0, 100, 200, 400, 800), return = "predict")
    print(predicted_values)

    # Use experimental data to predict photosynthetic rates and estimate linear parameters
    result <- eq9(data = example_data, return = "all")
    print(result$calc)  # View calculated quantities
    print(result$fit)   # View fit statistics and optimized parameters

    # Get calculated quantities directly
    calculated_quantities <- eq9(data = example_data, return = "calc")
    print(calculated_quantities)


Array of Results from all NLS Models eq1-eq11

Description

This function generates an array of results from the NLS models presented in Lobo et al. (2013) and Davis et al. (2024). The array includes all calculated values/model parameters for each NLS model (eq), predicted values of the NLS curve, and goodness of fit statistics - mean squared error (MSE) and r2 values- for each predicted curve and calculated value.

Usage

nls_results(
    data,
    species_col,
    sample_col,
    A_col,
    specs = NULL,
    dat_wide = NULL,
    PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500),
    PARi_fine = seq(0,6000,by = .1),
    eqs = paste("eq", c(1, 2, 3, 4, 5, 6, 8, 9, 11), sep = ""),
    par_names = c("Pgmax", "Pmax", "phi_I0", "phi_I0_Icomp", "phi_Icomp",
                   "phi_Icomp_200", "Rd", "Icomp", "Isat", "Isat_25",
                   "Isat_50", "Isat_75", "Isat_85", "Isat_90", "Isat_95",
                   "I5", "I10", "I15", "I25", "I50", "I75", "I85", "I90",
                   "I95", "Imax", "Imax_obs", "P_Imax",
                   "beta", "gamma", "theta", "k"))

Arguments

data

A data frame of measured input data with a column for each unique plant observed, a column to indicate a common identifier among each unique observation a column of light intensities at measured PARi values, and a column for measured measured carbon assimilation values.

species_col

Identify the column in your data set for the Species name, or the common identifier for each sample (Ex. H.Debilis)

sample_col

Identify the column in your data set with the Sample ID, or the unique identifier for each observation (Ex. H.Debilis_2_Oct1).

A_col

Identify the column in your data set corresponding to the measured carbon assimilation value (A).

specs

A character or factor vector to subset individual identifiers, defaults to all unique samples in the data set.

dat_wide

A wide-format data frame used to extract observed PARi and A values for each Species and Sample taken, defaults to transform dat_wide from data automatically.

PARi

A numeric vector of PARi values in which carbon assimilation was measured. Defaults to c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500).

PARi_fine

A finer numeric vector of PARi values for estimating response across a continuous light range, defaults to seq(0,6000,by = .1) for fine scale predictions.

eqs

A character vector of equation names to be fitted. Defaults to the 9 equations programmed in this package: (eq1, eq2, eq3, eq4, eq5, eq6, eq8, eq9, eq11).

par_names

A character or factor vector of parameters calculated from the NLS models to include in the array of results. Defaults to parameters calculated from all 9 models in this package unless otherwise specified.

Details

The function fits each equation from the eqs list to the subset of data corresponding to each unique sample. It then returns calculated parameters, predicted values, and observed PARi values for the given individual(s). The results are stored in an array, and the goodness-of-fit metrics (r2 and mse) are saved in separate matrices.

Value

A list containing the following elements:

res

An array of results. The array dimensions are: number of photosynthetic models (eq) tested x (number of parameters + 2 * length(PARi)) x length(inds).

fitted_curves

A list of fitted curves for each equation and individual.

r2

A matrix of r2 values for each individual and equation.

mse

A matrix of mse values for each individual and equation.

References

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of
photosynthetic light response curve: approaches and pitfalls in
phylogenetic modeling of a function-valued trait. IJPS, in review

Lobo, F. de A., M. P. de Barros, H. J. Dalmagro,  .C. Dalmolin,
W. E. Pereira, É.C. de Souza, G. L. Vourlitis and C. E. Rodriguez Ortiz
2013 Fitting net photosynthetic light-response curves with Microsoft
Excel – a critical look at the models. Photosynthetica 51 (3): 445-456.

Examples

# Example dataset
data(sunflowers)
data <- sunflowers |>filter(SampleID==SampleID)

# Specify arguments
PARi = c(0, 50, 100, 250, 500, 1000, 1500, 2000, 2500)
PARifine <- seq(0, 1500, by = 1)
par_names <- c("Pmax", "Icomp", "phi_Icomp", "Rd", "I15, I25", "I85", "I95")
dat_wide <- data %>% pivot_wider(id_cols = c(Species,SampleID),
                                 names_from = PARi, names_prefix = "PARi_",values_from = A)
subset <- first_five <- unique(data$SampleID[1:43])

# Process light response curve data for all model equations
my_results <- nls_results(data = data, species_col = "Species",
                          sample_col = "SampleID", A_col = "A", PARi_fine = PARifine,
                         specs = subset, dat_wide = dat_wide, par_names = par_names)

# Access the results array
result_array <- my_results$res
# Access the fitted curves
fitted_curves <- my_results$fitted_curves
# Access r2 and mse matrices
r2_matrix <- my_results$r2
mse_matrix <- my_results$mse


Plot Photosynthetic Models

Description

This function plots the fit of a given photosynthetic light response equation for all or select species in a data set. This base R plot includes the SampleID and the equation number in the title.

Usage

plot_eq(eqX,
       eq_name,
       i,
       data,
       title,
       species_subset = NULL,
       A_col)

Arguments

eqX

A function representing the photosynthetic light response equation (e.g., eq1, eq2).

eq_name

A character string representing the name of the equation, to be included in the plot title.

i

An integer specifying the index of the species in the inds vector.

data

A data frame containing the experimental data with at least two columns: PARi for the incident light and A for the measured photosynthetic rate.

title

An optional character string specifying the title of the plot (defaults to title in the format i SampleID Equation X.

species_subset

An optional vector of species names from inds to be plotted. If NULL, all species in inds will be used (default is NULL).

A_col

Allows data column with assimilation measurements to be specified and defaults to A.

Details

This function takes the equation of photosynthetic light response models and fits it to the data for a given species. It then plots the observed and predicted values, highlighting specific points on the curve (such as the model curve paramaters I15, I25, I85, and I95), where the number (X) is the carbon assimilation rate at X percent of the maximum assimilation in the measured data. The equation name is included in the plot title, and an optional subset of species can be selected for plotting. The function also calculates various fit statistics and adds both the original and reconstructed predictions as curves to the plot.

Value

A plot of the measured data points for the selected species (open points), with curve parameters from the fitted equation (black points), the NLS curve (red line), and the model fit (dashed blue line). It will also return the reconstructed model fit as a list.

Examples


# Example with eq1 and all species
# Please note, it may take more than 10 seconds to plot graphs with all species

data(sunflowers)
my_observed_data <- sunflowers
inds <- unique(my_observed_data$SampleID)

# Example with eq1 and all species

for (i in 1:length(inds)) {
   plot_eq(eq1, "eq1", i, data = my_observed_data)
 }

# Example of using the function for all equations with all species or a subset of species

LRCdata <- sunflowers |> filter(SampleID==SampleID)
highlight <- c("Agrestis_1_29/10/19", "Atrorubens_3_11/11/2019", "Divaricatus_2_29/10/19",
"Gracilentus_2_3/11/2019", "Gracilentus_5_5/11/2019", "Silphiodias_1_3/11/2019")
par(mfrow = c(3, 3))

for (i in 1:length(highlight)) {
  # Add equation names to the function calls
  plot_eq(eq1, "eq1", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq2, "eq2", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq3, "eq3", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq4, "eq4", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq5, "eq5", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq6, "eq6", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq8, "eq8", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq9, "eq9", i, data = LRCdata, species_subset = highlight)
  plot_eq(eq11, "eq11", i, data = LRCdata, species_subset = highlight)
  dev.off()
    }
    oldpar<- par(mfrow = c(1,2))
    par(oldpar)
    on.exit()



Light Response Curves from a Common Garden Experiment in Helianthus

Description

This dataset contains photosynthetic light response curves for 28 sunflower species in the genus Helianthus. The data was gathered in a common garden to evaluate phylogenetic change to photosynthetic response across as a function-valued trait (Davis et al. 2024).

Usage

sunflowers

Format

A data frame with 666 rows and 22 variables:

SampleID

A unique identifier for each sample, a combination of Species_Replicate_Date (character).

Species

The species name of the sunflower (character).

Replicate

The number assigned to indicate repeated individuals of the same species (numeric).

Date

The day at which the measurement was taken (character, DD:MM:YY format).

Time

The time at which the measurement was taken (character, HH:MM format).

CO2r

The TARGAS-1 reference CO2 (µmol CO2 mol^-1, numeric).

CO2a

The TARGAS-1 ambient CO2 reading (µmol CO2 mol^-1, numeric).

H2Or

Humidity reading measured by the TARGAS-1 reference during the time of measurement (mb, numeric).

H2Oa

Humidity reading measured in the air by the TARGAS-1 during the time of measurement (mb, numeric).

atm

Atmospheric pressured at the measurement (mb, numeric).

Flow.Supply

Air flow moving through the TARGAS-1 (cc/min, numeric).

Flow.sample

Air flow passing back into the TARGAS-1 from the PLC (cc/min, numeric).

PARe

Photosynthetically Active Radiation levels in the environment, measured at the PLC (µmol m^-2 s^-1, numeric).

PARi

Photosynthetically Active Radiation levels on the leaf (µmol m^-2 s^-1, numeric).

Tleaf

Leaf temperature in the PLC during the measurement (degrees Celsius, numeric).

Trans

Transpiration rate (mmol H2O m^-2 s^-1, numeric).

VPD

Vapor pressure deficit during the measurement (mb, numeric).

gs

Stomatal conductance (mmol H2O m^-2 s^-1, numeric).

A

Photosynthetic rate (µmol CO2 m^-2 s^-1, numeric).

Ci

Concentration of leaf internal CO2 (µmol CO2 mol^-1, numeric).

Area

The area of the leaf measured (cm^2, numeric).

Details

All plants were grown in fertilized 1 gallon pots during August- December 2019 at the University of Central Florida's Transgenic Greenhouse. Measurements were taken for two hours before and after solar noon with the Portable Photosynthetic Systems (PPS) TARGAS-1 on the most recently expanded full leaf during the juvenile stage just before flowering (V4-6) (NDSU Stages of Sunflower Development). The TARGAS-1 portable leaf cuvette (PLC) was clamped on the leaf perpendicular to the leaf margin, and photosynthetic measurements were taken at approximately 420 ppm CO2, ambient humidity, and 500 ppm flow. Photosynthetic responses were recorded at 9 levels with an acclimation of 2-5 minutes at PARi 0, PARi 50, PARi 100, PARi 250, PARi 500, PARi 1000, PARi 2000, PARi 2500 (µmol s/m2). The data was manually curated such that duplicate instantaneous assimilation points were removed and only one single representative sample from each replicate was used in analysis. The data set includes the Sample name, the species name, the replicate number, and 19 other variables obtained from the TARGAS-1 measurement.

Author(s)

Rebekah Davis, University of Central Florida

Source

Data collected by Rebekah Davis at the University of Central Florida.

References

Davis, R.E., C. M. Mason, E. W. Goolsby 2024 Comparative evolution of
photosynthetic light response curve: approaches and pitfalls in
phylogenetic modeling of a function-valued trait. IJPS, in review

Kandel, H., A. A. Schneiter, J. F. Miller, D. R. Berglund 2019 Stages of
Sunflower Development. North Dakota State University Extension
(https://www.ndsu.edu/agriculture/extension/publications/stages-
sunflower-development)

Examples

# Load the dataset
data(sunflowers)

# View the first few rows
head(sunflowers)

# Summary statistics for photosynthetic rate (A)
summary(sunflowers$A)

# Plot the photosynthetic rate vs. PARi
plot(sunflowers$PARi, sunflowers$A,
     xlab = "PAR (µmol m^-2 s^-1)",
     ylab = "Photosynthetic rate (µmol CO2 m^-2 s^-1)")