poly_term: Term for Orthogonal Polynomials

View source: R/expansions.R

poly_termR Documentation

Term for Orthogonal Polynomials

Description

Term for Orthogonal Polynomials

Usage

poly_term(
  x = numeric(),
  degree = 1,
  coefs = NULL,
  raw = FALSE,
  intercept = FALSE,
  use_log = FALSE
)

Arguments

x, degree, coefs, raw

same as poly.

intercept

TRUE if there should be an intercept.

use_log

TRUE if the polynomials should be in the log of the argument.

Value

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

See Also

bs_term, ns_term, weighted_term, and stacked_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_basis <- poly_term(vals,degree = 3, raw = TRUE)
# evaluate spline basis at 0.5
spline_basis$eval(0.5)
# evaluate first derivative of spline basis at 0.5
spline_basis$eval(0.5, der = 1)

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