Package lmesplines. R topics documented: February 20, Version

Similar documents
Package rgcvpack. February 20, Index 6. Fitting Thin Plate Smoothing Spline. Fit thin plate splines of any order with user specified knots

Package rpst. June 6, 2017

Package RLRsim. November 4, 2016

Package truncreg. R topics documented: August 3, 2016

Package FCGR. October 13, 2015

Package vinereg. August 10, 2018

Package cosinor. February 19, 2015

lme for SAS PROC MIXED Users

Package DengueRT. May 13, 2016

Package gamm4. July 25, Index 10

Package lcc. November 16, 2018

Package PrivateLR. March 20, 2018

Package orthogonalsplinebasis

Package RcmdrPlugin.survival

Package MDSGUI. February 19, 2015

Package svmpath. R topics documented: August 30, Title The SVM Path Algorithm Date Version Author Trevor Hastie

Package gsalib. R topics documented: February 20, Type Package. Title Utility Functions For GATK. Version 2.1.

Nonparametric Mixed-Effects Models for Longitudinal Data

Package ptinpoly. February 20, 2015

Package intccr. September 12, 2017

Package hgam. February 20, 2015

Package gibbs.met. February 19, 2015

Package orqa. R topics documented: February 20, Type Package

Package imgur. R topics documented: December 20, Type Package. Title Share plots using the imgur.com image hosting service. Version 0.1.

Organizing data in R. Fitting Mixed-Effects Models Using the lme4 Package in R. R packages. Accessing documentation. The Dyestuff data set

Package mixexp. February 15, 2013

Package OLScurve. August 29, 2016

Package pendvine. R topics documented: July 9, Type Package

Package gppm. July 5, 2018

Package CGP. June 12, 2018

Package Segmentor3IsBack

Package orderbook. R topics documented: February 20, Type Package Title Orderbook visualization/charting software

Package mlegp. April 15, 2018

Package palmtree. January 16, 2018

lme4: Mixed-effects modeling with R

Package logitnorm. R topics documented: February 20, 2015

Package superbiclust

Package tukeytrend. June 20, 2017

Applied Statistics : Practical 9

Package iterators. December 12, 2017

davidr Cornell University

Package coxme. R topics documented: May 13, Title Mixed Effects Cox Models Priority optional Version

Package sensory. R topics documented: February 23, Type Package

Package caic4. May 22, 2018

Generalized additive models I

Package gwrr. February 20, 2015

Package esabcv. May 29, 2015

Package TSzip. February 15, 2013

Package TVsMiss. April 5, 2018

Package r2d2. February 20, 2015

Package CompGLM. April 29, 2018

Package listdtr. November 29, 2016

Package sbf. R topics documented: February 20, Type Package Title Smooth Backfitting Version Date Author A. Arcagni, L.

Package gsscopu. R topics documented: July 2, Version Date

Package sfa. R topics documented: February 20, 2015

Package penrvine. R topics documented: May 21, Type Package

Package mcemglm. November 29, 2015

Package MTLR. March 9, 2019

Package AnDE. R topics documented: February 19, 2015

A fast Mixed Model B-splines algorithm

Package simr. April 30, 2018

Package bayeslongitudinal

Package flexcwm. May 20, 2018

Package rvinecopulib

Package FastKNN. February 19, 2015

Package naivebayes. R topics documented: January 3, Type Package. Title High Performance Implementation of the Naive Bayes Algorithm

Package datasets.load

Package glmmml. R topics documented: March 25, Encoding UTF-8 Version Date Title Generalized Linear Models with Clustering

Package JBTools. R topics documented: June 2, 2015

Package influence.sem

Package survivalmpl. December 11, 2017

Package GWRM. R topics documented: July 31, Type Package

Package gpdtest. February 19, 2015

Package dglm. August 24, 2016

Online Supplementary Appendix for. Dziak, Nahum-Shani and Collins (2012), Multilevel Factorial Experiments for Developing Behavioral Interventions:

Package gee. June 29, 2015

Package mtsdi. January 23, 2018

The lmekin function. Terry Therneau Mayo Clinic. May 11, 2018

