2y ago

38 Views

2 Downloads

975.32 KB

338 Pages

Transcription

Package ‘nlme’March 25, 2022Version 3.1-157Date 2022-03-25Priority recommendedTitle Linear and Nonlinear Mixed Effects ModelsContact see 'MailingList'Description Fit and compare Gaussian linear and nonlinear mixed-effects models.Depends R ( 3.5.0)Imports graphics, stats, utils, latticeSuggests Hmisc, MASS, SASmixedLazyData yesEncoding UTF-8License GPL ( 2)BugReports https://bugs.r-project.orgMailingList R-help@r-project.orgURL edsCompilation yesAuthor José Pinheiro [aut] (S version),Douglas Bates [aut] (up to 2007),Saikat DebRoy [ctb] (up to 2002),Deepayan Sarkar [ctb] (up to 2005),EISPACK authors [ctb] (src/rs.f),Siem Heisterkamp [ctb] (Author fixed sigma),Bert Van Willigen [ctb] (Programmer fixed sigma),Johannes Ranke [ctb] (varConstProp()),R Core Team [aut, cre]Maintainer R Core Team R-core@R-project.org Repository CRANDate/Publication 2022-03-25 16:25:02 UTC1

R topics documented:2R topics documented:ACF . . . . . . . . .ACF.gls . . . . . . .ACF.lme . . . . . . .Alfalfa . . . . . . . .allCoef . . . . . . . .anova.gls . . . . . .anova.lme . . . . . .as.matrix.corStruct .as.matrix.pdMat . . .as.matrix.reStruct . .asOneFormula . . . .Assay . . . . . . . .asTable . . . . . . .augPred . . . . . . .balancedGrouped . .bdf . . . . . . . . . .BodyWeight . . . . .Cefamandole . . . .Coef . . . . . . . . .coef.corStruct . . . .coef.gnls . . . . . . .coef.lme . . . . . . .coef.lmList . . . . .coef.modelStruct . .coef.pdMat . . . . .coef.reStruct . . . . .coef.varFunc . . . .collapse . . . . . . .collapse.groupedDatacompareFits . . . . .comparePred . . . .corAR1 . . . . . . .corARMA . . . . . .corCAR1 . . . . . .corClasses . . . . . .corCompSymm . . .corExp . . . . . . . .corFactor . . . . . .corFactor.corStruct .corGaus . . . . . . .corLin . . . . . . . .corMatrix . . . . . .corMatrix.corStruct .corMatrix.pdMat . .corMatrix.reStruct . .corNatural . . . . . 73839404243444647495051535455575859616263

R topics documented:corRatio . . . . . . . .corSpatial . . . . . . .corSpher . . . . . . . .corSymm . . . . . . .Covariate . . . . . . .Covariate.varFunc . . .Dialyzer . . . . . . . .Dim . . . . . . . . . .Dim.corSpatial . . . .Dim.corStruct . . . . .Dim.pdMat . . . . . .Earthquake . . . . . .ergoStool . . . . . . .Fatigue . . . . . . . .fdHess . . . . . . . . .fitted.glsStruct . . . . .fitted.gnlsStruct . . . .fitted.lme . . . . . . .fitted.lmeStruct . . . .fitted.lmList . . . . . .fitted.nlmeStruct . . . .fixed.effects . . . . . .fixef.lmList . . . . . .formula.pdBlocked . .formula.pdMat . . . .formula.reStruct . . . .gapply . . . . . . . . .Gasoline . . . . . . . .getCovariate . . . . . ovariate.varFunc .getCovariateFormula .getData . . . . . . . .getData.gls . . . . . .getData.lme . . . . . .getData.lmList . . . .getGroups . . . . . . .getGroups.corStruct . .getGroups.data.frame .getGroups.gls . . . . .getGroups.lme . . . . .getGroups.lmList . . .getGroups.varFunc . .getGroupsFormula . .getResponse . . . . . .getResponseFormula .getVarCov . . . . . . 109110110111

