stacked_term: Term for a Basis Matrix for of Different Types of Terms

View source: R/expansions.R

stacked_termR Documentation

Term for a Basis Matrix for of Different Types of Terms

Description

Creates a basis matrix consisting of different types of terms. E.g. to create a varying-coefficient.

Usage

stacked_term(...)

Arguments

...

term objects from the package.

Value

A list with an element called eval to evaluate the basis. See VAJointSurv-terms.

See Also

poly_term, bs_term, ns_term, and weighted_term.

Examples

vals <- c(0.41, 0.29, 0.44, 0.1, 0.18, 0.65, 0.29, 0.85, 0.36, 0.47)

spline_basis1 <- ns_term(vals, df = 3)
spline_basis2 <- bs_term(vals, df = 3)

# create stacked term from two spline bases
stacked_basis <- stacked_term(spline_basis1, spline_basis2)

# evaluate stacked basis at 0.5
stacked_basis$eval(0.5)
# evaluate first derivative of stacked basis at 0.5
stacked_basis$eval(0.5, der = 1)

VAJointSurv documentation built on Aug. 14, 2022, 9:05 a.m.