Skip to contents

Create distributed lag terms

Usage

distributed_lag_list(
  x,
  n_lag,
  lag_max,
  df,
  degree,
  internal_knots,
  boundary_knots,
  complete_basis,
  periodic,
  derivs,
  integral
)

Arguments

x

numeric vector to lag

n_lag

number of lag terms

lag_max

integer the maximum lag

df

Degree of freedom that equals to the column number of the returned matrix. One can specify df rather than knots, then the function chooses df - degree - as.integer(intercept) internal knots at suitable quantiles of x ignoring missing values and those x outside of the boundary. For periodic splines, df - as.integer(intercept) internal knots will be chosen at suitable quantiles of x relative to the beginning of the cyclic intervals they belong to (see Examples) and the number of internal knots must be greater or equal to the specified degree - 1. If internal knots are specified via knots, the specified df will be ignored.

degree

A nonnegative integer specifying the degree of the piecewise polynomial. The default value is 3 for cubic splines. Zero degree is allowed for piecewise constant basis functions.

internal_knots

location of internal knots

boundary_knots

location of boundary knots

complete_basis

logical intercept?

periodic

A logical value. If TRUE, the periodic splines will be returned. The default value is FALSE.

derivs

A nonnegative integer specifying the order of derivatives of splines basis function. The default value is 0.

integral

A logical value. If TRUE, the corresponding integrals of spline basis functions will be returned. The default value is FALSE. For periodic splines, the integral of each basis is integrated from the left boundary knot.

Value

List of distributed lags