time_basisFun_df: Construct basis functions

View source: R/time_basisFun_df.R

time_basisFun_dfR Documentation

Construct basis functions

Description

Given a numeric time vector, construct a set of overlapping basis functions.

Usage

time_basisFun_df(timeVar, basisDens, basis_calc_fun = "gaussian")

Arguments

timeVar

Vector of time (e.g., trial number)

basisDens

Space between basis function peaks (equal if gaussian; approximate if bspline)

basis_calc_fun

The function with which to calculate the basis functions. Either bspline (relies on fda package) or gaussian.

Details

Gaussian bases are equally-spaced with respect to time. Together, entered as linear predictors into a typical regression model, each basis function acts as a "bump" offset from the overall model fit, thereby approximating arbitrary nonlinear changes over time.

The function defining the bases defaults to Gaussian with a half-width half-max equal to the distance between the basis centers, that is, each basis function uses approximately dnorm(time_vector,basis_center,basis_width / .5875). The bases are then normalized so that each timepoint's bases sum to 1.

B spline bases are also implemented (and are more conventional), relying on the fda package.


akcochrane/TEfits documentation built on June 12, 2025, 11:10 a.m.