DesignFormula: Internal function extracting design matrices from formulas in...

View source: R/DesignFormula.R

DesignFormulaR Documentation

Internal function extracting design matrices from formulas in the tvcure function and computing penalty related matrices

Description

Internal function extracting design matrices from formulas in the tvcure function and computing penalty related matrices.

Usage

DesignFormula(
  formula,
  data,
  K = 10,
  pen.order = 2,
  knots.x = NULL,
  n = NULL,
  nointercept = FALSE
)

Arguments

formula

A formula describing the fixed effects and the additive terms in a regression model.

data

A dataframe containing the data.

K

Number of B-splines to describe an additive term.

pen.order

Desired penalty order for the spline parameters in the additive terms.

knots.x

(Optional) list of length J with the knots associated to each of the J additive terms. Automatically specified from the data by default.

n

Number of units (Default: number of rows in the design matrix constructed from the formula and the data frame).

nointercept

Logical indicating if the intercept should be set to zero (Default: FALSE).

Value

A list with

  • J : number of additive terms.

  • K : number of B-splines in a basis used to estimate an additive term.

  • Z : (n x nfixed) design matrix with fixed effects (including a first column of 1 if nointercept is FALSE).

  • X : (n x J) design matrix with the covariates involved in the additive terms.

  • Xcal : Z column-stacked with the J centered B-spline bases to yield the full design matrix (with column labels).

  • nfixed : number of fixed effect regression parameters.

If additive terms are specified in the formula, the following elements also appear:

  • Bcal : column-stacked matrix with the J centered B-spline bases.

  • Bx : list with J objects (one per additive term) including (B,Dd,Pd,K,cm).

  • Pd.x, Dd.x : penalty and difference penalty matrices applied on the spline parameters of an additive term.

  • knots.x : list of length J with the knots associated to each of the J additive terms.

  • pen.order : penalty order for the spline parameters in the additive terms.

  • additive.lab : labels for the columns in <Bcal> associated to the additive terms.

  • lambda.lab : labels for the penalty parameters.

  • has.ref : vector of J logicals indicating whether reference values were specified for a given additive term.

  • ref.values : specified reference values for the the J additive terms.

  • cm.values : list of length J with the values of the B-spline basis at the reference values specified (if any) for each of the additive terms.

Author(s)

Philippe Lambert p.lambert@uliege.be

References

Lambert, P. and Kreyenfeld, M. (2025). Time-varying exogenous covariates with frequently changing values in double additive cure survival model: an application to fertility. Journal of the Royal Statistical Society, Series A. <doi:10.1093/jrsssa/qnaf035>


tvcure documentation built on April 12, 2025, 1:58 a.m.