R topics documented:4gls . . . . . . . . .glsControl . . . . .glsObject . . . . .glsStruct . . . . . .Glucose . . . . . .Glucose2 . . . . .gnls . . . . . . . .gnlsControl . . . .gnlsObject . . . . .gnlsStruct . . . . .groupedData . . . .gsummary . . . . .Gun . . . . . . . .IGF . . . . . . . .Initialize . . . . . .Initialize.corStructInitialize.glsStruct .Initialize.lmeStructInitialize.reStruct .Initialize.varFunc .intervals . . . . . .intervals.gls . . . .intervals.lme . . . .intervals.lmList . .isBalanced . . . . .isInitialized . . . .LDEsysMat . . . .lme . . . . . . . .lme.groupedData .lme.lmList . . . . .lmeControl . . . .lmeObject . . . . .lmeStruct . . . . .lmList . . . . . . .lmList.groupedDatalogDet . . . . . . .logDet.corStruct . .logDet.pdMat . . .logDet.reStruct . .logLik.corStruct . .logLik.glsStruct . .logLik.gnls . . . .logLik.gnlsStruct .logLik.lme . . . . .logLik.lmeStruct .logLik.lmList . . .logLik.reStruct . .logLik.varFunc . 155156157158159160161162163164165166167168169

R topics documented:Machines . . . . . . . .MathAchieve . . . . . .MathAchSchool . . . . .Matrix . . . . . . . . . .Matrix.pdMat . . . . . .Matrix.reStruct . . . . .Meat . . . . . . . . . . .Milk . . . . . . . . . . .model.matrix.reStruct . .Muscle . . . . . . . . . .Names . . . . . . . . . .Names.formula . . . . .Names.pdBlocked . . . .Names.pdMat . . . . . .Names.reStruct . . . . .needUpdate . . . . . . .needUpdate.modelStructNitrendipene . . . . . .nlme . . . . . . . . . . .nlme.nlsList . . . . . . .nlmeControl . . . . . . .nlmeObject . . . . . . .nlmeStruct . . . . . . . .nlsList . . . . . . . . . .nlsList.selfStart . . . . .Oats . . . . . . . . . . .Orthodont . . . . . . . .Ovary . . . . . . . . . .Oxboys . . . . . . . . .Oxide . . . . . . . . . .pairs.compareFits . . . .pairs.lme . . . . . . . . .pairs.lmList . . . . . . .PBG . . . . . . . . . . .pdBlocked . . . . . . . .pdClasses . . . . . . . .pdCompSymm . . . . .pdConstruct . . . . . . .pdConstruct.pdBlocked .pdDiag . . . . . . . . . .pdFactor . . . . . . . . .pdFactor.reStruct . . . .pdIdent . . . . . . . . .pdLogChol . . . . . . .pdMat . . . . . . . . . .pdMatrix . . . . . . . .pdMatrix.reStruct . . . .pdNatural . . . . . . . 03204205207208209210212213214215216218219220221

R topics documented:6pdSymm . . . . . . .Phenobarb . . . . . .phenoModel . . . . .Pixel . . . . . . . . .plot.ACF . . . . . .plot.augPred . . . . .plot.compareFits . .plot.gls . . . . . . .plot.intervals.lmList .plot.lme . . . . . . .plot.lmList . . . . . pedDataplot.ranef.lme . . . .plot.ranef.lmList . .plot.Variogram . . .pooledSD . . . . . .predict.gls . . . . . .predict.gnls . . . . .predict.lme . . . . .predict.lmList . . . .predict.nlme . . . . .print.summary.pdMatprint.varFunc . . . .qqnorm.gls . . . . .qqnorm.lme . . . . .Quinidine . . . . . .quinModel . . . . . .Rail . . . . . . . . .random.effects . . . .ranef.lme . . . . . .ranef.lmList . . . . .RatPupWeight . . . .recalc . . . . . . . .recalc.corStruct . . .recalc.modelStruct .recalc.reStruct . . . .recalc.varFunc . . . .Relaxin . . . . . . .Remifentanil . . . .residuals.gls . . . . .residuals.glsStruct . .residuals.gnlsStruct .residuals.lme . . . .residuals.lmeStruct .residuals.lmList . . .residuals.nlmeStruct 264264265266267268269269271272273274275276277

