Mixed_Spline_Model: Create matrices for the mixed model with splines

Description Usage Arguments Details Value References See Also Examples

Description

This function creates the two matrices for the fixed and random components of the mixed model. The matrix corresponding to the random components is a made from a spline basis.

Usage

1
Mixed_Spline_Model(x, knots, P = 1, spline = "Radial", r = 1, theta = 2)

Arguments

x

A vector of a predictor variable.

knots

A vector containing the knots for the basis.

P

OPTIONAL: A value specifying the degree of the polynomial.

spline

OPTIONAL: The basis to be used for the spline model. This can either be "Truncated Poly" for the truncated polynomial basis function or "Radial" for the radial basis function.

r

OPTIONAL: A value for the degree of the radial basis function. Not used in the truncated polynomial basis function.

theta

OPTIONAL: A value for the range of the radial basis function. Not used in the truncated polynomial basis function.

Details

The truncated polynomial basis function is of the form: (x - k)+^P. The radial basis function is of the form exp(-abs(x - k)^r / theta).#' Set P = 1 for linear trend.

Value

Z_p is a basis matrix dimensions = n x k where n equals the length of x and k equals the length of int_knots. This matrix is used for the random part of the mixed model. X_p is the matrix with dimensions n x P. The columns are: the intercept, x, x^2, ..., x^P. This models the mean function of the data. X_p is used for the fixed part of the mixed model.

References

\insertRef

wand2003unequalgroupoutlier

See Also

radial_basis_fun and piecewise_poly_basis_fun

Examples

1
2
3
4
knots <- seq(1, 1000, len = 40)
x <- c(1:1000)
y <- rnorm(1000, x, 25)
model <- Mixed_Spline_Model(x, knots, P = 1)

cshannum/unequalgroupoutlier documentation built on May 13, 2019, 11:10 a.m.