Learn R Programming

lmeSplines (version 1.1.20)

approx.Z: Interpolating in Smoothing Spline Z-Matrix Columns

Description

Interpolates the Z-matrix for LME smoothing spline fits from one set of time covariate values to another using linear interpolation of each column of the Z-matrix, regarded as a function of time.

Usage

approx.Z(Z, oldtimes, newtimes)

Value

A matrix with the same number of columns as Z and rows corresponding to newtimes, containing the interpolated Z-matrix values. This can be used with smspline for fitting LME splines with random effects at different time points or as part of the newdata

argument in predict.lme for predictions at new points.

Arguments

Z

Z-matrix with rows corresponding to the sorted unique values of the time covariate (e.g., from smspline or smspline.v).

oldtimes

Numeric vector of original (sorted) time covariate values corresponding to the rows of Z.

newtimes

Numeric vector of new time covariate values to interpolate to.

Author

Rod Ball <rod.ball@scionresearch.com>

See Also

smspline, lme, predict.lme

Examples

Run this code
times1 <- 1:10
Zt1 <- smspline(~ times1)
times2 <- seq(1, 10, by = 0.1)
Zt2 <- approx.Z(Zt1, oldtimes = times1, newtimes = times2)

Run the code above in your browser using DataLab