% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/functional_dsp.R
\name{functional_contrast}
\alias{functional_contrast}
\title{Functional Contrast (Disease Suppression Profiles)}
\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{
\item{data}{A data frame containing disease progress observations, or an object of class \code{"functional_curves"}.}

\item{time}{Character string naming the time variable.}

\item{response}{Character string naming the response variable.}

\item{treatment}{Character string naming the treatment variable.}

\item{reference}{Character string specifying the reference treatment level. Default is \code{"Control"}.}

\item{group}{Optional character vector of grouping variables (e.g., \code{c("experiment", "location")}).}

\item{smooth}{Logical; if \code{TRUE}, the function could apply smoothing (currently placeholder).}

\item{grid}{Optional numeric vector of common time points for interpolation. If provided, curves are interpolated.}

\item{contrast}{Character specifying the contrast type. Currently \code{"difference"} is implemented.}

\item{keep_reference}{Logical; if \code{TRUE}, includes the reference treatment in the output (with DSP = 0). Default is \code{FALSE}.}

\item{...}{Additional arguments.}
}
\value{
An object of class \code{"functional_dsp"} (inheriting from \code{"tbl_df"}), containing:
\itemize{
\item grouping variables (if any)
\item treatment variable
\item time variable
\item \code{y_reference}: disease intensity of the reference
\item \code{y_treatment}: disease intensity of the treatment
\item \code{DSP}: the computed contrast
\item \code{contrast_type}: type of contrast used
\item \code{reference}: name of the reference treatment
}
}
\description{
Calculates 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: \deqn{DSP(t) = y_{control}(t) - y_{treatment}(t)}
where \eqn{y(t)} is the disease intensity at time \eqn{t}. The goal is to evaluate
the intensity, timing, and persistence of the fungicide protection.
}
\seealso{
\code{\link{functional_summary}}, \code{\link{plot_dsp}}
}
