create_bases: Generate bases function matrix

View source: R/create-bases.R

create_basesR Documentation

Generate bases function matrix

Description

The create_bases function generates a matrix of bases functions for modeling time. The bases function matrix include Fourier basis functions and polynomial basis functions.

Usage

create_bases(t, keep = NULL)

Arguments

t

A vector representing the timepoints for which basis functions are generated.

keep

(Optional) A vector specifying the indices of the basis functions to retain. If not provided, all generated basis functions are retained.

Details

The function constructs two types of basis functions: Fourier basis functions and polynomial basis functions. Fourier basis functions are constructed based on the maximum timepoint (max_t) and the input timepoints t. Polynomial basis functions are constructed with degrees ranging from 0.1 to 2, incrementing by 0.02.

Value

A list with the following components:

bases

A matrix containing the generated bases function.

selected_bases

A vector containing the indices of the selected basis functions after applying filter_nonzero_bases. If the keep argument is provided, filter_nonzero_bases is applied exclusively to the functions specified in keep.

See Also

filter_nonzero_bases

Examples

t <- seq(0, 10, by = 0.5)
bases <- create_bases(t)
selected_bases <- create_bases(t)
selected_bases[[1]]
selected_bases[[2]]

plsmmLasso documentation built on June 22, 2024, 9:35 a.m.