nlme: Linear and Nonlinear Mixed Effects Models

線形・非線形混合効果モデル

> library(nlme)

バージョン: 3.1.121


関数名 概略
ACF Autocorrelation Function
ACF.gls Autocorrelation Function for gls Residuals
ACF.lme Autocorrelation Function for lme Residuals
Alfalfa Split-Plot Experiment on Varieties of Alfalfa
allCoef Extract Coefficients from a Set of Objects
anova.gls Compare Likelihoods of Fitted Objects
anova.lme Compare Likelihoods of Fitted Objects
as.matrix.corStruct Matrix of a corStruct Object
as.matrix.pdMat Matrix of a pdMat Object
as.matrix.reStruct Matrices of an reStruct Object
asOneFormula Combine Formulas of a Set of Objects Assay Bioassay on Cell Culture Plate
asTable Convert groupedData to a matrix
augPred Augmented Predictions
balancedGrouped Create a groupedData object from a matrix
bdf Language scores
BIC Bayesian Information Criterion
BIC.logLik BIC of a logLik Object
BodyWeight Rat weight over time for different diets
Cefamandole Pharmacokinetics of Cefamandole
coef<- Assign Values to Coefficients
coef.corStruct Coefficients of a corStruct Object
coef.gnls Extract gnls Coefficients
coef.lme Extract lme Coefficients
coef.lmList Extract lmList Coefficients
coef.modelStruct Extract modelStruct Object Coefficients
coef.pdMat pdMat Object Coefficients
coef.reStruct reStruct Object Coefficients
coef.varFunc varFunc Object Coefficients
collapse Collapse According to Groups
collapse.groupedData Collapse a groupedData Object
compareFits Compare Fitted Objects
comparePred Compare Predictions
corAR1 AR(1) Correlation Structure
corARMA ARMA(p,q) Correlation Structure
corCAR1 Continuous AR(1) Correlation Structure
corClasses Correlation Structure Classes
corCompSymm Compound Symmetry Correlation Structure
corExp Exponential Correlation Structure
corFactor Factor of a Correlation Matrix
corFactor.corStruct Factor of a corStruct Object Matrix
corGaus Gaussian Correlation Structure
corLin Linear Correlation Structure
corMatrix Extract Correlation Matrix
corMatrix.corStruct Matrix of a corStruct Object
corMatrix.pdMat Extract Correlation Matrix from a pdMat Object
corMatrix.reStruct Extract Correlation Matrix from Components of an reStruct Object
corNatural General correlation in natural parameterization
corRatio Rational Quadratic Correlation Structure
corSpatial Spatial Correlation Structure
corSpher Spherical Correlation Structure
corSymm General Correlation Structure
covariate<- Assign Covariate Values
covariate<-.varFunc Assign varFunc Covariate
Dialyzer High-Flux Hemodialyzer
Dim Extract Dimensions from an Object
Dim.corSpatial Dimensions of a corSpatial Object
Dim.corStruct Dimensions of a corStruct Object
Dim.pdMat Dimensions of a pdMat Object
Earthquake Earthquake Intensity
ergoStool Ergometrics experiment with stool types
Fatigue Cracks caused by metal fatigue
fdHess Finite difference Hessian
fitted.glsStruct Calculate glsStruct Fitted Values
fitted.gnlsStruct Calculate gnlsStruct Fitted Values
fitted.lme Extract lme Fitted Values
fitted.lmeStruct Calculate lmeStruct Fitted Values
fitted.lmList Extract lmList Fitted Values
fitted.nlmeStruct Calculate nlmeStruct Fitted Values
fixed.effects Extract Fixed Effects
fixef.lmList Extract lmList Fixed Effects
formula.pdBlocked Extract pdBlocked Formula
formula.pdMat Extract pdMat Formula
formula.reStruct Extract reStruct Object Formula
gapply Apply a Function by Groups
Gasoline Refinery yield of gasoline
getCovariate Extract Covariate from an Object
getCovariate.corStruct Extract corStruct Object Covariate
getCovariate.data.frame Extract Data Frame Covariate
getCovariateFormula Extract Covariates Formula
getCovariate.varFunc Extract varFunc Covariate
getData Extract Data from an Object
getData.gls Extract gls Object Data
getData.lme Extract lme Object Data
getData.lmList Extract lmList Object Data
getGroups Extract Grouping Factors from an Object
getGroups.corStruct Extract corStruct Groups
getGroups.data.frame Extract Groups from a Data Frame
getGroupsFormula Extract Grouping Formula
getGroups.gls Extract gls Object Groups
getGroups.lme Extract lme Object Groups
getGroups.lmList Extract lmList Object Groups
getGroups.varFunc Extract varFunc Groups
getResponse Extract Response Variable from an Object
getResponseFormula Extract Formula Specifying Response Variable
getVarCov Extract variance-covariance matrix
gls Fit Linear Model Using Generalized Least Squares
glsControl Control Values for gls Fit
glsObject Fitted gls Object
glsStruct Generalized Least Squares Structure
Glucose Glucose levels over time
Glucose2 Glucose Levels Following Alcohol Ingestion
gnls Fit Nonlinear Model Using Generalized Least Squares
gnlsControl Control Values for gnls Fit
gnlsObject Fitted gnls Object
gnlsStruct Generalized Nonlinear Least Squares Structure
groupedData Construct a groupedData Object
gsummary Summarize by Groups
Gun Methods for firing naval guns
IGF Radioimmunoassay of IGF-I Protein
Initialize Initialize Object
Initialize.corStruct Initialize corStruct Object
Initialize.glsStruct Initialize a glsStruct Object
Initialize.lmeStruct Initialize an lmeStruct Object
Initialize.reStruct Initialize reStruct Object
Initialize.varFunc Initialize varFunc Object
intervals Confidence Intervals on Coefficients
intervals.gls Confidence Intervals on gls Parameters
intervals.lme Confidence Intervals on lme Parameters
intervals.lmList Confidence Intervals on lmList Coefficients
isBalanced Check a Design for Balance
isInitialized Check if Object is Initialized
LDEsysMat Generate system matrix for LDEs
lme Linear Mixed-Effects Models
lmeControl Control Values for lme Fit
lme.groupedData LME fit from groupedData Object
lme.lmList LME fit from lmList Object
lmeObject Fitted lme Object
lmeScale Scale for lme Optimization
lmeStruct Linear Mixed-Effects Structure
lmList List of lm Objects with a Common Model
lmList.groupedData lmList Fit from a groupedData Object
logDet Extract the Logarithm of the Determinant
logDet.corStruct Extract corStruct Log-Determinant
logDet.pdMat Extract Log-Determinant from a pdMat Object
logDet.reStruct Extract reStruct Log-Determinants
logLik.corStruct Extract corStruct Log-Likelihood
logLik.glsStruct Log-Likelihood of a glsStruct Object
logLik.gnls Log-Likelihood of a gnls Object
logLik.gnlsStruct Log-Likelihood of a gnlsStruct Object
logLik.lme Log-Likelihood of an lme Object
logLik.lmeStruct Log-Likelihood of an lmeStruct Object
logLik.lmList Log-Likelihood of an lmList Object
logLik.reStruct Calculate reStruct Log-Likelihood
logLik.varFunc Extract varFunc logLik
Machines Productivity Scores for Machines and Workers
MathAchieve Mathematics achievement scores
MathAchSchool School demographic data for MathAchieve
matrix<- Assign Matrix Values
matrix<-.pdMat Assign Matrix to a pdMat Object
matrix<-.reStruct Assign reStruct Matrices
Meat Tenderness of meat
Milk Protein content of cows' milk
model.matrix.reStruct reStruct Model Matrix
Muscle Contraction of heart muscle sections
Names Names Associated with an Object
Names.formula Extract Names from a formula
Names.pdBlocked Names of a pdBlocked Object
Names.pdMat Names of a pdMat Object
Names.reStruct Names of an reStruct Object
needUpdate Check if Update is Needed
needUpdate.modelStruct Check if a modelStruct Object Needs Updating
Nitrendipene Assay of nitrendipene
nlme Nonlinear Mixed-Effects Models
nlmeControl Control Values for nlme Fit
nlme.nlsList NLME fit from nlsList Object
nlmeObject Fitted nlme Object
nlmeStruct Nonlinear Mixed-Effects Structure
nlsList List of nls Objects with a Common Model
nlsList.selfStart nlsList Fit from a selfStart Function
Oats Split-plot Experiment on Varieties of Oats
Orthodont Growth curve data on an orthdontic measurement
Ovary Counts of Ovarian Follicles
Oxboys Heights of Boys in Oxford
Oxide Variability in Semiconductor Manufacturing
pairs.compareFits Pairs Plot of compareFits Object
pairs.lme Pairs Plot of an lme Object
pairs.lmList Pairs Plot of an lmList Object
PBG Effect of Phenylbiguanide on Blood Pressure
pdBlocked Positive-Definite Block Diagonal Matrix
pdClasses Positive-Definite Matrix Classes
pdCompSymm Positive-Definite Matrix with Compound Symmetry Structure
pdConstruct Construct pdMat Objects
pdConstruct.pdBlocked Construct pdBlocked Objects
pdDiag Diagonal Positive-Definite Matrix
pdFactor Square-Root Factor of a Positive-Definite Matrix
pdFactor.reStruct Extract Square-Root Factor from Components of an reStruct Object
pdIdent Multiple of the Identity Positive-Definite Matrix
pdLogChol General Positive-Definite Matrix
pdMat Positive-Definite Matrix
[.pdMat Subscript a pdMat Object
pdMatrix Extract Matrix or Square-Root Factor from a pdMat Object
pdMatrix.reStruct Extract Matrix or Square-Root Factor from Components of an reStruct Object
pdNatural General Positive-Definite Matrix in Natural Parametrization
pdSymm General Positive-Definite Matrix Phenobarb Phenobarbitol Kinetics
phenoModel Model function for the Phenobarb data
Pixel X-ray pixel intensities over time
plot.ACF Plot an ACF Object
plot.augPred Plot an augPred Object
plot.compareFits Plot a compareFits Object
plot.gls Plot a gls Object
plot.intervals.lmList Plot lmList Confidence Intervals
plot.lme Plot an lme or nls object
plot.lmList Plot an lmList Object
plot.nffGroupedData Plot an nffGroupedData Object
plot.nfnGroupedData Plot an nfnGroupedData Object
plot.nmGroupedData Plot an nmGroupedData Object
plot.ranef.lme Plot a ranef.lme Object
plot.ranef.lmList Plot a ranef.lmList Object
plot.Variogram Plot a Variogram Object
pooledSD Extract Pooled Standard Deviation
predict.gls Predictions from a gls Object
predict.gnls Predictions from a gnls Object
predict.lme Predictions from an lme Object
predict.lmList Predictions from an lmList Object
predict.nlme Predictions from an nlme Object
print.summary.pdMat Print a summary.pdMat Object
print.varFunc Print a varFunc Object
qqnorm.gls Normal Plot of Residuals from a gls Object
qqnorm.lme Normal Plot of Residuals or Random Effects from an lme Object
Quinidine Quinidine Kinetics
quinModel Model function for the Quinidine data
Rail Evaluation of Stress in Railway Rails
random.effects Extract Random Effects
ranef.lme Extract lme Random Effects
ranef.lmList Extract lmList Random Effects
RatPupWeight The weight of rat pups
recalc Recalculate Condensed Linear Model Object
recalc.corStruct Recalculate for corStruct Object
recalc.modelStruct Recalculate for a modelStruct Object
recalc.reStruct Recalculate for an reStruct Object
recalc.varFunc Recalculate for varFunc Object
Relaxin Assay for Relaxin
Remifentanil Pharmacokinetics of remifentanil
residuals.gls Extract gls Residuals
residuals.glsStruct Calculate glsStruct Residuals
residuals.gnlsStruct Calculate gnlsStruct Residuals
residuals.lme Extract lme Residuals
residuals.lmeStruct Calculate lmeStruct Residuals
residuals.lmList Extract lmList Residuals
residuals.nlmeStruct Calculate nlmeStruct Residuals
reStruct Random Effects Structure
simulate.lme Simulate results from lme models
solve.pdMat Calculate Inverse of a Positive-Definite Matrix
solve.reStruct Apply Solve to an reStruct Object
Soybean Growth of soybean plants
splitFormula Split a Formula
Spruce Growth of Spruce Trees
summary.corStruct Summarize a corStruct Object
summary.gls Summarize a gls Object
summary.lme Summarize an lme Object
summary.lmList Summarize an lmList Object
summary.modelStruct Summarize a modelStruct Object
summary.nlsList Summarize an nlsList Object
summary.pdMat Summarize a pdMat Object
summary.varFunc Summarize varFunc Object
Tetracycline1 Pharmacokinetics of tetracycline
Tetracycline2 Pharmacokinetics of tetracycline
update.modelStruct Update a modelStruct Object
update.varFunc Update varFunc Object
varClasses Variance Function Classes
varComb Combination of Variance Functions
varConstPower Constant Plus Power Variance Function
VarCorr Extract variance and correlation components
varExp Exponential Variance Function
varFixed Fixed Variance Function
varFunc Variance Function Structure
varIdent Constant Variance Function
Variogram Calculate Semi-variogram
Variogram.corExp Calculate Semi-variogram for a corExp Object
Variogram.corGaus Calculate Semi-variogram for a corGaus Object
Variogram.corLin Calculate Semi-variogram for a corLin Object
Variogram.corRatio Calculate Semi-variogram for a corRatio Object
Variogram.corSpatial Calculate Semi-variogram for a corSpatial Object
Variogram.corSpher Calculate Semi-variogram for a corSpher Object
Variogram.default Calculate Semi-variogram
Variogram.gls Calculate Semi-variogram for Residuals from a gls Object
Variogram.lme Calculate Semi-variogram for Residuals from an lme Object
varPower Power Variance Function
varWeights Extract Variance Function Weights
varWeights.glsStruct Variance Weights for glsStruct Object
varWeights.lmeStruct Variance Weights for lmeStruct Object
Wafer Modeling of Analog MOS Circuits
Wheat Yields by growing conditions
Wheat2 Wheat Yield Trials

gls

一般化最小二乗法による線形モデルへの当てはめ

Arguments

  • object
  • model
  • model.
  • data
  • correlation
  • weights
  • subset
  • method... REML 制限付き最尤推定法, ML 最尤推定法
  • na.action
  • control
  • verbose
  • ...
  • evaluate
> gls(model       = follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time), 
+     data        = Ovary,
+     correlation = corAR1(form = ~1 | Mare)) %>% {
+       summary(.) %>% print(.)
+       update(., weights = varPower()) %>% print(.)
+ }
Generalized least squares fit by REML
  Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time) 
  Data: Ovary 
       AIC      BIC    logLik
  1571.455 1590.056 -780.7273