Package cwm. R topics documented: February 19, 2015

Package fcr. March 13, 2018

9.1 Random coefficients models Constructed data Consumer preference mapping of carrots... 10

Package svalues. July 15, 2018

Package KRMM. R topics documented: June 3, Type Package Title Kernel Ridge Mixed Model Version 1.0 Author Laval Jacquin [aut, cre]

Package glassomix. May 30, 2013

Package mnlogit. November 8, 2016

Package msgps. February 20, 2015

Package sspline. R topics documented: February 20, 2015

Package ArCo. November 5, 2017

Package splines2. June 14, 2018

Package robustgam. February 20, 2015

Package hsiccca. February 20, 2015

The grplasso Package

Package PCADSC. April 19, 2017

Package reghelper. April 8, 2017

Package fgpt. February 19, 2015

Package stacomirtools

Package wethepeople. March 3, 2013

Package Numero. November 24, 2018

Package mrm. December 27, 2016

Package robustreg. R topics documented: April 27, Version Date Title Robust Regression Functions

Transcription:

Version 1.1-10 Package lmesplines February 20, 2015 Title Add smoothing spline modelling capability to nlme. Author Rod Ball <rod.ball@scionresearch.com> Maintainer Andrzej Galecki <agalecki@umich.edu> Description Add smoothing spline modelling capability to nlme. Fit smoothing spline terms in Gaussian linear and nonlinear mixed-effects models Depends nlme(>= 3.1-29) License GPL (>= 2) Repository CRAN Date/Publication 2013-08-04 02:08:38 Repository/R-Forge/Project nlmeu Repository/R-Forge/Revision 122 Repository/R-Forge/DateTimeStamp 2013-08-02 14:37:01 NeedsCompilation no R topics documented: approx.z........................................... 1 smspline........................................... 3 smsplineex1........................................ 5 Index 7 approx.z Interpolating in smoothing spline Z-matrix columns Description Function to interpolate the Z-matrix for LME smoothing spline fits from one set of values of the time covariate to another. 1

2 approx.z Usage approx.z(z, oldtimes, newtimes) Arguments Z oldtimes newtimes Z-matrix with rows corresponding to the sorted unique values of the time covariate original (sorted) values for time covariate, corresponding to the rows of Z 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 times1 <- 1:10 Zt1 <- smspline(~ times1) times2 <- seq(1,10,by=0.1) Zt2 <- approx.z(zt1,oldtimes=times1,newtimes=times2)

smspline 3 smspline Smoothing splines in NLME Description Usage Functions to generate matrices for a smoothing spline covariance structure, to enable fitting smoothing spline terms in LME/NLME. Arguments smspline(formula, data) smspline.v(time) formula data time model formula with right hand side giving the spline covariate optional data frame spline time covariate to smooth over Details Value A smoothing spline can be represented as a mixed model (Speed 1991, Verbyla 1999). The generated Z-matrix from smspline() can be incorporated in the users s dataframe, then used in model formulae for LME random effects terms at any level of grouping (see examples). The spline random terms are fitted in LME using an identity pdmat structure of the form pdident(~z - 1). The model formulation for a spline in time (t) is as follows (Verbyla 1999): y = X s β s + Z s u s + e where X s = [1 t], Z s = Q(t(Q)Q) 1, and u s N(0, G s ), is a set of random effects. We transform the set of random effects u s to independence with u s = Lv s, where v s N(0, Iσ 2 s) is a set of independent random effects. The Z-matrix is transformed accordingly to Z = Z s L, where L is the lower triangle of the Choleski decomposition of G s. The function smspline.v() is called by smspline(), and can be used to access the matrices X s, Q, G s. See Verbyla (1999) for further information. For smspline(), a Z-matrix with the same number of rows as the data frame. After fitting, the LME model output gives a standard deviation parameter for the random effects, estimating σ s. The smoothing parameter from the penalised likelihood formulation is For smspline.v(), a list of the form λ = σ 2 /σ 2 s

