approx.Z | R Documentation |
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.
approx.Z(Z, oldtimes, newtimes)
Z |
Z-matrix with rows corresponding to the sorted unique values of the
time covariate (e.g., from |
oldtimes |
Numeric vector of original (sorted) time covariate values
corresponding to the rows of |
newtimes |
Numeric vector of new time covariate values to interpolate to. |
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.
Linear interpolation works well because the spline basis functions are approximately piecewise linear.
Rod Ball <rod.ball@scionresearch.com>
smspline
, lme
,
predict.lme
times1 <- 1:10
Zt1 <- smspline(~ times1)
times2 <- seq(1, 10, by = 0.1)
Zt2 <- approx.Z(Zt1, oldtimes = times1, newtimes = times2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.