Skip to contents

Computes mean functional curves by group and, when exactly two groups are present, also returns the pointwise difference between those curves.

Usage

functional_group_summary(
  data,
  id_col,
  time_col,
  value_col,
  group_col,
  time_grid = NULL,
  method = c("none", "lowess", "spline"),
  smooth_args = list()
)

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.

value_col

Measured series column.

group_col

Grouping column, such as disease status.

time_grid

Optional grid where the summary curves are evaluated. If NULL, the sorted observed time values are used. Supplying a denser grid is useful when plotting smoothed curves as continuous functions.

method

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

smooth_args

Named list of extra arguments passed to the smoothing method. For "lowess", a common choice is list(f = 0.2). For "spline", typical choices include list(df = 12) or list(spar = 0.6).

Value

A list with grouped summary tables and, when two groups are present, pointwise difference tables. The returned object includes summary, difference, raw_summary, raw_difference, method, and smooth_args.