4 smspline Xs Zs Q,Gs,R X-matrix for fixed effects part of the model Z-matrix for random effects part of the model Matrices Q, G s, R associated to the mixed-model form of the smoothing spline. Note The time points for the smoothing spline basis are, by default, the unique values of the time covariate. This is the easiest approach, and model predictions at the fitted data points, can be obtained using predict.lme. By interpolation, using approx.z, the Z-matrix can be obtained for any set of time points and can be used for fitting and/or prediction. (See examples). Synopsis:data$Z <- smspline(formula1, data); fit <-lme(formula2, data, random=... ) Author(s) Rod Ball <rod.ball@scionresearch.com> www.scionresearch.com References The correspondence between penalized likelihood formulations of smoothing splines and mixed models was pointed out by Speed (1991). The formulation used here for the mixed smoothing spline matrices are given in Verbyla (1999). LME/NLME modelling is introduced in Pinheiro and Bates (2000). Pinheiro, J. and Bates, D. (2000) Mixed-Effects Models in S and S-PLUS Springer-Verlag, New York. Speed, T. (1991) Discussion of That BLUP is a good thing: the estimation of random effects by G. Robinson. Statist. Sci., 6, 42 44. See Also Verbyla, A. (1999) Mixed Models for Practitioners, Biometrics SA, Adelaide. approx.z nlme Examples # smoothing spline curve fit data(smsplineex1) # variable all for top level grouping smsplineex1$all <- rep(1,nrow(smsplineex1)) # setup spline Z-matrix smsplineex1$zt <- smspline(~ time, data=smsplineex1) fit1s <- lme(y ~ time, data=smsplineex1, random=list(all=pdident(~zt - 1))) summary(fit1s) plot(smsplineex1$time,smsplineex1$y,pch="o",type="n", main="spline fits: lme(y ~ time, random=list(all=pdident(~zt-1)))", xlab="time",ylab="y") points(smsplineex1$time,smsplineex1$y,col=1) lines(smsplineex1$time, smsplineex1$y.true,col=1) lines(smsplineex1$time, fitted(fit1s),col=2)

smsplineex1 5 # fit model with cut down number of spline points times20 <- seq(1,100,length=20) Zt20 <- smspline(times20) smsplineex1$zt20 <- approx.z(zt20,times20,smsplineex1$time) fit1s20 <- lme(y ~ time, data=smsplineex1, random=list(all=pdident(~zt20-1))) # note: virtually identical df, loglik. anova(fit1s,fit1s20) summary(fit1s20) # model predictions on a finer grid times200 <- seq(1,100,by=0.5) pred.df <- data.frame(all=rep(1,length(times200)),time=times200) pred.df$zt20 <- approx.z(zt20, times20,times200) yp20.200 <- predict(fit1s20,newdata=pred.df) lines(times200,yp20.200+0.02,col=4) # mixed model spline terms at multiple levels of grouping data(spruce) Spruce$Zday <- smspline(~ days, data=spruce) Spruce$all <- rep(1,nrow(spruce)) # overall spline term, random plot and Tree effects spruce.fit1 <- lme(logsize ~ days, data=spruce, random=list(all= pdident(~zday -1), plot=~1, Tree=~1)) # try overall spline term plus plot level linear + spline term spruce.fit2 <- lme(logsize ~ days, data=spruce, random=list(all= pdident(~zday - 1), plot= pdblocked(list(~ days,pdident(~zday - 1))), Tree = ~1)) anova(spruce.fit1,spruce.fit2) summary(spruce.fit1) smsplineex1 Simulated data about a smooth curve Description Simulated data to demonstrate smoothing spline curve fitting with smspline and lme Usage data(smsplineex1) Format A data frame with 100 observations on the following 4 variables. time time covariate

6 smsplineex1 Details y simulated response values y.true true response values 100 data points were simulated about the curve y = 10 6 exp( 4t/100), with iid normal random errors with standard deviation 1. Examples data(smsplineex1)

Index Topic datasets smsplineex1, 5 Topic manip approx.z, 1 Topic models smspline, 3 Topic regression smspline, 3 Topic smooth smspline, 3 approx.z, 1, 4 lme, 5 nlme, 2, 4 predict.lme, 4 smspline, 2, 3, 5 smsplineex1, 5 7