Correlation Structure: AR(1)
 Formula: ~1 | Mare 
 Parameter estimate(s):
      Phi 
0.7532079 

Coefficients:
                       Value Std.Error   t-value p-value
(Intercept)        12.216398 0.6646437 18.380373  0.0000
sin(2 * pi * Time) -2.774712 0.6450478 -4.301561  0.0000
cos(2 * pi * Time) -0.899605 0.6975383 -1.289685  0.1981

 Correlation: 
                   (Intr) s(*p*T
sin(2 * pi * Time)  0.000       
cos(2 * pi * Time) -0.294  0.000

Standardized residuals:
        Min          Q1         Med          Q3         Max 
-2.41180365 -0.75405234 -0.02923628  0.63156880  3.16247697 

Residual standard error: 4.616172 
Degrees of freedom: 308 total; 305 residual
Generalized least squares fit by REML
  Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time) 
  Data: Ovary 
  Log-restricted-likelihood: -779.4626

Coefficients:
       (Intercept) sin(2 * pi * Time) cos(2 * pi * Time) 
        12.1882442         -2.8125374         -0.8291796 

Correlation Structure: AR(1)
 Formula: ~1 | Mare 
 Parameter estimate(s):
      Phi 
0.7633477 
Variance function:
 Structure: Power of variance covariate
 Formula: ~fitted(.) 
 Parameter estimates:
     power 
