make_matrices function

Build the design matrix and the penalty matrix for models involving penalised splines based on a formula and a data set

Build the design matrix and the penalty matrix for models involving penalised splines based on a formula and a data set

make_matrices(formula, data, knots = NULL)

Arguments

  • formula: right side of a formula as used in mgcv

  • data: data frame containing the variables in the formula

  • knots: optional list containing user specified knot values to be used for basis construction

    For most bases the user simply supplies the knots to be used, which must match up with the k value supplied (note that the number of knots is not always just k). See mgcv documentation for more details.

Returns

a list containing the design matrix Z, the penalty matrix S, the formula, the data and the knots

Examples

modmat = make_matrices(~ s(x), data.frame(x = 1:10))