get_basis: Get Basis Function Values for Flexible Hazard Specifications

View source: R/model_helper_functions.R

get_basisR Documentation

Get Basis Function Values for Flexible Hazard Specifications

Description

Get Basis Function Values for Flexible Hazard Specifications

Usage

get_basis(x, knots, hazard, deriv = FALSE, flexsurv_compatible = FALSE)

Arguments

x

Numeric vector of event times (e.g., y1 or y2) at which to generate basis function values.

knots

Increasing vector of integers corresponding to the knots used in the desired spline or piecewise specification. Often an element of list generated from get_default_knots_list.

hazard

String specifying the form of the baseline hazard.

deriv

Boolean for whether returned values should be from derivatives of basis functions if TRUE, or original basis functions if FALSE.

flexsurv_compatible

For Royston-Parmar basis, boolean for whether returned values should be untransformed, as in flexsurv package, if TRUE, or whether they should be transformed to remove correlation, as in ns package otherwise.

Value

A matrix with each row corresponding to an element of the input, and each column giving the corresponding basis function value.


harrisonreeder/SemiCompRisksPen documentation built on Dec. 13, 2024, 5:30 a.m.