Skip to contents

Runs the main FDA workflow for one or more weather variables: creates subject-by-time matrices, computes smoothed group means, compares two groups with interval-wise permutation tests, and stores tidy summaries for plotting and feature extraction.

Usage

run_fda_analysis(
  data,
  id_col,
  time_col,
  group_col,
  value_cols,
  value_labels = NULL,
  alpha = 0.05,
  n_permutations = 1000,
  smooth_method = c("spline", "lowess", "none"),
  smooth_args = list(),
  time_grid = NULL,
  n_time_grid = 300,
  reference_group = NULL,
  comparison_group = NULL,
  quiet = TRUE,
  min_interval_length = 1
)

Arguments

data

A data frame in long format.

id_col

Subject identifier column.

time_col

Time column, such as relative day or days after planting.

group_col

Grouping column with exactly two groups.

value_cols

Weather variable columns to analyze.

value_labels

Optional named character vector or data frame with variable and label columns used for plot labels.

alpha

One or more significance levels used to extract intervals from the same set of corrected permutation p-values for each variable.

n_permutations

Number of permutations used by the interval-wise test.

smooth_method

Smoothing method used for group mean curves. One of "none", "lowess", or "spline".

smooth_args

Named list of extra arguments passed to the smoothing method.

time_grid

Optional grid for plotting smoothed group means. If NULL, a dense grid is created from the observed time range.

n_time_grid

Number of points in the dense plotting grid when time_grid = NULL.

reference_group

Optional reference group. If NULL, the first group level or first observed group is used.

comparison_group

Optional comparison group. If NULL, the other group is used.

quiet

Logical; if TRUE, suppresses routine console output emitted by fdatest::ITP2bspline().

min_interval_length

Minimum number of consecutive tested time points required for an interval to be retained. For daily series, this is the minimum number of consecutive days. Defaults to 1, which retains every run that crosses the corrected p-value threshold. This post-test filter does not alter the corrected p-values.

Value

A windcut_fda_analysis object with matrices, summaries, interval-test results, and tidy interval summaries.