-0.3838082 
Degrees of freedom: 308 total; 305 residual
Residual standard error: 12.08639

gnls

一般化最小二乗法による非線形モデルへの当てはめ

Arguments

  • model
  • data
  • params
  • start
  • correlation
  • weights
  • subset
  • na.action
  • naPattern
  • control
  • verbose
  • ...
> gnls(model   = weight ~ SSlogis(Time, Asym, xmid, scal), 
+      data    = Soybean,
+      weights = varPower())
Generalized nonlinear least squares fit
  Model: weight ~ SSlogis(Time, Asym, xmid, scal) 
  Data: Soybean 
  Log-likelihood: -486.8974

Coefficients:
     Asym      xmid      scal 
17.356822 51.872316  7.620525 

Variance function:
 Structure: Power of variance covariate
 Formula: ~fitted(.) 
 Parameter estimates:
    power 
0.8815436 
Degrees of freedom: 412 total; 409 residual
Residual standard error: 0.3662752

Ovary

データセット。

> data("Ovary")
> str(Ovary)
Classes 'nfnGroupedData', 'nfGroupedData', 'groupedData' and 'data.frame':    308 obs. of  3 variables:
 $ Mare     : Ord.factor w/ 11 levels "4"<"2"<"11"<"7"<..: 7 7 7 7 7 7 7 7 7 7 ...
 $ Time     : num  -0.1364 -0.0909 -0.0455 0 0.0455 ...
 $ follicles: num  20 15 19 16 13 10 12 14 13 20 ...
 - attr(*, "formula")=Class 'formula' length 3 follicles ~ Time | Mare
  .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> 
 - attr(*, "labels")=List of 2
  ..$ x: chr "Time in estrus cycle"
  ..$ y: chr "Number of ovarian follicles > 10 mm. diameter"
> head(Ovary)
Grouped Data: follicles ~ Time | Mare
  Mare        Time follicles
1    1 -0.13636360        20
2    1 -0.09090910        15
3    1 -0.04545455        19
4    1  0.00000000        16
5    1  0.04545455        13
6    1  0.09090910        10