1
  5   ˆl–ßi~” T¾R( 	ÅŒ¹pL©‹Fÿ�þB gàá ÞŸÀƒh¹¿ÃÂ      1
     ˆ¾�þB gàá ÞŸÀƒh¹¿ÃÂ      1
  
   	Å239ÄÃÂ  ï    	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
</body></html>
  6   ˆl–ßi~”d*eJe@½pB¸ÔÅ£�þBV]Y¹Y}—e‘ ?ÁƒuÖ[ÀÄÃ 7    #-*- R -*-

# initialization

library(nlme)
options(width = 65,
        ## reduce platform dependence in printed output when testing
        digits = if(nzchar(Sys.getenv("R_TESTS"))) 3 else 5)
options(contrasts = c(unordered = "contr.helmert", ordered = "contr.poly"))
pdf(file = "ch05.pdf")

# Chapter 5    Extending the Basic Linear Mixed-Effects Models

# 5.1 General Formulation of the Extended Model

vf1Fixed <- varFixed(~ age)
vf1Fixed <- Initialize(vf1Fixed, data = Orthodont)
varWeights(vf1Fixed)
vf1Ident <- varIdent(c(Female = 0.5), ~ 1 | Sex)
vf1Ident <- Initialize(vf1Ident, Orthodont)
varWeights(vf1Ident)
vf2Ident <- varIdent(form =  ~ 1 | Sex, fixed = c(Female = 0.5))
vf2Ident <- Initialize(vf2Ident, Orthodont)
varWeights(vf2Ident)
vf3Ident <- varIdent(form = ~ 1 | Sex * age)
vf3Ident <- Initialize(vf3Ident, Orthodont)
varWeights(vf3Ident)
vf1Power <- varPower(1)
formula(vf1Power)
vf2Power <- varPower(fixed = 0.5)
vf3Power <- varPower(form = ~ fitted(.) | Sex,
  fixed = list(Male = 0.5, Female = 0))
vf1Exp <- varExp(form = ~ age | Sex, fixed = c(Female = 0))
vf1ConstPower <- varConstPower(power = 0.5,
      fixed = list(const = 1))
vf1Comb <- varComb(varIdent(c(Female = 0.5), ~ 1 | Sex),
                     varExp(1, ~ age))
vf1Comb <- Initialize(vf1Comb, Orthodont)
varWeights(vf1Comb)
fm1Dial.lme <-
    lme(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB,
        Dialyzer, ~ pressure + I(pressure^2))
fm1Dial.lme
plot(fm1Dial.lme, resid(.) ~ pressure, abline = 0)
fm2Dial.lme <- update(fm1Dial.lme,
                        weights = varPower(form = ~ pressure))
fm2Dial.lme
anova(fm1Dial.lme, fm2Dial.lme)
plot(fm2Dial.lme, resid(., type = "p") ~ pressure,
     abline = 0)
## IGNORE_RDIFF_BEGIN
intervals(fm2Dial.lme)
## IGNORE_RDIFF_END
plot(fm2Dial.lme, resid(.) ~ pressure|QB, abline = 0)
fm3Dial.lme <- update(fm2Dial.lme,
                      weights=varPower(form = ~ pressure | QB))
fm3Dial.lme
anova(fm2Dial.lme, fm3Dial.lme)
fm4Dial.lme <- update(fm2Dial.lme,
                      weights = varConstPower(form = ~ pressure))
anova(fm2Dial.lme, fm4Dial.lme)
plot(augPred(fm2Dial.lme), grid = TRUE)
anova(fm2Dial.lme)
anova(fm2Dial.lme, Terms = 8:10)
options(contrasts = c("contr.treatment", "contr.poly"))
fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight,
                   random = ~ Time)
fm1BW.lme
fm2BW.lme <- update(fm1BW.lme, weights = varPower())
fm2BW.lme
anova(fm1BW.lme, fm2BW.lme)
summary(fm2BW.lme)
anova(fm2BW.lme, L = c("Time:Diet2" = 1, "Time:Diet3" = -1))
cs1CompSymm <- corCompSymm(value = 0.3, form = ~ 1 | Subject)
cs2CompSymm <- corCompSymm(value = 0.3, form = ~ age | Subject)
cs1CompSymm <- Initialize(cs1CompSymm, data = Orthodont)
corMatrix(cs1CompSymm)
cs1Symm <- corSymm(value = c(0.2, 0.1, -0.1, 0, 0.2, 0),
                   form = ~ 1 | Subject)
cs1Symm <- Initialize(cs1Symm, data = Orthodont)
corMatrix(cs1Symm)
cs1AR1 <- corAR1(0.8, form = ~ 1 | Subject)
cs1AR1 <- Initialize(cs1AR1, data = Orthodont)
corMatrix(cs1AR1)
cs1ARMA <- corARMA(0.4, form = ~ 1 | Subject, q = 1)
cs1ARMA <- Initialize(cs1ARMA, data = Orthodont)
corMatrix(cs1ARMA)
cs2ARMA <- corARMA(c(0.8, 0.4), form = ~ 1 | Subject, p=1, q=1)
cs2ARMA <- Initialize(cs2ARMA, data = Orthodont)
corMatrix(cs2ARMA)
spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4)
cs1Exp <- corExp(1, form = ~ x + y)
cs1Exp <- Initialize(cs1Exp, spatDat)
corMatrix(cs1Exp)
cs2Exp <- corExp(1, form = ~ x + y, metric = "man")
cs2Exp <- Initialize(cs2Exp, spatDat)
corMatrix(cs2Exp)
cs3Exp <- corExp(c(1, 0.2), form = ~ x + y, nugget = TRUE)
cs3Exp <- Initialize(cs3Exp, spatDat)
corMatrix(cs3E