approx.Z: Interpolating in smoothing spline Z-matrix columns

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/lmeSplines.R

Description

Function to interpolate the Z-matrix for LME smoothing spline fits from one set of values of the time covariate to another.

Usage

1
approx.Z(Z, oldtimes, newtimes)

Arguments

Z

Z-matrix with rows corresponding to the sorted unique values of the time covariate

oldtimes

original (sorted) values for time covariate, corresponding to the rows of Z

newtimes

new (sorted) values for time covariate

Details

Uses linear interpolation of each column of the Z-matrix, regarded as a function of time, with the times given by oldtimes.

Value

A matrix corresponding to an interpolated spline matrix. Can be used with smspline() for fitting LME splines with random effects corresponding to a different set of values of the time covariate than those represented in the data, or as part of the ‘newdata’ argument prediction from an existing model, to obtain predictions at points not represented in the data using predict.lme().

Note

Linear interpolation works well here because the spline basis functions are approximately piecewise linear.

Author(s)

Rod Ball rod.ball@scionresearch.com www.scionresearch.com

See Also

smspline nlme

Examples

1
2
3
4
times1 <- 1:10
Zt1 <- smspline(~ times1)
times2 <- seq(1,10,by=0.1)
Zt2 <- approx.Z(Zt1,oldtimes=times1,newtimes=times2)

Example output

Loading required package: nlme

lmeSplines documentation built on May 2, 2019, 6:48 p.m.