
Functional Contrast (Disease Suppression Profiles)
Source:R/functional_dsp.R
functional_contrast.RdCalculates functional contrast curves (Disease Suppression Profiles - DSP) between a reference treatment (e.g., untreated control) and other fungicide treatments over time. The DSP is defined by default as: $$DSP(t) = y_{control}(t) - y_{treatment}(t)$$ where \(y(t)\) is the disease intensity at time \(t\). The goal is to evaluate the intensity, timing, and persistence of the fungicide protection.
Usage
functional_contrast(
data,
time = "time",
response = "response",
treatment = "treatment",
reference = "Control",
group = NULL,
smooth = FALSE,
grid = NULL,
contrast = c("difference", "relative"),
keep_reference = FALSE
)Arguments
- data
A data frame containing disease progress observations, or an object of class
"functional_curves".- time
Character string naming the time variable.
- response
Character string naming the response variable.
- treatment
Character string naming the treatment variable.
- reference
Character string specifying the reference treatment level. Default is
"Control".- group
Optional character vector of grouping variables (e.g.,
c("experiment", "location")).- smooth
Logical; if
TRUE, the function could apply smoothing (currently placeholder).- grid
Optional numeric vector of common time points for interpolation. If provided, curves are interpolated.
- contrast
Character specifying the contrast type. Currently
"difference"is implemented.- keep_reference
Logical; if
TRUE, includes the reference treatment in the output (with DSP = 0). Default isFALSE.
Value
An object of class "functional_dsp" (inheriting from "tbl_df"), containing:
grouping variables (if any)
treatment variable
time variable
y_reference: disease intensity of the referencey_treatment: disease intensity of the treatmentDSP: the computed contrastcontrast_type: type of contrast usedreference: name of the reference treatment