| Title: | Plant Stress Response Index Calculator - Softmax Method |
|---|---|
| Description: | Implements the softmax aggregation method for calculating Plant Stress Response Index (PSRI) from time-series germination data under environmental stressors including prions, xenobiotics, osmotic stress, heavy metals, and chemical contaminants. Provides zero-robust PSRI computation through adaptive softmax weighting of germination components (Maximum Stress-adjusted Germination, Maximum Rate of Germination, complementary Mean Time to Germination, and Radicle Vigor Score), eliminating the zero-collapse failure mode of the geometric mean approach implemented in 'PSRICalc'. Includes perplexity-based temperature parameter calibration and modular component functions for transparent germination analysis. Built on the methodological foundation of the Osmotic Stress Response Index (OSRI) framework developed by Walne et al. (2020) <doi:10.1002/agg2.20087>. Note: This package implements methodology currently under peer review. Please contact the author before publication using this approach. Development followed an iterative human-machine collaboration where all algorithmic design, statistical methodologies, and biological validation logic were conceptualized, tested, and iteratively refined by Richard A. Feiss through repeated cycles of running experimental data, evaluating analytical outputs, and selecting among candidate algorithms and approaches. AI systems (Anthropic Claude and OpenAI GPT) served as coding assistants and analytical sounding boards under continuous human direction. The selection of statistical methods, evaluation of biological plausibility, and all final methodology decisions were made by the human author. AI systems did not independently originate algorithms, statistical approaches, or scientific methodologies. |
| Authors: | Richard Feiss [aut, cre] (ORCID: <https://orcid.org/0009-0008-0409-6042>), University of Minnesota [cph] |
| Maintainer: | Richard Feiss <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-05-25 06:19:14 UTC |
| Source: | https://github.com/cran/PSRICalcSM |
Implements the softmax aggregation method for calculating Plant Stress Response Index (PSRI) from time-series germination data. Provides a zero-robust alternative to the geometric mean PSRI in PSRICalc.
The main function is compute_psri_sm, which computes the
softmax PSRI from germination count data. Component functions
(compute_msg, compute_mrg,
compute_cmtg, compute_rvs) are available
for modular analysis. Use calibrate_temperature for
data-driven temperature parameter selection.
Richard A. Feiss IV
Maintainer: Richard A. Feiss IV <[email protected]>
Walne, C.H., Gaudin, A., Henry, W.B., and Reddy, K.R. (2020). In vitro seed germination response of corn hybrids to osmotic stress conditions. Agrosystems, Geosciences & Environment, 3(1), e20087. doi:10.1002/agg2.20087
compute_psri_sm, calibrate_temperature
Selects the optimal temperature parameter for softmax PSRI aggregation using perplexity targeting. The temperature controls how sharply the softmax concentrates weight on the dominant component(s).
calibrate_temperature( component_profiles, target_perplexity = 2.0, T_range = c(0.01, 2.0), tolerance = 0.05 )calibrate_temperature( component_profiles, target_perplexity = 2.0, T_range = c(0.01, 2.0), tolerance = 0.05 )
component_profiles |
A list of numeric vectors, where each vector represents a set of PSRI component scores from representative replicates. |
target_perplexity |
Numeric. Target effective number of components. Default is 2.0. |
T_range |
Numeric vector of length 2. Search range for T.
Default is |
tolerance |
Numeric. Convergence tolerance. Default is 0.05. |
Perplexity measures effective components receiving meaningful weight:
A perplexity of 2.0 (default target, for 3 components) balances signal extraction with robustness. The calibration uses bisection search over the provided range.
A list with:
The calibrated temperature parameter.
Mean perplexity at the optimal T.
Per-profile perplexity values.
The specified target.
The search range used.
softmax_weights, compute_psri_sm
profiles <- list( corn_control = c(0.80, 0.90, 0.60), corn_treated = c(0.50, 0.40, 0.55), barley_control = c(0.35, 0.30, 0.45), barley_treated = c(0.20, 0.15, 0.50) ) cal <- calibrate_temperature(profiles) cal$optimal_T cal$mean_perplexityprofiles <- list( corn_control = c(0.80, 0.90, 0.60), corn_treated = c(0.50, 0.40, 0.55), barley_control = c(0.35, 0.30, 0.45), barley_treated = c(0.20, 0.15, 0.50) ) cal <- calibrate_temperature(profiles) cal$optimal_T cal$mean_perplexity
Calculates cMTG as the complement of the normalized time to 50%
germination, bounded in [0, 1].
compute_cmtg(germination_counts, timepoints, total_seeds)compute_cmtg(germination_counts, timepoints, total_seeds)
germination_counts |
Integer vector of cumulative germination counts at each timepoint. |
timepoints |
Numeric vector of observation times. |
total_seeds |
Integer. Total number of seeds in the replicate. |
where is the interpolated time at which 50% of the final
germination count is reached.
Numeric value in [0, 1]. Higher values indicate faster
germination.
compute_cmtg(c(20, 23, 25), timepoints = c(3, 5, 7), total_seeds = 25) compute_cmtg(c(2, 8, 20), timepoints = c(3, 5, 7), total_seeds = 25)compute_cmtg(c(20, 23, 25), timepoints = c(3, 5, 7), total_seeds = 25) compute_cmtg(c(2, 8, 20), timepoints = c(3, 5, 7), total_seeds = 25)
Calculates MRG as the scaled average germination rate across consecutive observation intervals.
compute_mrg(germination_counts, timepoints, total_seeds)compute_mrg(germination_counts, timepoints, total_seeds)
germination_counts |
Integer vector of cumulative germination counts at each timepoint. |
timepoints |
Numeric vector of observation times (e.g., days). Must
be the same length as |
total_seeds |
Integer. Total number of seeds in the replicate. |
Numeric value >= 0 representing the scaled germination rate. For a single timepoint, returns 0.1 (rate not computable).
compute_mrg(c(5, 15, 20), timepoints = c(3, 5, 7), total_seeds = 25) compute_mrg(c(10), timepoints = c(3), total_seeds = 25)compute_mrg(c(5, 15, 20), timepoints = c(3, 5, 7), total_seeds = 25) compute_mrg(c(10), timepoints = c(3), total_seeds = 25)
Calculates MSG as the maximum cumulative germination fraction across all observed timepoints.
compute_msg(germination_counts, total_seeds)compute_msg(germination_counts, total_seeds)
germination_counts |
Integer vector of cumulative germination counts at each timepoint. |
total_seeds |
Integer. Total number of seeds in the replicate. |
Numeric value in [0, 1] representing the maximum germination
fraction.
compute_msg(c(5, 15, 20), total_seeds = 25) compute_msg(c(0, 0, 0), total_seeds = 25)compute_msg(c(5, 15, 20), total_seeds = 25) compute_msg(c(0, 0, 0), total_seeds = 25)
Calculates the softmax-aggregated PSRI from time-series germination data. This method handles zero-value components gracefully through adaptive softmax reweighting, eliminating the zero-collapse failure mode of the geometric mean approach.
compute_psri_sm( germination_counts, timepoints, total_seeds, radicle_count = NULL, temperature = 0.13, return_components = FALSE )compute_psri_sm( germination_counts, timepoints, total_seeds, radicle_count = NULL, temperature = 0.13, return_components = FALSE )
germination_counts |
Integer vector of cumulative germination counts
at each timepoint. Must be non-decreasing and not exceed
|
timepoints |
Numeric vector of observation times (e.g., days).
Must be the same length as |
total_seeds |
Integer. Total number of seeds in the replicate. |
radicle_count |
Integer or |
temperature |
Numeric. Softmax temperature parameter. Default is
0.13, calibrated via perplexity targeting. See
|
return_components |
Logical. If |
The softmax PSRI aggregates germination components using weighted summation:
where (3-component) or
(4-component), and weights are:
When any component , its softmax weight approaches zero
and the remaining components absorb its weight, preserving information
rather than collapsing the index.
If return_components = FALSE (default), a single numeric
PSRI value.
If return_components = TRUE, a list with:
The softmax PSRI value.
Named numeric vector of component scores.
Named numeric vector of softmax weights.
The temperature parameter used.
Number of components used (3 or 4).
Walne, C.H., Gaudin, A., Henry, W.B., and Reddy, K.R. (2020). In vitro seed germination response of corn hybrids to osmotic stress conditions. Agrosystems, Geosciences & Environment, 3(1), e20087. doi:10.1002/agg2.20087
compute_msg, compute_mrg,
compute_cmtg, compute_rvs,
softmax_weights, calibrate_temperature
# Basic 3-component PSRI compute_psri_sm( germination_counts = c(5, 15, 20), timepoints = c(3, 5, 7), total_seeds = 25 ) # With radicle vigor (4-component) compute_psri_sm( germination_counts = c(5, 15, 20), timepoints = c(3, 5, 7), total_seeds = 25, radicle_count = 18 ) # Detailed output result <- compute_psri_sm( germination_counts = c(0, 0, 10), timepoints = c(3, 5, 7), total_seeds = 25, return_components = TRUE ) result$psri_sm # > 0 (softmax prevents collapse) result$components result$weights# Basic 3-component PSRI compute_psri_sm( germination_counts = c(5, 15, 20), timepoints = c(3, 5, 7), total_seeds = 25 ) # With radicle vigor (4-component) compute_psri_sm( germination_counts = c(5, 15, 20), timepoints = c(3, 5, 7), total_seeds = 25, radicle_count = 18 ) # Detailed output result <- compute_psri_sm( germination_counts = c(0, 0, 10), timepoints = c(3, 5, 7), total_seeds = 25, return_components = TRUE ) result$psri_sm # > 0 (softmax prevents collapse) result$components result$weights
Calculates a continuous radicle vigor score on a [0, 1] scale
from radicle emergence counts and total seed counts. Unlike the discrete
Radicle Vigor Factor (RVF) in PSRICalc, RVS varies continuously.
compute_rvs(radicle_count, total_seeds)compute_rvs(radicle_count, total_seeds)
radicle_count |
Integer. Number of seeds with visible radicle
emergence. If |
total_seeds |
Integer. Total number of seeds in the replicate. |
Numeric value in [0, 1].
compute_rvs(18, total_seeds = 25) compute_rvs(0, total_seeds = 25) compute_rvs(NULL, total_seeds = 25)compute_rvs(18, total_seeds = 25) compute_rvs(0, total_seeds = 25) compute_rvs(NULL, total_seeds = 25)
A synthetic dataset modeled after prion-exposed germination experiments with corn and barley. Contains time-series germination counts and radicle emergence data across multiple treatments and replicates.
data(germination_example)data(germination_example)
A data frame with 40 rows and 8 columns:
Character. Crop species ("corn" or
"barley").
Character. Treatment group.
Integer. Replicate number (1-4).
Integer. Total seeds per replicate (25).
Integer. Cumulative germination count at day 3.
Integer. Cumulative germination count at day 5.
Integer. Cumulative germination count at day 7.
Integer. Seeds with radicle emergence at day 7.
Synthetic data modeled after experiments at the Minnesota Center for Prion Research and Outreach (MNPRO), University of Minnesota.
data(germination_example) head(germination_example) # Compute PSRI_SM for first row row1 <- germination_example[1, ] compute_psri_sm( germination_counts = c(row1$day3, row1$day5, row1$day7), timepoints = c(3, 5, 7), total_seeds = row1$total_seeds, radicle_count = row1$radicle_count, return_components = TRUE )data(germination_example) head(germination_example) # Compute PSRI_SM for first row row1 <- germination_example[1, ] compute_psri_sm( germination_counts = c(row1$day3, row1$day5, row1$day7), timepoints = c(3, 5, 7), total_seeds = row1$total_seeds, radicle_count = row1$radicle_count, return_components = TRUE )
Calculates softmax weights for a vector of component scores using a temperature parameter that controls weight concentration.
softmax_weights(scores, temperature = 0.13)softmax_weights(scores, temperature = 0.13)
scores |
Numeric vector of component scores (at least 2 elements). |
temperature |
Numeric. Temperature parameter. Lower = sharper weights. Default is 0.13. |
Uses the log-sum-exp trick for numerical stability.
Numeric vector of weights summing to 1. Named if input is named.
calibrate_temperature, compute_psri_sm
softmax_weights(c(MSG = 0.8, MRG = 1.0, cMTG = 0.6)) softmax_weights(c(MSG = 0.8, MRG = 0.0, cMTG = 0.7)) softmax_weights(c(0.8, 0.5, 0.3), temperature = 1.0)softmax_weights(c(MSG = 0.8, MRG = 1.0, cMTG = 0.6)) softmax_weights(c(MSG = 0.8, MRG = 0.0, cMTG = 0.7)) softmax_weights(c(0.8, 0.5, 0.3), temperature = 1.0)