R topics documented:reStruct . . . . . . .simulate.lme . . . . .solve.pdMat . . . . .solve.reStruct . . . .Soybean . . . . . . .splitFormula . . . . .Spruce . . . . . . . .summary.corStruct .summary.gls . . . . .summary.lme . . . .summary.lmList . . .summary.modelStructsummary.nlsList . . .summary.pdMat . . .summary.varFunc . .Tetracycline1 . . . .Tetracycline2 . . . .update.modelStruct .update.varFunc . . .varClasses . . . . . .varComb . . . . . . .varConstPower . . .varConstProp . . . .VarCorr . . . . . . .varExp . . . . . . . .varFixed . . . . . . .varFunc . . . . . . .varIdent . . . . . . .Variogram . . . . . .Variogram.corExp . .Variogram.corGaus .Variogram.corLin . .Variogram.corRatio .Variogram.corSpatialVariogram.corSpher .Variogram.default . .Variogram.gls . . . .Variogram.lme . . .varPower . . . . . .varWeights . . . . .varWeights.glsStructvarWeights.lmeStructWafer . . . . . . . .Wheat . . . . . . . .Wheat2 . . . . . . .[.pdMat . . . . . . 0311312313314315316318321322323324325325326326328

8ACFACFAutocorrelation FunctionDescriptionThis function is generic; method functions can be written to handle specific classes of objects.Classes which already have methods for this function include: gls and lme.UsageACF(object, maxLag, .)Argumentsobjectany object from which an autocorrelation function can be obtained. Generallyan object resulting from a model fit, from which residuals can be extracted.maxLagmaximum lag for which the autocorrelation should be calculated.some methods for this generic require additional arguments.Valuewill depend on the method function used; see the appropriate documentation.Author(s)José Pinheiro and Douglas Bates Bates@stat.wisc.edu ReferencesBox, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day.Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer.See AlsoACF.gls, ACF.lme, plot.ACFExamples## see the method function documentation

ACF.glsACF.gls9Autocorrelation Function for gls ResidualsDescriptionThis method function calculates the empirical autocorrelation function for the residuals from a glsfit. If a grouping variable is specified in form, the autocorrelation values are calculated using pairs ofresiduals within the same group; otherwise all possible residual pairs are used. The autocorrelationfunction is useful for investigating serial correlation models for equally spaced data.Usage## S3 method for class 'gls'ACF(object, maxLag, resType, form, na.action, .)ArgumentsobjectmaxLagresTypeformna.action.an object inheriting from class "gls", representing a generalized least squaresfitted model.an optional integer giving the maximum lag for which the autocorrelation shouldbe calculated. Defaults to maximum lag in the residuals.an optional character string specifying the type of residuals to be used. If"response", the "raw" residuals (observed - fitted) are used; else, if "pearson",the standardized residuals (raw residuals divided by the corresponding standarderrors) are used; else, if "normalized", the normalized residuals (standardizedresiduals pre-multiplied by the inverse square-root factor of the estimated errorcorrelation matrix) are used. Partial matching of arguments is used, so only thefirst character needs to be provided. Defaults to "pearson".an optional one sided formula of the form t, or t g, specifying a timecovariate t and, optionally, a grouping factor g. The time covariate must beinteger valued. When a grouping factor is present in form, the autocorrelationsare calculated using residual pairs within the same group. Defaults to 1, whichcorresponds to using the order of the observations in the data as a covariate, andno groups.a function that indicates what should happen when the data contain NAs. Thedefault action (na.fail) causes ACF.gls to print an error message and terminateif there are any incomplete observations.some methods for this generic require additional arguments.Valuea data frame with columns lag and ACF representing, respectively, the lag between residuals withina pair and the corresponding empirical autocorrelation. The returned value inherits from class ACF.Author(s)José Pinheiro and Douglas Bates bates@stat.wisc.edu

10ACF.lmeReferencesBox, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day.Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer.See AlsoACF.lme, plot.ACFExamplesfm1 - gls(follicles sin(2*pi*Time) cos(2*pi*Time), Ovary)ACF(fm1, form 1 Mare)# Pinheiro and Bates, p. 255-257fm1Dial.gls - gls(rate (pressure I(pressure 2) I(pressure 3) I(pressure 4))*QB,Dialyzer)fm2Dial.gls - update(fm1Dial.gls,weights varPower(form pressure))ACF(fm2Dial.gls, form 1 Subject)ACF.lmeAutocorrelation Function for lme ResidualsDescriptionThis method function calculates the empirical autocorrelation function for the within-group residuals from an lme fit. The autocorrelation values are calculated using pairs of residuals within theinnermost group level. The autocorrelation function is useful for investigating serial correlationmodels for equally spaced data.Usage## S3 method for class 'lme'ACF(object, maxLag, resType, .)Argumentsobjectan object inheriting from class "lme", representing a fitted linear mixed-effectsmodel.maxLagan optional integer giving the maximum lag for which the autocorrelation shouldbe calculated. Defaults to maximum lag in the within-group residuals.

Alfalfa11resTypean optional character string specifying the type of residuals to be used. If"response", the "raw" residuals (observed - fitted) are used; else, if "pearson",the standardized residuals (raw residuals divided by the corresponding standarderrors) are used; else, if "normalized", the normalized residuals (standardizedresiduals pre-multiplied by the inverse square-root factor of the estimated errorcorrelation matrix) are used. Partial matching of arguments is used, so only thefirst character needs to be provided. Defaults to "pearson".some methods for this generic require additional arguments – not used.Valuea data frame with columns lag and ACF representing, respectively, the lag between residuals withina pair and the corresponding empirical autocorrelation. The returned value inherits from class ACF.Author(s)José Pinheiro and Douglas Bates bates@stat.wisc.edu ReferencesBox, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day.Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer.See AlsoACF.gls, plot.ACFExamplesfm1 - lme(follicles sin(2*pi*Time) cos(2*pi*Time),Ovary, random sin(2*pi*Time) Mare)ACF(fm1, maxLag 11)# Pinheiro and Bates, p240-241fm1Over.lme - lme(follicles sin(2*pi*Time) cos(2*pi*Time), data Ovary,random pdDiag( sin(2*pi*Time)) )(ACF.fm1Over - ACF(fm1Over.lme, maxLag 10))plot(ACF.fm1Over, alpha 0.01)AlfalfaSplit-Plot Experiment on Varieties of AlfalfaDescriptionThe Alfalfa data frame has 72 rows and 4 columns.

12allCoefFormatThis data frame contains the following columns:Variety a factor with levels Cossack, Ladak, and RangerDate a factor with levels None S1 S20 O7Block a factor with levels 1 2 3 4 5 6Yield a numeric vectorDetailsThese data are described in Snedecor and Cochran (1980) as an example of a split-plot design. Thetreatment structure used in the experiment was a 3x4 full factorial, with three varieties of alfalfaand four dates of third cutting in 1943. The experimental units were arranged into six blocks, eachsubdivided into four plots. The varieties of alfalfa (Cossac, Ladak, and Ranger) were assignedrandomly to the blocks and the dates of third cutting (None, S1—September 1, S20—September 20,and O7—October 7) were randomly assigned to the plots. All four dates were used on each block.SourcePinheiro, J. C. and Bates, D. M. (2000), Mixed-Effects Models in S and S-PLUS, Springer, NewYork. (Appendix A.1)Snedecor, G. W. and Cochran, W. G. (1980), Statistical Methods (7th ed), Iowa State UniversityPress, Ames, IAallCoefExtract Coefficients from a Set of ObjectsDescriptionThe extractor function is applied to each object in ., with the result being converted to a vector.A map attribute is included to indicate which pieces of the returned vector correspond to the originalobjects in dots.UsageallCoef(., extract)Arguments.objects to which extract will be applied. Generally these will be model components, such as corStruct and varFunc objects.extractan optional extractor function. Defaults to coef.Valuea vector with all elements, generally coefficients, obtained by applying extract to the objects in.

anova.gls13Author(s)José’ Pinheiro and Douglas BatesSee AlsolmeStruct,nlmeStructExamplescs1 - corAR1(0.1)vf1 - varPower(0.5)allCoef(cs1, vf1)anova.glsCompare Likelihoods of Fitted ObjectsDescriptionWhen only one fitted model object is present, a data frame with the sums of squares, numeratordegrees of freedom, F-values, and P-values for Wald tests for the terms in the model (when Termsand L are NULL), a combination of model terms (when Terms in not NULL), or linear combinationsof the model coefficients (when L is not NULL). Otherwise, when multiple fitted objects are beingcompared, a data frame with the degrees of freedom, the (restricted) log-likelihood, the Akaike Information Criterion (AIC), and the Bayesian Information Criterion (BIC) of each object is returned.If test TRUE, whenever two consecutive objects have different number of degrees of freedom, alikelihood ratio statistic, with the associated p-value is included in the returned data frame.Usage## S3 method for class 'gls'anova(object, ., test, type, adjustSigma, Terms, L, verbose)Argumentsobject.testtypea fitted model object inheriting from class gls, representing a generalized leastsquares fit.other optional fitted model objects inheriting from classes "gls", "gnls", "lm","lme", "lmList", "nlme", "nlsList", or "nls".an optional logical value controlling whether likelihood ratio tests should beused to compare the fitted models represented by object and the objects in .Defaults to TRUE.an optional character string specifying the type of sum of squares to be usedin F-tests for the terms in the model. If "sequential", the sequential sum ofsquares obtained by including the terms in the order they appear in the model isused; else, if "marginal", the marginal sum of squares obtained by deleting aterm from the model at a time is used. This argument is only used when a singlefitted object is passed to the function. Partial matching of arguments is used, soonly the first character needs to be provided. Defaults to "sequential".

14anova.glsadjustSigmaan optional logical value. If TRUE and the estimation method used to obtainobjectwas maximum likelihood, the residual standard error is multiplied bypnobs /(nobs npar ), converting it to a REML-like estimate. This argument isonly used when a single fitted object is passed to the function. Default is TRUE.Termsan optional integer or character vector specifying which terms in the modelshould be jointly tested to be zero using a Wald F-test. If given as a charactervector, its elements must correspond to term names; else, if given as an integervector, its elements must correspond to the order in which terms are included inthe model. This argument is only used when a single fitted object is passed tothe function. Default is NULL.Lan optional numeric vector or array specifying linear combinations of the coefficients in the model that should be tested to be zero. If given as an array, its rowsdefine the linear combinations to be tested. If names are assigned to the vectorelements (array columns), they must correspond to coefficients names and willbe used to map the linear combination(s) to the coefficients; else, if no names areavailable, the vector elements (array columns) are assumed in the same order asthe coefficients appear in the model. This argument is only used when a singlefitted object is passed to the function. Default is NULL.verbosean optional logical value. If TRUE, the calling sequences for each fitted modelobject are printed with the rest of the output, being omitted if verbose FALSE.Defaults to FALSE.Valuea data frame inheriting from class "anova.lme".NoteLikelihood comparisons are not meaningful for objects fit using restricted maximum likelihood andwith different fixed effects.Author(s)José Pinheiro and Douglas Bates bates@stat.wisc.edu ReferencesPinheiro, J. C. and Bates, D. M. (2000), Mixed-Effects Models in S and S-PLUS, Springer, NewYork.See Alsogls, gnls, lme, logLik.gls, AIC, BIC, print.anova.lmeExamples# AR(1) errors withi

Package ‘nlme’ March 25, 2022 Version 3.1-157 Date 2022-03-25 Priority recommended Title Linear and Nonlinear Mixed Effects Models Contact see 'MailingList' Description Fit and compare Gaussian linear and nonlinear mixed-effects models. Depends R ( 3.5.0) Imports graphics, stats, utils

Related Documents: