nlme/0000755000176000001440000000000014772475235011255 5ustar ripleyusersnlme/tests/0000755000176000001440000000000014661543635012414 5ustar ripleyusersnlme/tests/varFixed.R0000644000176000001440000000304214610503740014271 0ustar ripleyuserslibrary(nlme) ## PR#17712: nlme() with a fixed variance function set.seed(42) d <- data.frame( obs = rnorm(137), # prime, so recycling would fail group = factor(rep_len(c("A", "B"), 137)) ) fit_wt <- function (weights = NULL) nlme(obs ~ b, fixed = b ~ 1, random = b ~ 1 | group, start = c(b = 0), data = d, weights = weights, control = nlmeControl(returnObject = TRUE)) # possibly small PNLS steps m_unweighted <- fit_wt(NULL) stopifnot(all.equal(fixef(m_unweighted), c(b = mean(d$obs)), tolerance = 0.05)) ## equivalent fit with a constant variance function: m_varIdent <- fit_wt(varIdent()) ## nlme <= 3.1-164 failed with Error in recalc.varFunc(object[[i]], conLin) : ## dims [product 12] do not match the length of object [13] stopifnot(all.equal(logLik(m_unweighted), logLik(m_varIdent))) fit0 <- fit_wt(varExp(form = ~obs)) ## equivalent fit with the coefficient **fixed** at its estimate: vf0 <- fit0$modelStruct$varStruct fit1 <- fit_wt(varExp(form = ~obs, fixed = unname(coef(vf0)))) ## fitting failed in nlme <= 3.1-164 (as above) stopifnot(all.equal(logLik(fit0), logLik(fit1), check.attributes = FALSE)) # df differs by 1 ## equivalent fit using the same variance weights via **varFixed**: ##d$wt <- varWeights(vf0) # beware of different (internal) ordering d$wt <- fit0$sigma / attr(fit0$residuals, "std") fit2 <- fit_wt(varFixed(~1/wt^2)) ## fitting failed in nlme <= 3.1-164 (as above) stopifnot(all.equal(logLik(fit0), logLik(fit2), check.attributes = FALSE)) # df differs by 1 nlme/tests/data.frame.R0000644000176000001440000000146114365771446014547 0ustar ripleyusersstopifnot(!any("package:nlme" == search())) # nlme *not* attached ll <- LETTERS[1:10] subs <- rep(ll, rep(3,10)) set.seed(101)# make reproducible resp <- rnorm(30) ## 'nlme' not in search() : op <- options(warn = 2) # there should be no (deprecation) warning (gd <- nlme::groupedData(resp ~ 1|subs)) options(op) ## failed in nlme < 3.1-129 (or previous to 2017-01-17) stopifnot(inherits(gd, "groupedData"), identical(dim(gd), c(30L, 2L)), inherits(gs <- gd[,"subs"], "ordered"), identical(sort(levels(gs)), ll), identical(sort.list(levels(gs)), c(5L, 9L, 8L, 4L, 10L, 2L, 1L, 6L, 7L, 3L))) ## PR#18177 -- [j] should give a data frame require(nlme) stopifnot(is.data.frame(Meat[2]) # had 'drop=TRUE' , identical(Meat[,1, drop=FALSE], Meat[1]) ) # gave vector in nlme < 3.1-153 nlme/tests/getData.R0000644000176000001440000000034514251721455014103 0ustar ripleyuserslibrary(nlme) fm1 <- lme(distance ~ age, Orthodont) str(o1 <- getData(fm1)) df <- Orthodont # note that the name conflicts with df in the stats fm2 <- lme(distance ~ age, df) str(o2 <- getData(fm2)) stopifnot(identical(o1, o2)) nlme/tests/gls.R0000644000176000001440000001265414660442253013325 0ustar ripleyusers## reported by simon bond to R-help 2007-03-16 library(nlme) x <- rnorm(10, 0.1, 1) try(gls(x ~ 0)) # segfaulted in 3.1-79 ## PR#10364 # copied verbatim from Pinheiro & Bates 8.3.3 fm1Dial.gnls <- gnls(rate ~ SSasympOff(pressure, Asym, lrc, c0), data = Dialyzer, params = list(Asym + lrc ~ QB, c0 ~ 1), start = c(53.6, 8.6, 0.51, -0.26, 0.225)) (p1 <- predict(fm1Dial.gnls)) (p2 <- predict(fm1Dial.gnls, newdata = Dialyzer)) # failed, factor levels complaint # also, missed row names as names stopifnot(all.equal(as.vector(p1), as.vector(p2)), # 'label' differs identical(names(p1), names(p2))) ## PR#13418 fm1 <- gls(weight ~ Time * Diet, BodyWeight) (V10 <- Variogram(fm1, form = ~ Time | Rat)[1:10,]) ## failed in 3.1-89 stopifnot(all.equal(V10$variog, c(0.0072395216, 0.014584634, 0.014207936, 0.018442267, 0.011128505, 0.019910082, 0.027072311, 0.034140379, 0.028320657, 0.037525507)), V10$dist == c(1, 6, 7, 8, 13, 14, 15, 20, 21, 22), V10$n.pairs == 16*c(1, 1, 9, 1, 1, 8, 1, 1, 7, 1)) intervals(fm1) ## predict from model with factor and no intercept fm1b <- gls(weight ~ Diet - 1, BodyWeight) stopifnot(all.equal(predict(fm1b, BodyWeight[1,]), coef(fm1b)[1], check.attributes = FALSE)) ## in nlme <= 3.1-155, failed with ## Error in X[, names(cf), drop = FALSE] : subscript out of bounds ## predict.gls(): handling newdata for factor variables stopifnot(all.equal( predict(fm1, newdata = data.frame(Time = 1, Diet = "1", stringsAsFactor = FALSE)), fitted(fm1)[1], check.attributes = FALSE)) ## in nlme <= 3.1-155, predict() failed with ## Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : ## contrasts can be applied only to factors with 2 or more levels stopifnot(all.equal( predict(fm1, data.frame(Time = 71, Diet = c("2", "3"), stringsAsFactor = FALSE)), predict(fm1, data.frame(Time = 71, Diet = c("2", "3"), stringsAsFactor = TRUE)))) ## in nlme <= 3.1-155, using character input failed with ## Error in X[, names(cf), drop = FALSE] : subscript out of bounds tools::assertError(predict(fm1, data.frame(Time = 71, Diet = 2)), verbose = TRUE) ## more helpful error + warning now ## PR#17226: same for predict.gnls(), also without intercept fm2 <- gnls(weight ~ f, data = BodyWeight, params = list(f ~ Diet - 1), start = rep(coef(fm1)[1], 3)) stopifnot(all.equal(predict(fm2, head(BodyWeight)), head(fitted(fm2)), check.attributes = FALSE)) ## in nlme <= 3.1-155, failed with ## Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : ## contrasts can be applied only to factors with 2 or more levels stopifnot(all.equal( predict(fm2, data.frame(Time = 71, Diet = c("2", "3"), stringsAsFactor = FALSE)), predict(fm2, data.frame(Time = 71, Diet = c("2", "3"), stringsAsFactor = TRUE)))) ## in nlme <= 3.1-155, failed with ## Error in p %*% beta[pmap[[nm]]] : non-conformable arguments ## PR#17880: offset() terms are (currently) not supported in package nlme y <- 10:20; off <- rep(10, length(y)) tools::assertError(gls(y ~ 1 + offset(off)), verbose = TRUE) ## the following was TRUE in nlme <= 3.1-155, unfortunately: ## all.equal(coef(gls(y ~ 1 + offset(off))), coef(gls(y ~ 1))) ## PR#18283: gls() did not keep terms so predict() lacked "predvars" fm_poly <- gls(distance ~ poly(age, 1), data = Orthodont) fm_nopoly <- gls(distance ~ age, data = Orthodont) stopifnot(all.equal(predict(fm_poly, data.frame(age = 10)), predict(fm_nopoly, data.frame(age = 10)))) ## in nlme <= 3.1-155, prediction from fm_poly failed with ## Error in poly(age, 1) : ## 'degree' must be less than number of unique points stopifnot(all.equal(predict(fm_poly, head(Orthodont)), head(fitted(fm_poly)), check.attributes = FALSE)) ## predictions were wrong due to data-dependent bases ## R-help, From: Aaron Crowley; Jul 21, 2022 "Error generated by nlme::gnls" df <- Soybean n <- nrow(df) set.seed(548) for(j in 1:12) df[sprintf("x%02d", j)] <- sample(0:1, size=n, replace=TRUE) gm12 <- gnls(weight ~ x, data = df, params = (x ~ -1 + x01 + x02 + x03 + x04 + x05 + x06 + x07 + x08 + x09 + x10 + x11 + x12), start = rep(0, 12)) ## gave error Error in if (deparse(params[[nm]][[3]]) != "1") { : ## the condition has length > 1 stopifnot(all.equal( c(0.652122, 0.454468, 1.01271, 1.20772, 1.35816, -0.207982, 1.19959, 0.349636, 2.39818, 1.36285, 0.75055, 1.18374), unname(coef(gm12)), tol = 1e-5)) # Lnx x68_64: 1.18e-6 ## PR#17988: corARMA() with default p=0=q fails, now with a clear error message tools::assertError( gls(follicles ~ 1, Ovary, correlation = corARMA(form = ~ 1 | Mare)) , verbose = TRUE) ## in nlme <= 3.1-164, corARMA() returned dysfunctional corIdent() which gave ## Error in getGroupsFormula.default(correlation) : ## 'form' argument must be a formula ## PR#17227 (example originally posted by Wolfgang Viechtbauer, R-sig-ME, 2008q3) gnls.exp <- gnls(circumference ~ Asym/(1 + exp(-(age-xmid)/scal)), data = Orange, correlation = corExp(form = ~1 | Tree), start = c(Asym=150, xmid=750, scal=300), control = gnlsControl(returnObject = TRUE)) # warn, not stop ## using a spatial correlation structure would sometimes crash with varying ## memory errors in nlme <= 3.1-166 nlme/tests/augPredmissing.R0000644000176000001440000000035714251721455015516 0ustar ripleyuserslibrary(nlme) data(Orthodont) # add a column with an NA that is not used in the fit Orthodont$Others = runif(nrow(Orthodont)) is.na(Orthodont$Others[3]) = TRUE fm1 = lme(Orthodont, random = ~1) augPred(fm1, length.out = 2, level = c(0,1)) nlme/tests/lme.Rout.save0000644000176000001440000001612214301417046014766 0ustar ripleyusers R version 3.5.2 Patched (2019-01-14 r75994) -- "Eggshell Igloo" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(nlme) > > options(digits = 6)# <==> less platform dependency in print() output > if(!dev.interactive(orNone=TRUE)) pdf("test_lme.pdf") > > fm1 <- lmList(Oxboys) > fm1 Call: Model: height ~ age | Subject Data: Oxboys Coefficients: (Intercept) age 10 130.262 3.72291 26 137.993 5.58878 25 139.210 4.02408 9 138.137 6.00906 2 142.858 5.44018 6 146.791 3.96317 7 146.128 4.99005 17 142.978 8.61178 16 147.545 4.54520 15 144.276 7.12426 8 148.293 6.46471 20 151.471 4.37447 1 148.120 7.17815 18 151.180 5.95779 5 151.429 6.24613 23 151.065 7.18512 11 150.047 8.50608 21 150.521 7.49779 3 155.651 4.77467 24 153.140 6.76470 22 154.567 8.08751 12 156.811 7.01547 13 156.071 8.49381 14 159.474 8.67089 19 164.576 9.06562 4 165.072 9.36056 Degrees of freedom: 234 total; 182 residual Residual standard error: 0.659888 > fm2 <- lme(fm1) > fm2 Linear mixed-effects model fit by REML Data: Oxboys Log-restricted-likelihood: -362.045 Fixed: height ~ age (Intercept) age 149.37175 6.52547 Random effects: Formula: ~age | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 8.081077 (Intr) age 1.680717 0.641 Residual 0.659889 Number of Observations: 234 Number of Groups: 26 > vc2 <- VarCorr(fm2) > stopifnot( + all.equal(fixef(fm2), c("(Intercept)" = 149.371753, + age = 6.52546866), tol=1e-8), + all.equal(as.numeric(vc2[,"StdDev"]), + c(8.081077, 1.680717, 0.659889), tol=4e-7)) > > # bug report from Arne.Mueller@sanofi-aventis.com > mod <- distance ~ age + Sex > fm3 <- lme(mod, Orthodont, random = ~ 1) > pm3 <- predict(fm3, Orthodont) > stopifnot(all.equal(mean(pm3), 24.023148148), + all.equal( sd(pm3), 2.4802195115), + all.equal(quantile(pm3), c("0%" = 17.0817792, "25%" = 22.3481813, + "50%" = 23.9271016, "75%" = 25.5740014, + "100%"= 30.8662241))) > > > ## bug report and fix from Dimitris Rizopoulos and Spencer Graves: > ## when 'returnObject = TRUE', do not stop() but give warning() on non-convergence: > tools::assertWarning( + fm1 <- lme(distance ~ age, data = Orthodont, + control = lmeControl(msMaxIter = 1, returnObject = TRUE)) + ) > > ## "typo" in 'random=' -- giving 27-dim. vector random effect: > ## PR#17524 B.Tyner: https://bugs.r-project.org/show_bug.cgi?id=17524 > try(lme(distance ~ 1, data=Orthodont, random = ~ Subject)) Error in lme.formula(distance ~ 1, data = Orthodont, random = ~Subject) : fewer observations than random effects in all level 1 groups > tools::assertError(lme(distance ~ age, data=Orthodont, random = ~ Subject)) > ## seg.faults in nlme <= 3.1-137 (2018) because of integer overflow > ## The previous warning is now an *error* (unless new lmeControl(allow.n.lt.q=TRUE)) > > > ## based on bug report on R-help > (p3.1 <- predict(fm3, Orthodont[1,])) M01 25.3924 attr(,"label") [1] "Predicted values (mm)" > # failed in 3.1-88 > stopifnot(all.equal(pm3[1], p3.1, + check.attributes=FALSE, tolerance = 1e-14)) > > ## Intervals failed in a patch proposal (Nov.2015): > (fm4 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)) Linear mixed-effects model fit by REML Data: Orthodont Log-restricted-likelihood: -221.318 Fixed: distance ~ age (Intercept) age 16.761111 0.660185 Random effects: Formula: ~age | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 2.327034 (Intr) age 0.226428 -0.609 Residual 1.310040 Number of Observations: 108 Number of Groups: 27 > i4 <- intervals(fm4) > ## from dput(signif(i4$reStruct$Subject, 8)) > ## R-devel 2016-01-11; 64-bit : > reSS <- data.frame(lower = c(0.9485605, 0.10250901, -0.93825047), + est. = c(2.3270341, 0.22642779, -0.60933286), + upper = c(5.7087424, 0.50014674, 0.29816857)) > ## R-devel 2016-01-11; 32-bit : > ## reSS <- data.frame(lower = c(0.94962127,0.10262181, -0.93804767), > ## est. = c(2.3270339, 0.22642779, -0.60933284), > ## upper = c(5.7023648, 0.49959695, 0.29662651)) > rownames(reSS) <- rownames(i4$reStruct$Subject) > sm4 <- summary(fm4) > stopifnot( + all.equal(fixef(fm4), + c("(Intercept)" = 16.761111, age = 0.66018519)), + identical(fixef(fm4), sm4$tTable[,"Value"]), + all.equal(sm4$tTable[,"Std.Error"], + c("(Intercept)" = 0.77524603, age = 0.071253264), tol=6e-8), + all.equal(i4$reStruct$Subject[,"est."], reSS[,"est."], tol= 1e-7) + ## (lower, upper) cannot be very accurate for these : ==> tol = *e-4 + ,## "interestingly" 32-bit values changed from 3.2.3 to R-devel(3.3.0): + all.equal(i4$reStruct$Subject[,c(1,3)], reSS[,c(1,3)], tol = .005) + , + all.equal(as.vector(i4$sigma), + ## lower est. upper + c(1.0849772, 1.3100397, 1.5817881), tol=8e-4) + , + all.equal(as.vector(i4$fixed), + as.vector(rbind(c(15.218322, 16.761111, 18.3039), + c(0.51838667, 0.66018519, 0.8019837))), + tol = 1e-6) + ) > > > ## wrong results from getData: > ss2 <- readRDS("ss2.rds") > m1 <- lme(PV1MATH ~ ESCS + Age +time , + random = ~ time|SCHOOLID, + data = ss2, + weights = varIdent(form=~1|time), + corr = corCompSymm(form=~1|SCHOOLID/StIDStd), + na.action = na.omit) > plot(m1, resid(.) ~ WEALTH) > > m2 <- lme(PV1MATH ~ ESCS + Age +time , + random = ~ time|SCHOOLID, + data = ss2, + weights = varIdent(form=~1|time), + corr = corCompSymm(form=~1|SCHOOLID/StIDStd), + na.action = na.omit) > plot(m2, resid(.) ~ WEALTH) > > > ## Variogram() failing in the case of 1-observation groups (PR#17192): > BW <- subset(BodyWeight, ! (Rat=="1" & Time > 1)) > if(interactive()) + print( xtabs(~ Rat + Time, data = BW) )# Rat '1' only at Time == 1 > fm2 <- lme(fixed = weight ~ Time * Diet, random = ~ 1 | Rat, data = BW) > Vfm2 <- Variogram(fm2, form = ~ Time | Rat) > stopifnot(is.data.frame(Vfm2), + identical(dim(Vfm2), c(19L, 3L)), + all.equal(unlist(Vfm2[10,]), c(variog = 1.08575384191148, + dist = 22, n.pairs = 15)) + ) > ## failed in nlme from 3.1-122 till 3.1-128 > > proc.time() user system elapsed 1.376 0.138 1.653 nlme/tests/updateLme.R0000644000176000001440000000345514634264536014466 0ustar ripleyuserslibrary(nlme) if (requireNamespace("MASS")) { ## Example 1 --- was ./update.R --- data(petrol, package = 'MASS') Petrol <- petrol Petrol[, 2:5] <- scale(Petrol[, 2:5], scale = FALSE) pet3.lme <- lme(Y ~ SG + VP + V10 + EP, random = ~ 1 | No, data = Petrol, method="ML") upet3 <- update(pet3.lme, Y ~ SG + VP + V10) upet3 vc3 <- VarCorr(upet3) upet2 <- lme(Y ~ SG + VP + V10, random = ~ 1 | No, data = Petrol, method = "ML") stopifnot( all.equal(upet3, upet2, tol = 1e-15) , all.equal(fixef(upet3), c("(Intercept)" = 19.659375, SG = 0.125045632, VP = 2.27818601, V10 = 0.0672413592), tol = 1e-8)# 1e-9 , all.equal(as.numeric(vc3[,"StdDev"]), c(0.00029397, 9.69657845), tol=1e-6) ) } ## Example 2 --- data(Assay) as1 <- lme(logDens~sample*dilut, data=Assay, random=pdBlocked(list( pdIdent(~1), pdIdent(~sample-1), pdIdent(~dilut-1)))) as1s <- update(as1, random=pdCompSymm(~sample-1)) (an.1s <- anova(as1, as1s)) # non significant stopifnot( all.equal(drop(data.matrix(an.1s[2,-1])), c(Model = 2, df = 33, AIC = -10.958851, BIC = 35.280663, logLik = 38.479425, Test = 2, L.Ratio = 0.11370211, `p-value` = 0.73596807), tol=8e-8)) as1S <- update(as1, . ~ sample+dilut) # dropping FE interaction tools::assertWarning(anova(as1, as1S))# REML not ok for different FE. as1M <- update(as1, method = "ML") as1SM <- update(as1S, method = "ML") (anM <- anova(as1M, as1SM)) # anova() OK: comparing MLE fits ## ==> significant: P ~= 0.0054 stopifnot( all.equal(drop(data.matrix(anM[2,])[,-(1:2)]), c(df = 14, AIC = -169.588248, BIC = -140.267424, logLik = 98.7941241, Test = 2, L.Ratio = 39.7345188, `p-value` = 0.0053958561), tol = 8e-8) ) nlme/tests/sigma-fixed-etc.R0000644000176000001440000004021514414220130015461 0ustar ripleyusers#### Testing Examples --- related to the new "sigma = fixed" feature #### ================================================================ ## library(nlme,lib.loc=lib.loc) library(nlme) nlme:::doExtras() ## used below {when activated by the tester, e.g., MM..r} ## isSun <- Sys.info()[["sysname"]] == "SunOS" ##=== example 1 general linear model page 251 gls ML and LME ================ ## ex <- "ex1_gls_page251"; .pt <- proc.time() ## cat("\n example ", ex,"\n") sigma <- 2 cat("\nFixed sigma= ",sigma," estimation method 'ML'\n") t1.fix.ML.gls <- gls(distance ~ Sex *I(age-11), data = Orthodont, correlation = corSymm(form = ~1 | Subject), weights = varIdent(form = ~1 |age), control = glsControl(sigma = sigma), method = "ML") (s1M <- summary(t1.fix.ML.gls)) (a1M <- anova(t1.fix.ML.gls)) # sequential (a1Mm<- anova(t1.fix.ML.gls, type = "marginal")) ## t_{n} ^2 == F_{1,n}: stopifnot(all.equal(as.vector(s1M$tTable[,"t-value"] ^ 2), a1Mm[,"F-value"], tolerance = 1e-14), identical(2, sigma(t1.fix.ML.gls))) ## cat("\nFixed sigma= ",sigma," estimation method 'REML'\n") t1.fix.REML.gls <- gls(distance ~ Sex*I(age-11), data = Orthodont, correlation = corSymm(form = ~1 | Subject), weights = varIdent(form = ~1 |age), control = glsControl(sigma = sigma, maxIter = 1000, msMaxIter = 200), method = "REML") (s1R <- summary(t1.fix.REML.gls)) (a1R <- anova(t1.fix.REML.gls)) (a1Rm <- anova(t1.fix.REML.gls, type="marginal")) intervals(t1.fix.REML.gls) # now work (via 'apVar') ## t_{n} ^2 == F_{1,n}: stopifnot(all.equal(as.vector(s1R$tTable[,"t-value"] ^ 2), a1Rm[,"F-value"], tolerance = 1e-14)) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 2 linear mixed model page 147 lme ML and REML ================ ex <- "ex2_lme_page147"; .pt <- proc.time() ## cat("\n example ", ex,"\n") ## method <- "ML" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t1.fix.ML.lme <- lme(distance ~ I(age-11), data = Orthodont, control = lmeControl(sigma = sigma), method = method) summary (t1.fix.ML.lme) anova (t1.fix.ML.lme) intervals(t1.fix.ML.lme) stopifnot(sigma(t1.fix.ML.lme) == 1) method <- "REML" cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t1.fix.REML.lme <- lme(distance ~ I(age-11), data = Orthodont, control = lmeControl(sigma = sigma), method = method) summary (t1.fix.REML.lme) anova (t1.fix.REML.lme) intervals(t1.fix.REML.lme) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 3 general non-linear model page 402/ page 512 gnls ls ======== ex <- "ex3_gnls_page402"; .pt <- proc.time() ## cat("\n example ", ex,"\n") ## method <- "LS" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t1.fix.gnls <- gnls( rate ~SSasympOff(pressure, Asym, lrc, c0), data = Dialyzer, params = list(Asym + lrc ~ QB, c0 ~ 1), start = c(53.6,8.6,0.51,-0.26, 0.225), control = gnlsControl(sigma = 1)) stopifnot(is.null(t1.fix.gnls$apVar)) ## as is has *no* varying ranef-parameters summary (t1.fix.gnls) anova (t1.fix.gnls) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n"); .pt <- proc.time() t1.fix.w <- update(t1.fix.gnls, weights = varPower()) summary (t1.fix.w) anova (t1.fix.w) (it1fw <- intervals(t1.fix.w)) stopifnot(all.equal(it1fw$varStruct["power",], c(lower = 0.33147895, est. = 0.36474755, upper = 0.39801614), tol = 1e-6)) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 4 mixed non-linear model page 363 nlme ======================= ex <- "ex4_nlme_page363"; .pt <- proc.time() ## cat("\n example ", ex,"\n") method <- "ML" cat("\nVariable sigma; estimation method ", method,"\n") t1.ML.nlme <- nlme(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph, fixed = lKe + lKa + lCl ~ 1, method = method, start = c(-2.4,0.45,-3.2)) ## default control, no fixed sigma t1.ML.nlme$numIter # 23 (32-bit) stopifnot(all.equal(as.vector(t1.ML.nlme$sigma), 0.6818253, tol = 1e-5)) sigma <- 0.7 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") set.seed(44) system.time(# *not* fast : t1.fix.ML.nlme <- nlme(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph, fixed = lKe + lKa + lCl ~ 1, method = method, start = c(-2.4,0.45,-3.2), control = nlmeControl(sigma=sigma, maxIter = 200), verbose = interactive()) ) t1.fix.ML.nlme$numIter # 58 or 61 (and now 22).. (sM4 <- summary(t1.fix.ML.nlme)) (aM4 <- anova (t1.fix.ML.nlme)) t1.fix.ML.nlme$apVar ## "Non-positive definite approximate variance-covariance" ##(iM4 <- intervals(t1.fix.ML.nlme)) stopifnot( all.equal(fixef(t1.fix.ML.nlme), c(lKe = -2.432512, lKa = 0.450163, lCl = -3.2144713), tol= 8e-6) , all.equal(sM4$tTable[,"Std.Error"], # aarch64/linux gave 5.915e-5 c(lKe = 0.0640155, lKa = 0.196058, lCl = 0.0808379), tol = 1e-4) , all.equal(aM4[,"F-value"], c(65.439, 9.09557, 1581.21), tol = 1e-4) # ATLAS had 7.86e-05 ) ## ## REML method if(nlme:::doExtras()) { ## -- takes 2--3 minutes method <- "REML" sigma <- 0.7 cat("\nFixed sigma= ", sigma," estimation method ", method,"\n") ## ## only converges when tolerance is not small (and still takes long!) : t1.fix.REML.nlme <- update(t1.fix.ML.nlme, method = method, control = nlmeControl(tolerance = 0.0005, sigma=sigma, pnlsMaxIter = 20, # not just 7 maxIter = 1000), verbose = interactive()) cat(" -> numIter: ", t1.fix.REML.nlme$numIter, "\n") # 380 or so print(summary(t1.fix.REML.nlme)) print( anova(t1.fix.REML.nlme)) it1.fRn <- try( intervals(t1.fix.REML.nlme) ) ## cannot get .. Non-positive ... }# only if(nlme:::doExtras()) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 5 mixed non-linear model page 358 nlme ======================= ## ## ex <- "ex5_nlme_page365"; .pt <- proc.time() cat("\n example ", ex,"\n") ## method <- "ML" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t5.fix.ML.nlme <- nlme(circumference ~ SSlogis(age,Asym,xmid,scal), data = Orange, fixed = Asym + xmid + scal ~ 1, method = method, start = c(192,727,356), control = nlmeControl(sigma = sigma)) (sM5 <- summary(t5.fix.ML.nlme)) (aM5 <- anova (t5.fix.ML.nlme)) (t5.fix.ML.nlme$apVar) ## Non-positive definite [FIXME?] stopifnot( all.equal(fixef(t5.fix.ML.nlme), c(Asym= 192.79023, xmid= 726.36351, scal= 355.62941), tol= 1e-7) , all.equal(sM5$tTable[,"Std.Error"], c(Asym= 14.1688, xmid= 35.3425, scal=16.3637), tol = 5e-5) , all.equal(aM5[,"F-value"], c(4879.5, 208.534, 472.316), tol = 5e-5) ) ## REML method method <-"REML" cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t5.fix.REML.nlme <- update(t5.fix.ML.nlme, method = method, control = nlmeControl(sigma=sigma), verbose = interactive()) ## converges very quickly (when started from ML!) (sR5 <- summary(t5.fix.REML.nlme)) (aR5 <- anova (t5.fix.REML.nlme)) ( t5.fix.REML.nlme$apVar) ## Non-positive definite [FIXME?] stopifnot( ## ML and REML : fixed effects are very close all.equal(fixef(t5.fix.REML.nlme), fixef(t5.fix.ML.nlme), tol = 1e-6) , all.equal(sR5$tTable[,"Std.Error"], c(Asym= 13.548, xmid= 33.794, scal=15.6467), tol = 5e-5) , all.equal(aR5[,"F-value"], c(5336.29, 228.076, 516.594), tol = 5e-5) ) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 6 linear mixed model page 177 lme ML and REML ================ ## ex <- "ex6_lme_page177"; .pt <- proc.time() cat("\n example ", ex,"\n") ## method <- "ML" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t6.fix.ML.lme <- lme(distance ~ I(age-11), data = Orthodont, weights = varIdent(form = ~1 | Sex), method = method, control = lmeControl(sigma = sigma)) (sM6 <- summary (t6.fix.ML.lme)) (aM6 <- anova (t6.fix.ML.lme)) (iM6 <- intervals(t6.fix.ML.lme)) stopifnot( all.equal(fixef(t6.fix.ML.lme), c("(Intercept)"= 24.009565, "I(age - 11)"= 0.64760432), tol= 1e-7) , all.equal(sM6$tTable[,"Std.Error"], c("(Intercept)"= 0.426561, "I(age - 11)"= 0.066832), tol = 5e-5) , all.equal(aM6[,"F-value"], c(3162.47, 93.8969), tol = 5e-5) , all.equal(iM6$varStruct["Female",], ## Win 32 c(lower = 0.51230063, ## 0.51226722 est. = 0.65065925, ## 0.65065925 upper = 0.82638482), ## 0.82643872 ## was tol = if(isSun) 4e-4 else 6e-5)#= 4.39e-5 tol = 4e-4) ## seen 5.35e-5 (Sparc Sol., no long double); later, 6e-5 was not ok ## Windows 64bit w/ OpenBLAS 0.2.18 gave 5.721e-05 (Avi A) ## Win-builder (i386) gave 9.584157e-05 ) ##------------- method <- "REML" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t6.fix.REML.lme <- lme(distance ~I(age-11), data = Orthodont, weights = varIdent(form = ~1 | Sex), method = method, control = lmeControl(sigma = sigma)) (sR6 <- summary (t6.fix.REML.lme)) (aR6 <- anova (t6.fix.REML.lme)) (iR6 <- intervals(t6.fix.REML.lme)) stopifnot( all.equal(fixef(t6.fix.REML.lme), c("(Intercept)"= 24.010662, "I(age - 11)"= 0.64879966), tol= 1e-7) , all.equal(sR6$tTable[,"Std.Error"], c("(Intercept)"= 0.436365, "I(age - 11)"= 0.0687549), tol = 5e-5) , all.equal(aR6[,"F-value"], c(3019.86, 89.046), tol = 5e-5) , all.equal(iR6$varStruct["Female",], ## Win 32 c(lower = 0.51774671, ## 0.51778038 est. = 0.66087796, ## 0.66087807 upper = 0.8435779), ## 0.84352331 ## was tol = if(isSun) 4e-4 else 5e-5)# 4.37e-5 tol = 4e-4) # was 5.63e-5 without long doubles. ) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 7 linear mixed model page 172 lme ML and REML ================ ex <- "ex7_lme_page172"; .pt <- proc.time() cat("\n example ", ex,"\n") method <- "ML" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") set.seed(107) t7.fix.ML.lme <- lme( current ~ voltage + I(voltage^2), data = Wafer, random = list(Wafer = pdDiag(~voltage + I(voltage^2)), Site = pdDiag(~voltage + I(voltage^2)) ), method = method, control = lmeControl(sigma = 1, ## nlminb: false convergence on 32-bit msVerbose = TRUE, opt = "optim")) (ss7 <- summary(t7.fix.ML.lme)) (aa7 <- anova(t7.fix.ML.lme)) stopifnot( all.equal(fixef(t7.fix.ML.lme), c("(Intercept)" = -4.4611657, "voltage" = 5.9033709, "I(voltage^2)" = 1.1704027), tol = 1e-7) , all.equal(ss7$tTable[,"Std.Error"], c("(Intercept)" = 0.446086, "voltage" = 0.608571, "I(voltage^2)"= 0.187459), tol = 5e-5) , all.equal(aa7[,"F-value"], c(2634.2137, 8851.0513, 38.981463), tol = 5e-5) ) ##------------------------------------------------------ REML --- method <- "REML" cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") ## This had 'false convergence' on Solaris using nlminb, and ## optim found a portable answer t7.fix.REML.lme <- lme( current ~ voltage + I(voltage^2), data = Wafer, random = list(Wafer = pdDiag(~voltage + I(voltage^2)), Site = pdDiag(~voltage + I(voltage^2)) ), control = lmeControl(sigma = 1, opt = "optim"), method = method) (sR7 <- summary(t7.fix.REML.lme)) (aR7 <- anova(t7.fix.REML.lme)) stopifnot( all.equal(fixef(t7.fix.REML.lme), fixef(t7.fix.ML.lme), ## should not change much from ML to REML ! tol = 1e-6) , all.equal(sR7$tTable[,"Std.Error"], c("(Intercept)" = 0.44441, "voltage" = 0.606321, "I(voltage^2)"= 0.186754), tol = 5e-5) , all.equal(aR7[,"F-value"], c(2584.9515, 8885.0, 39.2760), tol = 1e-6) ) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 8 mixed non-linear model page 364 nlme ======================= ## ex <- "ex8_nlme_page364"; .pt <- proc.time() ## cat("\n example ", ex,"\n") method <- "ML" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") set.seed(8^2) t8.fix.ML.nlme <- nlme(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph, fixed = lKe + lKa + lCl ~ 1, random = pdDiag(lKe + lKa + lCl ~ 1), method = method, start = c(-2.4,0.5,-3.3), control = nlmeControl(sigma = 1)) (sM8 <- summary(t8.fix.ML.nlme)) (aM8 <- anova (t8.fix.ML.nlme)) stopifnot( all.equal(fixef(t8.fix.ML.nlme), c(lKe = -2.4554999, lKa = 0.44870292, lCl = -3.2296957), tol = 1e-7) , all.equal(sM8$tTable[,"Std.Error"], c(lKe = 0.0739269, lKa = 0.197524, lCl = 0.0683049), tol = 5e-5) , all.equal(aM8[,"F-value"], c(10.9426, 17.4101, 2235.73), tol = 5e-5) ) ## REML method method <- "REML" cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t8.fix.REML.nlme <- update(t8.fix.ML.nlme, method = method) (sR8 <- summary(t8.fix.REML.nlme)) (aR8 <- anova (t8.fix.REML.nlme)) stopifnot( all.equal(fixef(t8.fix.REML.nlme), fixef(t8.fix.ML.nlme), ## should not change much from ML to REML ! tol = 1e-6) , all.equal(sR8$tTable[,"Std.Error"], c(lKe = 0.073082, lKa = 0.195266, lCl = 0.0675243), tol = 5e-5) , all.equal(aR8[,"F-value"], c(11.1971, 17.815, 2287.72), tol = 5e-5) ) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") ##=== example 9 mixed non-linear model page 365 nlme ======================= ## ex <- "ex9_nlme_page365"; .pt <- proc.time() ## cat("\n example ", ex,"\n") method <- "ML" sigma <- 1 cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") set.seed(909) t9.fix.ML.nlme <- nlme(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph, fixed = lKe + lKa + lCl ~ 1, random = pdDiag( lKa + lCl ~ 1), method = method, start = c(-2.4,0.5,-3.3), control = nlmeControl(sigma = 1)) (sM9 <- summary(t9.fix.ML.nlme)) (aM9 <- anova (t9.fix.ML.nlme)) stopifnot( all.equal(fixef(t9.fix.ML.nlme), c(lKe = -2.4555745, lKa = 0.44894103, lCl = -3.2297273), tol = 1e-7) , all.equal(sM9$tTable[,"Std.Error"], c(lKe = 0.0739266, lKa = 0.197459, lCl = 0.0683082), tol = 5e-5) , all.equal(aM9[,"F-value"], c(10.9669, 17.4108, 2235.56), tol = 5e-5) ) ## REML method method <- "REML" cat("\nFixed sigma= ",sigma," estimation method ", method,"\n") t9.fix.REML.nlme <- update(t9.fix.ML.nlme, method = method) (sR9 <- summary(t9.fix.REML.nlme)) (aR9 <- anova (t9.fix.REML.nlme)) stopifnot( all.equal(fixef(t9.fix.REML.nlme), fixef(t9.fix.ML.nlme), ## should not change much from ML to REML ! tol = 1e-6) , all.equal(sR9$tTable[,"Std.Error"], c(lKe = 0.0730817, lKa = 0.195202, lCl = 0.0675275), tol = 5e-5) , all.equal(aR9[,"F-value"], c(11.2219, 17.8157, 2287.55), tol = 5e-5) ) cat("Time elapsed: ", (proc.time() - .pt)[1:3], "\n") nlme/tests/augPred_lab.R0000644000176000001440000000630514534600346014740 0ustar ripleyuserslibrary(nlme) ## if(require("Hmisc")) { -- no longer: depending on ggplot2 -> total +22 pkgs is too much T.aug <- Orthodont ## now manually label(T.aug$age) <- 'anyL' ## now manually: T.aug$age <- structure(T.aug$age, label = "anyL", class = c("labelled", "numeric")) foo <- augPred(lme(distance ~ age, random = ~1|Subject, data=T.aug)) ## failed in 3.1-72 stopifnot(length(foo$age) == 1485L, inherits(foo$age, "labelled"), attr(foo$age,"label") == "anyL") ## } ## failed even if there is a variable with a class that is not being used. T.aug <- Orthodont T.aug$newage <- T.aug$age class(T.aug$newage) <- 'anyC' foo <- augPred(lme(distance ~ age, random = ~1|Subject, data=T.aug)) ## failed in 3.1-72 ## [Bug 16715] New: nlme: unable to use predict and augPredict functions in non linear mixed models ## Date: Wed, 17 Feb 2016 M1.lis <- nlsList( SSlogis, data=Soybean) ## prints "Error in qr.solve(QR.B, cc): singular matrix 'a' in solve" ## ==> MM: 2016-03-11 "fixed": now prints it as warning [you could suppress or catch] ## ==> one NA row '1989P8' in this: M1.lis ## Nonlinear Logistic Growth -- each of the 3 par. (Asym, xmid, scal) has RE term ## Model: weight ~ SSlogis(Time, Asym, xmid, scal) | Plot M1.nlme <- nlme( M1.lis ) summary(M1.nlme) ## R 3.2.2 (nlme 3.1-121) : ## Nonlinear mixed-effects model fit by maximum likelihood ## Model: weight ~ SSlogis(Time, Asym, xmid, scal) ## Data: Soybean ## AIC BIC logLik ## 1499.671 1539.881 -739.8354 ## Random effects: ## Formula: list(Asym ~ 1, xmid ~ 1, scal ~ 1) ## Level: Plot ## Structure: General positive-definite, Log-Cholesky parametrization ## StdDev Corr ## Asym 5.201186 Asym xmid ## xmid 4.197467 0.721 ## scal 1.404737 0.711 0.958 ## Residual 1.123461 ## Fixed effects: list(Asym ~ 1, xmid ~ 1, scal ~ 1) ## Value Std.Error DF t-value p-value ## Asym 19.25301 0.8031921 362 23.97062 0 ## xmid 55.01985 0.7272721 362 75.65235 0 ## scal 8.40333 0.3152893 362 26.65276 0 ## Correlation: ## Asym xmid ## xmid 0.724 ## scal 0.620 0.807 ## Standardized Within-Group Residuals: ## Min Q1 Med Q3 Max ## -6.08691772 -0.22160816 -0.03390491 0.29741145 4.84688248 ## Number of Observations: 412 ## Number of Groups: 48 M1.Fix <- fixef(M1.nlme) ## add fixed effect 'Variety' : M2.nlme <- update(M1.nlme, fixed = Asym + xmid + scal ~ Variety, start = c(M1.Fix[1], 1, M1.Fix[2], 1, M1.Fix[3], 1)) summary(M2.nlme) pred.m2 <- predict(M2.nlme, level = 0:1) stopifnot(is.data.frame(pred.m2), dim(pred.m2) == c(412, 3)) augp.m2 <- augPred(M2.nlme, level = 0:1) ## failed in nlme-3.1-124/5 stopifnot(is.data.frame(augp.m2), dim(augp.m2) == c(5308, 4) , all.equal(colMeans(augp.m2[,c("Time","weight")]), c(Time = 48.585908, weight =7.8599693), tolerance = 1e-6)# was 1e-7, 2e-9 but failed with ATLAS builds , identical(c(table(augp.m2[,".type"])), c(predict.fixed = 2448L, predict.Plot = 2448L, original = 412L)) , identical(c(table(as.vector(table(augp.m2[,".groups"])))), c("110" = 33L, "111" = 2L, "112" = 13L)) ) nlme/tests/lmList.R0000644000176000001440000000325714251721455014003 0ustar ripleyuserslibrary(nlme) ## PR#13788 qm <- lmList(height ~ age | Subject, data = Oxboys) nd <- with(Oxboys, expand.grid(age = seq(min(age),max(age),length=50), Subject = levels(Subject)) ) ## failed in 3.1-92 res <- predict(qm, nd, se=TRUE) stopifnot(is.data.frame(res), dim(res) == c(1300, 3), identical(names(res), c("Subject", "fit", "se.fit"))) ## plots of ranef() and intervals.lmList() with new arguments 'xlab', 'ylab' req <- ranef(qm) (p.req <- plot(req, xlab = "R.Eff.", ylab = "Subj")) # Fails (p.re2 <- plot(req, age ~ fitted(.))) iqm <- intervals(qm) stopifnot(is.array(iqm), dim(iqm) == c(26,3,2)) p.iq <- plot(iqm, ylab = "Subject [factor]") ## Error: formal argument "ylab" matched by multiple .. in 3.1.137 stopifnot(inherits(p.iq, "trellis"), inherits(p.req, "trellis"), identical( unclass(p.req)[c("xlab","ylab")], list(xlab = "R.Eff.", ylab = "Subj")), formula(p.iq) == (group ~ intervals | what)) p.iq ## PR#16542: summary.lmList() with NA coefs in subgroup lms <- lmList(pixel ~ day + I(day^2) | Dog, data = Pixel) coefs <- coef(lms) stopifnot(is.na(coefs["9", "I(day^2)"]), identical(dim(coefs), c(10L, 3L))) summary(lms) # failed in nlme <= 3.1-155 with ## Error in `[<-`(`*tmp*`, use, use, ii, value = lst[[ii]]) : ## subscript out of bounds ## same bug: unused factor levels in subgroup lms2 <- lmList(pixel ~ Dog + day | Side, data = Pixel, subset = !(Side == "R" & Dog == "1") & Dog %in% 1:3) coef(lms2) # failed in nlme <= 3.1-155 with ## Error in `[<-`(`*tmp*`, i, names(coefs[[i]]), value = if (is.null(coefs[[i]])) { : ## subscript out of bounds nlme/tests/corStruct.R0000644000176000001440000000100214656601407014514 0ustar ripleyuserslibrary("nlme") ## PR#18777: corARMA() with p or q exceeding "maxLag" dat3 <- data.frame(ID = gl(5, 3), visit = 0:2) # => max time diff is 2 csARMA22 <- corARMA(form = ~ visit | ID, p = 2, q = 2) Initialize(csARMA22, dat3) # ok csAR3 <- corARMA(form = ~ visit | ID, p = 3) csMA3 <- corARMA(form = ~ visit | ID, q = 3) tools::assertError(Initialize(csAR3, dat3), verbose = TRUE) tools::assertError(Initialize(csMA3, dat3), verbose = TRUE) ## both crashed with "free(): invalid next size (fast)" in nlme <= 3.1-165 nlme/tests/coef.Rout.save0000644000176000001440000000501514251721455015132 0ustar ripleyusers R Under development (unstable) (2017-11-28 r73785) -- "Unsuffered Consequences" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin17.2.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## tests of fix for PR#9831 > library(nlme) > val <- c("10"=1.10,"14"=1.14) > vf <- varIdent(value=val, form=~1|age, fixed=c("12"=1.12)) > vfi <- Initialize(vf,Orthodont) > vfi Variance function structure of class varIdent representing 8 10 14 12 1.00 1.10 1.14 1.12 > str(vfi) 'varIdent' Named num [1:2] 0.0953 0.131 - attr(*, "names")= chr [1:2] "10" "14" - attr(*, "groupNames")= chr [1:4] "8" "10" "14" "12" - attr(*, "fixed")= Named num 0.113 ..- attr(*, "names")= chr "12" - attr(*, "formula")=Class 'formula' language ~1 | age .. ..- attr(*, ".Environment")= - attr(*, "groups")= chr [1:108] "8" "10" "12" "14" ... - attr(*, "whichFix")= logi [1:3] FALSE FALSE TRUE - attr(*, "weights")= Named num [1:108] 1 0.909 0.893 0.877 1 ... ..- attr(*, "names")= chr [1:108] "8" "10" "12" "14" ... - attr(*, "logLik")= num -9.17 > stopifnot( + all.equal(coef(vfi), c(0.0953101798043, 0.131028262406)), + all.equal(coef(vfi, unconstrained = FALSE, allCoef = TRUE), + c("8" = 1, "10" = 1.1, "14" = 1.14, "12" = 1.12))) > > vfiCopy <- vfi # copy of an initialized object > length(vfiCopy) # length is 2 [1] 2 > coef(vfiCopy) <- c(11,12) # error in 3.1-84 > stopifnot(identical(coef(vfiCopy), c(11,12))) > > ## error in 3.1-84 > (gls. <- gls(distance ~ age, weights = vfi, data=Orthodont)) Generalized least squares fit by REML Model: distance ~ age Data: Orthodont Log-restricted-likelihood: -253.4207 Coefficients: (Intercept) age 16.746600 0.659796 Variance function: Structure: Different standard deviations per stratum Formula: ~1 | age Parameter estimates: 8 10 14 12 1.000000 0.872009 1.121849 1.120000 Degrees of freedom: 108 total; 106 residual Residual standard error: 2.453257 > > proc.time() user system elapsed 0.246 0.040 0.272 nlme/tests/fitted.R0000644000176000001440000000062214251721455014007 0ustar ripleyusers## PR#15678 library(nlme) set.seed(1) X1 <- gl(2,4) X2 <- gl(2,2,8) Y <- rnorm(8) mis.dat <- data.frame(Y = Y,X1 = X1,X2 = X2) mis.dat[3, "Y"] <- NA ## Fit model ----------------------- model <- lme(Y ~ 1, random = ~ 1 | X1/X2, data = mis.dat, na.action = na.omit) summary(model) labs <- with(na.omit(mis.dat), paste(X1, X2, sep = "/" )) fit <- fitted(model) stopifnot(identical(names(fit), labs)) nlme/tests/nlme2.R0000644000176000001440000001646514251721455013561 0ustar ripleyuserslibrary(nlme) is64bit <- .Machine$sizeof.pointer == 8 options(digits = 10)# <- see more, as we have *no* *.Rout.save file here ## https://stat.ethz.ch/pipermail/r-help/2014-September/422123.html nfm <- nlme(circumference ~ SSlogis(age, Asym, xmid, scal), data = Orange, fixed = Asym + xmid + scal ~ 1) (sO <- summary(nfm)) vc <- VarCorr(nfm, rdig = 5)# def. 3 storage.mode(vc) <- "double" # -> (correct) NA warning cfO <- sO$tTable if(FALSE) dput(signif(cfO[,c("Std.Error", "t-value")], 8)) if(FALSE) dput(signif(as.numeric(vc[,"StdDev"]), 8)) cfO.Ts <- list( stdE.T = cbind( b64nx = ## R-devel 2016-01-11, 2017-09-18; [lynne]: c(14.052671, 34.587947, 30.497593, 13.669776, 21.036087, 11.692943) , b32nx = ## R-devel 2016-01-11, 2017-09-18 [florence, Fedora 24 Linux]: c(14.053663, 34.589821, 30.49412, 13.668653, 21.034544, 11.693889) , b32Win1 = ## R-devel 2017-09-17, i386-w64-mingw32/i386, ## Windows Server 2008 R2 x64 (build 7601) Service Pack 1 c(14.053047, 34.588589, 30.4963, 13.669349, 21.035542, 11.693282) , b32Win = ## R-devel 2017-09-18, Tomas K (Win.10) c(14.051902, 34.579819, 30.499807, 13.670797, 21.041722, 11.692694) ), stdDev = cbind( b64nx = ## R-devel 2016-01-11; [lynne]: c(27.051312, 24.258159, 36.597078, 7.321525) , b32nx = ## R-devel 2017-09-18; [florence, Fedora 24 Linux]: c(27.053964, 24.275286, 36.58682, 7.3213653) , b32Win = ## R-devel 2017-09-17, i386-w64-mingw32/i386, W.Server 2008 R2.. c(27.05234, 24.264936, 36.593554, 7.3214448) ## for now ) ) ## Average number of decimal digits agreement : lapply(cfO.Ts, function(cc) round(-log10(apply(cc - rowMeans(cc), 1, sd)), 2)) ## $ stdE.T: num [1:6] 3.13 2.34 2.62 3.05 2.49 3.29 ## $ stdDev: num [1:4] 2.87 2.06 2.28 4.1 ## Pairwise distances (formatted, easier to read off): round(dist(1000 * t(cfO.Ts[["stdE.T"]])), 1) ## b64nx b32nx b32Win1 ## b32nx 4.6 ## b32Win1 1.7 2.9 ## b32Win 10.2 13.9 11.5 round(dist(1000 * t(cfO.Ts[["stdDev"]])), 1) ## b64nx b32nx ## b32nx 20.1 ## b32Win 7.7 12.5 cName <- (if(is64bit) "b64nx" else if(.Platform$OS.type == "Windows") { if(grepl("Server 2008 R2", win.version(), fixed=TRUE)) "b32Win1" else "b32Win" } else "b32nx" ## 32-bit, non-Windows ) cfO.T <- array(cfO.Ts[["stdE.T"]][, cName], dim = 3:2, dimnames = list(c("Asym", "xmid", "scal"), c("Std.Error", "t-value"))) vcSD <- setNames(cfO.Ts[["stdDev"]][, switch(cName, b64nx=, b32nx=, b32Win=cName, b32Win1 = "b32Win")], c("Asym", "xmid", "scal", "Residual")) stopifnot( identical(cfO[,"Value"], fixef(nfm)), all.equal(cfO[,c("Std.Error", "t-value")], cfO.T, tol = 3e-4) , cfO[,"DF"] == 28, all.equal(vc[,"Variance"], vc[,"StdDev"]^2, tol= 5e-7) , all.equal(vc[,"StdDev"], vcSD, tol = 6e-4) # 3.5e-4 (R 3.0.3, 32b) , all.equal(unname(vc[2:3, 3:4]), # "Corr" rbind(c(-0.3273, NA), c(-0.9920, 0.4430)), tol = 2e-3)# ~ 2e-4 / 8e-4 ) ## Confirm predict(*, newdata=.) works (n <- nrow(Orange)) # 35 set.seed(17) newOr <- within(Orange[sample(n, 64, replace=TRUE), ], age <- round(jitter(age, amount = 50))) fit.v <- predict(nfm, newdata = newOr) resiv <- newOr$circumference - fit.v res.T <- c(48, 115, 74, 15, 44, -94, 47, -51, 20, -52, -16, 12, -135, -85, 136, 100, 24, 181, -88, -102, -26, 52, -148, 8, -83, 73, -27, -34, 91, 42, 34, -8, 0, 83, 84, -90, -123, 94, -157, -11, 56, -164, -28, 72, 15, 148, 95, -122, 169, 84, -19, -124, 45, -66, -10, 119, -110, -43, 12, 94, -108, 45, 48, 46) if(!all((res10 <- round(10 * as.vector(resiv))) == res.T)) { iD <- which(res10 != res.T) cat("Differing rounded residuals, at indices", paste(iD, collapse=", "), "; with values:\n") print(cbind(resiv, res10, res.T)[iD,]) } ## -> indices 14 [64-bit] or 27 [32-bit], respectively ## [Bug 16715] New: nlme: unable to use predict and augPredict .. ## Date: 17 Feb 2016 -- part 2 -- predict(): ## ## Comment 4 daveauty@gmail.com 2016-03-08 -- modified by MM -- ## simulate density data then fit Michaelis-Menten equation of density as ## function of ring age. TreeIDs grouped by SP (spacing) set.seed(1) df <- data.frame(SP = rep(LETTERS[1:5], 60), expand.grid(TreeID = factor(1:12), age = seq(2, 50, 2)), stringsAsFactors = TRUE) df[,"dens"] <- with(df, (runif(1,10,20)*age)/(runif(1,9,10)+age)) + rnorm(25, 0, 1) str(df) ## 'data.frame': 300 obs. of 4 variables: ## $ SP : Factor w/ 5 levels "A","B","C","D",..: 1 2 3 4 5 1 2 3 4 5 ... ## $ TreeID: Factor w/ 12 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ... ## $ age : num 2 2 2 2 2 2 2 2 2 2 ... ## $ dens : num 2.41 1.39 3.82 2.56 1.41 ... ## mixed-effects model fit1 <- nlme(dens ~ a*age/(b+age), fixed = a+b ~ 1, random= a ~ 1|TreeID, start = c(a=15, b=5), data=df) summary(fit1) fit1R <- update(fit1, method = "REML") ## allow fixed effects parameters to vary by 'SP': fit2 <- update(fit1, fixed = list(a ~ SP, b ~ SP), start = c(a = rep(14, 5), b = rep(4, 5))) summary(fit2) ## make new data for predictions newdat <- expand.grid(SP = LETTERS[1:5], age = seq(1, 50, 1)) n.pred1 <- predict(fit1, newdat, level=0) # works fine n.pred2 <- predict(fit2, newdat, level=0) ## in nlme 3.1-124, throws the error: ## Error in eval(expr, envir, enclos) : object 'SP' not found ## New data with never-yet observed levels of a random effect -- PR#16614 : set.seed(47) newD <- expand.grid(SP = LETTERS[2:4], age = runif(16, 1,50), TreeID = sample(c(sample(1:12, 7), 100:102))) n1prD0 <- predict(fit1, newD, level=0) n2prD0 <- predict(fit2, newD, level=0) n1prD1 <- predict(fit1, newD, level=1) # failed in nlme <= 3.1-126 n2prD1 <- predict(fit2, newD, level=1) # ditto (n1prD01 <- predict(fit1, newD, level=0:1))# " (n2prD01 <- predict(fit2, newD, level=0:1))# " ## consistency : stopifnot( identical(is.na(n1prD1), is.na(n2prD1)), identical(sort(unique(newD[is.na(n2prD1), "TreeID"])), 100:102), sort(unique( newD[is.na(n2prD1), "TreeID"] )) %in% 100:102 , all.equal(as.vector(n1prD0), n1prD01[,"predict.fixed"], tolerance= 1e-15), all.equal(as.vector(n2prD0), n2prD01[,"predict.fixed"], tolerance= 1e-15), all.equal(as.vector(n1prD1), n1prD01[,"predict.TreeID"],tolerance= 1e-15), all.equal(as.vector(n2prD1), n2prD01[,"predict.TreeID"],tolerance= 1e-15)) ## new data with factor levels stored as character stopifnot(all.equal(predict(fit2, data.frame(SP="A", age=2), level = 0), predict(fit2, level = 0)[1], check.attributes = FALSE)) ## in nlme <= 3.1-155, failed with ## Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : ## contrasts can be applied only to factors with 2 or more levels ## model without intercept fit3 <- update(fit2, fixed = a + b ~ SP - 1) stopifnot(all.equal(predict(fit3, head(df, 3)), head(predict(fit3), 3), check.attributes = FALSE)) ## in nlme <= 3.1-155, prediction failed if not all levels occurred ## Error in f %*% beta[fmap[[nm]]] : non-conformable arguments nlme/tests/varConstProp.R0000644000176000001440000000413014251721455015166 0ustar ripleyuserstimes <- c(0, 1, 3, 7, 14, 28, 56, 90, 120) k_in <- c(0.1, 0.15, 0.16, 0.18, 0.2) lrc_in <- mean(log(k_in)) lrc_sd_in <- sd(log(k_in)) n_sample <- length(times) * 2 const <- c(s1 = 1, s2 = 1) prop <- c(s1 = 0.07, s2 = 0.03) const_in <- rep(const, times = c(3, 2) * n_sample) prop_in <- rep(prop, times = c(3, 2) * n_sample) pred <- as.numeric(sapply(k_in, function(k) rep(100 * exp(- k * times), each = 2))) set.seed(123456L) d_syn <- data.frame( time = rep(times, 5, each = 2), ds = rep(paste0("d", 1:5), each = n_sample), study = rep(c("s1", "s2"), times = c(3 * n_sample, 2 * n_sample)), value = rnorm(length(pred), pred, sqrt(const_in^2 + pred^2 * prop_in^2)) ) library(nlme) f_nlsList <- nlsList(value ~ SSasymp(time, 0, 100, lrc) | ds, data = d_syn, start = list(lrc = -3)) (fm_tc_study <- ## suppressWarnings( ## as the fit seems to be overparameterised nlme(f_nlsList, weights = varConstProp(form = ~ fitted(.) | study), control = list(sigma = 1)) ## ) ) (ints <- intervals(fm_tc_study)) ## Check if intervals include input used for data generation stopifnot(exprs = { ints$fixed["lrc", "lower"] < lrc_in ints$fixed["lrc", "upper"] > lrc_in all.equal(c( ints$fixed["lrc", "est."], ints$reStruct$ds["sd(lrc)", "est."]), c(lrc_in, lrc_sd_in), tol = 1e-2) # diff. 0.00797 seen ints$varStruct[1:2, "lower"] < const ints$varStruct[3:4, "lower"] < prop ints$varStruct[1:2, "upper"] > const ints$varStruct[3:4, "upper"] > prop all.equal( as.numeric(ints$varStruct[c("prop.s1", "prop.s2"), "est."]), as.numeric(prop), tol = 0.15) # diff. 0.062 seen }) ## We do not get warnings if we fix the constant part of the error model fm_tc_study_CF <- nlme(f_nlsList, weights = varConstProp(form = ~ fitted(.) | study, fixed = list(const = c(s1 = 1, s2 = 1)))) summary(fm_tc_study_CF) (ints_cf <- intervals(fm_tc_study_CF)) stopifnot( all.equal( as.numeric(ints_cf$varStruct[, "est."]), as.numeric(prop), tol = 0.15) # diff. 0.1168 seen ) nlme/tests/predict.lme.R0000644000176000001440000001467514661543635014762 0ustar ripleyusers## from PR#8905 library(nlme) data(Orthodont) fm <- lme(distance ~ poly(age, 3) + Sex, data = Orthodont, random = ~ 1) # data for predictions Newdata <- head(Orthodont) Newdata$Sex <- factor(Newdata$Sex, levels = levels(Orthodont$Sex)) (pr <- predict(fm, Newdata)) stopifnot(all.equal(c(pr), fitted(fm)[1:6])) ## https://stat.ethz.ch/pipermail/r-devel/2013-September/067600.html ## but with a different fix. m0 <- lme(distance ~ Sex, random = ~1|Subject, data = Orthodont) Fitted <- predict(m0, level = 0) Fitted.Newdata <- predict(m0, level = 0, newdata = Orthodont) stopifnot(sum(abs(Fitted - Fitted.Newdata)) == 0) Fitted <- predict(m0, level = 1) Fitted.Newdata <- predict(m0, level = 1, newdata = Orthodont) sum(abs(Fitted - Fitted.Newdata)) stopifnot(sum(abs(Fitted - Fitted.Newdata)) == 0) m1 <- lme(distance ~ 1, random = ~1|Subject, data = Orthodont) Fitted <- predict(m1, level = 0) Fitted.Newdata <- predict(m1, level = 0, newdata = Orthodont) stopifnot(sum(abs(Fitted - Fitted.Newdata)) == 0) Fitted <- predict(m1, level = 1) Fitted.Newdata <- predict(m1, level = 1, newdata = Orthodont) stopifnot(sum(abs(Fitted - Fitted.Newdata)) == 0) m2 <- lme(distance ~ 0, random = ~1|Subject, data = Orthodont) Fitted <- predict(m2, level = 0) Fitted.Newdata <- predict(m2, level = 0, newdata = Orthodont) stopifnot(sum(abs(Fitted - Fitted.Newdata)) == 0) Fitted <- predict(m2, level = 1) Fitted.Newdata <- predict(m2, level = 1, newdata = Orthodont) stopifnot(sum(abs(Fitted - Fitted.Newdata)) == 0) m3 <- lme(fixed = distance ~ age, data = Orthodont, random = ~ 1 | Subject) m4 <- update(m3, random = ~ age | Subject) m5 <- update(m4, fixed. = distance ~ age * Sex) newD <- expand.grid(age = seq(7,15, by = .25), Sex = c("Male", "Female"), Subject = c("M01", "F01")) (n.age <- attr(newD, "out.attrs")$dim[["age"]]) # 33 str(p5 <- predict(m5, newdata = newD, asList = TRUE, level=0:1)) pp5 <- cbind(newD, p5[,-1]) stopifnot(identical(colnames(pp5), c("age", "Sex", "Subject", "predict.fixed", "predict.Subject"))) fixef(m5) # (Intercept) age SexF age:SexF p5Mf <- pp5[pp5$Sex == "Male", "predict.fixed"] p5MS <- subset(pp5, subset = Subject == "M01" & Sex == "Male", select = "predict.Subject", drop=TRUE) X.1 <- cbind(1, newD[1:n.age,"age"]) stopifnot(all.equal(p5Mf[ 1:n.age], p5Mf[-(1:n.age)], tol = 1e-15) , all.equal(p5Mf[ 1:n.age], c(X.1 %*% fixef(m5)[1:2]), tol = 1e-15) , all.equal(p5MS, c(X.1 %*% (fixef(m5)[1:2] + as.numeric(ranef(m5)["M01",]))), tole = 1e-15) ) ## PR#18312: predict with character vs. factor variables in newdata newOrth <- data.frame(Subject = "F03", Sex = "Female", age = 8, stringsAsFactors = FALSE) # default in R >= 4.0.0 stopifnot(all.equal(predict(m5, newdata = newOrth), # this failed fitted(m5)["F03"], # first obs of F03 is for age 8 check.attributes = FALSE)) ## failed in nlme <= 3.1-155 with ## Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : ## contrasts can be applied only to factors with 2 or more levels newOrth2 <- rbind(newOrth, list("M11", "Male", 16)) stopifnot(all.equal( predict(m5, newdata = type.convert(newOrth2, as.is = FALSE)), # factor predict(m5, newdata = newOrth2) # character )) ## predictions with character input were *wrong* in nlme <= 3.1-155 ## numeric newdata for a factor variable should at least warn tools::assertWarning(predict(m5, newdata = transform(newOrth, Sex = 2)), verbose = TRUE) ## did not warn in nlme <= 3.1-155 and may return unexpected result ## (not the same as Sex=factor("Female", levels = c("Male", "Female"))) ## intercept-free model m0b <- lme(distance ~ Sex - 1, random = ~1|Subject, data = Orthodont) stopifnot(all.equal(predict(m0b, Orthodont[1,], level=0), fixef(m0b)[1], check.attributes = FALSE)) ## predict wrongly returned c(0,0) in nlme <= 3.1-155 ##--- simulate():--------- ## border cases ort.0 <- simulate(m3, method = character())# "nothing" stored ort.M <- simulate(m3, method = "ML", seed=47) ort.R <- simulate(m3, method = "REML", seed=47) stopifnot(identical(names(ort.0), "null"), identical(names(ort.M), "null"), identical(names(ort.R), "null"), identical(ort.0$null, list()), identical(names(ort.M$null), "ML"), identical(names(ort.R$null), "REML"), all.equal(loM <- ort.M$null$ML [,"logLik"], -215.437, tol = 2e-6) , all.equal(loR <- ort.R$null$REML[,"logLik"], -217.325, tol = 2e-6) ) system.time( orthS3 <- simulate.lme(list(fixed = distance ~ age, data = Orthodont, random = ~ 1 | Subject), nsim = 3, m2 = list(random = ~ age | Subject), seed = 47) ) ## the same, starting from two fitted models : ort.S3 <- simulate(m3, m2 = m4, nsim = 3, seed = 47) attr(ort.S3, "call") <- attr(orthS3, "call") ## was 1e-15, larger tolerance needed with ATLAS stopifnot(all.equal(orthS3, ort.S3, tolerance = 1e-10)) logL <- sapply(orthS3, function(E) sapply(E, function(M) M[,"logLik"]), simplify="array") stopifnot(is.array(logL), length(d <- dim(logL)) == 3, d == c(3,2,2), sapply(orthS3, function(E) sapply(E, function(M) M[,"info"])) == 0 , # typically even identical(), but not with ATLAS all.equal(logL[1,,"null"], c(ML = loM, REML = loR), tol = 1e-10) , all.equal(c(logL) + 230, c(14.563 , 2.86712, 1.00026, 12.6749, 1.1615,-0.602989, 16.2301, 2.95877, 2.12854, 14.3586, 1.2534, 0.582263), tol=8e-6) ) ## PR#17955 and PR#18433 makeLimitWarningsHandler <- function (limit = 10) { nWarn <- 0L function (w) if ((nWarn <<- nWarn + 1L) > limit) stop("caught too many warnings") } orthSim <- withCallingHandlers( simulate.lme( list(fixed = distance ~ age, data = Orthodont, random = ~ 1 | Subject), nsim = 150, seed = 38, m2 = list(random = ~ age | Subject), method = "ML", useGen = FALSE ) ## infinite looping under OpenBLAS (even serial), where optif9() called ## internal_loglik() with very large pars (849.665, 64.3347, 54954.7), ## producing an NaN result followed by endless warnings: ## Singular precision matrix in level -1, block 1 , warning = makeLimitWarningsHandler()) stopifnot(inherits(orthSim, "simulate.lme")) nlme/tests/scoping.R0000644000176000001440000000511514613731164014174 0ustar ripleyuserslibrary("nlme") ## PR#18157 mygnls <- function (mydata) gnls(weight ~ SSlogis(Time, Asym, xmid, scal), data = mydata) fm1 <- mygnls(Soybean) # failed in 3.1-153 with ## Error in stats::nls(formula = weight ~ SSlogis(Time, Asym, xmid, scal), : ## object 'mydata' not found ## similarly, each of the following calls of ## nlme.formula(), nlsList.selfStart(), nlme.nlsList() ## using a self-starting model with local data would fail in 3.1-153 with ## Error in is.data.frame(data) : object 'mydata' not found local({ mydata <- subset(Loblolly, Seed < "307") fm2 <- nlme(height ~ SSasymp(age, Asym, R0, lrc), data = mydata, random = Asym ~ 1) fml <- nlsList(SSasymp, data = mydata) fm3 <- nlme(fml, random = Asym ~ 1) }) ## look for data in the parent frame, not in nlme's namespace groupedData <- Orthodont m3 <- lme(distance ~ age, data = groupedData, random = ~1 | Subject) augPred(m3, length.out = 2) ## gave Error: data in 'm3' call must evaluate to a data frame simulate(m3, m2 = list(random = ~ age | Subject), seed = 42, method = "ML") ## gave Error: 'data' must be a data.frame, environment, or list rm(groupedData) ## PR#15892: formula.gls and formula.lme evaluated the call (in bad scope) ## same for predict.lme invisible(lapply(list(gls, lme), function (FUN) { form <- follicles ~ 1 model <- FUN(form, Ovary) stopifnot(identical(formula(model), form)) stopifnot(all.equal(predict(model, newdata = Ovary[1,]), fitted(model)[1], check.attributes = FALSE)) })) ## first gave Error in eval(x$call$model) : object 'form' not found ## second gave Error in eval(mCall$fixed) : object 'form' not found ## Subject: [Bug 18559] New: nlme -> anova doesn't handle symbolic formulas nicely ## Date: Sat, 08 Jul 2023 --- by Ben Bolker formula <- height ~ a*exp(-b*age) fm1 <- nlme(formula, data = Loblolly, fixed = a + b ~ 1, random = a ~ 1, start = c(a = 100, b = 1)) ## "same" for gnls: fmGnl <- gnls(formula, data = Loblolly, start = c(a = 100, b = 1)) stopifnot(exprs = { identical(formula(fm1), formula) ## was equal to stats::formula (!) identical(getResponseFormula(fm1), ~height) identical(formula(fmGnl), formula) # was stats::formula identical(getResponseFormula(fmGnl), ~height) }) ## similarly for self-starting models: formula <- height ~ SSasymp(age, Asym, R0, lrc) fm2 <- nlme(formula, data = Loblolly, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1) ## nlme <= 3.1-164 failed with Error in x$formula : ## object of type 'symbol' is not subsettable stopifnot(identical(formula(fm2), formula)) nlme/tests/varIdent.R0000644000176000001440000000040314251721455014301 0ustar ripleyusers## test for PR#9765 library(nlme) Orth <- subset(Orthodont, Subject %in% c("M01","F01")) # Argument fixed in varIdent is ignored vf <- varIdent(form=~1|Sex,fixed=c(Female=0.5)) vf <- Initialize(vf, data=Orth) stopifnot(varWeights(vf) == rep(c(1,2), each=4)) nlme/tests/gnls-ch8.R0000644000176000001440000000340514251721455014155 0ustar ripleyusers## Really just one section from ../inst/scripts/ch08.R : library(nlme) (fm1Lis <- nlsList(rate ~ SSasympOff(pressure, Asym, lrc, c0) | QB, data = Dialyzer)) (iLis <- intervals(fm1Lis)) ## TODO: stopifnot(all.equal(..)) ? fm1Dial.gnls <- gnls(rate ~ SSasympOff(pressure, Asym, lrc, c0), data = Dialyzer, params = list(Asym + lrc ~ QB, c0 ~ 1), start = c(53.6, 8.6, 0.51, -0.26, 0.225)) summary(fm1Dial.gnls) ## Modified Data (==> rename it !) ---------------------------------- DialyzerM <- Dialyzer DialyzerM$QBcontr <- 2 * (Dialyzer$QB == 300) - 1 fm1Dial.nls <- nls(rate ~ SSasympOff(pressure, Asym.Int + Asym.QB * QBcontr, lrc.Int + lrc.QB * QBcontr, c0), data = DialyzerM, start = c(Asym.Int = 53.6, Asym.QB = 8.6, lrc.Int = 0.51, lrc.QB = -0.26, c0 = 0.225)) summary(fm1Dial.nls) logLik(fm1Dial.nls) plot(fm1Dial.gnls, resid(.) ~ pressure, abline = 0) fm2Dial.gnls <- update(fm1Dial.gnls, weights = varPower(form = ~ pressure)) anova(fm1Dial.gnls, fm2Dial.gnls) ACF(fm2Dial.gnls, form = ~ 1 | Subject) plot(ACF(fm2Dial.gnls, form = ~ 1 | Subject), alpha = 0.05) fm3Dial.gnls <- update(fm2Dial.gnls, corr = corAR1(0.716, form = ~ 1 | Subject)) fm3Dial.gnls (im3 <- intervals(fm3Dial.gnls)) (a23 <- anova(fm2Dial.gnls, fm3Dial.gnls)) anoC <- cbind(fm2Dial.gnls = c(df=7, AIC= 748.4749, BIC= 769.0664, logLik=-367.2375, L.Ratio=NA, "p-value"=NA), fm3Dial.gnls= c(8, 661.0424, 684.5756, -322.5212, 89.4325, 3.e-21)) # NB: exact p-value irrelevant stopifnot( all.equal(anoC, t(data.matrix(a23)[,rownames(anoC)]), tol = 7e-7) ) nlme/tests/deparse.R0000644000176000001440000002044714251721455014162 0ustar ripleyusers## Tests to make sure that the deparse(as.vector(x)) construction is not ## tripping us up again. library(nlme) options(digits = 7) data(Loblolly) fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc), data = Loblolly, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1, start = c(Asym = 103, R0 = -8.5, lrc = -3.3)) fm1 vcV <- VarCorr(fm1)[,"Variance"] stopifnot( all.equal(fixef(fm1), c(Asym = 101.4496, R0 = -8.6273307, lrc = -3.2337507)) , all.equal(as.numeric(vcV), c(13.3271856, 0.5167634), tol = 1e-6) ) model <- height ~ SSasymp(age, Asym, R0, lrc) fixed <- Asym + R0 + lrc ~ 1 random <- Asym ~ 1 start <- c(Asym = 103, R0 = -8.5, lrc = -3.3) fm2 <- nlme(model, data = Loblolly, fixed = fixed, random = random, start = start) fm2 ## equal apart from 'call' : fm2$call <- fm1$call ## BUT with macOS's Accelerate: ## Component "apVar": Mean relative difference: 7.07812e-05 stopifnot(all.equal(fm1, fm2, tolerance = 1e-15)) ## deparse can give multiple lines ## example from https://stat.ethz.ch/pipermail/r-help/2006-February/086648.html "mydata2" <- structure(list(Tps = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 14, 14, 14, 14, 14, 17, 17, 17, 17, 17, 20, 20, 20, 20, 25, 28, 29, 50, 50, 50, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 14, 14, 14, 14, 14, 17, 17, 17, 17, 17, 20, 20, 20, 20, 25, 28, 29, 50, 50, 50, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 14, 14, 14, 14, 14, 17, 17, 17, 17, 17, 20, 20, 20, 20, 25, 28, 29, 50, 50, 50, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136), Conc = c(0, 0, 0, 0, 0, 0, 0, 0.807852503274902, 0.204371494701886, 0.579222129993907, 0.989062273721619, 0, 1.11728297897571, 1.41057428121324, 0.888883702851307, 1.259907624008, 1.45753269675829, 1.07077516747401, 0.843279379, 0, 0.763110069196737, 1.11297791434297, 1.10087763997637, 0.946929594501016, 1.33112168, 0.654041755, 0.694167499, 1.289548703, 1.117139864, 0.807196192, 0.720221376552025, 0.560082823, 0.476583438, 2.590855204, 0.51510972, 1.072946887, 0.537999938614396, 0.886684225905255, 0.630178116793598, 1.31534758842196, 1.33333958571746, 0.922032210748255, 0.429930193046174, 1.35881467717335, 0.790045927902363, 1.22484702570724, 0.808104508207897, 1.31185966817903, 1.51837686425553, 1.74105163638734, 1.80365598487402, 1.13240352674377, 1.50086243061644, 2.06355364280445, 0.439350890906039, 1.54692793444949, 1.78758216051046, 1.09043400023239, 0.811328376840514, 0.459192443530981, 0.695333473157298, 0.387995007681174, 0.784627063444921, 1.02282256375842, 0.382687104107726, 0.554290634950242, 0.130420456296453, 0.324194753224919, 0.31106140274139, 0.513473505828888, 0.878620320248701, 1.18404358659996, 0.136926837896477, 0, 0, 0.835588760032974, 0.558617235576616, 1.21002805866839, 0.769381068031404, 1.04514254228094, 0.373251847173678, 0.389005898972802, 0.183141006154896, 0.223596336820146, 0.315526423315647, 0.0930349732768131, 0.169959185212759, 0.161878841748425, 0, 0.0483041009105874, 0, 0, 0, 0.0777005553478052, 0, 0.153175826795441, 0.0428171049833677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26.564295705327, 5.5893744508169, 7.22612934071834, 36.6563989567777, 0, 28.8967184437329, 28.4030370337251, 28.0886043901352, 26.1230935842208, 28.8895673910072, 42.6814210131968, 32.3555695551062, 0.76883326657205, 34.6159136622156, 38.329242204291, 56.4476583636484, 26.6249506083603, 31.3001451026823, 23.7339071829084, 23.3702284599355, 36.669903715038, 44.7377244306005, 31.2079335923023, 32.8613384312272, 29.4259634309146, 45.6112405959009, 48.1231689836687, 55.0037961570027, 32.9822316456421, 20.0382768189682, 26.0986380308655, 28.8915584506145, 28.7949023823068, 30.0278417498425, 58.8089779973569, 20.3602570111197, 29.6269605259023, 28.4404986724604, 30.2165182590977, 19.9204461889074, 31.1019196559556, 30.3847467747055, 36.8726911479995, 51.0618036275519, 23.5408013442579, 36.6948355347593, 27.4753860809429, 24.1341667099646, 27.5411488989643, 35.9021799354022, 19.7417897046158, 31.1403887303244, 46.1743622734049, 34.8235854891765, 22.1714704189293, 33.6805966894274, 35.2814908686112, 42.9767437212852, 38.1264997164547, 5.3651357974451, 42.8990434918385, 25.4908883698364, 25.99649502, 36.4958105490917, 40.8004126550705, 5.36867162116895, 0.00898476265269363, 0, 27.6810997945798, 28.7918300045713, 45.7577183830352, 35.9276318604787, 34.9717618087238, 29.620354272564, 24.6537513599869, 13.5363982464958, 25.8289073574818, 12.0090406245759, 4.753436805, 11.849214652228, 8.41410147611612, 0, 1.80855352862552, 1.1987530031681, 1.01148025243171, 0.495675369574172, 1.62701127228732, 0, 16.6288242287241, 1.23656061354912, 0.323708776035328, 0, 0.566916625204436, 0, 0, 0, 0, 0, 0, 0, 2.53578781871283, 3.50083667130797, 0, 0.98049572179098, 0, 3.57129673217304, 2.77298867949388, 2.12302645642669, 4.11923869203499, 4.69069462193674, 2.8698666062651, 2.05079837323067, 0.0602771574448942, 5.96454350250626, 2.26267114439802, 3.06911285674854, 2.04233129537404, 2.62181873844029, 1.51813653072598, 1.46193772981073, 2.69864635755833, 3.44016493913122, 2.50834832469627, 3.48170744166168, 1.00637581555435, 1.67065398473081, 4.18855363095027, 3.39649762611015, 1.72804613460423, 1.40053679329531, 2.37032387724109, 3.19332545080983, 2.49474373894248, 2.17800931288708, 2.7601484443213, 0.91266104095844, 1.93485048639199, 1.19692593420788, 1.79537330666258, 2.14020930767983, 3.0122526724942, 2.81112226980754, 3.54890724398174, 3.01022926452999, 2.38263226710738, 3.53569238341869, 3.47869329713911, 0.679333339820719, 2.4764260756438, 3.82615100065366, 2.20449890383871, 1.371303113329, 1.2427787019995, 1.73319133880954, 0.391268883238408, 1.73610193837913, 2.68494324646718, 1.77065393606844, 1.45079980147062, 0.763775702906329, 0.98566725668627, 0.37838763208699, 0.841811919286804, 1.46436462204795, 1.98409602726, 0.507005887891038, 0.465515668274195, 0, 1.873365675227, 1.69023864630648, 2.65530855919137, 2.34392199908302, 1.61917643594837, 1.05165934333345, 0.564642823436471, 0.121621029620328, 0.515007625737071, 0.524345809084086, 0.130898614090571, 0.332427740242623, 0.110214989555118, 0, 0.128642193589, 0.119407067173878, 0.128926224027295, 0.0622331866694357, 0.215645168287442, 0, 0.859343941945178, 0.0500810300696456, 0, 0, 0.0628746592609754), Organ = structure(rep(c(1L,3L,2L), each=100), .Label = c("Carc", "TD", "Foie"), class = c("ordered", "factor"))), row.names = as.character(1:300), class = c("nfnGroupedData", "nfGroupedData", "groupedData", "data.frame"), formula = quote(Conc ~ Tps | Organ), FUN = function (x) max(x, na.rm = TRUE), order.groups = TRUE) mydata2$Dose <- 100 mymod3 <- nlsList(Conc+1 ~ Dose * exp(lKe+lKa-lCl) * (exp(-exp(lKe)*Tps)-exp(-exp(lKa)*Tps)) /(exp(lKa)-exp(lKe)) | Organ, data=mydata2, start= c(lKe=-2.77, lKa=-1.41, lCl=-1.13)) mymod3 (sm3 <- summary(mymod3)) stopifnot( all.equal(coef(sm3), array(c(-5.0742843, -3.0284227, -2.9006161, 2.9998357, 1.7851301, 0.26206915, -1.6915208, -1.6964717, -11.068132, 4.263934e-43, 1.4546246e-17, 4.9468128e-09, -0.18001926, -0.67150218, -1.3685062, 2.9213761, 1.6846644, 0.22295774, -0.061621391, -0.39859699, -6.1379624, 0.37741845, 0.015884023, 0.0005718832, -1.1485352, 0.086542979, -2.2452234, 2.769282, 1.177223, 0.13378181, -0.41474113, 0.073514514, -16.782726, 3.9250025e-08, 0.65176229, 4.8777767e-16), dim = c(3L, 4L, 3L), dimnames = list(c("Carc", "TD", "Foie"), c("Estimate", "Std. Error", "t value", "Pr(>|t|)"), c("lKe", "lKa", "lCl"))), tolerance = 1e-7) ) nlme/tests/ss2.rds0000644000176000001440000001127214251721455013631 0ustar ripleyusers\{tTչ RQ@2s3^YgPl rˍ 6{&`}!^Z_H%ಊrXZAD^һ>3wB\qf͙w=l 遌@z{q#|?k7Tu<\;M3teg_}<[ggI\1vͣJNդe{xغ‹ÖX|z+ط˭Yo-o7+6eҷW[NJzoeS[Qn?;:SL+}j}J-@sk=Vֽ'ykϣz\u4o;wkgj|_ڛqwgcdud޿35 u\TeәKV<`=q ^gt9^]b/^' W78h\bUܠu6p){^'???n5ioyȘػ-+|},[ v3[-٧[8mKOȥce}얎]{3Gi5-MOrzqk[3^j罼^8n\>맷tOzhti[zubA:]1]g1ÞΫޕpԶh|>ӞZ_yh`ךFi}oo"_?8ީ9 g_>|ɐg[-r)닚w~}ׇ_~}}^}|ݮ^N@FFz+9HoEF{y>c['Ytyׇ_~}ׇ_ߧ>}p $Ӧ5CֈN]efkškdm a:Sî6vх}s)e/9Oȼ_#kGrk`b:0י*谔1[ɮ:Y{g` Ș #{abi?x FzFf< #kvo_r1{`d1#ّYd`ev61f{!6Y_0[3>F xY rY3 ދؼaP8_!_g.]~R>랒 >xvaYQ{>ֵzv+nx-MعFZ̔Պ~L/L9 )<)rRdy2 &*CuKχ%fMpTqII"A6g2S(.+C gL.r|+lTw!=TB?'aTB2_ (QFT8Rv5lQvl Bh6(Q2 i8u Qhl1I1pQh^XG`iGMEmPJ| ;#(GHT6`d:& Lm!,"ULj4"WQ·Ċ"l c]V8*6CXEiY$GvAÊt,Yѱ(ұ:; B`Vp(Cz VrW 4W #TjTĬ:6RWBDF&* Q !dID]w%,Ak!L"侉$Mx~(b Zu75/TAMlo$*)AWWT ѪBhUǴS֧}5LhEZuC#4 k c{MV q>AA̯?jg5Y!WU5<_%R1+>{uۣuUC 3p}&^Lߏ((ZPQ0B8F~*h\/Ŗ{&^8ߚaw S~;)Nw S߳S )P9y,Nnh]gƎ0pe59Y&n<~)K~n_Qًyqāњ^E@_Im|ǁq[)Wpqӣ0?񤐓ͨVEAnf7j_rf;?):J08?}570Z ~*V=]@ g{0 yCXz u'pu*2@_ +V W`G@?wh!w=_,+ lN;W!~qL@\]g]_;]q=ț3U@U r 0e<_O 9- bOw$FW/jاփ ϭ9X>L)%;I OjQXvT)ۗŵ |"?+A~]oЛU3H住 Nlb?+MW_!S]'v #j;0z̓ ~1[)s 7oN*@~xa:V͢b>B<;񅢮97~ s~?C\jB zAo?1EY(]!E !_m7? TJyHzh+cK W- CaQ-~N8}w_̏wS1"?C!*Cr#btm[ܰHb>BPU]Dy~lN]W/UYϊ9u žrG,6pjy/u)m4<4/]ywUGg߱ŧ|_Wg7O5NuJZAh9?XE!)ROkf]A_^: yьi'xzV`F'o]X0aʀi&jׁ~nXP6QG9X93K?h(O6GZP@'`@  `JĀM1)ZXŀNMוI, +Dh8HF<@hD(G$6W,QD Q$ ãS9A5$ў\yDݤ^D:QO,E*D))E5AHiE4*G7Acx zzaz|7B3LuJPR| library(nlme) > > op <- options(digits = 3) # reduce rounding differences > > Ovary[c(1,272), 2] <- NA > fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, + correlation = corAR1(form = ~ 1 | Mare), na.action=na.exclude) > fitted(fm1) 1 2 3 4 5 6 7 8 9 10 11 12 13 NA 12.86 12.06 11.27 10.55 9.96 9.54 9.34 9.36 9.60 10.05 10.67 11.41 14 15 16 17 18 19 20 21 22 23 24 25 26 12.21 13.00 13.71 14.31 14.72 14.93 14.91 14.66 14.21 13.59 12.86 12.06 11.27 27 28 29 30 31 32 33 34 35 36 37 38 39 10.55 9.96 9.54 13.79 13.01 12.14 11.27 10.49 9.86 9.46 9.32 9.45 9.85 40 41 42 43 44 45 46 47 48 49 50 51 52 10.47 11.26 12.13 13.00 13.78 14.41 14.81 14.95 14.81 14.41 13.79 13.01 12.14 53 54 55 56 57 58 59 60 61 62 63 64 65 11.27 10.49 9.86 9.46 13.90 13.10 12.19 11.27 10.45 9.81 9.42 9.32 9.53 66 67 68 69 70 71 72 73 74 75 76 77 78 10.03 10.75 11.62 12.54 13.42 14.17 14.69 14.93 14.87 14.52 13.90 13.10 12.19 79 80 81 82 83 84 85 86 87 88 89 90 91 11.27 10.45 9.81 9.42 13.59 12.86 12.06 11.27 10.55 9.96 9.54 9.34 9.36 92 93 94 95 96 97 98 99 100 101 102 103 104 9.60 10.05 10.67 11.41 12.21 13.00 13.71 14.31 14.72 14.93 14.91 14.66 14.21 105 106 107 108 109 110 111 112 113 114 115 116 117 13.59 12.86 12.06 11.27 10.55 9.96 9.54 13.59 12.86 12.06 11.27 10.55 9.96 118 119 120 121 122 123 124 125 126 127 128 129 130 9.54 9.34 9.36 9.60 10.05 10.67 11.41 12.21 13.00 13.71 14.31 14.72 14.93 131 132 133 134 135 136 137 138 139 140 141 142 143 14.91 14.66 14.21 13.59 12.86 12.06 11.27 10.55 9.96 9.54 13.59 12.86 12.06 144 145 146 147 148 149 150 151 152 153 154 155 156 11.27 10.55 9.96 9.54 9.34 9.36 9.60 10.05 10.67 11.41 12.21 13.00 13.71 157 158 159 160 161 162 163 164 165 166 167 168 169 14.31 14.72 14.93 14.91 14.66 14.21 13.59 12.86 12.06 11.27 10.55 9.96 9.54 170 171 172 173 174 175 176 177 178 179 180 181 182 13.79 13.01 12.14 11.27 10.49 9.86 9.46 9.32 9.45 9.85 10.47 11.26 12.13 183 184 185 186 187 188 189 190 191 192 193 194 195 13.00 13.78 14.41 14.81 14.95 14.81 14.41 13.79 13.01 12.14 11.27 10.49 9.86 196 197 198 199 200 201 202 203 204 205 206 207 208 9.46 13.42 12.73 11.99 11.27 10.61 10.05 9.63 9.38 9.32 9.45 9.77 10.24 209 210 211 212 213 214 215 216 217 218 219 220 221 10.85 11.54 12.27 13.00 13.66 14.22 14.64 14.88 14.94 14.81 14.50 14.02 13.42 222 223 224 225 226 227 228 229 230 231 232 233 234 12.73 11.99 11.27 10.61 10.05 9.63 14.02 13.19 12.24 11.27 10.41 9.75 9.38 235 236 237 238 239 240 241 242 243 244 245 246 247 9.35 9.64 10.24 11.07 12.03 13.00 13.86 14.52 14.88 14.92 14.62 14.02 13.19 248 249 250 251 252 253 254 255 256 257 258 259 260 12.24 11.27 10.41 9.75 9.38 13.59 12.86 12.06 11.27 10.55 9.96 9.54 9.34 261 262 263 264 265 266 267 268 269 270 271 272 273 9.36 9.60 10.05 10.67 11.41 12.21 13.00 13.71 14.31 14.72 14.93 NA 14.66 274 275 276 277 278 279 280 281 282 283 284 285 286 14.21 13.59 12.86 12.06 11.27 10.55 9.96 9.54 13.79 13.01 12.14 11.27 10.49 287 288 289 290 291 292 293 294 295 296 297 298 299 9.86 9.46 9.32 9.45 9.85 10.47 11.26 12.13 13.00 13.78 14.41 14.81 14.95 300 301 302 303 304 305 306 307 308 14.81 14.41 13.79 13.01 12.14 11.27 10.49 9.86 9.46 attr(,"label") [1] "Fitted values" > residuals(fm1) 1 2 3 4 5 6 7 8 NA 2.1439 6.9394 4.7290 2.4488 0.0405 2.4560 4.6618 9 10 11 12 13 14 15 16 3.6412 10.3959 11.9456 4.3270 6.5900 4.7945 1.0049 4.2851 17 18 19 20 21 22 23 24 -0.3066 1.2779 2.0720 3.0927 3.3380 2.7883 0.4069 -0.8561 25 26 27 28 29 30 31 32 -0.0606 2.7290 -0.5512 1.0405 6.4560 -7.7936 -7.0102 -4.1410 33 34 35 36 37 38 39 40 -4.2710 5.5146 0.1390 3.5409 -0.3189 -2.4542 -3.8517 -2.4725 41 42 43 44 45 46 47 48 -3.2559 -6.1251 -4.9951 -6.7808 -5.4051 -8.8070 -10.9472 -9.8119 49 50 51 52 53 54 55 56 -6.4144 -2.7936 -0.0102 -2.1410 -5.2710 -3.4854 -3.8610 -4.4591 57 58 59 60 61 62 63 64 -0.9042 -2.0982 -2.1875 -5.2710 -2.4479 -3.8074 -0.4189 -0.3245 65 66 67 68 69 70 71 72 0.4655 -2.0261 3.2540 1.3838 1.4576 2.5757 5.8338 6.3122 73 74 75 76 77 78 79 80 10.0674 8.1260 4.4817 8.0958 2.9018 8.8125 7.7290 9.5521 81 82 83 84 85 86 87 88 7.1926 14.5811 -4.5931 -3.8561 -5.0606 -5.2710 -3.5512 -3.9595 89 90 91 92 93 94 95 96 -8.5440 -8.3382 -8.3588 -4.6041 -4.0544 -7.6730 -6.4100 -9.2055 97 98 99 100 101 102 103 104 -6.9951 -5.7149 -8.3066 -9.7221 -8.9280 -6.9073 -3.6620 -0.2117 105 106 107 108 109 110 111 112 -5.5931 -3.8561 -2.0606 -4.2710 -3.5512 -3.9595 1.4560 -3.5931 113 114 115 116 117 118 119 120 -0.8561 -0.0606 5.7290 -1.5512 0.0405 -6.5440 2.6618 3.6412 121 122 123 124 125 126 127 128 -0.6041 -6.0544 -3.6730 -7.4100 -0.2055 1.0049 -1.7149 0.6934 129 130 131 132 133 134 135 136 2.2779 0.0720 -1.9073 3.3380 4.7883 -0.5931 -3.8561 -0.0606 137 138 139 140 141 142 143 144 -3.2710 -0.5512 -4.9595 4.4560 2.4069 4.1439 0.9394 5.7290 145 146 147 148 149 150 151 152 4.4488 -0.9595 -1.5440 -4.3382 -0.3588 -1.6041 -2.0544 2.3270 153 154 155 156 157 158 159 160 2.5900 0.7945 1.0049 0.2851 -3.3066 2.2779 6.0720 6.0927 161 162 163 164 165 166 167 168 6.3380 5.7883 3.4069 5.1439 9.9394 -1.2710 0.4488 1.0405 169 170 171 172 173 174 175 176 2.4560 4.2064 -0.0102 1.8590 0.7290 0.5146 -1.8610 -4.4591 177 178 179 180 181 182 183 184 -1.3189 0.5458 1.1483 -0.4725 0.7441 -2.1251 -3.9951 -1.7808 185 186 187 188 189 190 191 192 -0.4051 1.1930 -1.9472 -3.8119 -1.4144 -0.7936 -2.0102 -1.1410 193 194 195 196 197 198 199 200 -3.2710 3.5146 -5.8610 -2.4591 -0.4177 -3.7259 3.0063 3.7290 201 202 203 204 205 206 207 208 1.3930 -2.0471 0.3708 -3.3821 -0.3224 -1.4542 0.2314 -4.2441 209 210 211 212 213 214 215 216 -2.8484 1.4598 -0.2724 -0.9951 1.3409 6.7809 10.3631 6.1159 217 218 219 220 221 222 223 224 6.0562 9.1881 5.5025 5.9780 4.5823 7.2741 8.0063 7.7290 225 226 227 228 229 230 231 232 1.3930 -3.0471 -1.6292 -4.0220 0.8054 -0.2392 -1.2710 -3.4068 233 234 235 236 237 238 239 240 2.2493 0.6179 -1.3452 0.3554 4.7559 3.9285 -0.0269 6.0049 241 242 243 244 245 246 247 248 1.1406 1.4846 0.1159 2.0791 -0.6215 1.9780 1.8054 -1.2392 249 250 251 252 253 254 255 256 -1.2710 -3.4067 -5.7507 -1.3821 -2.5931 3.1439 2.9394 0.7290 257 258 259 260 261 262 263 264 0.4488 -3.9595 1.4560 2.6618 1.6412 6.3959 4.9456 0.3270 265 266 267 268 269 270 271 272 -4.4100 1.7945 7.0049 8.2851 8.6934 6.2779 6.0720 NA 273 274 275 276 277 278 279 280 7.3380 7.7883 3.4069 4.1439 4.9394 5.7290 3.4488 2.0405 281 282 283 284 285 286 287 288 1.4560 -4.7936 -5.0102 -4.1410 -3.2710 -2.4854 -3.8610 -2.4591 289 290 291 292 293 294 295 296 -1.3189 0.5458 0.1483 3.5275 1.7441 -4.1251 -4.9951 -5.7808 297 298 299 300 301 302 303 304 -5.4051 1.1930 -2.9472 -4.8119 -2.4144 -1.7936 -4.0102 -6.1410 305 306 307 308 -2.2710 -3.4854 -4.8610 -4.4591 attr(,"std") [1] NA 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [16] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [31] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [46] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [61] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [76] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [91] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [106] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [121] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [136] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [151] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [166] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [181] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [196] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [211] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [226] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [241] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [256] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [271] 4.58 NA 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [286] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 [301] 4.58 4.58 4.58 4.58 4.58 4.58 4.58 4.58 attr(,"label") [1] "Residuals" > summary(fm1) Generalized least squares fit by REML Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time) Data: Ovary AIC BIC logLik 1560 1579 -775 Correlation Structure: AR(1) Formula: ~1 | Mare Parameter estimate(s): Phi 0.75 Coefficients: Value Std.Error t-value p-value (Intercept) 12.13 0.657 18.46 0.000 sin(2 * pi * Time) -2.68 0.644 -4.16 0.000 cos(2 * pi * Time) -0.86 0.690 -1.25 0.213 Correlation: (Intr) s(*p*T sin(2 * pi * Time) -0.007 cos(2 * pi * Time) -0.295 0.003 Standardized residuals: Min Q1 Med Q3 Max -2.3897 -0.7565 -0.0132 0.6396 3.1830 Residual standard error: 4.58 Degrees of freedom: 306 total; 303 residual > > Orthodont[100:102, 2] <- NA > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, + na.action=na.exclude) > fitted(fm2, 0:1) fixed Subject 1 23.0 25.4 2 24.3 26.7 3 25.6 28.0 4 27.0 29.4 5 23.0 21.6 6 24.3 22.9 7 25.6 24.3 8 27.0 25.6 9 23.0 22.3 10 24.3 23.7 11 25.6 25.0 12 27.0 26.4 13 23.0 24.4 14 24.3 25.7 15 25.6 27.1 16 27.0 28.4 17 23.0 21.3 18 24.3 22.6 19 25.6 23.9 20 27.0 25.3 21 23.0 24.2 22 24.3 25.5 23 25.6 26.9 24 27.0 28.2 25 23.0 21.9 26 24.3 23.2 27 25.6 24.6 28 27.0 25.9 29 23.0 22.0 30 24.3 23.4 31 25.6 24.7 32 27.0 26.0 33 23.0 23.1 34 24.3 24.4 35 25.6 25.8 36 27.0 27.1 37 23.0 26.9 38 24.3 28.2 39 25.6 29.5 40 27.0 30.9 41 23.0 21.8 42 24.3 23.1 43 25.6 24.5 44 27.0 25.8 45 23.0 22.3 46 24.3 23.7 47 25.6 25.0 48 27.0 26.4 49 23.0 22.3 50 24.3 23.7 51 25.6 25.0 52 27.0 26.4 53 23.0 22.9 54 24.3 24.2 55 25.6 25.6 56 27.0 26.9 57 23.0 23.7 58 24.3 25.1 59 25.6 26.4 60 27.0 27.8 61 23.0 21.3 62 24.3 22.6 63 25.6 23.9 64 27.0 25.3 65 20.7 19.5 66 22.0 20.9 67 23.4 22.2 68 24.7 23.6 69 20.7 20.9 70 22.0 22.3 71 23.4 23.6 72 24.7 25.0 73 20.7 21.6 74 22.0 22.9 75 23.4 24.3 76 24.7 25.6 77 20.7 22.6 78 22.0 23.9 79 23.4 25.2 80 24.7 26.6 81 20.7 20.6 82 22.0 22.0 83 23.4 23.3 84 24.7 24.6 85 20.7 19.3 86 22.0 20.7 87 23.4 22.0 88 24.7 23.4 89 20.7 20.9 90 22.0 22.3 91 23.4 23.6 92 24.7 25.0 93 20.7 21.3 94 22.0 22.6 95 23.4 24.0 96 24.7 25.3 97 20.7 19.8 98 22.0 21.2 99 23.4 22.5 100 NA NA 101 NA NA 102 NA NA 103 23.4 19.7 104 24.7 21.1 105 20.7 23.9 106 22.0 25.2 107 23.4 26.5 108 24.7 27.9 > fitted(fm2) M01 M01 M01 M01 M02 M02 M02 M02 M03 M03 M03 M03 M04 M04 M04 M04 25.4 26.7 28.0 29.4 21.6 22.9 24.3 25.6 22.3 23.7 25.0 26.4 24.4 25.7 27.1 28.4 M05 M05 M05 M05 M06 M06 M06 M06 M07 M07 M07 M07 M08 M08 M08 M08 21.3 22.6 23.9 25.3 24.2 25.5 26.9 28.2 21.9 23.2 24.6 25.9 22.0 23.4 24.7 26.0 M09 M09 M09 M09 M10 M10 M10 M10 M11 M11 M11 M11 M12 M12 M12 M12 23.1 24.4 25.8 27.1 26.9 28.2 29.5 30.9 21.8 23.1 24.5 25.8 22.3 23.7 25.0 26.4 M13 M13 M13 M13 M14 M14 M14 M14 M15 M15 M15 M15 M16 M16 M16 M16 22.3 23.7 25.0 26.4 22.9 24.2 25.6 26.9 23.7 25.1 26.4 27.8 21.3 22.6 23.9 25.3 F01 F01 F01 F01 F02 F02 F02 F02 F03 F03 F03 F03 F04 F04 F04 F04 19.5 20.9 22.2 23.6 20.9 22.3 23.6 25.0 21.6 22.9 24.3 25.6 22.6 23.9 25.2 26.6 F05 F05 F05 F05 F06 F06 F06 F06 F07 F07 F07 F07 F08 F08 F08 F08 20.6 22.0 23.3 24.6 19.3 20.7 22.0 23.4 20.9 22.3 23.6 25.0 21.3 22.6 24.0 25.3 F09 F09 F09 F10 F10 F11 F11 F11 F11 19.8 21.2 22.5 NA NA NA 19.7 21.1 23.9 25.2 26.5 27.9 attr(,"label") [1] "Fitted values (mm)" > residuals(fm2, 0:1) fixed Subject 1 3.0453 0.64827 2 0.7026 -1.69443 3 3.3599 0.96286 4 4.0172 1.62016 5 -1.4547 -0.08111 6 -1.7974 -0.42382 7 -2.6401 -1.26652 8 -0.4828 0.89078 9 0.0453 0.66476 10 -1.7974 -1.17794 11 -1.6401 -1.02064 12 0.5172 1.13665 13 2.5453 1.11786 14 3.2026 1.77515 15 0.8599 -0.56755 16 0.0172 -1.41025 17 -2.9547 -1.25792 18 -0.7974 0.89938 19 -3.1401 -1.44332 20 -0.9828 0.71397 21 1.5453 0.33332 22 1.2026 -0.00938 23 1.3599 0.14791 24 1.5172 0.30521 25 -0.9547 0.09569 26 -2.2974 -1.24701 27 -1.1401 -0.08972 28 -0.4828 0.56758 29 1.0453 1.98796 30 -2.7974 -1.85474 31 -1.1401 -0.19745 32 -1.4828 -0.54015 33 0.0453 -0.08936 34 -3.7974 -3.93206 35 5.3599 5.22523 36 -0.9828 -1.11747 37 4.5453 0.64002 38 3.7026 -0.20268 39 5.3599 1.45461 40 4.5172 0.61191 41 0.0453 1.20342 42 -1.2974 -0.13928 43 -2.1401 -0.98198 44 -1.9828 -0.82469 45 -1.4547 -0.83524 46 -0.7974 -0.17794 47 -1.6401 -1.02064 48 1.0172 1.63665 49 -5.9547 -5.33524 50 0.2026 0.82206 51 0.3599 0.97936 52 2.5172 3.13665 53 -0.4547 -0.37390 54 1.2026 1.28340 55 -0.1401 -0.05930 56 -0.9828 -0.90201 57 0.0453 -0.73575 58 0.2026 -0.57846 59 0.3599 -0.42116 60 3.0172 2.23614 61 -0.9547 0.74208 62 -2.7974 -1.10062 63 -2.1401 -0.44332 64 -1.9828 -0.28603 65 0.3135 1.45594 66 -2.0292 -0.88676 67 -1.8719 -0.72947 68 -1.7146 -0.57217 69 0.3135 0.05543 70 -0.5292 -0.78728 71 0.6281 0.37002 72 0.7854 0.52732 73 -0.1865 -1.09097 74 1.9708 1.06633 75 1.1281 0.22363 76 1.2854 0.38092 77 2.8135 0.93945 78 2.4708 0.59674 79 1.6281 -0.24596 80 1.7854 -0.08866 81 0.8135 0.87862 82 0.9708 1.03592 83 -0.8719 -0.80678 84 -1.2146 -1.14949 85 -0.6865 0.67141 86 -1.0292 0.32870 87 -2.3719 -1.01400 88 -2.2146 -0.85670 89 0.8135 0.55543 90 0.4708 0.21272 91 -0.3719 -0.62998 92 0.2854 0.02732 93 2.3135 1.73223 94 0.9708 0.38953 95 0.1281 -0.45318 96 -0.7146 -1.29588 97 -0.6865 0.16148 98 -1.0292 -0.18122 99 -1.3719 -0.52392 100 NA NA 101 NA NA 102 NA NA 103 -4.3719 -0.74222 104 -5.2146 -1.58492 105 3.8135 0.64666 106 2.9708 -0.19604 107 4.6281 1.46126 108 3.2854 0.11855 > round(residuals(fm2), 2) M01 M01 M01 M01 M02 M02 M02 M02 M03 M03 M03 M03 M04 0.65 -1.69 0.96 1.62 -0.08 -0.42 -1.27 0.89 0.66 -1.18 -1.02 1.14 1.12 M04 M04 M04 M05 M05 M05 M05 M06 M06 M06 M06 M07 M07 1.78 -0.57 -1.41 -1.26 0.90 -1.44 0.71 0.33 -0.01 0.15 0.31 0.10 -1.25 M07 M07 M08 M08 M08 M08 M09 M09 M09 M09 M10 M10 M10 -0.09 0.57 1.99 -1.85 -0.20 -0.54 -0.09 -3.93 5.23 -1.12 0.64 -0.20 1.45 M10 M11 M11 M11 M11 M12 M12 M12 M12 M13 M13 M13 M13 0.61 1.20 -0.14 -0.98 -0.82 -0.84 -0.18 -1.02 1.64 -5.34 0.82 0.98 3.14 M14 M14 M14 M14 M15 M15 M15 M15 M16 M16 M16 M16 F01 -0.37 1.28 -0.06 -0.90 -0.74 -0.58 -0.42 2.24 0.74 -1.10 -0.44 -0.29 1.46 F01 F01 F01 F02 F02 F02 F02 F03 F03 F03 F03 F04 F04 -0.89 -0.73 -0.57 0.06 -0.79 0.37 0.53 -1.09 1.07 0.22 0.38 0.94 0.60 F04 F04 F05 F05 F05 F05 F06 F06 F06 F06 F07 F07 F07 -0.25 -0.09 0.88 1.04 -0.81 -1.15 0.67 0.33 -1.01 -0.86 0.56 0.21 -0.63 F07 F08 F08 F08 F08 F09 F09 F09 F10 F10 0.03 1.73 0.39 -0.45 -1.30 0.16 -0.18 -0.52 NA NA NA -0.74 -1.58 F11 F11 F11 F11 0.65 -0.20 1.46 0.12 attr(,"label") [1] "Residuals (mm)" > summary(fm2) Linear mixed-effects model fit by REML Data: Orthodont AIC BIC logLik 437 450 -213 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev: 1.8 1.44 Fixed effects: distance ~ age + Sex Value Std.Error DF t-value p-value (Intercept) 17.58 0.850 77 20.68 0.0000 age 0.67 0.064 77 10.56 0.0000 SexFemale -2.27 0.762 25 -2.98 0.0064 Correlation: (Intr) age age -0.822 SexFemale -0.357 -0.006 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.7079 -0.5471 -0.0564 0.4666 3.6314 Number of Observations: 105 Number of Groups: 27 > > Soybean[1:5, "Time"] <- NA > fm3 <- gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean, + weights = varPower(), na.action=na.exclude) > fitted(fm3) 1 2 3 4 5 6 7 8 9 10 11 NA NA NA NA NA 7.047 10.958 14.082 15.894 16.756 0.120 12 13 14 15 16 17 18 19 20 21 22 0.298 0.726 1.708 3.724 7.047 10.958 15.894 16.756 0.120 0.298 0.726 23 24 25 26 27 28 29 30 31 32 33 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 34 35 36 37 38 39 40 41 42 43 44 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 45 46 47 48 49 50 51 52 53 54 55 7.047 10.958 15.894 0.120 0.298 0.726 1.708 3.724 7.047 10.958 14.082 56 57 58 59 60 61 62 63 64 65 66 15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047 10.958 15.894 16.756 67 68 69 70 71 72 73 74 75 76 77 0.120 0.298 0.726 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 78 79 80 81 82 83 84 85 86 87 88 0.298 0.726 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 89 90 91 92 93 94 95 96 97 98 99 0.726 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 100 101 102 103 104 105 106 107 108 109 110 1.708 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 111 112 113 114 115 116 117 118 119 120 121 3.724 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 122 123 124 125 126 127 128 129 130 131 132 7.047 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047 133 134 135 136 137 138 139 140 141 142 143 10.958 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047 10.958 144 145 146 147 148 149 150 151 152 153 154 14.082 15.894 16.756 0.120 0.298 0.726 1.708 3.724 7.047 10.958 14.082 155 156 157 158 159 160 161 162 163 164 165 15.894 16.756 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 166 167 168 169 170 171 172 173 174 175 176 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 177 178 179 180 181 182 183 184 185 186 187 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 188 189 190 191 192 193 194 195 196 197 198 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 199 200 201 202 203 204 205 206 207 208 209 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 210 211 212 213 214 215 216 217 218 219 220 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 221 222 223 224 225 226 227 228 229 230 231 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 232 233 234 235 236 237 238 239 240 241 242 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 243 244 245 246 247 248 249 250 251 252 253 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 254 255 256 257 258 259 260 261 262 263 264 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 265 266 267 268 269 270 271 272 273 274 275 3.355 10.419 15.706 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 276 277 278 279 280 281 282 283 284 285 286 17.127 0.120 0.262 0.640 1.517 3.355 10.419 15.706 17.127 0.137 0.385 287 288 289 290 291 292 293 294 295 296 297 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 298 299 300 301 302 303 304 305 306 307 308 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 309 310 311 312 313 314 315 316 317 318 319 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 320 321 322 323 324 325 326 327 328 329 330 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 331 332 333 334 335 336 337 338 339 340 341 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 342 343 344 345 346 347 348 349 350 351 352 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 353 354 355 356 357 358 359 360 361 362 363 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 364 365 366 367 368 369 370 371 372 373 374 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 375 376 377 378 379 380 381 382 383 384 385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 386 387 388 389 390 391 392 393 394 395 396 8.166 14.418 16.897 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 397 398 399 400 401 402 403 404 405 406 407 0.137 0.385 0.932 2.157 4.121 8.166 14.418 16.897 0.137 0.385 0.932 408 409 410 411 412 2.157 4.121 8.166 14.418 16.897 attr(,"label") [1] "Fitted values (g)" > residuals(fm3) 1 2 3 4 5 6 7 8 NA NA NA NA NA -0.81724 -2.24772 -0.73203 9 10 11 12 13 14 15 16 0.44774 0.99485 -0.01627 -0.02870 0.05209 0.41153 -0.79366 -1.75724 17 18 19 20 21 22 23 24 -1.45772 1.07274 0.99072 -0.01227 -0.00670 -0.05891 0.34153 0.08634 25 26 27 28 29 30 31 32 -0.91724 -0.67772 3.99797 4.28854 5.05482 -0.01527 0.00130 0.11809 33 34 35 36 37 38 39 40 -0.38847 -1.48366 -2.36724 -2.13772 1.00797 -1.23396 -2.75138 -0.01927 41 42 43 44 45 46 47 48 -0.02470 0.12209 0.24153 1.04634 -1.03724 -1.04772 3.36834 -0.01427 49 50 51 52 53 54 55 56 0.03930 -0.02691 -0.17847 0.14634 -1.44724 -1.52772 -0.35203 1.48684 57 58 59 60 61 62 63 64 3.17632 -0.01827 -0.02270 0.04109 -0.25847 0.22634 -2.10724 -1.31772 65 66 67 68 69 70 71 72 1.98604 0.96822 -0.01727 -0.02470 0.01609 -0.29847 -0.71366 -1.78724 73 74 75 76 77 78 79 80 -1.14772 -1.23203 2.32021 2.92402 0.01073 0.04030 -0.02491 -0.04847 81 82 83 84 85 86 87 88 0.52634 2.19276 1.19228 2.69797 0.03104 0.51632 0.00773 0.10630 89 90 91 92 93 94 95 96 0.17109 0.07153 0.18634 0.35276 -0.88772 4.77797 1.11774 10.61402 97 98 99 100 101 102 103 104 0.01073 0.08130 0.40009 0.73153 0.16634 -0.13724 1.53228 1.58797 105 106 107 108 109 110 111 112 7.86934 4.73482 0.03373 0.05930 0.45509 0.12153 0.98634 3.66276 113 114 115 116 117 118 119 120 -1.04772 1.42797 -0.93606 5.04402 0.01873 0.03030 0.20609 0.28153 121 122 123 124 125 126 127 128 -0.26366 -0.02724 0.83228 1.74797 0.02687 0.68572 0.01873 0.09130 129 130 131 132 133 134 135 136 0.36809 0.42153 0.31634 0.57276 1.52228 3.84797 -1.47226 13.51572 137 138 139 140 141 142 143 144 0.02473 0.06830 0.07309 -0.09847 -0.21366 -0.25724 -1.00772 0.45797 145 146 147 148 149 150 151 152 3.38604 5.81675 0.00973 0.05730 0.36409 0.57153 0.21634 -2.08724 153 154 155 156 157 158 159 160 -0.03772 -0.06203 2.10024 5.61482 -0.07327 -0.12571 -0.36726 -0.53373 161 162 163 164 165 166 167 168 -1.55813 -6.30167 -4.66844 -6.72407 -0.08527 -0.14971 -0.37209 -0.46373 169 170 171 172 173 174 175 176 -1.63980 -3.69048 -5.39225 -6.03907 -0.07627 -0.11571 -0.27959 -0.74206 177 178 179 180 181 182 183 184 -1.71313 -6.67048 -4.83058 -1.09990 -0.07127 -0.16471 -0.41259 -0.68373 185 186 187 188 189 190 191 192 -2.00080 -4.43048 -5.12058 -6.21597 -0.08127 -0.14071 -0.36842 -0.85873 193 194 195 196 197 198 199 200 -0.96480 -4.93548 -5.76891 -8.23907 -0.09127 -0.16971 -0.38909 -0.97539 201 202 203 204 205 206 207 208 -2.29313 -5.58881 -9.43391 -8.54407 -0.07927 -0.11671 -0.23476 -0.75706 209 210 211 212 213 214 215 216 -1.86147 -4.17048 -4.59388 -8.24740 -0.08227 -0.13471 -0.29992 -0.52306 217 218 219 220 221 222 223 224 -1.07313 -1.91281 -6.73225 -5.49540 -0.05027 -0.05371 -0.03926 0.38461 225 226 227 228 229 230 231 232 -0.38980 -2.27548 -0.00558 2.76090 -0.05227 -0.00971 -0.05959 0.49694 233 234 235 236 237 238 239 240 -0.68147 -1.61881 -1.22058 5.51590 -0.04327 -0.03771 -0.29876 0.22294 241 242 243 244 245 246 247 248 1.16920 1.23789 4.61112 4.27460 -0.02127 -0.06371 -0.14892 -0.31206 249 250 251 252 253 254 255 256 -0.55480 -3.05548 -0.56391 0.05927 -0.05227 -0.02971 -0.20409 -0.07373 257 258 259 260 261 262 263 264 -0.09480 -2.21048 3.70112 -1.46573 -0.05727 -0.05271 0.10074 -0.24873 265 266 267 268 269 270 271 272 0.53520 -1.32681 -1.21558 1.96760 0.01273 0.04129 0.47691 0.66294 273 274 275 276 277 278 279 280 0.18187 2.74119 0.08442 -2.35240 -0.03927 -0.00671 0.12474 -0.42373 281 282 283 284 285 286 287 288 -0.30313 -2.31381 8.71842 1.79090 -0.02776 -0.00104 0.23005 0.18344 289 290 291 292 293 294 295 296 -1.25117 1.37221 -1.73490 1.73667 -0.04196 -0.04654 -0.17329 0.36344 297 298 299 300 301 302 303 304 -1.60284 -3.04945 -5.84320 -2.72333 -0.04896 0.22830 0.38338 0.86511 305 306 307 308 309 310 311 312 1.72883 -0.74945 -3.08650 -0.01333 -0.04824 0.21180 0.14338 0.91844 313 314 315 316 317 318 319 320 -0.16284 -2.13279 -3.98153 0.90664 -0.03566 -0.00954 0.99005 0.05011 321 322 323 324 325 326 327 328 0.64383 0.97388 1.42180 1.21164 -0.02720 0.09846 0.37505 1.79844 329 330 331 332 333 334 335 336 0.18383 -0.13445 1.66513 2.67664 -0.03402 0.02963 0.73171 -0.76656 337 338 339 340 341 342 343 344 -1.11950 -1.32112 1.79180 2.17664 -0.06027 -0.01304 -0.18662 0.09011 345 346 347 348 349 350 351 352 0.37383 -2.49112 1.72680 2.03504 0.01178 0.30213 0.64005 1.65677 353 354 355 356 357 358 359 360 0.69050 3.48721 2.95850 1.00004 0.01680 0.20930 0.26838 0.98844 361 362 363 364 365 366 367 368 -0.31784 -0.74945 -0.83820 3.96334 -0.01280 0.36546 0.52671 3.60177 369 370 371 372 373 374 375 376 1.87550 0.80555 2.65350 0.92004 0.04150 0.49596 0.45005 1.47178 377 378 379 380 381 382 383 384 1.07217 -2.97612 1.36180 4.64501 0.00218 0.07096 0.65171 1.89844 385 386 387 388 389 390 391 392 0.38883 -0.00445 4.29680 1.05834 0.02574 0.38880 0.04338 1.35511 393 394 395 396 397 398 399 400 0.38883 -0.38279 3.70013 -0.94999 -0.02653 0.07113 0.43838 -0.01156 401 402 403 404 405 406 407 408 1.70883 0.63721 -2.18320 0.88834 0.00904 0.17880 0.54671 0.44511 409 410 411 412 2.22216 -2.03445 1.99350 0.05004 attr(,"std") [1] NA NA NA NA NA 2.0514 3.0228 3.7679 4.1905 4.3895 [11] 0.0575 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 4.1905 4.3895 0.0575 [21] 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 [31] 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 [41] 0.1274 0.2786 0.5909 1.1714 2.0514 3.0228 4.1905 0.0575 0.1274 0.2786 [51] 0.5909 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 [61] 0.5909 1.1714 2.0514 3.0228 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [71] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [81] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [91] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [101] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [111] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [121] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [131] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [141] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1274 0.2786 0.5909 [151] 1.1714 2.0514 3.0228 3.7679 4.1905 4.3895 0.0575 0.1137 0.2495 0.5324 [161] 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 [171] 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 [181] 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 [191] 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 [201] 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 [211] 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 [221] 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 [231] 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 [241] 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 [251] 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 [261] 0.0575 0.1137 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 [271] 0.2495 0.5324 1.0689 2.8919 4.1469 4.4749 0.0575 0.1137 0.2495 0.5324 [281] 1.0689 2.8919 4.1469 4.4749 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 [291] 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 [301] 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 [311] 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 [321] 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 [331] 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 [341] 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 [351] 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 [361] 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 [371] 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 [381] 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 [391] 0.3469 0.7251 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 [401] 1.2806 2.3348 3.8468 4.4219 0.0644 0.1596 0.3469 0.7251 1.2806 2.3348 [411] 3.8468 4.4219 attr(,"label") [1] "Residuals (g)" > summary(fm3) Generalized nonlinear least squares fit Model: weight ~ SSlogis(Time, Asym, xmid, scal) Data: Soybean AIC BIC logLik 987 1007 -489 Variance function: Structure: Power of variance covariate Formula: ~fitted(.) Parameter estimates: power 0.878 Coefficients: Value Std.Error t-value p-value Asym 17.4 0.525 33.1 0 xmid 51.9 0.598 86.8 0 scal 7.6 0.142 54.0 0 Correlation: Asym xmid xmid 0.788 scal 0.488 0.842 Standardized residuals: Min Q1 Med Q3 Max -2.3066 -0.6545 -0.0019 0.5012 4.9676 Residual standard error: 0.369 Degrees of freedom: 407 total; 404 residual > > options(op)# revert when this file is source()d > > proc.time() user system elapsed 0.461 0.085 0.549 nlme/tests/corMatrix.R0000644000176000001440000000245014657673625014520 0ustar ripleyusers## test for PR#16110 library(nlme) Orth <- subset(Orthodont, Subject %in% c("M01","F01")) cs1CompSymm <- corCompSymm(value = 0.3, form = ~ 1 | Subject) cs1CompSymm <- Initialize(cs1CompSymm, data = Orth) ## corFactor should return corMatrix(, corr = FALSE) as a vector Linvt <- corMatrix(cs1CompSymm, corr = FALSE) stopifnot(all.equal(unlist(Linvt, use.names = FALSE), as.vector(corFactor(cs1CompSymm)))) ## failed in 3.1-145 because the corFactor.corCompSymm method was ## misnamed corFactor.compSymm (a non-existent class), such that the ## general corFactor.corStruct method was called instead, which returned ## a different solution for the (transpose inverse) square-root factor ## test corMatrix() with spatial correlation *and* groups coords <- cbind(x = (0:5)/10, y = (0:5)/10, z = (0:5)/10) dists <- dist(coords, method = "manhattan") spatDatGrouped <- data.frame(ID = factor(rep(c("A", "B"), each = nrow(coords))), coords) cs1Exp <- corExp(1, form = ~ x + y + z | ID, metric = "manhattan") cs1Exp <- Initialize(cs1Exp, spatDatGrouped) stopifnot(identical(getCovariate(cs1Exp), list(A = c(dists), B = c(dists)))) cM <- corMatrix(cs1Exp) stopifnot(exprs = { identical(cM[[1]], cM[[2]]) cM[[1]][lower.tri(cM[[1]])] == exp(-dists) }) nlme/tests/deviance.R0000644000176000001440000000233214634264536014315 0ustar ripleyuserslibrary(nlme) ## ==> ~/R/Pkgs/MASS_CRAN/tests/lme.R : tests stepAIC() for *both* lme and gls if (!require(MASS)) q("no") ## deviance.lme() and extractAIC.lme() : set.seed(321) # to be sure a <- data.frame( resp=rnorm(250), cov1=rnorm(250), cov2=rnorm(250), group=rep(letters[1:10],25) ) mod1 <- lme(resp~cov1, a, ~cov1|group, method="ML") mod2 <- stepAIC(mod1, scope = list(upper=~(cov1+cov2)^2, lower=~1) ) stopifnot(all.equal(logLik(mod1), logLik(mod2)), all.equal( coef(mod1), coef(mod2)), all.equal(logLik(mod2), structure(-344.190316608, class = "logLik", nall = 250L, nobs = 250, df = 6))) ## deviance.gls() and extractAIC.gls() : data(beav2, package = "MASS") set.seed(123) beav <- beav2; beav$dummy <- rnorm(nrow(beav)) beav.gls <- gls(temp ~ activ + dummy, data = beav, corr = corAR1(0.8), method = "ML") stopifnot(all.equal(sigma(beav.gls), 0.2516395, tol = 1e-6), all.equal(coef(beav.gls), c("(Intercept)" = 37.191057, activ = 0.61602059, dummy =0.006842112))) st.beav <- stepAIC(beav.gls) stopifnot(all.equal(coef(st.beav), c("(Intercept)" = 37.1919453124, "activ" = 0.614177660082)), all.equal(sigma(st.beav), 0.2527856, tol = 1e-6)) nlme/tests/lme.R0000644000176000001440000001055014301417046013300 0ustar ripleyuserslibrary(nlme) options(digits = 6)# <==> less platform dependency in print() output if(!dev.interactive(orNone=TRUE)) pdf("test_lme.pdf") fm1 <- lmList(Oxboys) fm1 fm2 <- lme(fm1) fm2 vc2 <- VarCorr(fm2) stopifnot( all.equal(fixef(fm2), c("(Intercept)" = 149.371753, age = 6.52546866), tol=1e-8), all.equal(as.numeric(vc2[,"StdDev"]), c(8.081077, 1.680717, 0.659889), tol=4e-7)) # bug report from Arne.Mueller@sanofi-aventis.com mod <- distance ~ age + Sex fm3 <- lme(mod, Orthodont, random = ~ 1) pm3 <- predict(fm3, Orthodont) stopifnot(all.equal(mean(pm3), 24.023148148), all.equal( sd(pm3), 2.4802195115), all.equal(quantile(pm3), c("0%" = 17.0817792, "25%" = 22.3481813, "50%" = 23.9271016, "75%" = 25.5740014, "100%"= 30.8662241))) ## bug report and fix from Dimitris Rizopoulos and Spencer Graves: ## when 'returnObject = TRUE', do not stop() but give warning() on non-convergence: tools::assertWarning( fm1 <- lme(distance ~ age, data = Orthodont, control = lmeControl(msMaxIter = 1, returnObject = TRUE)) ) ## "typo" in 'random=' -- giving 27-dim. vector random effect: ## PR#17524 B.Tyner: https://bugs.r-project.org/show_bug.cgi?id=17524 try(lme(distance ~ 1, data=Orthodont, random = ~ Subject)) tools::assertError(lme(distance ~ age, data=Orthodont, random = ~ Subject)) ## seg.faults in nlme <= 3.1-137 (2018) because of integer overflow ## The previous warning is now an *error* (unless new lmeControl(allow.n.lt.q=TRUE)) ## based on bug report on R-help (p3.1 <- predict(fm3, Orthodont[1,])) # failed in 3.1-88 stopifnot(all.equal(pm3[1], p3.1, check.attributes=FALSE, tolerance = 1e-14)) ## Intervals failed in a patch proposal (Nov.2015): (fm4 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)) i4 <- intervals(fm4) ## from dput(signif(i4$reStruct$Subject, 8)) ## R-devel 2016-01-11; 64-bit : reSS <- data.frame(lower = c(0.9485605, 0.10250901, -0.93825047), est. = c(2.3270341, 0.22642779, -0.60933286), upper = c(5.7087424, 0.50014674, 0.29816857)) ## R-devel 2016-01-11; 32-bit : ## reSS <- data.frame(lower = c(0.94962127,0.10262181, -0.93804767), ## est. = c(2.3270339, 0.22642779, -0.60933284), ## upper = c(5.7023648, 0.49959695, 0.29662651)) rownames(reSS) <- rownames(i4$reStruct$Subject) sm4 <- summary(fm4) stopifnot( all.equal(fixef(fm4), c("(Intercept)" = 16.761111, age = 0.66018519)), identical(fixef(fm4), sm4$tTable[,"Value"]), all.equal(sm4$tTable[,"Std.Error"], c("(Intercept)" = 0.77524603, age = 0.071253264), tol=6e-8), all.equal(i4$reStruct$Subject[,"est."], reSS[,"est."], tol= 1e-7) ## (lower, upper) cannot be very accurate for these : ==> tol = *e-4 ,## "interestingly" 32-bit values changed from 3.2.3 to R-devel(3.3.0): all.equal(i4$reStruct$Subject[,c(1,3)], reSS[,c(1,3)], tol = .005) , all.equal(as.vector(i4$sigma), ## lower est. upper c(1.0849772, 1.3100397, 1.5817881), tol=8e-4) , all.equal(as.vector(i4$fixed), as.vector(rbind(c(15.218322, 16.761111, 18.3039), c(0.51838667, 0.66018519, 0.8019837))), tol = 1e-6) ) ## wrong results from getData: ss2 <- readRDS("ss2.rds") m1 <- lme(PV1MATH ~ ESCS + Age +time , random = ~ time|SCHOOLID, data = ss2, weights = varIdent(form=~1|time), corr = corCompSymm(form=~1|SCHOOLID/StIDStd), na.action = na.omit) plot(m1, resid(.) ~ WEALTH) m2 <- lme(PV1MATH ~ ESCS + Age +time , random = ~ time|SCHOOLID, data = ss2, weights = varIdent(form=~1|time), corr = corCompSymm(form=~1|SCHOOLID/StIDStd), na.action = na.omit) plot(m2, resid(.) ~ WEALTH) ## Variogram() failing in the case of 1-observation groups (PR#17192): BW <- subset(BodyWeight, ! (Rat=="1" & Time > 1)) if(interactive()) print( xtabs(~ Rat + Time, data = BW) )# Rat '1' only at Time == 1 fm2 <- lme(fixed = weight ~ Time * Diet, random = ~ 1 | Rat, data = BW) Vfm2 <- Variogram(fm2, form = ~ Time | Rat) stopifnot(is.data.frame(Vfm2), identical(dim(Vfm2), c(19L, 3L)), all.equal(unlist(Vfm2[10,]), c(variog = 1.08575384191148, dist = 22, n.pairs = 15)) ) ## failed in nlme from 3.1-122 till 3.1-128 nlme/tests/contrMat.R0000644000176000001440000000507014251721455014321 0ustar ripleyusers## problem reported by Christian Ritz on R-help, Tue, 20 Mar 2007 14:55:38 ## Dataset PestSci from package drc [w/ 'CURVE' as factor] PestSci <- data.frame(CURVE = gl(5, 21), HERBICIDE = rep(c("bentazon", "diuron"), times = c(63, 42)), DOSE = rep(c(0, 0.62, 1.85, 5.56, 16.67, 50, 150, 0, 0.62, 1.85, 5.56, 16.67, 50, 150, 0, 0.15, 0.59, 2.34, 9.38, 37.5, 150, 0, 0.01, 0.03, 0.1, 0.3, 1, 3, 0, 0.01, 0.03, 0.1, 0.3, 1, 3), each = 3), SLOPE = c(1.81295, 1.86704, 1.95606, 1.39073, 1.15721, 1.06126, 0.99409, 0.83298, 0.8334, 0.72513, 0.69548, 0.65299, 0.49855, 0.36873, 0.42617, 0.26666, 0.26896, 0.25989, 0.16074, 0.16404, 0.1475, 1.02654, 0.91306, 0.89371, 0.59074, 0.669, 0.5965, 0.37561, 0.44823, 0.42093, 0.31874, 0.27342, 0.2725, 0.27182, 0.21752, 0.19981, 0.17332, 0.17949, 0.15623, 0.12855, 0.14524, 0.11533, 1.03872, 1.0917, 1.10324, 0.94274, 0.91256, 1.02352, 0.78689, 0.69706, 0.65989, 0.5372, 0.51324, 0.54981, 0.37401, 0.34033, 0.32491, 0.30518, 0.24593, 0.289, 0.17414, 0.12275, 0.14788, 2.20963, 2.27931, 2.14703, 2.18831, 2.08863, 2.06676, 2.18827, 2.10748, 1.84474, 1.78805, 1.75547, 1.61381, 0.70295, 0.6983, 0.74045, 0.20673, 0.20784, 0.22402, 0.05268, 0.06519, 0.09258, 1.94033, 1.80193, 1.71586, 1.71586, 1.98471, 1.74905, 1.87795, 1.64081, 1.53094, 1.50709, 1.41035, 1.35367, 0.64427, 0.62185, 0.60337, 0.14073, 0.12928, 0.15016, 8e-05, 0.00262, 0.00303)) library(nlme) sv <- c(0.43355869, 2.49963220, 0.05861799, 1.73290589, 0.38153146, 0.24316978) ## bug only triggered from the " factor(.) " below: fm <- nlme(SLOPE ~ c + (d-c)/(1+exp(b*(log(DOSE)-log(e)))), fixed = list(b ~ factor(HERBICIDE)-1, c ~ 1, d ~ 1, e ~ factor(HERBICIDE)-1), random = d ~ 1 | CURVE, start = sv, data = PestSci) fm ## failed in contrMat / contr.treatment in 3.1-78 stopifnot( all.equal(as.numeric(VarCorr(fm)[,"StdDev"]), c(0.46996772, 0.07139796), tol = 5e-5) , all.equal(as.numeric(fixef(fm)), c(0.563538644, 1.7912626, 0.0519817224, 1.57545308, 1.5714210, 0.201112468), tol = 1e-7) ) (sfm <- summary(fm)) cfT <- sfm$tTable stopifnot(is.matrix(cfT), identical(cfT[,"Value"], fixef(fm)), all.equal(as.vector(cfT[,"Std.Error"]), c(0.0363115, 0.106345, 0.022107, 0.217066, 0.191389, 0.00771419), tol = 5e-5) , all.equal(as.numeric(sfm[c("AIC", "BIC", "logLik")]), c(-211.36462, -190.13294, 113.68231), tol = 1e-7) ) nlme/tests/extras/0000755000176000001440000000000014772475235013725 5ustar ripleyusersnlme/tests/extras/scripts.Rout.save0000644000176000001440000070227514611514607017226 0ustar ripleyusers R Under development (unstable) (2024-04-16 r86430) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## run reproduction scripts from the NLME book chapters > testdir <- system.file("scripts", package = "nlme", mustWork = TRUE) > scripts <- dir(testdir, pattern = "^ch[0-9]*\\.R$") > for(f in scripts) { + writeLines(c("", strrep("=", nchar(f)), basename(f), strrep("=", nchar(f)))) + set.seed(3) + options(warn = 1) # chapters set digits + source(file.path(testdir, f), echo = TRUE, + max.deparse.length = Inf, keep.source = TRUE) + } ====== ch01.R ====== > #-*- R -*- > > library(nlme) > pdf(file = 'ch01.pdf') > options( width = 65, digits = 5 ) > options( contrasts = c(unordered = "contr.helmert", ordered = "contr.poly") ) > # Chapter 1 Linear Mixed-Effects Models: Basic Concepts and Examples > > # 1.1 A Simple Example of Random Effects > > Rail Grouped Data: travel ~ 1 | Rail Rail travel 1 1 55 2 1 53 3 1 54 4 2 26 5 2 37 6 2 32 7 3 78 8 3 91 9 3 85 10 4 92 11 4 100 12 4 96 13 5 49 14 5 51 15 5 50 16 6 80 17 6 85 18 6 83 > fm1Rail.lm <- lm( travel ~ 1, data = Rail ) > fm1Rail.lm Call: lm(formula = travel ~ 1, data = Rail) Coefficients: (Intercept) 66.5 > fm2Rail.lm <- lm( travel ~ Rail - 1, data = Rail ) > fm2Rail.lm Call: lm(formula = travel ~ Rail - 1, data = Rail) Coefficients: Rail2 Rail5 Rail1 Rail6 Rail3 Rail4 31.7 50.0 54.0 82.7 84.7 96.0 > fm1Rail.lme <- lme(travel ~ 1, data = Rail, random = ~ 1 | Rail) > summary( fm1Rail.lme ) Linear mixed-effects model fit by REML Data: Rail AIC BIC logLik 128.18 130.68 -61.089 Random effects: Formula: ~1 | Rail (Intercept) Residual StdDev: 24.805 4.0208 Fixed effects: travel ~ 1 Value Std.Error DF t-value p-value (Intercept) 66.5 10.171 12 6.5382 0 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.618827 -0.282177 0.035693 0.219558 1.614377 Number of Observations: 18 Number of Groups: 6 > fm1Rail.lmeML <- update( fm1Rail.lme, method = "ML" ) > summary( fm1Rail.lmeML ) Linear mixed-effects model fit by maximum likelihood Data: Rail AIC BIC logLik 134.56 137.23 -64.28 Random effects: Formula: ~1 | Rail (Intercept) Residual StdDev: 22.624 4.0208 Fixed effects: travel ~ 1 Value Std.Error DF t-value p-value (Intercept) 66.5 9.554 12 6.9604 0 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.610981 -0.288870 0.034542 0.213728 1.622223 Number of Observations: 18 Number of Groups: 6 > plot( fm1Rail.lme ) # produces Figure 1.4 > intervals( fm1Rail.lme ) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 44.339 66.5 88.661 Random Effects: Level: Rail lower est. upper sd((Intercept)) 13.274 24.805 46.353 Within-group standard error: lower est. upper 2.6950 4.0208 5.9987 > anova( fm1Rail.lme ) numDF denDF F-value p-value (Intercept) 1 12 42.748 <.0001 > # 1.2 A Randomized Block Design > > plot.design( ergoStool ) # produces Figure 1.6 > contrasts( ergoStool$Type ) [,1] [,2] [,3] T1 -1 -1 -1 T2 1 -1 -1 T3 0 2 -1 T4 0 0 3 > ergoStool1 <- ergoStool[ ergoStool$Subject == "1", ] > model.matrix( effort ~ Type, ergoStool1 ) # X matrix for Subject 1 (Intercept) Type1 Type2 Type3 1 1 -1 -1 -1 2 1 1 -1 -1 3 1 0 2 -1 4 1 0 0 3 attr(,"assign") [1] 0 1 1 1 attr(,"contrasts") attr(,"contrasts")$Type [1] "contr.helmert" > fm1Stool <- + lme(effort ~ Type, data = ergoStool, random = ~ 1 | Subject) > summary( fm1Stool ) Linear mixed-effects model fit by REML Data: ergoStool AIC BIC logLik 139.49 148.28 -63.743 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev: 1.3325 1.1003 Fixed effects: effort ~ Type Value Std.Error DF t-value p-value (Intercept) 10.2500 0.48052 24 21.3309 0.0000 Type1 1.9444 0.25934 24 7.4976 0.0000 Type2 0.0926 0.14973 24 0.6184 0.5421 Type3 -0.3426 0.10588 24 -3.2358 0.0035 Correlation: (Intr) Type1 Type2 Type1 0 Type2 0 0 Type3 0 0 0 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.802003 -0.643166 0.057831 0.700997 1.631421 Number of Observations: 36 Number of Groups: 9 > anova( fm1Stool ) numDF denDF F-value p-value (Intercept) 1 24 455.01 <.0001 Type 3 24 22.36 <.0001 > options( contrasts = c( factor = "contr.treatment", + ordered = "contr.poly" ) ) > contrasts( ergoStool$Type ) T2 T3 T4 T1 0 0 0 T2 1 0 0 T3 0 1 0 T4 0 0 1 > fm2Stool <- + lme(effort ~ Type, data = ergoStool, random = ~ 1 | Subject) > summary( fm2Stool ) Linear mixed-effects model fit by REML Data: ergoStool AIC BIC logLik 133.13 141.93 -60.565 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev: 1.3325 1.1003 Fixed effects: effort ~ Type Value Std.Error DF t-value p-value (Intercept) 8.5556 0.57601 24 14.8531 0.0000 TypeT2 3.8889 0.51868 24 7.4976 0.0000 TypeT3 2.2222 0.51868 24 4.2843 0.0003 TypeT4 0.6667 0.51868 24 1.2853 0.2110 Correlation: (Intr) TypeT2 TypeT3 TypeT2 -0.45 TypeT3 -0.45 0.50 TypeT4 -0.45 0.50 0.50 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.802003 -0.643166 0.057831 0.700997 1.631421 Number of Observations: 36 Number of Groups: 9 > anova( fm2Stool ) numDF denDF F-value p-value (Intercept) 1 24 455.01 <.0001 Type 3 24 22.36 <.0001 > model.matrix( effort ~ Type - 1, ergoStool1 ) TypeT1 TypeT2 TypeT3 TypeT4 1 1 0 0 0 2 0 1 0 0 3 0 0 1 0 4 0 0 0 1 attr(,"assign") [1] 1 1 1 1 attr(,"contrasts") attr(,"contrasts")$Type [1] "contr.treatment" > fm3Stool <- + lme(effort ~ Type - 1, data = ergoStool, random = ~ 1 | Subject) > summary( fm3Stool ) Linear mixed-effects model fit by REML Data: ergoStool AIC BIC logLik 133.13 141.93 -60.565 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev: 1.3325 1.1003 Fixed effects: effort ~ Type - 1 Value Std.Error DF t-value p-value TypeT1 8.5556 0.57601 24 14.853 0 TypeT2 12.4444 0.57601 24 21.605 0 TypeT3 10.7778 0.57601 24 18.711 0 TypeT4 9.2222 0.57601 24 16.011 0 Correlation: TypeT1 TypeT2 TypeT3 TypeT2 0.595 TypeT3 0.595 0.595 TypeT4 0.595 0.595 0.595 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.802003 -0.643166 0.057831 0.700997 1.631421 Number of Observations: 36 Number of Groups: 9 > anova( fm3Stool ) numDF denDF F-value p-value Type 4 24 130.52 <.0001 > intervals( fm1Stool ) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 9.25825 10.250000 11.24175 Type1 1.40919 1.944444 2.47970 Type2 -0.21644 0.092593 0.40162 Type3 -0.56111 -0.342593 -0.12408 Random Effects: Level: Subject lower est. upper sd((Intercept)) 0.74962 1.3325 2.3685 Within-group standard error: lower est. upper 0.82957 1.10029 1.45937 > plot( fm1Stool, # produces Figure 1.8 + form = resid(., type = "p") ~ fitted(.) | Subject, + abline = 0 ) > # 1.3 Mixed-effects Models for Replicated, Blocked Designs > > with(Machines, interaction.plot( Machine, Worker, score, las = 1)) # Figure 1.10 > fm1Machine <- + lme( score ~ Machine, data = Machines, random = ~ 1 | Worker ) > fm1Machine Linear mixed-effects model fit by REML Data: Machines Log-restricted-likelihood: -143.44 Fixed: score ~ Machine (Intercept) MachineB MachineC 52.3556 7.9667 13.9167 Random effects: Formula: ~1 | Worker (Intercept) Residual StdDev: 5.1466 3.1616 Number of Observations: 54 Number of Groups: 6 > fm2Machine <- update( fm1Machine, random = ~ 1 | Worker/Machine ) > fm2Machine Linear mixed-effects model fit by REML Data: Machines Log-restricted-likelihood: -107.84 Fixed: score ~ Machine (Intercept) MachineB MachineC 52.3556 7.9667 13.9167 Random effects: Formula: ~1 | Worker (Intercept) StdDev: 4.781 Formula: ~1 | Machine %in% Worker (Intercept) Residual StdDev: 3.7295 0.96158 Number of Observations: 54 Number of Groups: Worker Machine %in% Worker 6 18 > anova( fm1Machine, fm2Machine ) Model df AIC BIC logLik Test L.Ratio p-value fm1Machine 1 5 296.88 306.54 -143.44 fm2Machine 2 6 227.69 239.28 -107.84 1 vs 2 71.191 <.0001 > ## delete selected rows from the Machines data > MachinesUnbal <- Machines[ -c(2,3,6,8,9,12,19,20,27,33), ] > ## check that the result is indeed unbalanced > table(MachinesUnbal$Machine, MachinesUnbal$Worker) 6 2 4 1 3 5 A 3 2 2 1 1 3 B 3 3 3 1 2 2 C 3 3 3 3 3 3 > fm1MachinesU <- lme( score ~ Machine, data = MachinesUnbal, + random = ~ 1 | Worker/Machine ) > fm1MachinesU Linear mixed-effects model fit by REML Data: MachinesUnbal Log-restricted-likelihood: -90.936 Fixed: score ~ Machine (Intercept) MachineB MachineC 52.3540 7.9624 13.9182 Random effects: Formula: ~1 | Worker (Intercept) StdDev: 4.7387 Formula: ~1 | Machine %in% Worker (Intercept) Residual StdDev: 3.7728 0.9332 Number of Observations: 44 Number of Groups: Worker Machine %in% Worker 6 18 > intervals( fm1MachinesU ) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 47.2345 52.3540 57.474 MachineB 3.0278 7.9624 12.897 MachineC 8.9955 13.9182 18.841 Random Effects: Level: Worker lower est. upper sd((Intercept)) 2.2162 4.7387 10.132 Level: Machine lower est. upper sd((Intercept)) 2.4091 3.7728 5.9085 Within-group standard error: lower est. upper 0.71113 0.93320 1.22463 > fm4Stool <- lme( effort ~ Type, ergoStool, ~ 1 | Subject/Type ) > if (interactive()) intervals( fm4Stool ) > (fm1Stool$sigma)^2 [1] 1.2106 > (fm4Stool$sigma)^2 + 0.79621^2 [1] 0.84554 > Machine1 <- Machines[ Machines$Worker == "1", ] > model.matrix( score ~ Machine, Machine1 ) # fixed-effects X_i (Intercept) MachineB MachineC 1 1 0 0 2 1 0 0 3 1 0 0 19 1 1 0 20 1 1 0 21 1 1 0 37 1 0 1 38 1 0 1 39 1 0 1 attr(,"assign") [1] 0 1 1 attr(,"contrasts") attr(,"contrasts")$Machine [1] "contr.treatment" > model.matrix( ~ Machine - 1, Machine1 ) # random-effects Z_i MachineA MachineB MachineC 1 1 0 0 2 1 0 0 3 1 0 0 19 0 1 0 20 0 1 0 21 0 1 0 37 0 0 1 38 0 0 1 39 0 0 1 attr(,"assign") [1] 1 1 1 attr(,"contrasts") attr(,"contrasts")$Machine [1] "contr.treatment" > fm3Machine <- update( fm1Machine, random = ~Machine - 1 |Worker) > summary( fm3Machine ) Linear mixed-effects model fit by REML Data: Machines AIC BIC logLik 228.31 247.63 -104.16 Random effects: Formula: ~Machine - 1 | Worker Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr MachineA 4.07928 MachnA MachnB MachineB 8.62529 0.803 MachineC 4.38948 0.623 0.771 Residual 0.96158 Fixed effects: score ~ Machine Value Std.Error DF t-value p-value (Intercept) 52.356 1.6807 46 31.1508 0.0000 MachineB 7.967 2.4209 46 3.2909 0.0019 MachineC 13.917 1.5401 46 9.0362 0.0000 Correlation: (Intr) MachnB MachineB 0.463 MachineC -0.374 0.301 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.393540 -0.513776 0.026908 0.472455 2.533387 Number of Observations: 54 Number of Groups: 6 > anova( fm1Machine, fm2Machine, fm3Machine ) Model df AIC BIC logLik Test L.Ratio p-value fm1Machine 1 5 296.88 306.54 -143.44 fm2Machine 2 6 227.69 239.28 -107.84 1 vs 2 71.191 <.0001 fm3Machine 3 10 228.31 247.63 -104.16 2 vs 3 7.376 0.1173 > # 1.4 An Analysis of Covariance Model > > names( Orthodont ) [1] "distance" "age" "Subject" "Sex" > levels( Orthodont$Sex ) [1] "Male" "Female" > OrthoFem <- Orthodont[ Orthodont$Sex == "Female", ] > fm1OrthF.lis <- lmList( distance ~ age, data = OrthoFem ) > coef( fm1OrthF.lis ) (Intercept) age F10 13.55 0.450 F09 18.10 0.275 F06 17.00 0.375 F01 17.25 0.375 F05 19.60 0.275 F07 16.95 0.550 F02 14.20 0.800 F08 21.45 0.175 F03 14.40 0.850 F04 19.65 0.475 F11 18.95 0.675 > intervals( fm1OrthF.lis ) , , (Intercept) lower est. upper F10 10.071 13.55 17.029 F09 14.621 18.10 21.579 F06 13.521 17.00 20.479 F01 13.771 17.25 20.729 F05 16.121 19.60 23.079 F07 13.471 16.95 20.429 F02 10.721 14.20 17.679 F08 17.971 21.45 24.929 F03 10.921 14.40 17.879 F04 16.171 19.65 23.129 F11 15.471 18.95 22.429 , , age lower est. upper F10 0.1401 0.450 0.7599 F09 -0.0349 0.275 0.5849 F06 0.0651 0.375 0.6849 F01 0.0651 0.375 0.6849 F05 -0.0349 0.275 0.5849 F07 0.2401 0.550 0.8599 F02 0.4901 0.800 1.1099 F08 -0.1349 0.175 0.4849 F03 0.5401 0.850 1.1599 F04 0.1651 0.475 0.7849 F11 0.3651 0.675 0.9849 > plot( intervals ( fm1OrthF.lis ) ) # produces Figure 1.12 > fm2OrthF.lis <- update( fm1OrthF.lis, distance ~ I( age - 11 ) ) > plot( intervals( fm2OrthF.lis ) ) # produces Figure 1.13 > fm1OrthF <- + lme( distance ~ age, data = OrthoFem, random = ~ 1 | Subject ) > summary( fm1OrthF ) Linear mixed-effects model fit by REML Data: OrthoFem AIC BIC logLik 149.22 156.17 -70.609 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev: 2.0685 0.78003 Fixed effects: distance ~ age Value Std.Error DF t-value p-value (Intercept) 17.3727 0.85874 32 20.2304 0 age 0.4795 0.05259 32 9.1186 0 Correlation: (Intr) age -0.674 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.27365 -0.70902 0.17282 0.41221 1.63252 Number of Observations: 44 Number of Groups: 11 > fm1OrthFM <- update( fm1OrthF, method = "ML" ) > summary( fm1OrthFM ) Linear mixed-effects model fit by maximum likelihood Data: OrthoFem AIC BIC logLik 146.03 153.17 -69.015 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev: 1.9699 0.76812 Fixed effects: distance ~ age Value Std.Error DF t-value p-value (Intercept) 17.3727 0.85063 32 20.4234 0 age 0.4795 0.05301 32 9.0471 0 Correlation: (Intr) age -0.685 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.30562 -0.71924 0.17636 0.42580 1.66894 Number of Observations: 44 Number of Groups: 11 > fm2OrthF <- update( fm1OrthF, random = ~ age | Subject ) > anova( fm1OrthF, fm2OrthF ) Model df AIC BIC logLik Test L.Ratio p-value fm1OrthF 1 4 149.22 156.17 -70.609 fm2OrthF 2 6 149.43 159.85 -68.714 1 vs 2 3.7896 0.1503 > random.effects( fm1OrthF ) (Intercept) F10 -4.005329 F09 -1.470449 F06 -1.470449 F01 -1.229032 F05 -0.021947 F07 0.340179 F02 0.340179 F08 0.702304 F03 1.064430 F04 2.150807 F11 3.599309 > ranef( fm1OrthFM ) (Intercept) F10 -3.995835 F09 -1.466964 F06 -1.466964 F01 -1.226119 F05 -0.021895 F07 0.339372 F02 0.339372 F08 0.700640 F03 1.061907 F04 2.145709 F11 3.590778 > coef( fm1OrthF ) (Intercept) age F10 13.367 0.47955 F09 15.902 0.47955 F06 15.902 0.47955 F01 16.144 0.47955 F05 17.351 0.47955 F07 17.713 0.47955 F02 17.713 0.47955 F08 18.075 0.47955 F03 18.437 0.47955 F04 19.524 0.47955 F11 20.972 0.47955 > plot( compareFits(coef(fm1OrthF), coef(fm1OrthFM))) # Figure 1.15 > plot( augPred(fm1OrthF), aspect = "xy", grid = TRUE ) # Figure 1.16 > # 1.5 Models for Nested Classification Factors > > fm1Pixel <- lme( pixel ~ day + I(day^2), data = Pixel, + random = list( Dog = ~ day, Side = ~ 1 ) ) > intervals( fm1Pixel ) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 1053.0968 1073.33914 1093.5814 day 4.3797 6.12960 7.8795 I(day^2) -0.4349 -0.36735 -0.2998 Random Effects: Level: Dog lower est. upper sd((Intercept)) 15.92760 28.36990 50.53187 sd(day) 1.08139 1.84375 3.14357 cor((Intercept),day) -0.89465 -0.55472 0.19197 Level: Side lower est. upper sd((Intercept)) 10.417 16.824 27.173 Within-group standard error: lower est. upper 7.6345 8.9896 10.5852 > plot( augPred( fm1Pixel ) ) # produces Figure 1.18 > VarCorr( fm1Pixel ) Variance StdDev Corr Dog = pdLogChol(day) (Intercept) 804.8514 28.3699 (Intr) day 3.3994 1.8438 -0.555 Side = pdLogChol(1) (Intercept) 283.0572 16.8243 Residual 80.8130 8.9896 > summary( fm1Pixel ) Linear mixed-effects model fit by REML Data: Pixel AIC BIC logLik 841.21 861.97 -412.61 Random effects: Formula: ~day | Dog Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 28.3699 (Intr) day 1.8438 -0.555 Formula: ~1 | Side %in% Dog (Intercept) Residual StdDev: 16.824 8.9896 Fixed effects: pixel ~ day + I(day^2) Value Std.Error DF t-value p-value (Intercept) 1073.34 10.1717 80 105.522 0 day 6.13 0.8793 80 6.971 0 I(day^2) -0.37 0.0339 80 -10.822 0 Correlation: (Intr) day day -0.517 I(day^2) 0.186 -0.668 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.829057 -0.449181 0.025549 0.557216 2.751965 Number of Observations: 102 Number of Groups: Dog Side %in% Dog 10 20 > fm2Pixel <- update( fm1Pixel, random = ~ day | Dog) > anova( fm1Pixel, fm2Pixel ) Model df AIC BIC logLik Test L.Ratio p-value fm1Pixel 1 8 841.21 861.97 -412.61 fm2Pixel 2 7 884.52 902.69 -435.26 1 vs 2 45.309 <.0001 > fm3Pixel <- update( fm1Pixel, random = ~ 1 | Dog/Side ) > anova( fm1Pixel, fm3Pixel ) Model df AIC BIC logLik Test L.Ratio p-value fm1Pixel 1 8 841.21 861.97 -412.61 fm3Pixel 2 6 876.84 892.41 -432.42 1 vs 2 39.629 <.0001 > fm4Pixel <- update( fm1Pixel, pixel ~ day + I(day^2) + Side ) > summary( fm4Pixel ) Linear mixed-effects model fit by REML Data: Pixel AIC BIC logLik 835.85 859.12 -408.93 Random effects: Formula: ~day | Dog Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 28.4636 (Intr) day 1.8438 -0.553 Formula: ~1 | Side %in% Dog (Intercept) Residual StdDev: 16.507 8.9836 Fixed effects: pixel ~ day + I(day^2) + Side Value Std.Error DF t-value p-value (Intercept) 1077.95 10.8627 80 99.234 0.0000 day 6.13 0.8790 80 6.973 0.0000 I(day^2) -0.37 0.0339 80 -10.829 0.0000 SideR -9.22 7.6268 9 -1.209 0.2576 Correlation: (Intr) day I(d^2) day -0.484 I(day^2) 0.174 -0.667 SideR -0.351 0.000 0.000 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.809825 -0.471334 0.026103 0.541154 2.774701 Number of Observations: 102 Number of Groups: Dog Side %in% Dog 10 20 > # 1.6 A Split-Plot Experiment > > fm1Oats <- lme( yield ~ ordered(nitro) * Variety, data = Oats, + random = ~ 1 | Block/Variety ) > anova( fm1Oats ) numDF denDF F-value p-value (Intercept) 1 45 245.143 <.0001 ordered(nitro) 3 45 37.686 <.0001 Variety 2 10 1.485 0.2724 ordered(nitro):Variety 6 45 0.303 0.9322 > fm2Oats <- update( fm1Oats, yield ~ ordered(nitro) + Variety ) > anova( fm2Oats ) numDF denDF F-value p-value (Intercept) 1 51 245.145 <.0001 ordered(nitro) 3 51 41.053 <.0001 Variety 2 10 1.485 0.2724 > summary( fm2Oats ) Linear mixed-effects model fit by REML Data: Oats AIC BIC logLik 587.46 607.16 -284.73 Random effects: Formula: ~1 | Block (Intercept) StdDev: 14.645 Formula: ~1 | Variety %in% Block (Intercept) Residual StdDev: 10.473 12.75 Fixed effects: yield ~ ordered(nitro) + Variety Value Std.Error DF t-value p-value (Intercept) 104.500 7.7975 51 13.4017 0.0000 ordered(nitro).L 32.945 3.0052 51 10.9627 0.0000 ordered(nitro).Q -5.167 3.0052 51 -1.7193 0.0916 ordered(nitro).C -0.447 3.0052 51 -0.1488 0.8823 VarietyMarvellous 5.292 7.0789 10 0.7475 0.4720 VarietyVictory -6.875 7.0789 10 -0.9712 0.3544 Correlation: (Intr) or().L or().Q or().C VrtyMr ordered(nitro).L 0.000 ordered(nitro).Q 0.000 0.000 ordered(nitro).C 0.000 0.000 0.000 VarietyMarvellous -0.454 0.000 0.000 0.000 VarietyVictory -0.454 0.000 0.000 0.000 0.500 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.841341 -0.662797 -0.066943 0.638225 1.660668 Number of Observations: 72 Number of Groups: Block Variety %in% Block 6 18 > fm3Oats <- update( fm1Oats, yield ~ ordered( nitro ) ) > summary( fm3Oats ) Linear mixed-effects model fit by REML Data: Oats AIC BIC logLik 597.61 613.14 -291.8 Random effects: Formula: ~1 | Block (Intercept) StdDev: 14.506 Formula: ~1 | Variety %in% Block (Intercept) Residual StdDev: 11.039 12.75 Fixed effects: yield ~ ordered(nitro) Value Std.Error DF t-value p-value (Intercept) 103.972 6.6407 51 15.6569 0.0000 ordered(nitro).L 32.945 3.0052 51 10.9627 0.0000 ordered(nitro).Q -5.167 3.0052 51 -1.7193 0.0916 ordered(nitro).C -0.447 3.0052 51 -0.1488 0.8823 Correlation: (Intr) or().L or().Q ordered(nitro).L 0 ordered(nitro).Q 0 0 ordered(nitro).C 0 0 0 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.781556 -0.611689 0.022224 0.622007 1.681382 Number of Observations: 72 Number of Groups: Block Variety %in% Block 6 18 > fm4Oats <- + lme( yield ~ nitro, data = Oats, random = ~ 1 | Block/Variety ) > summary( fm4Oats ) Linear mixed-effects model fit by REML Data: Oats AIC BIC logLik 603.04 614.28 -296.52 Random effects: Formula: ~1 | Block (Intercept) StdDev: 14.506 Formula: ~1 | Variety %in% Block (Intercept) Residual StdDev: 11.005 12.867 Fixed effects: yield ~ nitro Value Std.Error DF t-value p-value (Intercept) 81.872 6.9453 53 11.788 0 nitro 73.667 6.7815 53 10.863 0 Correlation: (Intr) nitro -0.293 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.743808 -0.664752 0.017104 0.542988 1.802989 Number of Observations: 72 Number of Groups: Block Variety %in% Block 6 18 > VarCorr( fm4Oats ) Variance StdDev Block = pdLogChol(1) (Intercept) 210.42 14.506 Variety = pdLogChol(1) (Intercept) 121.10 11.005 Residual 165.56 12.867 > intervals( fm4Oats ) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 67.942 81.872 95.803 nitro 60.065 73.667 87.269 Random Effects: Level: Block lower est. upper sd((Intercept)) 6.6089 14.506 31.839 Level: Variety lower est. upper sd((Intercept)) 6.4081 11.005 18.898 Within-group standard error: lower est. upper 10.637 12.867 15.565 > plot(augPred(fm4Oats), aspect = 2.5, layout = c(6, 3), + between = list(x = c(0, 0, 0.5, 0, 0))) # produces Figure 1.21 > # cleanup > > summary(warnings()) No warnings ====== ch02.R ====== > #-*- R -*- > > library( nlme ) > options( width = 65, digits = 5 ) > options( contrasts = c(unordered = "contr.helmert", + ordered = "contr.poly") ) > pdf( file = 'ch02.pdf' ) > # Chapter 2 Theory and Computational Methods for Linear Mixed-Effects Models > > # 2.2 Likelihood Estimation for LME Models > > Xmat <- matrix( c(1, 1, 1, 1, 8, 10, 12, 14), ncol = 2 ) > Xmat [,1] [,2] [1,] 1 8 [2,] 1 10 [3,] 1 12 [4,] 1 14 > Xqr <- qr( Xmat ) # creates a QR structure > qr.R( Xqr ) # returns R [,1] [,2] [1,] -2 -22.0000 [2,] 0 -4.4721 > qr.Q( Xqr ) # returns Q-truncated [,1] [,2] [1,] -0.5 0.67082 [2,] -0.5 0.22361 [3,] -0.5 -0.22361 [4,] -0.5 -0.67082 > qr.Q( Xqr, complete = TRUE ) # returns the full Q [,1] [,2] [,3] [,4] [1,] -0.5 0.67082 0.023607 0.54721 [2,] -0.5 0.22361 -0.439345 -0.71202 [3,] -0.5 -0.22361 0.807869 -0.21760 [4,] -0.5 -0.67082 -0.392131 0.38240 > fm1Rail.lme <- lme( travel ~ 1, data = Rail, random = ~ 1 | Rail, + control = list( msVerbose = TRUE ) ) 0: 61.048859: -1.81959 1: 61.048859: -1.81959 > fm1Rail.lme <- lme( travel ~ 1, data = Rail, random = ~ 1 | Rail, + control = list( msVerbose = TRUE, niterEM = 0 )) 0: 67.893737: -0.431523 1: 61.612483: -1.43152 2: 61.138913: -1.98441 3: 61.050114: -1.83866 4: 61.048866: -1.81819 5: 61.048859: -1.81960 6: 61.048859: -1.81959 > fm1Machine <- + lme( score ~ Machine, data = Machines, random = ~ 1 | Worker ) > fm2Machine <- update( fm1Machine, random = ~ 1 | Worker/Machine ) > anova( fm1Machine, fm2Machine ) Model df AIC BIC logLik Test L.Ratio p-value fm1Machine 1 5 300.46 310.12 -145.23 fm2Machine 2 6 231.27 242.86 -109.64 1 vs 2 71.191 <.0001 > OrthoFem <- Orthodont[ Orthodont$Sex == "Female", ] > fm1OrthF <- lme( distance ~ age, data = OrthoFem, + random = ~ 1 | Subject ) > fm2OrthF <- update( fm1OrthF, random = ~ age | Subject ) > orthLRTsim <- simulate.lme( fm1OrthF, m2 = fm2OrthF, nsim = 1000 ) > plot( orthLRTsim, df = c(1, 2) ) # produces Figure 2.3 > machineLRTsim <- simulate.lme(fm1Machine, m2 = fm2Machine, nsim= 1000) > plot( machineLRTsim, df = c(0, 1), # produces Figure 2.4 + layout = c(4,1), between = list(x = c(0, 0.5, 0)) ) > stoolLRTsim <- + simulate.lme( list(fixed = effort ~ 1, data = ergoStool, + random = ~ 1 | Subject), + m2 = list(fixed = effort ~ Type), + method = "ML", nsim = 1000 ) > plot( stoolLRTsim, df = c(3, 4) ) # Figure 2.5 > data( PBIB, package = 'SASmixed' ) > pbibLRTsim <- + simulate.lme(list( fixed = response ~ 1, data = PBIB, + random = ~ 1 | Block ), + m2 = list(fixed = response ~ Treatment, data = PBIB, + random = ~ 1 | Block), + method = "ML", nsim = 1000 ) > plot( pbibLRTsim, df = c(14,16,18), weights = FALSE ) # Figure 2.6 > summary( fm2Machine ) Linear mixed-effects model fit by REML Data: Machines AIC BIC logLik 231.27 242.86 -109.64 Random effects: Formula: ~1 | Worker (Intercept) StdDev: 4.781 Formula: ~1 | Machine %in% Worker (Intercept) Residual StdDev: 3.7295 0.96158 Fixed effects: score ~ Machine Value Std.Error DF t-value p-value (Intercept) 59.650 2.14467 36 27.8131 0.0000 Machine1 3.983 1.08849 10 3.6595 0.0044 Machine2 3.311 0.62844 10 5.2688 0.0004 Correlation: (Intr) Machn1 Machine1 0 Machine2 0 0 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.269587 -0.548466 -0.010706 0.439366 2.540058 Number of Observations: 54 Number of Groups: Worker Machine %in% Worker 6 18 > fm1PBIB <- lme(response ~ Treatment, data = PBIB, random = ~ 1 | Block) > anova( fm1PBIB ) numDF denDF F-value p-value (Intercept) 1 31 1654.21 <.0001 Treatment 14 31 1.53 0.1576 > fm2PBIB <- update( fm1PBIB, method = "ML" ) > fm3PBIB <- update( fm2PBIB, response ~ 1 ) > anova( fm2PBIB, fm3PBIB ) Model df AIC BIC logLik Test L.Ratio p-value fm2PBIB 1 17 56.571 92.174 -11.285 fm3PBIB 2 3 52.152 58.435 -23.076 1 vs 2 23.581 0.0514 > anova( fm2Machine ) numDF denDF F-value p-value (Intercept) 1 36 773.57 <.0001 Machine 2 10 20.58 3e-04 > # cleanup > > summary(warnings()) No warnings ====== ch03.R ====== > #-*- R -*- > > # initialization > > library(nlme) > options(width = 65, digits = 5) > options(contrasts = c(unordered = "contr.helmert", ordered = "contr.poly")) > pdf(file = 'ch03.pdf') > # Chapter 3 Describing the Structure of Grouped Data > > # 3.1 The Display Formula and Its Components > > formula( Rail ) travel ~ 1 | Rail > formula( ergoStool ) effort ~ Type | Subject > formula( Machines ) score ~ Machine | Worker > formula( Orthodont ) distance ~ age | Subject > formula( Pixel ) pixel ~ day | Dog/Side > formula( Oats ) yield ~ nitro | Block > table( Oxboys$Subject ) 10 26 25 9 2 6 7 17 16 15 8 20 1 18 5 23 11 21 3 24 22 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 12 13 14 19 4 9 9 9 9 9 > table( getGroups( Oxboys ) ) 10 26 25 9 2 6 7 17 16 15 8 20 1 18 5 23 11 21 3 24 22 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 12 13 14 19 4 9 9 9 9 9 > unique( table( getGroups( Oxboys ) ) ) # a more concise result [1] 9 > unique( table( getCovariate( Oxboys ), getGroups( Oxboys ) ) ) [1] 1 0 > length( unique( getCovariate( Oxboys ) ) ) [1] 16 > unique( getGroups(Pixel, level = 1) ) [1] 1 2 3 4 5 6 7 8 9 10 Levels: 1 10 2 3 4 5 6 7 8 9 > unique( getGroups(Pixel, level = 2) ) [1] 1/R 2/R 3/R 4/R 5/R 6/R 7/R 8/R 9/R 10/R 1/L 2/L [13] 3/L 4/L 5/L 6/L 7/L 8/L 9/L 10/L 20 Levels: 1/R < 2/R < 3/R < 4/R < 5/R < 6/R < 7/R < ... < 10/L > Pixel.groups <- getGroups( Pixel, level = 1:2 ) > class( Pixel.groups ) [1] "data.frame" > names( Pixel.groups ) [1] "Dog" "Side" > unique( Pixel.groups[["Side"]] ) [1] R L Levels: L R > formula( PBG ) deltaBP ~ dose | Rabbit > PBG.log <- update( PBG, formula = deltaBP ~ log(dose) | Rabbit ) > formula(PBG.log) deltaBP ~ log(dose) | Rabbit > unique( getCovariate(PBG.log) ) [1] 1.8326 2.5257 3.2189 3.9120 4.6052 5.2983 > unique( getCovariate(PBG) ) [1] 6.25 12.50 25.00 50.00 100.00 200.00 > # 3.2 Constructing groupedData Objects > > # The next line is not from the book. > # It is added to ensure that the file is available > > write.table( Oxboys, "oxboys.dat" ) > Oxboys.frm <- read.table( "oxboys.dat", header = TRUE ) > class( Oxboys.frm ) # check the class of the result [1] "data.frame" > dim( Oxboys.frm ) # check the dimensions [1] 234 4 > Oxboys <- groupedData( height ~ age | Subject, + data = read.table("oxboys.dat", header = TRUE), + labels = list(x = "Centered age", y = "Height"), + units = list(y = "(cm)") ) > Oxboys # display the object Grouped Data: height ~ age | Subject Subject age height Occasion 1 1 -1.0000 140.50 1 2 1 -0.7479 143.40 2 3 1 -0.4630 144.80 3 4 1 -0.1643 147.10 4 5 1 -0.0027 147.70 5 6 1 0.2466 150.20 6 7 1 0.5562 151.70 7 8 1 0.7781 153.30 8 9 1 0.9945 155.80 9 10 2 -1.0000 136.90 1 11 2 -0.7479 139.10 2 12 2 -0.4630 140.10 3 13 2 -0.1643 142.60 4 14 2 -0.0027 143.20 5 15 2 0.2466 144.00 6 16 2 0.5562 145.80 7 17 2 0.7781 146.80 8 18 2 0.9945 148.30 9 19 3 -1.0000 150.00 1 20 3 -0.7479 152.10 2 21 3 -0.4630 153.90 3 22 3 -0.1643 155.80 4 23 3 -0.0027 156.00 5 24 3 0.2466 156.90 6 25 3 0.5562 157.40 7 26 3 0.7781 159.10 8 27 3 0.9945 160.60 9 28 4 -1.0000 155.70 1 29 4 -0.7479 158.70 2 30 4 -0.4630 160.60 3 31 4 -0.1643 163.30 4 32 4 -0.0027 164.40 5 33 4 0.2466 167.30 6 34 4 0.5562 170.70 7 35 4 0.7781 172.00 8 36 4 0.9945 174.80 9 37 5 -1.0000 145.80 1 38 5 -0.7479 147.30 2 39 5 -0.4493 148.70 3 40 5 -0.1643 149.78 4 41 5 -0.0027 150.22 5 42 5 0.2466 152.50 6 43 5 0.5562 154.80 7 44 5 0.7781 156.40 8 45 5 0.9973 158.70 9 46 6 -1.0000 142.40 1 47 6 -0.7479 143.80 2 48 6 -0.4630 145.20 3 49 6 -0.1643 146.30 4 50 6 -0.0027 147.10 5 51 6 0.2466 148.10 6 52 6 0.5562 148.90 7 53 6 0.7781 149.10 8 54 6 0.9945 151.00 9 55 7 -1.0000 141.30 1 56 7 -0.7479 142.40 2 57 7 -0.4493 144.30 3 58 7 -0.1643 145.20 4 59 7 0.0000 146.10 5 60 7 0.2466 146.80 6 61 7 0.5562 147.90 7 62 7 0.7945 150.50 8 63 7 0.9945 151.80 9 64 8 -1.0000 141.70 1 65 8 -0.7479 143.70 2 66 8 -0.4630 145.10 3 67 8 -0.1643 147.90 4 68 8 -0.0027 148.10 5 69 8 0.2466 149.60 6 70 8 0.5562 150.99 7 71 8 0.7945 154.10 8 72 8 1.0055 154.90 9 73 9 -1.0000 132.70 1 74 9 -0.7479 134.10 2 75 9 -0.4493 135.30 3 76 9 -0.1643 136.60 4 77 9 -0.0027 137.50 5 78 9 0.2466 139.10 6 79 9 0.5562 140.90 7 80 9 0.7945 143.70 8 81 9 0.9945 144.70 9 82 10 -1.0000 126.20 1 83 10 -0.7479 128.20 2 84 10 -0.4630 129.00 3 85 10 -0.1643 129.40 4 86 10 -0.0027 129.59 5 87 10 0.2466 130.60 6 88 10 0.5562 132.50 7 89 10 0.7781 133.40 8 90 10 0.9945 134.20 9 91 11 -1.0000 142.50 1 92 11 -0.7479 143.80 2 93 11 -0.4630 145.60 3 94 11 -0.1643 148.30 4 95 11 -0.0027 149.40 5 96 11 0.2466 151.60 6 97 11 0.5562 154.80 7 98 11 0.7781 156.90 8 99 11 0.9945 159.20 9 100 12 -1.0000 149.90 1 101 12 -0.7479 151.70 2 102 12 -0.4630 153.30 3 103 12 -0.1643 156.10 4 104 12 0.0000 156.70 5 105 12 0.2466 157.80 6 106 12 0.5562 160.70 7 107 12 0.7781 162.70 8 108 12 0.9945 163.80 9 109 13 -1.0000 148.90 1 110 13 -0.7150 149.80 2 111 13 -0.4630 151.70 3 112 13 -0.1643 154.40 4 113 13 -0.0027 155.50 5 114 13 0.2466 156.40 6 115 13 0.5562 161.40 7 116 13 0.7781 163.90 8 117 13 0.9945 164.60 9 118 14 -1.0000 151.60 1 119 14 -0.7479 153.20 2 120 14 -0.4630 155.20 3 121 14 -0.1643 157.30 4 122 14 0.0000 159.10 5 123 14 0.2466 160.90 6 124 14 0.5562 164.40 7 125 14 0.7781 166.90 8 126 14 0.9945 168.40 9 127 15 -1.0000 137.50 1 128 15 -0.7479 139.30 2 129 15 -0.4630 140.90 3 130 15 -0.1643 142.70 4 131 15 -0.0027 144.20 5 132 15 0.2466 145.70 6 133 15 0.5562 147.09 7 134 15 0.7781 150.20 8 135 15 0.9945 152.30 9 136 16 -1.0000 142.80 1 137 16 -0.7479 144.90 2 138 16 -0.4630 145.00 3 139 16 -0.1643 146.70 4 140 16 -0.0027 147.20 5 141 16 0.2466 148.90 6 142 16 0.5562 150.10 7 143 16 0.7781 151.00 8 144 16 0.9945 152.20 9 145 17 -1.0000 134.90 1 146 17 -0.7479 137.40 2 147 17 -0.4630 138.20 3 148 17 -0.1643 140.20 4 149 17 -0.0027 143.60 5 150 17 0.2466 144.20 6 151 17 0.5562 147.90 7 152 17 0.7781 150.30 8 153 17 0.9945 151.80 9 154 18 -1.0000 145.50 1 155 18 -0.7479 146.20 2 156 18 -0.4630 148.20 3 157 18 -0.1643 150.30 4 158 18 -0.0027 152.00 5 159 18 0.2466 152.30 6 160 18 0.5562 154.30 7 161 18 0.7781 156.20 8 162 18 0.9945 156.80 9 163 19 -1.0000 156.90 1 164 19 -0.7479 157.90 2 165 19 -0.4630 160.30 3 166 19 -0.1643 161.90 4 167 19 0.0000 163.80 5 168 19 0.2466 165.50 6 169 19 0.5562 169.90 7 170 19 0.7781 172.40 8 171 19 0.9945 174.40 9 172 20 -1.0000 146.50 1 173 20 -0.7479 148.40 2 174 20 -0.4630 149.30 3 175 20 -0.1643 151.20 4 176 20 -0.0027 152.10 5 177 20 0.2466 152.40 6 178 20 0.5562 153.90 7 179 20 0.7781 154.90 8 180 20 0.9945 155.40 9 181 21 -1.0000 143.90 1 182 21 -0.7479 145.10 2 183 21 -0.4630 147.00 3 184 21 -0.1643 149.20 4 185 21 -0.0027 149.80 5 186 21 0.2466 151.50 6 187 21 0.5562 153.17 7 188 21 0.7781 156.90 8 189 21 0.9945 159.60 9 190 22 -1.0000 147.40 1 191 22 -0.7479 148.80 2 192 22 -0.4630 150.10 3 193 22 -0.1643 152.50 4 194 22 -0.0027 154.70 5 195 22 0.2466 156.00 6 196 22 0.5562 158.40 7 197 22 0.7781 161.50 8 198 22 0.9945 163.30 9 199 23 -1.0000 144.50 1 200 23 -0.7479 146.00 2 201 23 -0.4630 147.40 3 202 23 -0.1643 149.20 4 203 23 -0.0027 150.80 5 204 23 0.2466 152.50 6 205 23 0.5562 155.00 7 206 23 0.7781 156.80 8 207 23 0.9945 158.80 9 208 24 -1.0000 147.80 1 209 24 -0.7479 148.20 2 210 24 -0.4630 150.20 3 211 24 -0.1643 151.00 4 212 24 -0.0027 152.20 5 213 24 0.2466 153.60 6 214 24 0.5562 155.80 7 215 24 0.7781 159.20 8 216 24 0.9945 161.60 9 217 25 -1.0000 135.50 1 218 25 -0.7479 136.60 2 219 25 -0.4630 137.30 3 220 25 -0.1643 138.20 4 221 25 -0.0027 139.00 5 222 25 0.2466 139.50 6 223 25 0.5562 141.00 7 224 25 0.7808 142.70 8 225 25 0.9945 143.90 9 226 26 -1.0000 132.20 1 227 26 -0.7479 134.30 2 228 26 -0.4630 135.10 3 229 26 -0.1643 136.70 4 230 26 -0.0027 138.40 5 231 26 0.2466 138.90 6 232 26 0.5562 141.80 7 233 26 0.7781 142.60 8 234 26 1.0055 143.10 9 > unique( getGroups( Oxboys ) ) [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21] 21 22 23 24 25 26 26 Levels: 10 < 26 < 25 < 9 < 2 < 6 < 7 < 17 < 16 < 15 < ... < 4 > plot( BodyWeight, outer = ~ Diet, aspect = 3 ) # Figure 3.3 > plot( BodyWeight, outer = TRUE, aspect = 3 ) > plot( Soybean, outer = ~ Year * Variety ) # Figure 6.10 > plot( Soybean, outer = ~ Variety * Year ) > gsummary( BodyWeight, invar = TRUE ) Rat Diet 2 2 1 3 3 1 4 4 1 1 1 1 8 8 1 5 5 1 6 6 1 7 7 1 11 11 2 9 9 2 10 10 2 12 12 2 13 13 3 15 15 3 14 14 3 16 16 3 > plot( PBG, inner = ~ Treatment, scales = list(x = list(log = 2))) > ergoStool.mat <- asTable( ergoStool ) > ergoStool.mat T1 T2 T3 T4 8 7 11 8 7 5 8 11 8 7 4 7 11 10 9 9 9 13 10 8 6 9 11 11 10 3 7 14 13 9 7 8 12 12 11 1 12 15 12 10 2 10 14 13 12 > ergoStool.new <- balancedGrouped( effort ~ Type | Subject, + data = ergoStool.mat ) > ergoStool.new Grouped Data: effort ~ Type | Subject Type Subject effort 1 T1 8 7 2 T2 8 11 3 T3 8 8 4 T4 8 7 5 T1 5 8 6 T2 5 11 7 T3 5 8 8 T4 5 7 9 T1 4 7 10 T2 4 11 11 T3 4 10 12 T4 4 9 13 T1 9 9 14 T2 9 13 15 T3 9 10 16 T4 9 8 17 T1 6 9 18 T2 6 11 19 T3 6 11 20 T4 6 10 21 T1 3 7 22 T2 3 14 23 T3 3 13 24 T4 3 9 25 T1 7 8 26 T2 7 12 27 T3 7 12 28 T4 7 11 29 T1 1 12 30 T2 1 15 31 T3 1 12 32 T4 1 10 33 T1 2 10 34 T2 2 14 35 T3 2 13 36 T4 2 12 > # 3.3 Controlling Trellis Graphics Presentations of Grouped Data > > plot(CO2, layout=c(6,2), between=list(x=c(0,0,0.5,0,0))) > plot( Spruce, layout = c(7, 4, 3), + skip = c(rep(FALSE, 27), TRUE, rep(FALSE, 27), TRUE, + rep(FALSE, 12), rep(TRUE, 2), rep(FALSE,13)) ) > plot( Spruce, layout = c(9, 3, 3), + skip = c(rep(FALSE, 66), TRUE, TRUE, rep(FALSE, 13)) ) > unique( getCovariate(DNase) ) [1] 0.048828 0.195312 0.390625 0.781250 1.562500 3.125000 [7] 6.250000 12.500000 > log( unique(getCovariate(DNase)), 2 ) [1] -4.35614 -2.35614 -1.35614 -0.35614 0.64386 1.64386 [7] 2.64386 3.64386 > plot( DNase, layout=c(6,2), scales = list(x=list(log=2)) ) > plot(Pixel, layout = c(4,5), + between = list(x = c(0, 0.5, 0), y = 0.5)) > plot( Pixel, displayLevel = 1 ) > plot( Wafer, display = 1, collapse = 1 ) > plot( Wafer, display = 1, collapse = 1, + FUN = function(x) sqrt(var(x)), layout = c(10,1) ) > # 3.4 Summaries > > sapply( ergoStool, data.class ) effort Type Subject "numeric" "factor" "ordered" > gsummary( Theoph, inv = TRUE ) Subject Wt Dose 6 6 80.0 4.00 7 7 64.6 4.95 8 8 70.5 4.53 11 11 65.0 4.92 3 3 70.5 4.53 2 2 72.4 4.40 4 4 72.7 4.40 9 9 86.4 3.10 12 12 60.5 5.30 10 10 58.2 5.50 1 1 79.6 4.02 5 5 54.6 5.86 > gsummary( Theoph, omit = TRUE, inv = TRUE ) Wt Dose 6 80.0 4.00 7 64.6 4.95 8 70.5 4.53 11 65.0 4.92 3 70.5 4.53 2 72.4 4.40 4 72.7 4.40 9 86.4 3.10 12 60.5 5.30 10 58.2 5.50 1 79.6 4.02 5 54.6 5.86 > is.null(gsummary(Theoph, inv = TRUE, omit = TRUE)) # invariants present [1] FALSE > is.null(gsummary(Oxboys, inv = TRUE, omit = TRUE)) # no invariants [1] TRUE > gsummary( Theoph ) Subject Wt Dose Time conc 6 6 80.0 4.00 5.8882 3.5255 7 7 64.6 4.95 5.8655 3.9109 8 8 70.5 4.53 5.8900 4.2718 11 11 65.0 4.92 5.8718 4.5109 3 3 70.5 4.53 5.9073 5.0864 2 2 72.4 4.40 5.8691 4.8236 4 4 72.7 4.40 5.9400 4.9400 9 9 86.4 3.10 5.8682 4.8936 12 12 60.5 5.30 5.8764 5.4100 10 10 58.2 5.50 5.9155 5.9309 1 1 79.6 4.02 5.9500 6.4391 5 5 54.6 5.86 5.8936 5.7827 > gsummary( Theoph, FUN = max, omit = TRUE ) Wt Dose Time conc 6 80.0 4.00 23.85 6.44 7 64.6 4.95 24.22 7.09 8 70.5 4.53 24.12 7.56 11 65.0 4.92 24.08 8.00 3 70.5 4.53 24.17 8.20 2 72.4 4.40 24.30 8.33 4 72.7 4.40 24.65 8.60 9 86.4 3.10 24.43 9.03 12 60.5 5.30 24.15 9.75 10 58.2 5.50 23.70 10.21 1 79.6 4.02 24.37 10.50 5 54.6 5.86 24.35 11.40 > Quin.sum <- gsummary( Quinidine, omit = TRUE, FUN = mean ) > dim( Quin.sum ) [1] 136 13 > Quin.sum[1:10, ] time conc dose interval Age Height Weight Race 109 30.2633 NA NA NA 70 67 58.000 Caucasian 70 0.7500 NA NA NA 68 69 75.000 Caucasian 23 52.0262 NA NA NA 75 72 108.000 Caucasian 92 8.8571 NA NA NA 68 72 65.000 Caucasian 111 18.1638 NA NA NA 68 66 56.000 Latin 5 24.3750 NA NA NA 62 71 66.000 Caucasian 18 196.8438 NA NA NA 87 69 85.375 Caucasian 24 31.2500 NA NA NA 55 69 89.000 Latin 2 12.2000 NA NA NA 58 69 85.000 Latin 88 4.7900 NA NA NA 85 72 77.000 Caucasian Smoke Ethanol Heart Creatinine glyco 109 no none No/Mild >= 50 0.46000 70 no former No/Mild >= 50 1.15000 23 yes none No/Mild >= 50 0.83875 92 yes former No/Mild >= 50 1.27000 111 yes former No/Mild >= 50 1.23000 5 yes none Severe >= 50 1.39000 18 no none No/Mild < 50 1.26000 24 no former No/Mild >= 50 0.57000 2 no current Moderate >= 50 0.82000 88 no none Moderate >= 50 0.61000 > Quinidine[Quinidine[["Subject"]] == 3, 1:8] Grouped Data: conc ~ time | Subject Subject time conc dose interval Age Height Weight 17 3 0.00 NA 201 NA 67 69 69 18 3 8.00 NA 201 NA 67 69 69 19 3 16.00 NA 201 NA 67 69 69 20 3 24.00 NA 201 NA 67 69 69 21 3 32.00 NA 201 NA 67 69 69 22 3 41.25 2.4 NA NA 67 69 69 23 3 104.00 NA 201 8 67 69 69 24 3 113.00 2.3 NA NA 67 69 69 25 3 3865.00 NA 201 6 67 69 62 26 3 3873.00 NA 201 NA 67 69 62 27 3 3881.00 NA 201 NA 67 69 62 28 3 3889.00 NA 201 NA 67 69 62 29 3 3897.00 NA 201 NA 67 69 62 30 3 3900.00 NA NA NA 67 69 62 31 3 3905.00 NA 201 NA 67 69 62 32 3 3909.00 4.7 NA NA 67 69 62 33 3 4073.00 NA 201 8 67 69 62 > Quin.sum1 <- gsummary( Quinidine, omit = TRUE ) > Quin.sum1[1:10, 1:7] time conc dose interval Age Height Weight 109 30.2633 0.50000 100.00 NaN 70 67 58.000 70 0.7500 0.60000 201.00 8 68 69 75.000 23 52.0262 0.56667 166.00 6 75 72 108.000 92 8.8571 0.70000 83.00 NaN 68 72 65.000 111 18.1638 0.90000 249.00 NaN 68 66 56.000 5 24.3750 0.70000 301.00 NaN 62 71 66.000 18 196.8438 0.93333 201.00 6 87 69 85.375 24 31.2500 1.10000 187.88 NaN 55 69 89.000 2 12.2000 1.20000 166.00 NaN 58 69 85.000 88 4.7900 1.20000 201.00 8 85 72 77.000 > summary( Quin.sum1 ) time conc dose interval Min. : 0.1 Min. :0.50 Min. : 83 Min. : 5.00 1st Qu.: 19.3 1st Qu.:1.70 1st Qu.:198 1st Qu.: 6.00 Median : 47.2 Median :2.24 Median :201 Median : 6.00 Mean : 251.5 Mean :2.36 Mean :224 Mean : 6.99 3rd Qu.: 171.1 3rd Qu.:2.92 3rd Qu.:249 3rd Qu.: 8.00 Max. :5364.9 Max. :5.77 Max. :498 Max. :12.00 NA's :29 Age Height Weight Race Min. :42.0 Min. :60.0 Min. : 41.0 Caucasian:91 1st Qu.:61.0 1st Qu.:67.0 1st Qu.: 67.8 Latin :35 Median :66.0 Median :70.0 Median : 79.2 Black :10 Mean :66.9 Mean :69.6 Mean : 79.2 3rd Qu.:73.0 3rd Qu.:72.0 3rd Qu.: 88.2 Max. :92.0 Max. :79.0 Max. :119.0 Smoke Ethanol Heart Creatinine glyco no :94 none :90 No/Mild :55 < 50 : 36 Min. :0.390 yes:42 current:16 Moderate:40 >= 50:100 1st Qu.:0.885 former :30 Severe :41 Median :1.174 Mean :1.212 3rd Qu.:1.453 Max. :2.995 > summary( Quinidine ) Subject time conc dose 223 : 47 Min. : 0 Min. :0.40 Min. : 83 110 : 41 1st Qu.: 16 1st Qu.:1.60 1st Qu.:166 81 : 40 Median : 60 Median :2.30 Median :201 136 : 32 Mean : 373 Mean :2.45 Mean :225 7 : 31 3rd Qu.: 241 3rd Qu.:3.00 3rd Qu.:249 76 : 28 Max. :8096 Max. :9.40 Max. :603 (Other):1252 NA's :1110 NA's :443 interval Age Height Weight Min. : 4.00 Min. :42.0 Min. :60.0 Min. : 41.0 1st Qu.: 6.00 1st Qu.:60.0 1st Qu.:67.0 1st Qu.: 69.5 Median : 6.00 Median :66.0 Median :69.0 Median : 78.0 Mean : 7.11 Mean :66.7 Mean :69.2 Mean : 79.7 3rd Qu.: 8.00 3rd Qu.:74.0 3rd Qu.:72.0 3rd Qu.: 89.0 Max. :12.00 Max. :92.0 Max. :79.0 Max. :119.0 NA's :1222 Race Smoke Ethanol Heart Caucasian:968 no :1024 none :991 No/Mild :598 Latin :384 yes: 447 current:191 Moderate:375 Black :119 former :289 Severe :498 Creatinine glyco < 50 : 418 Min. :0.39 >= 50:1053 1st Qu.:0.93 Median :1.23 Mean :1.28 3rd Qu.:1.54 Max. :3.16 > sum( ifelse(is.na(Quinidine[["conc"]]), 0, 1) ) [1] 361 > sum( !is.na(Quinidine[["conc"]]) ) [1] 361 > sum( !is.na(Quinidine[["dose"]]) ) [1] 1028 > gapply( Quinidine, "conc", function(x) sum(!is.na(x)) ) 109 70 23 92 111 5 18 24 2 88 91 117 120 13 89 27 1 1 3 1 1 2 3 1 1 1 1 3 2 1 3 1 53 122 129 132 16 106 15 22 57 77 115 121 123 11 48 126 1 1 2 3 1 1 1 1 3 1 4 1 1 2 2 2 223 19 38 42 52 56 63 83 104 118 137 17 29 34 46 73 6 1 1 2 1 1 4 1 2 2 1 1 1 1 3 2 87 103 138 45 44 97 36 37 72 100 8 71 6 14 26 75 2 1 2 3 7 2 2 3 1 3 1 5 1 3 1 3 20 96 99 134 12 49 67 85 112 127 55 68 124 1 35 47 2 3 2 1 1 3 3 1 3 3 6 3 1 2 2 5 79 95 114 135 105 116 62 65 107 130 66 139 33 80 125 110 3 3 2 2 1 3 4 7 4 3 1 3 3 2 1 11 128 136 21 43 90 102 40 84 98 30 82 93 108 119 32 133 2 11 2 1 1 2 2 6 2 1 3 4 1 3 1 2 7 9 76 94 58 113 50 39 78 25 61 3 64 60 59 10 6 2 6 5 1 2 3 2 10 2 2 3 4 4 3 6 69 4 81 54 41 74 28 51 2 6 11 4 3 3 4 6 > table( gapply(Quinidine, "conc", function(x) sum(!is.na(x))) ) 1 2 3 4 5 6 7 10 11 46 33 31 9 3 8 2 1 3 > changeRecords <- gapply( Quinidine, FUN = function(frm) + any(is.na(frm[["conc"]]) & is.na(frm[["dose"]])) ) > changeRecords 109 70 23 92 111 5 18 24 2 88 FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE 91 117 120 13 89 27 53 122 129 132 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE 16 106 15 22 57 77 115 121 123 11 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE 48 126 223 19 38 42 52 56 63 83 TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE 104 118 137 17 29 34 46 73 87 103 FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE 138 45 44 97 36 37 72 100 8 71 FALSE TRUE TRUE TRUE FALSE TRUE FALSE FALSE FALSE TRUE 6 14 26 75 20 96 99 134 12 49 FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE 67 85 112 127 55 68 124 1 35 47 FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE 79 95 114 135 105 116 62 65 107 130 TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE FALSE FALSE 66 139 33 80 125 110 128 136 21 43 FALSE TRUE TRUE TRUE FALSE TRUE FALSE TRUE FALSE FALSE 90 102 40 84 98 30 82 93 108 119 FALSE FALSE TRUE TRUE TRUE FALSE TRUE FALSE FALSE TRUE 32 133 7 9 76 94 58 113 50 39 FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE 78 25 61 3 64 60 59 10 69 4 FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE FALSE TRUE 81 54 41 74 28 51 TRUE TRUE TRUE FALSE TRUE FALSE > sort( as.numeric( names(changeRecords)[changeRecords] ) ) [1] 3 4 7 10 14 18 28 33 37 40 41 44 45 46 47 [16] 48 50 54 55 61 62 63 64 65 71 75 76 77 79 80 [31] 81 82 84 94 95 96 97 98 110 112 114 118 119 127 132 [46] 133 135 136 139 223 > Quinidine[29:31,] Grouped Data: conc ~ time | Subject Subject time conc dose interval Age Height Weight Race 29 3 3897 NA 201 NA 67 69 62 Caucasian 30 3 3900 NA NA NA 67 69 62 Caucasian 31 3 3905 NA 201 NA 67 69 62 Caucasian Smoke Ethanol Heart Creatinine glyco 29 yes former Moderate < 50 1.71 30 yes former Moderate < 50 1.71 31 yes former Moderate < 50 1.71 > Quinidine[Quinidine[["Subject"]] == 4, ] Grouped Data: conc ~ time | Subject Subject time conc dose interval Age Height Weight Race 45 4 0.00 NA 332 NA 88 66 103 Black 46 4 7.00 NA 332 NA 88 66 103 Black 47 4 13.00 NA 332 NA 88 66 103 Black 48 4 19.00 NA 332 NA 88 66 103 Black 49 4 21.50 3.1 NA NA 88 66 103 Black 50 4 85.00 NA 249 6 88 66 103 Black 51 4 91.00 5.8 NA NA 88 66 103 Black 52 4 91.08 NA 249 NA 88 66 103 Black 53 4 97.00 NA 249 NA 88 66 103 Black 54 4 103.00 NA 249 NA 88 66 103 Black 55 4 105.00 NA NA NA 88 66 92 Black 56 4 109.00 NA 249 NA 88 66 92 Black 57 4 115.00 NA 249 NA 88 66 92 Black 58 4 145.00 NA 166 NA 88 66 92 Black 59 4 151.00 NA 166 NA 88 66 92 Black 60 4 156.00 3.1 NA NA 88 66 92 Black 61 4 157.00 NA 166 NA 88 66 92 Black 62 4 163.00 NA 166 NA 88 66 92 Black 63 4 169.00 NA 166 NA 88 66 92 Black 64 4 174.75 NA 201 NA 88 66 92 Black 65 4 177.00 NA NA NA 88 66 92 Black 66 4 181.50 3.1 NA NA 88 66 92 Black 67 4 245.00 NA 201 8 88 66 92 Black 68 4 249.00 NA NA NA 88 66 86 Black 69 4 252.50 3.2 NA NA 88 66 86 Black 70 4 317.00 NA 201 8 88 66 86 Black 71 4 326.00 1.9 NA NA 88 66 86 Black Smoke Ethanol Heart Creatinine glyco 45 yes none Severe >= 50 1.48 46 yes none Severe >= 50 1.48 47 yes none Severe >= 50 1.48 48 yes none Severe >= 50 1.48 49 yes none Severe >= 50 1.48 50 yes none Severe >= 50 1.61 51 yes none Severe >= 50 1.61 52 yes none Severe >= 50 1.61 53 yes none Severe >= 50 1.61 54 yes none Severe >= 50 1.61 55 yes none Severe >= 50 1.61 56 yes none Severe >= 50 1.61 57 yes none Severe >= 50 1.61 58 yes none Severe >= 50 1.88 59 yes none Severe >= 50 1.88 60 yes none Severe >= 50 1.88 61 yes none Severe >= 50 1.88 62 yes none Severe >= 50 1.88 63 yes none Severe >= 50 1.88 64 yes none Severe >= 50 1.88 65 yes none Severe >= 50 1.68 66 yes none Severe >= 50 1.68 67 yes none Severe >= 50 1.87 68 yes none Severe >= 50 1.87 69 yes none Severe >= 50 1.87 70 yes none Severe >= 50 1.83 71 yes none Severe >= 50 1.83 > # cleanup > > summary(warnings()) No warnings ====== ch04.R ====== > #-*- R -*- > > # initialization > > library(nlme) > library(lattice) > 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 = 'ch04.pdf') > # Chapter 4 Fitting Linear Mixed-Effects Models > > # 4.1 Fitting Linear Models in S with lm and lmList > > fm1Orth.lm <- lm(distance ~ age, Orthodont) > fm1Orth.lm Call: lm(formula = distance ~ age, data = Orthodont) Coefficients: (Intercept) age 16.76 0.66 > par(mfrow=c(2,2)) > plot(fm1Orth.lm) # Figure 4.1 > fm2Orth.lm <- update(fm1Orth.lm, formula = distance ~ Sex*age) > summary(fm2Orth.lm) Call: lm(formula = distance ~ Sex + age + Sex:age, data = Orthodont) Residuals: Min 1Q Median 3Q Max -5.616 -1.322 -0.168 1.330 5.247 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 16.8567 1.1094 15.19 < 2e-16 *** Sex1 0.5161 1.1094 0.47 0.64 age 0.6320 0.0988 6.39 4.7e-09 *** Sex1:age -0.1524 0.0988 -1.54 0.13 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.26 on 104 degrees of freedom Multiple R-squared: 0.423, Adjusted R-squared: 0.406 F-statistic: 25.4 on 3 and 104 DF, p-value: 2.11e-12 > fm3Orth.lm <- update(fm2Orth.lm, formula = . ~ . - Sex) > summary(fm3Orth.lm) Call: lm(formula = distance ~ age + Sex:age, data = Orthodont) Residuals: Min 1Q Median 3Q Max -5.742 -1.242 -0.189 1.268 5.267 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 16.7611 1.0861 15.43 < 2e-16 *** age 0.6403 0.0968 6.61 1.6e-09 *** age:Sex1 -0.1074 0.0196 -5.47 3.0e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.25 on 105 degrees of freedom Multiple R-squared: 0.422, Adjusted R-squared: 0.411 F-statistic: 38.3 on 2 and 105 DF, p-value: 3.31e-13 > bwplot(getGroups(Orthodont)~resid(fm2Orth.lm)) # Figure 4.2 > fm1Orth.lis <- lmList(distance ~ age | Subject, Orthodont) > getGroupsFormula(Orthodont) ~Subject > fm1Orth.lis <- lmList(distance ~ age, Orthodont) > formula(Orthodont) distance ~ age | Subject > fm1Orth.lis <- lmList(Orthodont) > fm1Orth.lis Call: Model: distance ~ age | Subject Data: Orthodont Coefficients: (Intercept) age M16 17.0 0.550 M05 13.7 0.850 M02 14.9 0.775 M11 20.1 0.325 M07 15.0 0.800 M08 19.8 0.375 M03 16.0 0.750 M12 13.2 1.000 M13 2.8 1.950 M14 19.1 0.525 M09 14.4 0.975 M15 13.5 1.125 M06 19.0 0.675 M04 24.7 0.175 M01 17.3 0.950 M10 21.2 0.750 F10 13.5 0.450 F09 18.1 0.275 F06 17.0 0.375 F01 17.2 0.375 F05 19.6 0.275 F07 16.9 0.550 F02 14.2 0.800 F08 21.4 0.175 F03 14.4 0.850 F04 19.7 0.475 F11 19.0 0.675 Degrees of freedom: 108 total; 54 residual Residual standard error: 1.31 > summary(fm1Orth.lis) Call: Model: distance ~ age | Subject Data: Orthodont Coefficients: (Intercept) Estimate Std. Error t value Pr(>|t|) M16 17.0 3.29 5.155 3.70e-06 M05 13.7 3.29 4.151 1.18e-04 M02 14.9 3.29 4.516 3.46e-05 M11 20.1 3.29 6.098 1.19e-07 M07 15.0 3.29 4.547 3.12e-05 M08 19.8 3.29 6.006 1.67e-07 M03 16.0 3.29 4.866 1.03e-05 M12 13.2 3.29 4.030 1.76e-04 M13 2.8 3.29 0.852 3.98e-01 M14 19.1 3.29 5.809 3.45e-07 M09 14.4 3.29 4.379 5.51e-05 M15 13.5 3.29 4.106 1.37e-04 M06 19.0 3.29 5.763 4.08e-07 M04 24.7 3.29 7.512 6.08e-10 M01 17.3 3.29 5.261 2.52e-06 M10 21.2 3.29 6.463 3.07e-08 F10 13.5 3.29 4.121 1.31e-04 F09 18.1 3.29 5.505 1.05e-06 F06 17.0 3.29 5.170 3.50e-06 F01 17.2 3.29 5.246 2.67e-06 F05 19.6 3.29 5.961 1.97e-07 F07 16.9 3.29 5.155 3.70e-06 F02 14.2 3.29 4.319 6.76e-05 F08 21.4 3.29 6.523 2.44e-08 F03 14.4 3.29 4.379 5.51e-05 F04 19.7 3.29 5.976 1.86e-07 F11 19.0 3.29 5.763 4.08e-07 age Estimate Std. Error t value Pr(>|t|) M16 0.550 0.293 1.878 6.58e-02 M05 0.850 0.293 2.902 5.36e-03 M02 0.775 0.293 2.646 1.07e-02 M11 0.325 0.293 1.109 2.72e-01 M07 0.800 0.293 2.731 8.51e-03 M08 0.375 0.293 1.280 2.06e-01 M03 0.750 0.293 2.560 1.33e-02 M12 1.000 0.293 3.414 1.22e-03 M13 1.950 0.293 6.657 1.49e-08 M14 0.525 0.293 1.792 7.87e-02 M09 0.975 0.293 3.328 1.58e-03 M15 1.125 0.293 3.840 3.25e-04 M06 0.675 0.293 2.304 2.51e-02 M04 0.175 0.293 0.597 5.53e-01 M01 0.950 0.293 3.243 2.03e-03 M10 0.750 0.293 2.560 1.33e-02 F10 0.450 0.293 1.536 1.30e-01 F09 0.275 0.293 0.939 3.52e-01 F06 0.375 0.293 1.280 2.06e-01 F01 0.375 0.293 1.280 2.06e-01 F05 0.275 0.293 0.939 3.52e-01 F07 0.550 0.293 1.878 6.58e-02 F02 0.800 0.293 2.731 8.51e-03 F08 0.175 0.293 0.597 5.53e-01 F03 0.850 0.293 2.902 5.36e-03 F04 0.475 0.293 1.622 1.11e-01 F11 0.675 0.293 2.304 2.51e-02 Residual standard error: 1.31 on 54 degrees of freedom > pairs(fm1Orth.lis, id = 0.01, adj = -0.5) # Figure 4.3 > fm2Orth.lis <- update(fm1Orth.lis, distance ~ I(age-11)) > intervals(fm2Orth.lis) , , (Intercept) lower est. upper M16 21.7 23.0 24.3 M05 21.7 23.0 24.3 M02 22.1 23.4 24.7 M11 22.3 23.6 24.9 M07 22.4 23.8 25.1 M08 22.6 23.9 25.2 M03 22.9 24.2 25.6 M12 22.9 24.2 25.6 M13 22.9 24.2 25.6 M14 23.6 24.9 26.2 M09 23.8 25.1 26.4 M15 24.6 25.9 27.2 M06 25.1 26.4 27.7 M04 25.3 26.6 27.9 M01 26.4 27.8 29.1 M10 28.2 29.5 30.8 F10 17.2 18.5 19.8 F09 19.8 21.1 22.4 F06 19.8 21.1 22.4 F01 20.1 21.4 22.7 F05 21.3 22.6 23.9 F07 21.7 23.0 24.3 F02 21.7 23.0 24.3 F08 22.1 23.4 24.7 F03 22.4 23.8 25.1 F04 23.6 24.9 26.2 F11 25.1 26.4 27.7 , , I(age - 11) lower est. upper M16 -0.0373 0.550 1.137 M05 0.2627 0.850 1.437 M02 0.1877 0.775 1.362 M11 -0.2623 0.325 0.912 M07 0.2127 0.800 1.387 M08 -0.2123 0.375 0.962 M03 0.1627 0.750 1.337 M12 0.4127 1.000 1.587 M13 1.3627 1.950 2.537 M14 -0.0623 0.525 1.112 M09 0.3877 0.975 1.562 M15 0.5377 1.125 1.712 M06 0.0877 0.675 1.262 M04 -0.4123 0.175 0.762 M01 0.3627 0.950 1.537 M10 0.1627 0.750 1.337 F10 -0.1373 0.450 1.037 F09 -0.3123 0.275 0.862 F06 -0.2123 0.375 0.962 F01 -0.2123 0.375 0.962 F05 -0.3123 0.275 0.862 F07 -0.0373 0.550 1.137 F02 0.2127 0.800 1.387 F08 -0.4123 0.175 0.762 F03 0.2627 0.850 1.437 F04 -0.1123 0.475 1.062 F11 0.0877 0.675 1.262 > plot(intervals(fm2Orth.lis)) # Figure 4.5 > IGF Grouped Data: conc ~ age | Lot Lot age conc 1 1 7 4.90 2 1 7 5.68 3 1 8 5.32 4 1 8 5.50 5 1 13 4.94 6 1 13 5.19 7 1 14 5.18 8 1 14 5.67 9 1 15 5.02 10 1 15 5.88 11 1 22 5.12 12 1 23 5.24 13 1 24 5.88 14 1 27 5.40 15 1 28 5.59 16 1 28 5.77 17 1 30 5.57 18 1 34 5.86 19 1 34 5.87 20 1 35 4.65 21 1 35 5.34 22 1 36 4.93 23 1 36 5.33 24 1 36 4.99 25 1 41 3.38 26 1 42 5.44 27 1 42 5.24 28 1 43 5.39 29 2 3 5.34 30 2 3 5.27 31 2 3 5.48 32 2 6 5.15 33 2 11 4.23 34 2 11 5.77 35 2 11 5.06 36 2 12 5.33 37 2 12 5.78 38 2 13 5.01 39 2 13 4.85 40 2 13 4.94 41 2 18 5.14 42 2 24 5.43 43 2 24 5.66 44 2 25 5.62 45 2 25 5.53 46 2 26 6.20 47 2 27 5.30 48 2 27 4.09 49 2 32 5.78 50 2 32 5.66 51 2 34 5.07 52 2 38 5.45 53 2 40 4.76 54 2 42 4.81 55 2 45 4.92 56 2 46 4.32 57 2 47 3.30 58 3 1 5.88 59 3 2 5.91 60 3 5 0.86 61 3 6 5.40 62 3 7 4.94 63 3 8 5.42 64 3 13 5.40 65 3 15 5.68 66 3 15 5.71 67 3 21 9.55 68 3 21 5.94 69 3 21 6.17 70 3 22 5.34 71 3 22 8.14 72 3 27 5.51 73 3 28 5.31 74 3 28 4.81 75 3 28 5.26 76 3 29 4.72 77 3 30 5.08 78 3 30 3.99 79 3 33 4.87 80 3 34 4.92 81 3 34 6.13 82 3 35 6.30 83 3 36 5.97 84 3 37 5.98 85 3 41 6.68 86 3 42 5.33 87 3 43 6.08 88 3 44 4.76 89 3 47 5.31 90 3 47 6.66 91 3 48 5.52 92 3 49 5.48 93 3 50 5.10 94 4 5 5.12 95 4 5 5.08 96 4 5 4.63 97 4 5 5.38 98 4 7 5.78 99 4 9 9.34 100 4 11 5.58 101 4 11 5.19 102 4 12 5.25 103 4 12 5.44 104 4 14 5.31 105 4 14 4.71 106 4 14 5.67 107 4 14 4.65 108 4 14 5.05 109 4 15 4.23 110 4 19 5.02 111 4 19 4.98 112 4 20 5.08 113 4 20 4.84 114 4 22 4.84 115 4 22 5.53 116 4 25 5.85 117 4 25 5.32 118 4 26 5.47 119 5 1 5.49 120 5 2 5.43 121 5 6 5.02 122 5 6 5.29 123 5 7 6.25 124 5 9 4.63 125 5 10 5.18 126 5 15 5.17 127 5 15 4.98 128 5 15 5.38 129 5 15 3.76 130 5 17 5.63 131 5 21 6.12 132 5 22 4.00 133 5 23 6.53 134 5 24 4.67 135 5 24 5.55 136 5 24 5.62 137 5 29 4.58 138 5 30 5.41 139 5 35 4.84 140 5 37 4.83 141 5 37 5.36 142 5 37 4.81 143 5 37 5.35 144 5 42 5.46 145 5 43 5.09 146 5 44 4.78 147 5 44 4.44 148 5 45 4.67 149 5 48 4.98 150 6 2 4.56 151 6 3 5.83 152 6 3 5.27 153 6 4 4.90 154 7 1 4.94 155 7 2 4.78 156 7 3 5.42 157 7 4 5.42 158 7 5 5.38 159 7 7 5.55 160 7 10 5.81 161 7 10 5.62 162 7 11 6.08 163 7 15 4.80 164 7 16 5.32 165 7 17 4.95 166 7 17 5.44 167 7 18 5.48 168 7 21 5.26 169 7 22 5.21 170 7 23 4.65 171 7 24 4.62 172 7 24 5.15 173 7 26 4.71 174 7 27 5.02 175 7 29 5.38 176 7 31 5.34 177 7 31 5.10 178 7 32 5.69 179 7 36 5.00 180 7 37 5.02 181 7 38 9.74 182 7 38 9.60 183 7 39 5.58 184 7 42 4.94 185 7 43 4.66 186 7 43 5.23 187 7 45 5.62 188 7 45 5.53 189 7 45 5.45 190 7 45 4.63 191 7 47 5.01 192 7 50 5.43 193 8 1 6.17 194 8 1 5.57 195 8 2 4.82 196 8 3 5.84 197 8 6 5.55 198 8 9 5.17 199 8 9 6.50 200 8 9 5.36 201 9 4 5.47 202 9 4 5.57 203 9 5 5.36 204 9 7 4.93 205 9 8 5.49 206 9 11 3.25 207 9 13 5.53 208 9 13 4.91 209 9 13 5.74 210 9 14 4.95 211 9 15 5.07 212 9 19 5.54 213 9 20 5.29 214 9 21 4.59 215 9 25 5.66 216 9 26 4.69 217 9 26 5.18 218 9 27 5.19 219 9 27 5.35 220 9 29 5.28 221 9 29 5.50 222 9 29 5.00 223 9 30 5.47 224 9 33 5.55 225 9 34 5.75 226 9 35 5.41 227 9 35 5.65 228 9 35 5.25 229 9 36 5.81 230 9 40 4.71 231 9 41 4.95 232 10 4 6.00 233 10 5 5.74 234 10 6 5.68 235 10 6 5.83 236 10 11 5.30 237 10 13 5.63 > plot(IGF) # Figure 4.6 > fm1IGF.lis <- lmList(IGF) > coef(fm1IGF.lis) (Intercept) age 9 5.10 0.00573 6 4.63 0.17000 1 5.49 -0.00779 10 6.05 -0.04733 2 5.48 -0.01443 8 5.59 0.00606 5 5.37 -0.00951 4 5.58 -0.01666 3 5.28 0.01008 7 5.21 0.00931 > plot(intervals(fm1IGF.lis)) # Figure 4.7 > fm1IGF.lm <- lm(conc ~ age, data = IGF) > summary(fm1IGF.lm) Call: lm(formula = conc ~ age, data = IGF) Residuals: Min 1Q Median 3Q Max -4.488 -0.374 -0.009 0.258 4.414 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.351059 0.103734 51.58 <2e-16 *** age -0.000669 0.003943 -0.17 0.87 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.833 on 235 degrees of freedom Multiple R-squared: 0.000123, Adjusted R-squared: -0.00413 F-statistic: 0.0288 on 1 and 235 DF, p-value: 0.865 > # 4.2 Fitting Linear Mixed-Effects Models with lme > > fm1Orth.lme <- lme(distance ~ I(age-11), data = Orthodont, + random = ~ I(age-11) | Subject) > fm1Orth.lme <- lme(distance ~ I(age-11), data = Orthodont) > fm1Orth.lme <- lme(fm2Orth.lis) > fm1Orth.lme Linear mixed-effects model fit by REML Data: Orthodont Log-restricted-likelihood: -221 Fixed: distance ~ I(age - 11) (Intercept) I(age - 11) 24.02 0.66 Random effects: Formula: ~I(age - 11) | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 2.134 (Intr) I(age - 11) 0.226 0.503 Residual 1.310 Number of Observations: 108 Number of Groups: 27 > fm2Orth.lme <- update(fm1Orth.lme, distance~Sex*I(age-11)) > summary(fm2Orth.lme) Linear mixed-effects model fit by REML Data: Orthodont AIC BIC logLik 451 473 -218 Random effects: Formula: ~I(age - 11) | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.83 (Intr) I(age - 11) 0.18 0.206 Residual 1.31 Fixed effects: distance ~ Sex + I(age - 11) + Sex:I(age - 11) Value Std.Error DF t-value p-value (Intercept) 23.81 0.381 79 62.5 0.0000 Sex1 -1.16 0.381 25 -3.0 0.0054 I(age - 11) 0.63 0.067 79 9.4 0.0000 Sex1:I(age - 11) -0.15 0.067 79 -2.3 0.0264 Correlation: (Intr) Sex1 I(-11) Sex1 0.185 I(age - 11) 0.102 0.019 Sex1:I(age - 11) 0.019 0.102 0.185 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.1681 -0.3859 0.0071 0.4452 3.8495 Number of Observations: 108 Number of Groups: 27 > fitted(fm2Orth.lme, level = 0:1) fixed Subject 1 22.6 24.8 2 24.2 26.6 3 25.8 28.3 4 27.3 30.0 5 22.6 21.3 6 24.2 22.8 7 25.8 24.3 8 27.3 25.8 9 22.6 22.0 10 24.2 23.6 11 25.8 25.1 12 27.3 26.6 13 22.6 24.5 14 24.2 25.8 15 25.8 27.0 16 27.3 28.3 17 22.6 20.9 18 24.2 22.5 19 25.8 24.0 20 27.3 25.6 21 22.6 23.9 22 24.2 25.4 23 25.8 27.0 24 27.3 28.5 25 22.6 21.6 26 24.2 23.1 27 25.8 24.7 28 27.3 26.2 29 22.6 22.0 30 24.2 23.3 31 25.8 24.6 32 27.3 26.0 33 22.6 22.6 34 24.2 24.3 35 25.8 26.0 36 27.3 27.6 37 22.6 26.5 38 24.2 28.1 39 25.8 29.8 40 27.3 31.5 41 22.6 21.8 42 24.2 23.1 43 25.8 24.4 44 27.3 25.7 45 22.6 21.8 46 24.2 23.5 47 25.8 25.2 48 27.3 26.8 49 22.6 21.2 50 24.2 23.3 51 25.8 25.5 52 27.3 27.7 53 22.6 22.7 54 24.2 24.2 55 25.8 25.6 56 27.3 27.0 57 22.6 23.1 58 24.2 24.9 59 25.8 26.7 60 27.3 28.5 61 22.6 21.1 62 24.2 22.5 63 25.8 23.9 64 27.3 25.3 65 21.2 20.2 66 22.2 21.1 67 23.1 21.9 68 24.1 22.8 69 21.2 21.3 70 22.2 22.4 71 23.1 23.6 72 24.1 24.7 73 21.2 21.9 74 22.2 23.1 75 23.1 24.2 76 24.1 25.4 77 21.2 23.1 78 22.2 24.1 79 23.1 25.1 80 24.1 26.1 81 21.2 21.3 82 22.2 22.2 83 23.1 23.0 84 24.1 23.9 85 21.2 20.0 86 22.2 20.9 87 23.1 21.7 88 24.1 22.6 89 21.2 21.5 90 22.2 22.5 91 23.1 23.5 92 24.1 24.5 93 21.2 22.0 94 22.2 22.9 95 23.1 23.7 96 24.1 24.5 97 21.2 20.1 98 22.2 20.9 99 23.1 21.7 100 24.1 22.5 101 21.2 17.7 102 22.2 18.6 103 23.1 19.4 104 24.1 20.2 105 21.2 24.2 106 22.2 25.4 107 23.1 26.5 108 24.1 27.7 > resid(fm2Orth.lme, level = 1) M01 M01 M01 M01 M02 M02 M02 1.15428 -1.57649 0.69275 0.96198 0.22522 -0.29641 -1.31803 M02 M03 M03 M03 M03 M04 M04 0.66034 0.96689 -1.06449 -1.09588 0.87274 1.03549 1.74867 M04 M04 M05 M05 M05 M05 M06 -0.53814 -1.32495 -0.90249 1.04571 -1.50610 0.44210 0.61473 M06 M06 M06 M07 M07 M07 M07 0.06728 0.01983 -0.02762 0.42649 -1.11840 -0.16330 0.29181 M08 M08 M08 M08 M09 M09 M09 2.00813 -1.81291 -0.13395 -0.45500 0.39248 -3.78229 5.04295 M09 M10 M10 M10 M10 M11 M11 -1.63182 1.02728 -0.14284 1.18705 0.01693 1.18276 -0.10495 M11 M11 M12 M12 M12 M12 M13 -0.89267 -0.68038 -0.34919 -0.01420 -1.17920 1.15579 -4.15031 M13 M13 M13 M14 M14 M14 M14 1.17692 0.50416 1.83139 -0.22716 1.34520 -0.08244 -1.01008 M15 M15 M15 M15 M16 M16 M16 -0.13140 -0.40616 -0.68091 1.54433 0.87681 -1.01465 -0.40610 M16 F01 F01 F01 F01 F02 F02 -0.29756 0.79027 -1.07931 -0.44889 0.18152 -0.27124 -0.91092 F02 F02 F03 F03 F03 F03 F04 0.44940 0.80973 -1.36869 0.94509 0.25887 0.57265 0.40409 F04 F04 F04 F05 F05 F05 F05 0.38858 -0.12694 0.35754 0.15965 0.81049 -0.53868 -0.38784 F06 F06 F06 F06 F07 F07 F07 0.00168 0.13870 -0.72427 -0.08725 0.04484 0.03879 -0.46727 F07 F08 F08 F08 F08 F09 F09 0.52667 0.95185 0.13632 -0.17921 -0.49475 -0.07189 0.11859 F09 F09 F10 F10 F10 F10 F11 0.30906 -1.00047 -1.22334 0.44296 -0.39073 -0.72443 0.28277 F11 F11 F11 -0.37929 1.45866 0.29661 attr(,"label") [1] "Residuals (mm)" > resid(fm2Orth.lme, level = 1, type = "pearson") M01 M01 M01 M01 M02 M02 M02 0.88111 -1.20339 0.52880 0.73431 0.17192 -0.22626 -1.00610 M02 M03 M03 M03 M03 M04 M04 0.50406 0.73806 -0.81257 -0.83652 0.66619 0.79042 1.33482 M04 M04 M05 M05 M05 M05 M06 -0.41078 -1.01139 -0.68890 0.79822 -1.14966 0.33747 0.46925 M06 M06 M06 M07 M07 M07 M07 0.05136 0.01514 -0.02108 0.32556 -0.85372 -0.12465 0.22275 M08 M08 M08 M08 M09 M09 M09 1.53288 -1.38386 -0.10225 -0.34732 0.29959 -2.88715 3.84946 M09 M10 M10 M10 M10 M11 M11 -1.24562 0.78416 -0.10903 0.90612 0.01293 0.90284 -0.08012 M11 M11 M12 M12 M12 M12 M13 -0.68140 -0.51936 -0.26655 -0.01084 -0.90013 0.88226 -3.16808 M13 M13 M13 M14 M14 M14 M14 0.89839 0.38484 1.39796 -0.17340 1.02684 -0.06293 -0.77103 M15 M15 M15 M15 M16 M16 M16 -0.10030 -0.31003 -0.51977 1.17884 0.66930 -0.77452 -0.30999 M16 F01 F01 F01 F01 F02 F02 -0.22714 0.60324 -0.82388 -0.34266 0.13856 -0.20705 -0.69534 F02 F02 F03 F03 F03 F03 F04 0.34305 0.61809 -1.04477 0.72142 0.19761 0.43712 0.30846 F04 F04 F04 F05 F05 F05 F05 0.29661 -0.09690 0.27293 0.12187 0.61867 -0.41119 -0.29605 F06 F06 F06 F06 F07 F07 F07 0.00128 0.10588 -0.55286 -0.06660 0.03423 0.02961 -0.35668 F07 F08 F08 F08 F08 F09 F09 0.40203 0.72658 0.10406 -0.13680 -0.37766 -0.05488 0.09052 F09 F09 F10 F10 F10 F10 F11 0.23592 -0.76369 -0.93382 0.33813 -0.29826 -0.55298 0.21585 F11 F11 F11 -0.28952 1.11345 0.22641 attr(,"label") [1] "Standardized residuals" > newOrth <- data.frame(Subject = rep(c("M11","F03"), c(3, 3)), + Sex = rep(c("Male", "Female"), c(3, 3)), + age = rep(16:18, 2)) > predict(fm2Orth.lme, newdata = newOrth) M11 M11 M11 F03 F03 F03 27.0 27.6 28.3 26.6 27.2 27.8 attr(,"label") [1] "Predicted values (mm)" > predict(fm2Orth.lme, newdata = newOrth, level = 0:1) Subject predict.fixed predict.Subject 1 M11 28.9 27.0 2 M11 29.7 27.6 3 M11 30.5 28.3 4 F03 25.0 26.6 5 F03 25.5 27.2 6 F03 26.0 27.8 > fm2Orth.lmeM <- update(fm2Orth.lme, method = "ML") > summary(fm2Orth.lmeM) Linear mixed-effects model fit by maximum likelihood Data: Orthodont AIC BIC logLik 444 465 -214 Random effects: Formula: ~I(age - 11) | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.752 (Intr) I(age - 11) 0.154 0.234 Residual 1.310 Fixed effects: distance ~ Sex + I(age - 11) + Sex:I(age - 11) Value Std.Error DF t-value p-value (Intercept) 23.81 0.373 79 63.8 0.0000 Sex1 -1.16 0.373 25 -3.1 0.0046 I(age - 11) 0.63 0.066 79 9.6 0.0000 Sex1:I(age - 11) -0.15 0.066 79 -2.3 0.0237 Correlation: (Intr) Sex1 I(-11) Sex1 0.185 I(age - 11) 0.102 0.019 Sex1:I(age - 11) 0.019 0.102 0.185 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.3360 -0.4154 0.0104 0.4917 3.8582 Number of Observations: 108 Number of Groups: 27 > compOrth <- + compareFits(coef(fm2Orth.lis), coef(fm1Orth.lme)) > compOrth , , (Intercept) coef(fm2Orth.lis) coef(fm1Orth.lme) M16 23.0 23.1 M05 23.0 23.1 M02 23.4 23.5 M11 23.6 23.6 M07 23.8 23.8 M08 23.9 23.8 M03 24.2 24.2 M12 24.2 24.3 M13 24.2 24.4 M14 24.9 24.8 M09 25.1 25.1 M15 25.9 25.8 M06 26.4 26.2 M04 26.6 26.3 M01 27.8 27.4 M10 29.5 29.0 F10 18.5 19.0 F09 21.1 21.3 F06 21.1 21.4 F01 21.4 21.6 F05 22.6 22.7 F07 23.0 23.1 F02 23.0 23.1 F08 23.4 23.4 F03 23.8 23.8 F04 24.9 24.8 F11 26.4 26.2 , , I(age - 11) coef(fm2Orth.lis) coef(fm1Orth.lme) M16 0.550 0.591 M05 0.850 0.686 M02 0.775 0.675 M11 0.325 0.541 M07 0.800 0.695 M08 0.375 0.565 M03 0.750 0.696 M12 1.000 0.775 M13 1.950 1.074 M14 0.525 0.646 M09 0.975 0.796 M15 1.125 0.868 M06 0.675 0.743 M04 0.175 0.594 M01 0.950 0.876 M10 0.750 0.871 F10 0.450 0.410 F09 0.275 0.442 F06 0.375 0.474 F01 0.375 0.482 F05 0.275 0.492 F07 0.550 0.591 F02 0.800 0.670 F08 0.175 0.486 F03 0.850 0.711 F04 0.475 0.630 F11 0.675 0.743 > plot(compOrth, mark = fixef(fm1Orth.lme)) # Figure 4.8 > ## Figure 4.9 > plot(comparePred(fm2Orth.lis, fm1Orth.lme, length.out = 2), + layout = c(8,4), between = list(y = c(0, 0.5, 0))) > plot(compareFits(ranef(fm2Orth.lme), ranef(fm2Orth.lmeM)), + mark = c(0, 0)) > fm4Orth.lm <- lm(distance ~ Sex * I(age-11), Orthodont) > summary(fm4Orth.lm) Call: lm(formula = distance ~ Sex * I(age - 11), data = Orthodont) Residuals: Min 1Q Median 3Q Max -5.616 -1.322 -0.168 1.330 5.247 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 23.8082 0.2210 107.73 < 2e-16 *** Sex1 -1.1605 0.2210 -5.25 8.1e-07 *** I(age - 11) 0.6320 0.0988 6.39 4.7e-09 *** Sex1:I(age - 11) -0.1524 0.0988 -1.54 0.13 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.26 on 104 degrees of freedom Multiple R-squared: 0.423, Adjusted R-squared: 0.406 F-statistic: 25.4 on 3 and 104 DF, p-value: 2.11e-12 > anova(fm2Orth.lme, fm4Orth.lm) Model df AIC BIC logLik Test L.Ratio p-value fm2Orth.lme 1 8 451 473 -218 fm4Orth.lm 2 5 496 510 -243 1 vs 2 51 <.0001 > #fm1IGF.lme <- lme(fm1IGF.lis) > #fm1IGF.lme > #intervals(fm1IGF.lme) > #summary(fm1IGF.lme) > pd1 <- pdDiag(~ age) > pd1 Uninitialized positive definite matrix structure of class pdDiag. > formula(pd1) ~age > #fm2IGF.lme <- update(fm1IGF.lme, random = pdDiag(~age)) > (fm2IGF.lme <- lme(conc ~ age, IGF, + random = pdDiag(~age))) Linear mixed-effects model fit by REML Data: IGF Log-restricted-likelihood: -297 Fixed: conc ~ age (Intercept) age 5.36904 -0.00193 Random effects: Formula: ~age | Lot Structure: Diagonal (Intercept) age Residual StdDev: 3.62e-05 0.00537 0.822 Number of Observations: 237 Number of Groups: 10 > #anova(fm1IGF.lme, fm2IGF.lme) > anova(fm2IGF.lme) numDF denDF F-value p-value (Intercept) 1 226 6439 <.0001 age 1 226 0 0.673 > #update(fm1IGF.lme, random = list(Lot = pdDiag(~ age))) > pd2 <- pdDiag(value = diag(2), form = ~ age) > pd2 Positive definite matrix structure of class pdDiag representing [,1] [,2] [1,] 1 0 [2,] 0 1 > formula(pd2) ~age > lme(conc ~ age, IGF, pdDiag(diag(2), ~age)) Linear mixed-effects model fit by REML Data: IGF Log-restricted-likelihood: -297 Fixed: conc ~ age (Intercept) age 5.36904 -0.00193 Random effects: Formula: ~age | Lot Structure: Diagonal (Intercept) age Residual StdDev: 3.12e-05 0.00537 0.822 Number of Observations: 237 Number of Groups: 10 > fm4OatsB <- lme(yield ~ nitro, data = Oats, + random =list(Block = pdCompSymm(~ Variety - 1))) > summary(fm4OatsB) Linear mixed-effects model fit by REML Data: Oats AIC BIC logLik 603 614 -297 Random effects: Formula: ~Variety - 1 | Block Structure: Compound Symmetry StdDev Corr VarietyGolden Rain 18.2 VarietyMarvellous 18.2 0.635 VarietyVictory 18.2 0.635 0.635 Residual 12.9 Fixed effects: yield ~ nitro Value Std.Error DF t-value p-value (Intercept) 81.9 6.95 65 11.8 0 nitro 73.7 6.78 65 10.9 0 Correlation: (Intr) nitro -0.293 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.7438 -0.6648 0.0171 0.5430 1.8030 Number of Observations: 72 Number of Groups: 6 > corMatrix(fm4OatsB$modelStruct$reStruct$Block)[1,2] [1] 0.635 > fm4OatsC <- lme(yield ~ nitro, data = Oats, + random=list(Block=pdBlocked(list(pdIdent(~ 1), + pdIdent(~ Variety-1))))) > summary(fm4OatsC) Linear mixed-effects model fit by REML Data: Oats AIC BIC logLik 603 614 -297 Random effects: Composite Structure: Blocked Block 1: (Intercept) Formula: ~1 | Block (Intercept) StdDev: 14.5 Block 2: VarietyGolden Rain, VarietyMarvellous, VarietyVictory Formula: ~Variety - 1 | Block Structure: Multiple of an Identity VarietyGolden Rain VarietyMarvellous VarietyVictory StdDev: 11 11 11 Residual StdDev: 12.9 Fixed effects: yield ~ nitro Value Std.Error DF t-value p-value (Intercept) 81.9 6.95 65 11.8 0 nitro 73.7 6.78 65 10.9 0 Correlation: (Intr) nitro -0.293 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.7438 -0.6648 0.0171 0.5430 1.8030 Number of Observations: 72 Number of Groups: 6 > ## establishing the desired parameterization for contrasts > options(contrasts = c("contr.treatment", "contr.poly")) > fm1Assay <- lme(logDens ~ sample * dilut, Assay, + random = pdBlocked(list(pdIdent(~ 1), pdIdent(~ sample - 1), + pdIdent(~ dilut - 1)))) > fm1Assay Linear mixed-effects model fit by REML Data: Assay Log-restricted-likelihood: 38.5 Fixed: logDens ~ sample * dilut (Intercept) sampleb samplec sampled -0.18279 0.08075 0.13398 0.20770 samplee samplef dilut2 dilut3 -0.02367 0.07357 0.20443 0.40586 dilut4 dilut5 sampleb:dilut2 samplec:dilut2 0.57319 0.72064 0.00894 -0.00850 sampled:dilut2 samplee:dilut2 samplef:dilut2 sampleb:dilut3 0.00108 -0.04192 0.01935 -0.02507 samplec:dilut3 sampled:dilut3 samplee:dilut3 samplef:dilut3 0.01865 0.00399 -0.02771 0.05432 sampleb:dilut4 samplec:dilut4 sampled:dilut4 samplee:dilut4 0.06079 0.00526 -0.01649 0.04980 samplef:dilut4 sampleb:dilut5 samplec:dilut5 sampled:dilut5 0.06337 -0.04576 -0.07260 -0.17776 samplee:dilut5 samplef:dilut5 0.01361 0.00402 Random effects: Composite Structure: Blocked Block 1: (Intercept) Formula: ~1 | Block (Intercept) StdDev: 0.00981 Block 2: samplea, sampleb, samplec, sampled, samplee, samplef Formula: ~sample - 1 | Block Structure: Multiple of an Identity samplea sampleb samplec sampled samplee samplef StdDev: 0.0253 0.0253 0.0253 0.0253 0.0253 0.0253 Block 3: dilut1, dilut2, dilut3, dilut4, dilut5 Formula: ~dilut - 1 | Block Structure: Multiple of an Identity dilut1 dilut2 dilut3 dilut4 dilut5 Residual StdDev: 0.00913 0.00913 0.00913 0.00913 0.00913 0.0416 Number of Observations: 60 Number of Groups: 2 > anova(fm1Assay) numDF denDF F-value p-value (Intercept) 1 29 538 <.0001 sample 5 29 11 <.0001 dilut 4 29 421 <.0001 sample:dilut 20 29 2 0.119 > formula(Oxide) Thickness ~ 1 | Lot/Wafer > fm1Oxide <- lme(Thickness ~ 1, Oxide) > fm1Oxide Linear mixed-effects model fit by REML Data: Oxide Log-restricted-likelihood: -227 Fixed: Thickness ~ 1 (Intercept) 2000 Random effects: Formula: ~1 | Lot (Intercept) StdDev: 11.4 Formula: ~1 | Wafer %in% Lot (Intercept) Residual StdDev: 5.99 3.55 Number of Observations: 72 Number of Groups: Lot Wafer %in% Lot 8 24 > intervals(fm1Oxide, which = "var-cov") Approximate 95% confidence intervals Random Effects: Level: Lot lower est. upper sd((Intercept)) 6.39 11.4 20.3 Level: Wafer lower est. upper sd((Intercept)) 4.06 5.99 8.82 Within-group standard error: lower est. upper 2.90 3.55 4.33 > fm2Oxide <- update(fm1Oxide, random = ~ 1 | Lot) > anova(fm1Oxide, fm2Oxide) Model df AIC BIC logLik Test L.Ratio p-value fm1Oxide 1 4 462 471 -227 fm2Oxide 2 3 497 504 -246 1 vs 2 37.1 <.0001 > coef(fm1Oxide, level = 1) (Intercept) 1 1997 2 1989 3 2001 4 1996 5 2014 6 2020 7 1992 8 1994 > coef(fm1Oxide, level = 2) (Intercept) 1/1 2003 1/2 1985 1/3 2001 2/1 1990 2/2 1988 2/3 1986 3/1 2002 3/2 2000 3/3 2000 4/1 1996 4/2 1999 4/3 1991 5/1 2009 5/2 2017 5/3 2019 6/1 2031 6/2 2022 6/3 2011 7/1 1990 7/2 1991 7/3 1992 8/1 1994 8/2 1995 8/3 1991 > ranef(fm1Oxide, level = 1:2) Level: Lot (Intercept) 1 -3.463 2 -11.222 3 0.869 4 -4.471 5 13.463 6 19.408 7 -8.199 8 -6.385 Level: Wafer %in% Lot (Intercept) 1/1 6.5460 1/2 -11.9589 1/3 4.4567 2/1 0.6586 2/2 -0.8337 2/3 -2.9230 3/1 1.4728 3/2 -0.6164 3/3 -0.6164 4/1 -0.0135 4/2 3.2696 4/3 -4.4905 5/1 -4.4318 5/2 3.0298 5/3 5.1191 6/1 11.7350 6/2 2.1841 6/3 -8.5607 7/1 -1.7494 7/2 -0.5556 7/3 0.0414 8/1 -0.0902 8/2 1.4021 8/3 -3.0749 > fm1Wafer <- lme(current ~ voltage + I(voltage^2), data = Wafer, + random = list(Wafer = pdDiag(~voltage + I(voltage^2)), + Site = pdDiag(~voltage + I(voltage^2)))) > ## IGNORE_RDIFF_BEGIN > summary(fm1Wafer) Linear mixed-effects model fit by REML Data: Wafer AIC BIC logLik -282 -242 151 Random effects: Formula: ~voltage + I(voltage^2) | Wafer Structure: Diagonal (Intercept) voltage I(voltage^2) StdDev: 2.81e-05 0.187 0.025 Formula: ~voltage + I(voltage^2) | Site %in% Wafer Structure: Diagonal (Intercept) voltage I(voltage^2) Residual StdDev: 8.17e-06 0.136 2.45e-08 0.115 Fixed effects: current ~ voltage + I(voltage^2) Value Std.Error DF t-value p-value (Intercept) -4.46 0.0513 318 -87.0 0 voltage 5.90 0.0927 318 63.7 0 I(voltage^2) 1.17 0.0230 318 51.0 0 Correlation: (Intr) voltag voltage -0.735 I(voltage^2) 0.884 -0.698 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.8966 -0.5354 0.0249 0.7985 1.7777 Number of Observations: 400 Number of Groups: Wafer Site %in% Wafer 10 80 > ## IGNORE_RDIFF_END > fitted(fm1Wafer, level = 0) 1 1 1 1 1 1 1 1 1 1 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 1 1 1 1 1 1 1 1 1 1 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 1 1 1 1 1 1 1 1 1 1 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 1 1 1 1 1 1 1 1 1 1 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 2 2 2 2 2 2 2 2 2 2 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 2 2 2 2 2 2 2 2 2 2 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 2 2 2 2 2 2 2 2 2 2 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 2 2 2 2 2 2 2 2 2 2 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 3 3 3 3 3 3 3 3 3 3 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 3 3 3 3 3 3 3 3 3 3 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 3 3 3 3 3 3 3 3 3 3 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 3 3 3 3 3 3 3 3 3 3 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 4 4 4 4 4 4 4 4 4 4 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 4 4 4 4 4 4 4 4 4 4 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 4 4 4 4 4 4 4 4 4 4 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 4 4 4 4 4 4 4 4 4 4 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 5 5 5 5 5 5 5 5 5 5 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 5 5 5 5 5 5 5 5 5 5 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 5 5 5 5 5 5 5 5 5 5 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 5 5 5 5 5 5 5 5 5 5 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 6 6 6 6 6 6 6 6 6 6 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 6 6 6 6 6 6 6 6 6 6 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 6 6 6 6 6 6 6 6 6 6 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 6 6 6 6 6 6 6 6 6 6 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 7 7 7 7 7 7 7 7 7 7 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 7 7 7 7 7 7 7 7 7 7 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 7 7 7 7 7 7 7 7 7 7 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 7 7 7 7 7 7 7 7 7 7 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 8 8 8 8 8 8 8 8 8 8 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 8 8 8 8 8 8 8 8 8 8 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 8 8 8 8 8 8 8 8 8 8 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 8 8 8 8 8 8 8 8 8 8 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 9 9 9 9 9 9 9 9 9 9 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 9 9 9 9 9 9 9 9 9 9 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 9 9 9 9 9 9 9 9 9 9 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 9 9 9 9 9 9 9 9 9 9 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 10 10 10 10 10 10 10 10 10 10 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 10 10 10 10 10 10 10 10 10 10 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 10 10 10 10 10 10 10 10 10 10 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 10 10 10 10 10 10 10 10 10 10 1.01 4.31 7.98 12.03 16.45 1.01 4.31 7.98 12.03 16.45 attr(,"label") [1] "Fitted values (mA)" > resid(fm1Wafer, level = 1:2) Wafer Site 1 0.061492 0.068062 2 -0.189869 -0.180013 3 -0.015086 -0.001944 4 0.103762 0.120189 5 -0.053726 -0.034014 6 0.192612 0.073736 7 0.044131 -0.134183 8 0.275914 0.038163 9 0.431762 0.134573 10 0.306274 -0.050353 11 0.084612 0.060177 12 -0.150069 -0.186722 13 0.045314 -0.003556 14 0.185762 0.124675 15 0.054274 -0.019031 16 0.042212 0.073671 17 -0.237069 -0.189880 18 -0.077086 -0.014167 19 0.035762 0.114410 20 -0.121726 -0.027348 21 0.092692 0.076696 22 -0.149069 -0.173062 23 0.033314 0.001324 24 0.159762 0.119774 25 0.014274 -0.033712 26 -0.057768 0.111841 27 -0.453669 -0.199256 28 -0.379286 -0.040068 29 -0.339838 0.084185 30 -0.553726 -0.044899 31 0.047012 0.088048 32 -0.238069 -0.176514 33 -0.090886 -0.008812 34 0.007762 0.110354 35 -0.165726 -0.042616 36 0.079392 0.084841 37 -0.172269 -0.164095 38 -0.006486 0.004413 39 0.101762 0.115385 40 -0.063726 -0.047378 41 0.038702 0.065476 42 -0.209573 -0.169412 43 -0.048411 0.005137 44 0.036789 0.103724 45 -0.117373 -0.037052 46 0.266102 0.151852 47 0.114027 -0.057349 48 0.302789 0.074288 49 0.390789 0.105163 50 0.226627 -0.116125 51 0.299502 0.205135 52 0.129627 -0.011925 53 0.280989 0.092254 54 0.324789 0.088870 55 0.120627 -0.162477 56 -0.032838 0.072449 57 -0.343973 -0.186043 58 -0.225411 -0.014838 59 -0.171211 0.092005 60 -0.353373 -0.037514 61 0.262902 0.160786 62 0.095827 -0.057348 63 0.274189 0.069956 64 0.356789 0.101497 65 0.188627 -0.117724 66 0.000342 0.087867 67 -0.298573 -0.167286 68 -0.178211 -0.003161 69 -0.127211 0.091601 70 -0.315373 -0.052799 71 0.100502 0.127285 72 -0.153973 -0.113800 73 -0.025611 0.027954 74 0.022789 0.089745 75 -0.169373 -0.089027 76 0.032102 0.097186 77 -0.244373 -0.146748 78 -0.120611 0.009556 79 -0.071211 0.091498 80 -0.261373 -0.066123 81 -0.004099 0.052717 82 -0.278076 -0.192852 83 -0.127696 -0.014064 84 -0.029418 0.112622 85 -0.197444 -0.026995 86 0.052321 0.089249 87 -0.208276 -0.152884 88 -0.067296 0.006561 89 0.014582 0.106902 90 -0.171444 -0.060659 91 0.118641 0.062782 92 -0.064476 -0.148264 93 0.134904 0.023187 94 0.266582 0.126935 95 0.120556 -0.047019 96 -0.041079 0.051265 97 -0.346676 -0.208160 98 -0.212496 -0.027807 99 -0.121418 0.109442 100 -0.297444 -0.020411 101 0.128041 0.079868 102 -0.066076 -0.138336 103 0.121104 0.024758 104 0.240582 0.120149 105 0.088556 -0.055963 106 -0.091839 0.070304 107 -0.452476 -0.209261 108 -0.361896 -0.037608 109 -0.311418 0.093941 110 -0.519444 -0.033013 111 0.286041 0.146703 112 0.154524 -0.054483 113 0.353704 0.075028 114 0.468582 0.120237 115 0.298556 -0.119458 116 0.253641 0.183845 117 0.066124 -0.038569 118 0.211104 0.071514 119 0.274582 0.100094 120 0.062556 -0.146829 121 0.113168 0.059522 122 -0.082704 -0.163173 123 0.123749 0.016457 124 0.262907 0.128791 125 0.124569 -0.036370 126 0.199348 0.075597 127 0.057096 -0.128531 128 0.288549 0.041047 129 0.444907 0.135529 130 0.316569 -0.054685 131 0.010568 0.105606 132 -0.309104 -0.166546 133 -0.198251 -0.008174 134 -0.139093 0.098502 135 -0.349431 -0.064316 136 0.000368 0.076116 137 -0.314704 -0.201082 138 -0.178051 -0.026555 139 -0.083093 0.106277 140 -0.251431 -0.024187 141 0.016268 0.116152 142 -0.315904 -0.166078 143 -0.212251 -0.012483 144 -0.155093 0.094617 145 -0.363431 -0.063779 146 0.004348 0.054446 147 -0.286504 -0.211357 148 -0.125651 -0.025456 149 -0.009093 0.116151 150 -0.161431 -0.011138 151 0.096848 0.080552 152 -0.138304 -0.162749 153 0.039349 0.006756 154 0.158907 0.118165 155 0.006569 -0.042321 156 0.118788 0.080347 157 -0.096904 -0.154565 158 0.090949 0.014067 159 0.218907 0.122804 160 0.068569 -0.046754 161 -0.029651 0.042434 162 -0.299821 -0.191694 163 -0.157165 -0.012996 164 -0.067684 0.112527 165 -0.246778 -0.030524 166 0.116949 0.129128 167 -0.114421 -0.096153 168 0.013235 0.037592 169 0.072316 0.102762 170 -0.146778 -0.110243 171 0.197149 0.101805 172 0.049179 -0.093837 173 0.245235 0.054547 174 0.362316 0.123955 175 0.195222 -0.090810 176 0.048749 0.058063 177 -0.177021 -0.163051 178 -0.010365 0.008261 179 0.094316 0.117599 180 -0.072778 -0.044839 181 0.214149 0.102694 182 0.073779 -0.093404 183 0.277635 0.054723 184 0.402316 0.123676 185 0.249222 -0.085146 186 -0.092031 0.056118 187 -0.426021 -0.203798 188 -0.326965 -0.030668 189 -0.271684 0.098687 190 -0.478778 -0.034333 191 0.187949 0.129497 192 0.004979 -0.082699 193 0.168635 0.051730 194 0.256316 0.110185 195 0.069222 -0.106135 196 0.095349 0.120157 197 -0.145621 -0.108410 198 -0.019765 0.029849 199 0.040316 0.102333 200 -0.174778 -0.100357 201 0.115311 0.075105 202 -0.097595 -0.157904 203 0.094646 0.014234 204 0.223635 0.123120 205 0.077572 -0.043047 206 0.121051 0.100980 207 -0.110195 -0.140302 208 0.058846 0.018704 209 0.165635 0.115457 210 -0.004428 -0.064642 211 0.079591 0.081229 212 -0.172795 -0.170338 213 -0.001954 0.001323 214 0.113635 0.117730 215 -0.046428 -0.041514 216 0.007011 0.076714 217 -0.304595 -0.200040 218 -0.163954 -0.024547 219 -0.066365 0.107893 220 -0.234428 -0.025319 221 0.066991 0.085934 222 -0.202595 -0.174180 223 -0.042754 -0.004867 224 0.065635 0.112994 225 -0.096428 -0.039598 226 -0.020549 0.093776 227 -0.371395 -0.199907 228 -0.261754 -0.033103 229 -0.188365 0.097449 230 -0.376428 -0.033452 231 0.124251 0.092105 232 -0.097195 -0.145414 233 0.081646 0.017355 234 0.199635 0.119271 235 0.039572 -0.056865 236 0.104871 0.083043 237 -0.123995 -0.156738 238 0.055046 0.011389 239 0.173635 0.119064 240 0.017572 -0.047914 241 0.227356 0.097058 242 0.136724 -0.058724 243 0.348539 0.087942 244 0.457002 0.131256 245 0.268913 -0.121982 246 -0.049644 -0.001886 247 -0.250476 -0.178840 248 -0.082661 0.012853 249 0.007002 0.126395 250 -0.185087 -0.041815 251 0.491556 0.164445 252 0.535924 0.045257 253 0.814739 0.160517 254 0.963002 0.145224 255 0.798913 -0.182420 256 0.035556 -0.000644 257 -0.106476 -0.160777 258 0.103139 0.030738 259 0.229002 0.138501 260 0.066913 -0.041688 261 0.084356 0.047445 262 -0.064476 -0.119844 263 0.122139 0.048316 264 0.219002 0.126723 265 0.030913 -0.079821 266 -0.102844 -0.008156 267 -0.348676 -0.206645 268 -0.197861 -0.008486 269 -0.112998 0.123721 270 -0.311087 -0.027023 271 -0.104044 0.032614 272 -0.381676 -0.176689 273 -0.275861 -0.002545 274 -0.234998 0.106647 275 -0.471087 -0.061112 276 -0.127844 0.030339 277 -0.422076 -0.184802 278 -0.325461 -0.009095 279 -0.292998 0.102459 280 -0.531087 -0.056538 281 0.272748 0.047840 282 0.262060 -0.075302 283 0.546385 0.096569 284 0.718724 0.156454 285 0.586276 -0.088447 286 0.249948 0.062457 287 0.206660 -0.074577 288 0.464785 0.089803 289 0.616724 0.147996 290 0.466276 -0.096197 291 -0.032652 0.011344 292 -0.243540 -0.177547 293 -0.075615 0.012376 294 0.014724 0.124713 295 -0.175724 -0.043737 296 -0.108452 -0.012938 297 -0.355740 -0.212470 298 -0.201215 -0.010187 299 -0.113276 0.125508 300 -0.309724 -0.023182 301 -0.096052 0.018185 302 -0.362540 -0.191185 303 -0.234015 -0.005541 304 -0.171276 0.114316 305 -0.387724 -0.045013 306 -0.123652 -0.009999 307 -0.389340 -0.218861 308 -0.245215 -0.017909 309 -0.163276 0.120856 310 -0.359724 -0.018765 311 -0.108452 0.037755 312 -0.402940 -0.183630 313 -0.300215 -0.007802 314 -0.259276 0.106241 315 -0.497724 -0.059104 316 0.285348 0.119276 317 0.217660 -0.031449 318 0.435785 0.103641 319 0.548724 0.133543 320 0.356276 -0.141940 321 0.066249 0.061990 322 -0.106937 -0.113325 323 0.058058 0.049541 324 0.133235 0.122588 325 -0.084807 -0.097583 326 0.058049 0.013390 327 -0.080137 -0.147125 328 0.128858 0.039540 329 0.251235 0.139588 330 0.077193 -0.056784 331 0.004649 0.041019 332 -0.199737 -0.145182 333 -0.044542 0.028198 334 0.029235 0.120160 335 -0.182807 -0.073697 336 0.088449 -0.002738 337 -0.008937 -0.145718 338 0.230458 0.048083 339 0.377235 0.149266 340 0.225193 -0.048369 341 0.017249 0.032907 342 -0.167737 -0.144250 343 0.000858 0.032174 344 0.085235 0.124380 345 -0.116807 -0.069833 346 -0.084751 -0.026585 347 -0.303337 -0.216088 348 -0.124142 -0.007810 349 -0.012765 0.132649 350 -0.184807 -0.010310 351 -0.104351 0.042779 352 -0.394337 -0.173642 353 -0.296142 -0.001881 354 -0.264765 0.103060 355 -0.508807 -0.067416 356 0.278649 0.082220 357 0.247263 -0.047380 358 0.498058 0.105201 359 0.635235 0.144163 360 0.469193 -0.120093 361 -0.107404 -0.012451 362 -0.354401 -0.211972 363 -0.199807 -0.009901 364 -0.112820 0.124562 365 -0.307642 -0.022784 366 0.231396 0.061385 367 0.179399 -0.075617 368 0.428793 0.088772 369 0.571180 0.146153 370 0.410358 -0.099674 371 0.162596 0.050096 372 0.066399 -0.102351 373 0.292993 0.067994 374 0.421180 0.139931 375 0.252358 -0.085141 376 -0.022804 -0.020045 377 -0.198801 -0.194662 378 0.005393 0.010912 379 0.131180 0.138078 380 -0.027642 -0.019364 381 0.015396 0.011892 382 -0.160401 -0.165658 383 0.030993 0.023985 384 0.141180 0.132419 385 -0.035642 -0.046155 386 -0.105404 0.014675 387 -0.373401 -0.193283 388 -0.246407 -0.006248 389 -0.184820 0.115377 390 -0.405642 -0.045405 391 0.164196 0.113448 392 0.015399 -0.060723 393 0.177393 0.075897 394 0.243180 0.116310 395 0.016358 -0.135886 396 -0.008404 0.037007 397 -0.216401 -0.148285 398 -0.065007 0.025815 399 0.005180 0.118707 400 -0.207642 -0.071409 > newWafer <- + data.frame(Wafer = rep(1, 4), voltage = c(1, 1.5, 3, 3.5)) > predict(fm1Wafer, newWafer, level = 0:1) Wafer predict.fixed predict.Wafer 1 1 2.61 2.40 2 1 7.03 6.72 3 1 23.78 23.23 4 1 30.54 29.92 > newWafer2 <- data.frame(Wafer = rep(1, 4), Site = rep(3, 4), + voltage = c(1, 1.5, 3, 3.5)) > predict(fm1Wafer, newWafer2, level = 0:2) Wafer Site predict.fixed predict.Wafer predict.Site 1 1 1/3 2.61 2.40 2.43 2 1 1/3 7.03 6.72 6.77 3 1 1/3 23.78 23.23 23.32 4 1 1/3 30.54 29.92 30.03 > # 4.3 Examining a Fitted Model > > plot(fm2Orth.lme, Subject~resid(.), abline = 0) > plot(fm2Orth.lme, resid(., type = "p") ~ fitted(.) | Sex, + id = 0.05, adj = -0.3) > fm3Orth.lme <- + update(fm2Orth.lme, weights = varIdent(form = ~ 1 | Sex)) > fm3Orth.lme Linear mixed-effects model fit by REML Data: Orthodont Log-restricted-likelihood: -206 Fixed: distance ~ Sex + I(age - 11) + Sex:I(age - 11) (Intercept) SexFemale 24.969 -2.321 I(age - 11) SexFemale:I(age - 11) 0.784 -0.305 Random effects: Formula: ~I(age - 11) | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.855 (Intr) I(age - 11) 0.157 0.394 Residual 1.630 Variance function: Structure: Different standard deviations per stratum Formula: ~1 | Sex Parameter estimates: Male Female 1.000 0.409 Number of Observations: 108 Number of Groups: 27 > plot(fm3Orth.lme, distance ~ fitted(.), + id = 0.05, adj = -0.3) > anova(fm2Orth.lme, fm3Orth.lme) Model df AIC BIC logLik Test L.Ratio p-value fm2Orth.lme 1 8 451 473 -218 fm3Orth.lme 2 9 430 453 -206 1 vs 2 23.8 <.0001 > qqnorm(fm3Orth.lme, ~resid(.) | Sex) > plot(fm2IGF.lme, resid(., type = "p") ~ fitted(.) | Lot, + layout = c(5,2)) > qqnorm(fm2IGF.lme, ~ resid(.), id = 0.05, adj = -0.75) > plot(fm1Oxide) > qqnorm(fm1Oxide) > plot(fm1Wafer, resid(.) ~ voltage | Wafer) > plot(fm1Wafer, resid(.) ~ voltage | Wafer, + panel = function(x, y, ...) { + panel.grid() + panel.xyplot(x, y) + panel.loess(x, y, lty = 2) + panel.abline(0, 0) + }) > with(Wafer, + coef(lm(resid(fm1Wafer) ~ cos(4.19*voltage)+sin(4.19*voltage)-1))) cos(4.19 * voltage) sin(4.19 * voltage) -0.0519 0.1304 > nls(resid(fm1Wafer) ~ b3*cos(w*voltage) + b4*sin(w*voltage), Wafer, + start = list(b3 = -0.0519, b4 = 0.1304, w = 4.19)) Nonlinear regression model model: resid(fm1Wafer) ~ b3 * cos(w * voltage) + b4 * sin(w * voltage) data: Wafer b3 b4 w -0.1117 0.0777 4.5679 residual sum-of-squares: 0.729 Number of iterations to convergence: 6 Achieved convergence tolerance: 1.12e-06 > fm2Wafer <- update(fm1Wafer, + . ~ . + cos(4.5679*voltage) + sin(4.5679*voltage), + random = list(Wafer=pdDiag(~voltage+I(voltage^2)), + Site=pdDiag(~voltage+I(voltage^2)))) > summary(fm2Wafer) Linear mixed-effects model fit by REML Data: Wafer AIC BIC logLik -1233 -1185 628 Random effects: Formula: ~voltage + I(voltage^2) | Wafer Structure: Diagonal (Intercept) voltage I(voltage^2) StdDev: 0.129 0.349 0.0491 Formula: ~voltage + I(voltage^2) | Site %in% Wafer Structure: Diagonal (Intercept) voltage I(voltage^2) Residual StdDev: 0.0397 0.234 0.0475 0.0113 Fixed effects: current ~ voltage + I(voltage^2) + cos(4.5679 * voltage) + sin(4.5679 * voltage) Value Std.Error DF t-value p-value (Intercept) -4.26 0.0422 316 -100.8 0 voltage 5.62 0.1142 316 49.2 0 I(voltage^2) 1.26 0.0170 316 74.2 0 cos(4.5679 * voltage) -0.10 0.0011 316 -85.0 0 sin(4.5679 * voltage) 0.10 0.0015 316 69.4 0 Correlation: (Intr) voltag I(v^2) c(4.*v voltage -0.029 I(voltage^2) 0.060 -0.031 cos(4.5679 * voltage) 0.162 -0.082 0.172 sin(4.5679 * voltage) 0.200 -0.101 0.212 0.567 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.4272 -0.4032 0.0253 0.3936 2.8427 Number of Observations: 400 Number of Groups: Wafer Site %in% Wafer 10 80 > ## IGNORE_RDIFF_BEGIN > intervals(fm2Wafer) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) -4.3385 -4.2554 -4.1723 voltage 5.3977 5.6224 5.8470 I(voltage^2) 1.2251 1.2585 1.2919 cos(4.5679 * voltage) -0.0978 -0.0956 -0.0933 sin(4.5679 * voltage) 0.1014 0.1043 0.1073 Random Effects: Level: Wafer lower est. upper sd((Intercept)) 0.0802 0.1289 0.207 sd(voltage) 0.2135 0.3487 0.569 sd(I(voltage^2)) 0.0290 0.0491 0.083 Level: Site lower est. upper sd((Intercept)) 0.0220 0.0397 0.0717 sd(voltage) 0.1909 0.2344 0.2878 sd(I(voltage^2)) 0.0383 0.0475 0.0590 Within-group standard error: lower est. upper 0.00927 0.01133 0.01383 > ## IGNORE_RDIFF_END > qqnorm(fm2Wafer) > qqnorm(fm2Orth.lme, ~ranef(.), id = 0.10, cex = 0.7) > pairs(fm2Orth.lme, ~ranef(.) | Sex, + id = ~ Subject == "M13", adj = -0.3) > fm2IGF.lme Linear mixed-effects model fit by REML Data: IGF Log-restricted-likelihood: -297 Fixed: conc ~ age (Intercept) age 5.36904 -0.00193 Random effects: Formula: ~age | Lot Structure: Diagonal (Intercept) age Residual StdDev: 3.62e-05 0.00537 0.822 Number of Observations: 237 Number of Groups: 10 > c(0.00031074, 0.0053722)/abs(fixef(fm2IGF.lme)) (Intercept) age 5.79e-05 2.78e+00 > fm3IGF.lme <- update(fm2IGF.lme, random = ~ age - 1) > anova(fm2IGF.lme, fm3IGF.lme) Model df AIC BIC logLik Test L.Ratio p-value fm2IGF.lme 1 5 605 622 -297 fm3IGF.lme 2 4 603 617 -297 1 vs 2 1.47e-07 1 > qqnorm(fm1Oxide, ~ranef(., level = 1), id=0.10) > qqnorm(fm1Oxide, ~ranef(., level = 2), id=0.10) > #fm3Wafer <- update(fm2Wafer, > # random = list(Wafer = ~voltage+I(voltage^2), > # Site = pdDiag(~voltage+I(voltage^2))), > # control = list(msVerbose = TRUE, msMaxIter = 200) > # ) > #fm3Wafer > #anova(fm2Wafer, fm3Wafer) > #fm4Wafer <- update(fm2Wafer, > # random = list(Wafer = ~ voltage + I(voltage^2), > # Site = pdBlocked(list(~1, > # ~voltage+I(voltage^2) - 1))), > # control = list(msVerbose = TRUE, > # msMaxIter = 200)) > #fm4Wafer > #anova(fm3Wafer, fm4Wafer) > #qqnorm(fm4Wafer, ~ranef(., level = 2), id = 0.05, > # cex = 0.7, layout = c(3, 1)) > > # The next line is not in the book but is needed to get fm1Machine > > fm1Machine <- + lme(score ~ Machine, data = Machines, random = ~ 1 | Worker) > (fm3Machine <- update(fm1Machine, random = ~Machine-1|Worker)) Linear mixed-effects model fit by REML Data: Machines Log-restricted-likelihood: -104 Fixed: score ~ Machine (Intercept) MachineB MachineC 52.36 7.97 13.92 Random effects: Formula: ~Machine - 1 | Worker Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr MachineA 4.079 MachnA MachnB MachineB 8.625 0.803 MachineC 4.389 0.623 0.771 Residual 0.962 Number of Observations: 54 Number of Groups: 6 > # cleanup > > summary(warnings()) No warnings ====== ch05.R ====== > #-*- 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) [1] 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 [11] 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 [21] 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 [31] 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 [41] 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 [51] 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 [61] 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 [71] 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 [81] 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 [91] 0.289 0.267 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 [101] 0.354 0.316 0.289 0.267 0.354 0.316 0.289 0.267 > vf1Ident <- varIdent(c(Female = 0.5), ~ 1 | Sex) > vf1Ident <- Initialize(vf1Ident, Orthodont) > varWeights(vf1Ident) Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Female Female Female Female Female Female Female Female 1 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 > vf2Ident <- varIdent(form = ~ 1 | Sex, fixed = c(Female = 0.5)) > vf2Ident <- Initialize(vf2Ident, Orthodont) > varWeights(vf2Ident) Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Male Male Male Male Male Male Male Male 1 1 1 1 1 1 1 1 1 Male Female Female Female Female Female Female Female Female 1 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 Female Female Female Female Female Female Female Female Female 2 2 2 2 2 2 2 2 2 > vf3Ident <- varIdent(form = ~ 1 | Sex * age) > vf3Ident <- Initialize(vf3Ident, Orthodont) > varWeights(vf3Ident) Male*8 Male*10 Male*12 Male*14 Male*8 Male*10 1 1 1 1 1 1 Male*12 Male*14 Male*8 Male*10 Male*12 Male*14 1 1 1 1 1 1 Male*8 Male*10 Male*12 Male*14 Male*8 Male*10 1 1 1 1 1 1 Male*12 Male*14 Male*8 Male*10 Male*12 Male*14 1 1 1 1 1 1 Male*8 Male*10 Male*12 Male*14 Male*8 Male*10 1 1 1 1 1 1 Male*12 Male*14 Male*8 Male*10 Male*12 Male*14 1 1 1 1 1 1 Male*8 Male*10 Male*12 Male*14 Male*8 Male*10 1 1 1 1 1 1 Male*12 Male*14 Male*8 Male*10 Male*12 Male*14 1 1 1 1 1 1 Male*8 Male*10 Male*12 Male*14 Male*8 Male*10 1 1 1 1 1 1 Male*12 Male*14 Male*8 Male*10 Male*12 Male*14 1 1 1 1 1 1 Male*8 Male*10 Male*12 Male*14 Female*8 Female*10 1 1 1 1 1 1 Female*12 Female*14 Female*8 Female*10 Female*12 Female*14 1 1 1 1 1 1 Female*8 Female*10 Female*12 Female*14 Female*8 Female*10 1 1 1 1 1 1 Female*12 Female*14 Female*8 Female*10 Female*12 Female*14 1 1 1 1 1 1 Female*8 Female*10 Female*12 Female*14 Female*8 Female*10 1 1 1 1 1 1 Female*12 Female*14 Female*8 Female*10 Female*12 Female*14 1 1 1 1 1 1 Female*8 Female*10 Female*12 Female*14 Female*8 Female*10 1 1 1 1 1 1 Female*12 Female*14 Female*8 Female*10 Female*12 Female*14 1 1 1 1 1 1 > vf1Power <- varPower(1) > formula(vf1Power) ~fitted(.) > 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) [1] 3.35e-04 4.54e-05 6.14e-06 8.32e-07 3.35e-04 4.54e-05 [7] 6.14e-06 8.32e-07 3.35e-04 4.54e-05 6.14e-06 8.32e-07 [13] 3.35e-04 4.54e-05 6.14e-06 8.32e-07 3.35e-04 4.54e-05 [19] 6.14e-06 8.32e-07 3.35e-04 4.54e-05 6.14e-06 8.32e-07 [25] 3.35e-04 4.54e-05 6.14e-06 8.32e-07 3.35e-04 4.54e-05 [31] 6.14e-06 8.32e-07 3.35e-04 4.54e-05 6.14e-06 8.32e-07 [37] 3.35e-04 4.54e-05 6.14e-06 8.32e-07 3.35e-04 4.54e-05 [43] 6.14e-06 8.32e-07 3.35e-04 4.54e-05 6.14e-06 8.32e-07 [49] 3.35e-04 4.54e-05 6.14e-06 8.32e-07 3.35e-04 4.54e-05 [55] 6.14e-06 8.32e-07 3.35e-04 4.54e-05 6.14e-06 8.32e-07 [61] 3.35e-04 4.54e-05 6.14e-06 8.32e-07 6.71e-04 9.08e-05 [67] 1.23e-05 1.66e-06 6.71e-04 9.08e-05 1.23e-05 1.66e-06 [73] 6.71e-04 9.08e-05 1.23e-05 1.66e-06 6.71e-04 9.08e-05 [79] 1.23e-05 1.66e-06 6.71e-04 9.08e-05 1.23e-05 1.66e-06 [85] 6.71e-04 9.08e-05 1.23e-05 1.66e-06 6.71e-04 9.08e-05 [91] 1.23e-05 1.66e-06 6.71e-04 9.08e-05 1.23e-05 1.66e-06 [97] 6.71e-04 9.08e-05 1.23e-05 1.66e-06 6.71e-04 9.08e-05 [103] 1.23e-05 1.66e-06 6.71e-04 9.08e-05 1.23e-05 1.66e-06 > fm1Dial.lme <- + lme(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, + Dialyzer, ~ pressure + I(pressure^2)) > fm1Dial.lme Linear mixed-effects model fit by REML Data: Dialyzer Log-restricted-likelihood: -326 Fixed: rate ~ (pressure + I(pressure^2) + I(pressure^3) + I(pressure^4)) * QB (Intercept) pressure I(pressure^2) -16.5980 88.6733 -42.7320 I(pressure^3) I(pressure^4) QB1 9.2165 -0.7756 -0.6317 pressure:QB1 I(pressure^2):QB1 I(pressure^3):QB1 0.3104 1.5742 0.0509 I(pressure^4):QB1 -0.0860 Random effects: Formula: ~pressure + I(pressure^2) | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.50 (Intr) pressr pressure 4.91 -0.507 I(pressure^2) 1.47 0.311 -0.944 Residual 1.82 Number of Observations: 140 Number of Groups: 20 > plot(fm1Dial.lme, resid(.) ~ pressure, abline = 0) > fm2Dial.lme <- update(fm1Dial.lme, + weights = varPower(form = ~ pressure)) > fm2Dial.lme Linear mixed-effects model fit by REML Data: Dialyzer Log-restricted-likelihood: -310 Fixed: rate ~ (pressure + I(pressure^2) + I(pressure^3) + I(pressure^4)) * QB (Intercept) pressure I(pressure^2) -17.680 93.711 -49.187 I(pressure^3) I(pressure^4) QB1 12.245 -1.243 -0.921 pressure:QB1 I(pressure^2):QB1 I(pressure^3):QB1 1.353 0.480 0.491 I(pressure^4):QB1 -0.146 Random effects: Formula: ~pressure + I(pressure^2) | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.86 (Intr) pressr pressure 5.33 -0.522 I(pressure^2) 1.65 0.362 -0.954 Residual 1.26 Variance function: Structure: Power of variance covariate Formula: ~pressure Parameter estimates: power 0.749 Number of Observations: 140 Number of Groups: 20 > anova(fm1Dial.lme, fm2Dial.lme) Model df AIC BIC logLik Test L.Ratio p-value fm1Dial.lme 1 17 687 736 -326 fm2Dial.lme 2 18 655 707 -310 1 vs 2 33.8 <.0001 > plot(fm2Dial.lme, resid(., type = "p") ~ pressure, + abline = 0) > ## IGNORE_RDIFF_BEGIN > intervals(fm2Dial.lme) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) -19.148 -17.680 -16.212 pressure 87.231 93.711 100.192 I(pressure^2) -57.616 -49.187 -40.757 I(pressure^3) 7.967 12.245 16.523 I(pressure^4) -1.953 -1.243 -0.533 QB1 -2.478 -0.921 0.636 pressure:QB1 -5.127 1.353 7.833 I(pressure^2):QB1 -7.949 0.480 8.910 I(pressure^3):QB1 -3.787 0.491 4.769 I(pressure^4):QB1 -0.856 -0.146 0.564 Random Effects: Level: Subject lower est. upper sd((Intercept)) 1.256 1.857 2.7466 sd(pressure) 3.623 5.328 7.8363 sd(I(pressure^2)) 1.091 1.648 2.4909 cor((Intercept),pressure) -0.803 -0.522 -0.0525 cor((Intercept),I(pressure^2)) -0.166 0.362 0.7292 cor(pressure,I(pressure^2)) -0.985 -0.954 -0.8624 Variance function: lower est. upper power 0.508 0.749 0.991 Within-group standard error: lower est. upper 1.06 1.26 1.50 > ## IGNORE_RDIFF_END > plot(fm2Dial.lme, resid(.) ~ pressure|QB, abline = 0) > fm3Dial.lme <- update(fm2Dial.lme, + weights=varPower(form = ~ pressure | QB)) > fm3Dial.lme Linear mixed-effects model fit by REML Data: Dialyzer Log-restricted-likelihood: -309 Fixed: rate ~ (pressure + I(pressure^2) + I(pressure^3) + I(pressure^4)) * QB (Intercept) pressure I(pressure^2) -17.695 93.759 -49.231 I(pressure^3) I(pressure^4) QB1 12.260 -1.244 -1.017 pressure:QB1 I(pressure^2):QB1 I(pressure^3):QB1 1.840 -0.194 0.827 I(pressure^4):QB1 -0.200 Random effects: Formula: ~pressure + I(pressure^2) | Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.82 (Intr) pressr pressure 5.24 -0.502 I(pressure^2) 1.64 0.338 -0.951 Residual 1.26 Variance function: Structure: Power of variance covariate, different strata Formula: ~pressure | QB Parameter estimates: 200 300 0.648 0.838 Number of Observations: 140 Number of Groups: 20 > anova(fm2Dial.lme, fm3Dial.lme) Model df AIC BIC logLik Test L.Ratio p-value fm2Dial.lme 1 18 655 707 -310 fm3Dial.lme 2 19 656 711 -309 1 vs 2 0.711 0.399 > fm4Dial.lme <- update(fm2Dial.lme, + weights = varConstPower(form = ~ pressure)) > anova(fm2Dial.lme, fm4Dial.lme) Model df AIC BIC logLik Test L.Ratio p-value fm2Dial.lme 1 18 655 707 -310 fm4Dial.lme 2 19 657 711 -309 1 vs 2 0.159 0.69 > plot(augPred(fm2Dial.lme), grid = TRUE) > anova(fm2Dial.lme) numDF denDF F-value p-value (Intercept) 1 112 553 <.0001 pressure 1 112 2329 <.0001 I(pressure^2) 1 112 1175 <.0001 I(pressure^3) 1 112 360 <.0001 I(pressure^4) 1 112 12 0.0006 QB 1 18 5 0.0414 pressure:QB 1 112 80 <.0001 I(pressure^2):QB 1 112 1 0.2476 I(pressure^3):QB 1 112 2 0.1370 I(pressure^4):QB 1 112 0 0.6839 > anova(fm2Dial.lme, Terms = 8:10) F-test for: I(pressure^2):QB, I(pressure^3):QB, I(pressure^4):QB numDF denDF F-value p-value 1 3 112 1.25 0.294 > options(contrasts = c("contr.treatment", "contr.poly")) > fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight, + random = ~ Time) > fm1BW.lme Linear mixed-effects model fit by REML Data: BodyWeight Log-restricted-likelihood: -576 Fixed: weight ~ Time * Diet (Intercept) Time Diet2 Diet3 Time:Diet2 251.652 0.360 200.665 252.072 0.606 Time:Diet3 0.298 Random effects: Formula: ~Time | Rat Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 36.939 (Intr) Time 0.248 -0.149 Residual 4.444 Number of Observations: 176 Number of Groups: 16 > fm2BW.lme <- update(fm1BW.lme, weights = varPower()) > fm2BW.lme Linear mixed-effects model fit by REML Data: BodyWeight Log-restricted-likelihood: -571 Fixed: weight ~ Time * Diet (Intercept) Time Diet2 Diet3 Time:Diet2 251.602 0.361 200.777 252.170 0.602 Time:Diet3 0.295 Random effects: Formula: ~Time | Rat Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 36.898 (Intr) Time 0.244 -0.145 Residual 0.175 Variance function: Structure: Power of variance covariate Formula: ~fitted(.) Parameter estimates: power 0.543 Number of Observations: 176 Number of Groups: 16 > anova(fm1BW.lme, fm2BW.lme) Model df AIC BIC logLik Test L.Ratio p-value fm1BW.lme 1 10 1172 1203 -576 fm2BW.lme 2 11 1164 1198 -571 1 vs 2 9.8 0.0017 > summary(fm2BW.lme) Linear mixed-effects model fit by REML Data: BodyWeight AIC BIC logLik 1164 1198 -571 Random effects: Formula: ~Time | Rat Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 36.898 (Intr) Time 0.244 -0.145 Residual 0.175 Variance function: Structure: Power of variance covariate Formula: ~fitted(.) Parameter estimates: power 0.543 Fixed effects: weight ~ Time * Diet Value Std.Error DF t-value p-value (Intercept) 251.6 13.07 157 19.25 0.0000 Time 0.4 0.09 157 4.09 0.0001 Diet2 200.8 22.66 13 8.86 0.0000 Diet3 252.2 22.66 13 11.13 0.0000 Time:Diet2 0.6 0.16 157 3.87 0.0002 Time:Diet3 0.3 0.16 157 1.89 0.0601 Correlation: (Intr) Time Diet2 Diet3 Tm:Dt2 Time -0.152 Diet2 -0.577 0.088 Diet3 -0.577 0.088 0.333 Time:Diet2 0.087 -0.569 -0.157 -0.050 Time:Diet3 0.086 -0.567 -0.050 -0.158 0.322 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.9374 -0.4439 0.0799 0.5808 2.2649 Number of Observations: 176 Number of Groups: 16 > anova(fm2BW.lme, L = c("Time:Diet2" = 1, "Time:Diet3" = -1)) F-test for linear combination(s) Time:Diet2 Time:Diet3 1 -1 numDF denDF F-value p-value 1 1 157 2.86 0.0926 > cs1CompSymm <- corCompSymm(value = 0.3, form = ~ 1 | Subject) > cs2CompSymm <- corCompSymm(value = 0.3, form = ~ age | Subject) > cs1CompSymm <- Initialize(cs1CompSymm, data = Orthodont) > corMatrix(cs1CompSymm) $M01 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M02 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M03 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M04 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M05 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M06 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M07 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M08 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M09 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M10 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M11 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M12 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M13 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M14 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M15 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $M16 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F01 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F02 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F03 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F04 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F05 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F06 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F07 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F08 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F09 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F10 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 $F11 [,1] [,2] [,3] [,4] [1,] 1.0 0.3 0.3 0.3 [2,] 0.3 1.0 0.3 0.3 [3,] 0.3 0.3 1.0 0.3 [4,] 0.3 0.3 0.3 1.0 > cs1Symm <- corSymm(value = c(0.2, 0.1, -0.1, 0, 0.2, 0), + form = ~ 1 | Subject) > cs1Symm <- Initialize(cs1Symm, data = Orthodont) > corMatrix(cs1Symm) $M01 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M02 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M03 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M04 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M05 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M06 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M07 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M08 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M09 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M10 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M11 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M12 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M13 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M14 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M15 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $M16 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F01 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F02 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F03 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F04 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F05 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F06 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F07 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F08 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F09 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F10 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 $F11 [,1] [,2] [,3] [,4] [1,] 1.0 2.00e-01 1.00e-01 -1.00e-01 [2,] 0.2 1.00e+00 9.02e-17 2.00e-01 [3,] 0.1 9.02e-17 1.00e+00 -1.04e-16 [4,] -0.1 2.00e-01 -1.04e-16 1.00e+00 > cs1AR1 <- corAR1(0.8, form = ~ 1 | Subject) > cs1AR1 <- Initialize(cs1AR1, data = Orthodont) > corMatrix(cs1AR1) $M01 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M02 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M03 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M04 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M05 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M06 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M07 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M08 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M09 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M10 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M11 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M12 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M13 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M14 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M15 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $M16 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F01 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F02 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F03 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F04 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F05 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F06 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F07 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F08 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F09 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F10 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 $F11 [,1] [,2] [,3] [,4] [1,] 1.000 0.80 0.64 0.512 [2,] 0.800 1.00 0.80 0.640 [3,] 0.640 0.80 1.00 0.800 [4,] 0.512 0.64 0.80 1.000 > cs1ARMA <- corARMA(0.4, form = ~ 1 | Subject, q = 1) > cs1ARMA <- Initialize(cs1ARMA, data = Orthodont) > corMatrix(cs1ARMA) $M01 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M02 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M03 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M04 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M05 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M06 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M07 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M08 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M09 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M10 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M11 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M12 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M13 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M14 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M15 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $M16 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F01 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F02 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F03 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F04 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F05 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F06 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F07 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F08 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F09 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F10 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 $F11 [,1] [,2] [,3] [,4] [1,] 1.000 0.345 0.000 0.000 [2,] 0.345 1.000 0.345 0.000 [3,] 0.000 0.345 1.000 0.345 [4,] 0.000 0.000 0.345 1.000 > cs2ARMA <- corARMA(c(0.8, 0.4), form = ~ 1 | Subject, p=1, q=1) > cs2ARMA <- Initialize(cs2ARMA, data = Orthodont) > corMatrix(cs2ARMA) $M01 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M02 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M03 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M04 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M05 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M06 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M07 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M08 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M09 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M10 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M11 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M12 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M13 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M14 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M15 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $M16 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F01 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F02 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F03 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F04 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F05 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F06 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F07 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F08 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F09 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F10 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 $F11 [,1] [,2] [,3] [,4] [1,] 1.000 0.880 0.704 0.563 [2,] 0.880 1.000 0.880 0.704 [3,] 0.704 0.880 1.000 0.880 [4,] 0.563 0.704 0.880 1.000 > spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) > cs1Exp <- corExp(1, form = ~ x + y) > cs1Exp <- Initialize(cs1Exp, spatDat) > corMatrix(cs1Exp) [,1] [,2] [,3] [,4] [,5] [1,] 1.000 0.702 0.493 0.346 0.243 [2,] 0.702 1.000 0.702 0.493 0.346 [3,] 0.493 0.702 1.000 0.702 0.493 [4,] 0.346 0.493 0.702 1.000 0.702 [5,] 0.243 0.346 0.493 0.702 1.000 > cs2Exp <- corExp(1, form = ~ x + y, metric = "man") > cs2Exp <- Initialize(cs2Exp, spatDat) > corMatrix(cs2Exp) [,1] [,2] [,3] [,4] [,5] [1,] 1.000 0.607 0.368 0.223 0.135 [2,] 0.607 1.000 0.607 0.368 0.223 [3,] 0.368 0.607 1.000 0.607 0.368 [4,] 0.223 0.368 0.607 1.000 0.607 [5,] 0.135 0.223 0.368 0.607 1.000 > cs3Exp <- corExp(c(1, 0.2), form = ~ x + y, nugget = TRUE) > cs3Exp <- Initialize(cs3Exp, spatDat) > corMatrix(cs3Exp) [,1] [,2] [,3] [,4] [,5] [1,] 1.000 0.562 0.394 0.277 0.194 [2,] 0.562 1.000 0.562 0.394 0.277 [3,] 0.394 0.562 1.000 0.562 0.394 [4,] 0.277 0.394 0.562 1.000 0.562 [5,] 0.194 0.277 0.394 0.562 1.000 > fm1Ovar.lme <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), + data = Ovary, random = pdDiag(~sin(2*pi*Time))) > fm1Ovar.lme Linear mixed-effects model fit by REML Data: Ovary Log-restricted-likelihood: -813 Fixed: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time) (Intercept) sin(2 * pi * Time) cos(2 * pi * Time) 12.182 -3.299 -0.862 Random effects: Formula: ~sin(2 * pi * Time) | Mare Structure: Diagonal (Intercept) sin(2 * pi * Time) Residual StdDev: 3.05 2.08 3.11 Number of Observations: 308 Number of Groups: 11 > ACF(fm1Ovar.lme) lag ACF 1 0 1.0000 2 1 0.3795 3 2 0.1797 4 3 0.0357 5 4 0.0598 6 5 0.0021 7 6 0.0643 8 7 0.0716 9 8 0.0486 10 9 0.0278 11 10 -0.0343 12 11 -0.0772 13 12 -0.1611 14 13 -0.1960 15 14 -0.2893 > plot(ACF(fm1Ovar.lme, maxLag = 10), alpha = 0.01) > fm2Ovar.lme <- update(fm1Ovar.lme, correlation = corAR1()) > anova(fm1Ovar.lme, fm2Ovar.lme) Model df AIC BIC logLik Test L.Ratio p-value fm1Ovar.lme 1 6 1638 1660 -813 fm2Ovar.lme 2 7 1563 1589 -775 1 vs 2 76.6 <.0001 > if (interactive()) intervals(fm2Ovar.lme) > fm3Ovar.lme <- update(fm1Ovar.lme, correlation = corARMA(q = 2)) > fm3Ovar.lme Linear mixed-effects model fit by REML Data: Ovary Log-restricted-likelihood: -778 Fixed: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time) (Intercept) sin(2 * pi * Time) cos(2 * pi * Time) 12.194 -3.115 -0.869 Random effects: Formula: ~sin(2 * pi * Time) | Mare Structure: Diagonal (Intercept) sin(2 * pi * Time) Residual StdDev: 2.97 1.67 3.24 Correlation Structure: ARMA(0,2) Formula: ~1 | Mare Parameter estimate(s): Theta1 Theta2 0.475 0.257 Number of Observations: 308 Number of Groups: 11 > anova(fm2Ovar.lme, fm3Ovar.lme, test = F) Model df AIC BIC logLik fm2Ovar.lme 1 7 1563 1589 -775 fm3Ovar.lme 2 8 1571 1601 -778 > fm4Ovar.lme <- update(fm1Ovar.lme, + correlation = corCAR1(form = ~Time)) > anova(fm2Ovar.lme, fm4Ovar.lme, test = F) Model df AIC BIC logLik fm2Ovar.lme 1 7 1563 1589 -775 fm4Ovar.lme 2 7 1566 1592 -776 > (fm5Ovar.lme <- update(fm1Ovar.lme, + corr = corARMA(p = 1, q = 1))) Linear mixed-effects model fit by REML Data: Ovary Log-restricted-likelihood: -772 Fixed: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time) (Intercept) sin(2 * pi * Time) cos(2 * pi * Time) 12.125 -2.920 -0.849 Random effects: Formula: ~sin(2 * pi * Time) | Mare Structure: Diagonal (Intercept) sin(2 * pi * Time) Residual StdDev: 2.61 1 3.73 Correlation Structure: ARMA(1,1) Formula: ~1 | Mare Parameter estimate(s): Phi1 Theta1 0.787 -0.279 Number of Observations: 308 Number of Groups: 11 > anova(fm2Ovar.lme, fm5Ovar.lme) Model df AIC BIC logLik Test L.Ratio p-value fm2Ovar.lme 1 7 1563 1589 -775 fm5Ovar.lme 2 8 1560 1590 -772 1 vs 2 5.55 0.0184 > plot(ACF(fm5Ovar.lme, maxLag = 10, resType = "n"), alpha = 0.01) > Variogram(fm2BW.lme, form = ~ Time) variog dist n.pairs 1 0.345 1 16 2 0.993 6 16 3 0.762 7 144 4 0.685 8 16 5 0.682 13 16 6 0.951 14 128 7 0.900 15 16 8 1.694 20 16 9 1.125 21 112 10 1.088 22 16 11 0.897 28 96 12 0.932 29 16 13 0.851 35 80 14 0.755 36 16 15 1.082 42 64 16 1.567 43 16 17 0.644 49 48 18 0.674 56 32 19 0.587 63 16 > plot(Variogram(fm2BW.lme, form = ~ Time, maxDist = 42)) > fm3BW.lme <- update(fm2BW.lme, + correlation = corExp(form = ~ Time)) > ## IGNORE_RDIFF_BEGIN > intervals(fm3BW.lme) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 2.26e+02 251.487 277.336 Time 1.93e-01 0.363 0.532 Diet2 1.52e+02 200.786 249.841 Diet3 2.04e+02 252.590 301.667 Time:Diet2 3.22e-01 0.624 0.926 Time:Diet3 2.63e-03 0.307 0.610 Random Effects: Level: Rat lower est. upper sd((Intercept)) 25.023 36.919 54.471 sd(Time) 0.147 0.233 0.368 cor((Intercept),Time) -0.637 -0.147 0.428 Correlation structure: lower est. upper range 2.46 4.89 9.7 Variance function: lower est. upper power 0.244 0.594 0.944 Within-group standard error: lower est. upper 0.0181 0.1384 1.0593 > ## IGNORE_RDIFF_END > anova(fm2BW.lme, fm3BW.lme) Model df AIC BIC logLik Test L.Ratio p-value fm2BW.lme 1 11 1164 1198 -571 fm3BW.lme 2 12 1145 1183 -561 1 vs 2 20.8 <.0001 > fm4BW.lme <- + update(fm3BW.lme, correlation = corExp(form = ~ Time, + nugget = TRUE)) > anova(fm3BW.lme, fm4BW.lme) Model df AIC BIC logLik Test L.Ratio p-value fm3BW.lme 1 12 1145 1183 -561 fm4BW.lme 2 13 1138 1178 -556 1 vs 2 9.5 0.0021 > plot(Variogram(fm3BW.lme, form = ~ Time, maxDist = 42)) > plot(Variogram(fm3BW.lme, form = ~ Time, maxDist = 42, + resType = "n", robust = TRUE)) > fm5BW.lme <- update(fm3BW.lme, correlation = corRatio(form = ~ Time)) > fm6BW.lme <- update(fm3BW.lme, correlation = corSpher(form = ~ Time)) > fm7BW.lme <- update(fm3BW.lme, correlation = corLin(form = ~ Time)) > fm8BW.lme <- update(fm3BW.lme, correlation = corGaus(form = ~ Time)) > anova(fm3BW.lme, fm5BW.lme, fm6BW.lme, fm7BW.lme, fm8BW.lme) Model df AIC BIC logLik fm3BW.lme 1 12 1145 1183 -561 fm5BW.lme 2 12 1149 1186 -562 fm6BW.lme 3 12 1151 1188 -563 fm7BW.lme 4 12 1151 1188 -563 fm8BW.lme 5 12 1151 1188 -563 > fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont, + correlation = corSymm(form = ~ 1 | Subject), + weights = varIdent(form = ~ 1 | age)) > fm1Orth.gls Generalized least squares fit by REML Model: distance ~ Sex * I(age - 11) Data: Orthodont Log-restricted-likelihood: -212 Coefficients: (Intercept) SexFemale 24.937 -2.272 I(age - 11) SexFemale:I(age - 11) 0.827 -0.350 Correlation Structure: General Formula: ~1 | Subject Parameter estimate(s): Correlation: 1 2 3 2 0.568 3 0.659 0.581 4 0.522 0.725 0.740 Variance function: Structure: Different standard deviations per stratum Formula: ~1 | age Parameter estimates: 8 10 12 14 1.000 0.879 1.074 0.959 Degrees of freedom: 108 total; 104 residual Residual standard error: 2.33 > ## IGNORE_RDIFF_BEGIN > intervals(fm1Orth.gls) Approximate 95% confidence intervals Coefficients: lower est. upper (Intercept) 23.999 24.937 25.875 SexFemale -3.741 -2.272 -0.803 I(age - 11) 0.664 0.827 0.990 SexFemale:I(age - 11) -0.606 -0.350 -0.095 Correlation structure: lower est. upper cor(1,2) 0.253 0.568 0.774 cor(1,3) 0.385 0.659 0.826 cor(1,4) 0.184 0.522 0.749 cor(2,3) 0.272 0.581 0.781 cor(2,4) 0.481 0.725 0.865 cor(3,4) 0.512 0.740 0.870 Variance function: lower est. upper 10 0.633 0.879 1.22 12 0.801 1.074 1.44 14 0.686 0.959 1.34 Residual standard error: lower est. upper 1.77 2.33 3.07 > ## IGNORE_RDIFF_END > fm2Orth.gls <- + update(fm1Orth.gls, corr = corCompSymm(form = ~ 1 | Subject)) > anova(fm1Orth.gls, fm2Orth.gls) Model df AIC BIC logLik Test L.Ratio p-value fm1Orth.gls 1 14 453 490 -212 fm2Orth.gls 2 9 450 474 -216 1 vs 2 7.43 0.191 > intervals(fm2Orth.gls) Approximate 95% confidence intervals Coefficients: lower est. upper (Intercept) 23.930 24.868 25.8071 SexFemale -3.668 -2.197 -0.7266 I(age - 11) 0.642 0.794 0.9470 SexFemale:I(age - 11) -0.555 -0.316 -0.0763 Correlation structure: lower est. upper Rho 0.446 0.635 0.778 Variance function: lower est. upper 10 0.638 0.862 1.17 12 0.771 1.034 1.39 14 0.683 0.920 1.24 Residual standard error: lower est. upper 1.81 2.39 3.15 > fm3Orth.gls <- update(fm2Orth.gls, weights = NULL) > anova(fm2Orth.gls, fm3Orth.gls) Model df AIC BIC logLik Test L.Ratio p-value fm2Orth.gls 1 9 450 474 -216 fm3Orth.gls 2 6 446 462 -217 1 vs 2 1.78 0.618 > plot(fm3Orth.gls, resid(., type = "n") ~ age | Sex) > fm4Orth.gls <- update(fm3Orth.gls, + weights = varIdent(form = ~ 1 | Sex)) > anova(fm3Orth.gls, fm4Orth.gls) Model df AIC BIC logLik Test L.Ratio p-value fm3Orth.gls 1 6 446 462 -217 fm4Orth.gls 2 7 436 455 -211 1 vs 2 11.6 7e-04 > qqnorm(fm4Orth.gls, ~resid(., type = "n")) > # not in book but needed for the following command > fm3Orth.lme <- + lme(distance~Sex*I(age-11), data = Orthodont, + random = ~ I(age-11) | Subject, + weights = varIdent(form = ~ 1 | Sex)) > anova(fm3Orth.lme, fm4Orth.gls, test = FALSE) Model df AIC BIC logLik fm3Orth.lme 1 9 430 453 -206 fm4Orth.gls 2 7 436 455 -211 > fm1Dial.gls <- + gls(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, + Dialyzer) > plot(fm1Dial.gls, resid(.) ~ pressure, abline = 0) > fm2Dial.gls <- update(fm1Dial.gls, + weights = varPower(form = ~ pressure)) > anova(fm1Dial.gls, fm2Dial.gls) Model df AIC BIC logLik Test L.Ratio p-value fm1Dial.gls 1 11 761 793 -370 fm2Dial.gls 2 12 738 773 -357 1 vs 2 24.9 <.0001 > ACF(fm2Dial.gls, form = ~ 1 | Subject) lag ACF 1 0 1.0000 2 1 0.7709 3 2 0.6323 4 3 0.4083 5 4 0.2007 6 5 0.0731 7 6 0.0778 > plot(ACF(fm2Dial.gls, form = ~ 1 | Subject), alpha = 0.01) > (fm3Dial.gls <- update(fm2Dial.gls, + corr = corAR1(0.771, form = ~ 1 | Subject))) Generalized least squares fit by REML Model: rate ~ (pressure + I(pressure^2) + I(pressure^3) + I(pressure^4)) * QB Data: Dialyzer Log-restricted-likelihood: -308 Coefficients: (Intercept) pressure I(pressure^2) -16.818 92.334 -49.265 I(pressure^3) I(pressure^4) QB300 11.400 -1.020 -1.594 pressure:QB300 I(pressure^2):QB300 I(pressure^3):QB300 1.705 2.127 0.480 I(pressure^4):QB300 -0.221 Correlation Structure: AR(1) Formula: ~1 | Subject Parameter estimate(s): Phi 0.753 Variance function: Structure: Power of variance covariate Formula: ~pressure Parameter estimates: power 0.518 Degrees of freedom: 140 total; 130 residual Residual standard error: 3.05 > intervals(fm3Dial.gls) Approximate 95% confidence intervals Coefficients: lower est. upper (Intercept) -18.90 -16.818 -14.7401 pressure 81.91 92.334 102.7541 I(pressure^2) -63.10 -49.265 -35.4263 I(pressure^3) 4.56 11.400 18.2345 I(pressure^4) -2.12 -1.020 0.0856 QB300 -4.76 -1.594 1.5681 pressure:QB300 -13.64 1.705 17.0518 I(pressure^2):QB300 -17.95 2.127 22.2020 I(pressure^3):QB300 -9.35 0.480 10.3097 I(pressure^4):QB300 -1.80 -0.221 1.3608 Correlation structure: lower est. upper Phi 0.628 0.753 0.839 Variance function: lower est. upper power 0.381 0.518 0.656 Residual standard error: lower est. upper 2.50 3.05 3.71 > anova(fm2Dial.gls, fm3Dial.gls) Model df AIC BIC logLik Test L.Ratio p-value fm2Dial.gls 1 12 738 773 -357 fm3Dial.gls 2 13 643 680 -308 1 vs 2 97.5 <.0001 > anova(fm3Dial.gls, fm2Dial.lme, test = FALSE) Model df AIC BIC logLik fm3Dial.gls 1 13 643 680 -308 fm2Dial.lme 2 18 655 707 -310 > fm1Wheat2 <- gls(yield ~ variety - 1, Wheat2) > Variogram(fm1Wheat2, form = ~ latitude + longitude) variog dist n.pairs 1 0.370 4.30 1143 2 0.396 5.61 1259 3 0.470 8.39 1263 4 0.508 9.32 1241 5 0.545 10.52 1242 6 0.640 12.75 1241 7 0.612 13.39 1283 8 0.657 14.76 1252 9 0.738 16.18 1221 10 0.728 17.37 1261 11 0.751 18.46 1288 12 0.875 20.24 1254 13 0.805 21.63 1256 14 0.871 22.67 1182 15 0.868 24.62 1257 16 0.859 26.24 1264 17 0.971 28.56 1235 18 0.993 30.79 1226 19 1.096 34.59 1263 20 1.341 39.36 1234 > plot(Variogram(fm1Wheat2, form = ~ latitude + longitude, + maxDist = 32), xlim = c(0,32)) > fm2Wheat2 <- update(fm1Wheat2, corr = corSpher(c(28, 0.2), + form = ~ latitude + longitude, + nugget = TRUE)) > fm2Wheat2 Generalized least squares fit by REML Model: yield ~ variety - 1 Data: Wheat2 Log-restricted-likelihood: -534 Coefficients: varietyARAPAHOE varietyBRULE varietyBUCKSKIN 26.7 25.8 34.8 varietyCENTURA varietyCENTURK78 varietyCHEYENNE 25.1 26.3 24.7 varietyCODY varietyCOLT varietyGAGE 22.5 25.2 24.3 varietyHOMESTEAD varietyKS831374 varietyLANCER 21.7 26.9 23.3 varietyLANCOTA varietyNE83404 varietyNE83406 21.3 24.0 25.3 varietyNE83407 varietyNE83432 varietyNE83498 25.2 21.8 28.7 varietyNE83T12 varietyNE84557 varietyNE85556 22.1 21.8 28.0 varietyNE85623 varietyNE86482 varietyNE86501 23.9 25.0 25.0 varietyNE86503 varietyNE86507 varietyNE86509 27.2 27.5 22.4 varietyNE86527 varietyNE86582 varietyNE86606 25.9 22.6 26.8 varietyNE86607 varietyNE86T666 varietyNE87403 25.9 16.8 21.5 varietyNE87408 varietyNE87409 varietyNE87446 24.3 26.3 22.2 varietyNE87451 varietyNE87457 varietyNE87463 24.2 23.5 23.2 varietyNE87499 varietyNE87512 varietyNE87513 22.2 22.6 21.8 varietyNE87522 varietyNE87612 varietyNE87613 19.5 27.4 27.6 varietyNE87615 varietyNE87619 varietyNE87627 23.8 28.5 18.5 varietyNORKAN varietyREDLAND varietyROUGHRIDER 22.1 28.0 25.7 varietySCOUT66 varietySIOUXLAND varietyTAM107 26.9 25.7 22.8 varietyTAM200 varietyVONA 18.8 24.8 Correlation Structure: Spherical spatial correlation Formula: ~latitude + longitude Parameter estimate(s): range nugget 27.457 0.209 Degrees of freedom: 224 total; 168 residual Residual standard error: 7.41 > fm3Wheat2 <- update(fm1Wheat2, + corr = corRatio(c(12.5, 0.2), + form = ~ latitude + longitude, nugget = TRUE)) > fm3Wheat2 Generalized least squares fit by REML Model: yield ~ variety - 1 Data: Wheat2 Log-restricted-likelihood: -533 Coefficients: varietyARAPAHOE varietyBRULE varietyBUCKSKIN 26.5 26.3 35.0 varietyCENTURA varietyCENTURK78 varietyCHEYENNE 24.9 26.7 24.4 varietyCODY varietyCOLT varietyGAGE 23.4 25.2 24.5 varietyHOMESTEAD varietyKS831374 varietyLANCER 21.5 26.5 23.0 varietyLANCOTA varietyNE83404 varietyNE83406 21.2 24.6 25.7 varietyNE83407 varietyNE83432 varietyNE83498 25.5 21.8 29.1 varietyNE83T12 varietyNE84557 varietyNE85556 21.6 21.3 27.9 varietyNE85623 varietyNE86482 varietyNE86501 23.7 24.4 24.9 varietyNE86503 varietyNE86507 varietyNE86509 27.3 27.4 22.2 varietyNE86527 varietyNE86582 varietyNE86606 25.0 23.3 27.3 varietyNE86607 varietyNE86T666 varietyNE87403 25.7 17.3 21.8 varietyNE87408 varietyNE87409 varietyNE87446 24.7 26.3 22.1 varietyNE87451 varietyNE87457 varietyNE87463 24.4 23.6 23.4 varietyNE87499 varietyNE87512 varietyNE87513 21.9 22.7 21.6 varietyNE87522 varietyNE87612 varietyNE87613 19.6 28.3 27.7 varietyNE87615 varietyNE87619 varietyNE87627 24.0 28.7 19.1 varietyNORKAN varietyREDLAND varietyROUGHRIDER 22.7 27.7 25.6 varietySCOUT66 varietySIOUXLAND varietyTAM107 26.3 25.7 22.5 varietyTAM200 varietyVONA 18.7 25.0 Correlation Structure: Rational quadratic spatial correlation Formula: ~latitude + longitude Parameter estimate(s): range nugget 13.461 0.194 Degrees of freedom: 224 total; 168 residual Residual standard error: 8.85 > anova(fm2Wheat2, fm3Wheat2) Model df AIC BIC logLik fm2Wheat2 1 59 1186 1370 -534 fm3Wheat2 2 59 1183 1368 -533 > anova(fm1Wheat2, fm3Wheat2) Model df AIC BIC logLik Test L.Ratio p-value fm1Wheat2 1 57 1355 1533 -620 fm3Wheat2 2 59 1183 1368 -533 1 vs 2 176 <.0001 > plot(Variogram(fm3Wheat2, resType = "n")) > plot(fm3Wheat2, resid(., type = "n") ~ fitted(.), abline = 0) > qqnorm(fm3Wheat2, ~ resid(., type = "n")) > fm4Wheat2 <- update(fm3Wheat2, model = yield ~ variety) > anova(fm4Wheat2) Denom. DF: 168 numDF F-value p-value (Intercept) 1 30.40 <.0001 variety 55 1.85 0.0015 > anova(fm3Wheat2, L = c(-1, 0, 1)) Denom. DF: 168 F-test for linear combination(s) varietyARAPAHOE varietyBUCKSKIN -1 1 numDF F-value p-value 1 1 7.7 0.0062 > # cleanup > > summary(warnings()) No warnings ====== ch06.R ====== > #-*- 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 = "ch06.pdf") > # Chapter 6 Nonlinear Mixed-Effects Models: > # Basic Concepts and Motivating Examples > > # 6.2 Indomethicin Kinetics > > plot(Indometh) > fm1Indom.nls <- nls(conc ~ SSbiexp(time, A1, lrc1, A2, lrc2), + data = Indometh) > summary(fm1Indom.nls) Formula: conc ~ SSbiexp(time, A1, lrc1, A2, lrc2) Parameters: Estimate Std. Error t value Pr(>|t|) A1 2.773 0.253 10.95 4e-16 *** lrc1 0.886 0.222 3.99 0.00018 *** A2 0.607 0.267 2.27 0.02660 * lrc2 -1.092 0.409 -2.67 0.00966 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.174 on 62 degrees of freedom Number of iterations to convergence: 0 Achieved convergence tolerance: 3.3e-07 > plot(fm1Indom.nls, Subject ~ resid(.), abline = 0) > (fm1Indom.lis <- nlsList(conc ~ SSbiexp(time, A1, lrc1, A2, lrc2), + data = Indometh)) Call: Model: conc ~ SSbiexp(time, A1, lrc1, A2, lrc2) | Subject Data: Indometh Coefficients: A1 lrc1 A2 lrc2 1 2.03 0.579 0.192 -1.788 4 2.20 0.242 0.255 -1.603 2 2.83 0.801 0.499 -1.635 5 3.57 1.041 0.291 -1.507 6 3.00 1.088 0.969 -0.873 3 5.47 1.750 1.676 -0.412 Degrees of freedom: 66 total; 42 residual Residual standard error: 0.0756 > plot(intervals(fm1Indom.lis)) > ## IGNORE_RDIFF_BEGIN > (fm1Indom.nlme <- nlme(fm1Indom.lis, + random = pdDiag(A1 + lrc1 + A2 + lrc2 ~ 1), + control = list(tolerance = 0.0001))) Nonlinear mixed-effects model fit by maximum likelihood Model: conc ~ SSbiexp(time, A1, lrc1, A2, lrc2) Data: Indometh Log-likelihood: 54.6 Fixed: list(A1 ~ 1, lrc1 ~ 1, A2 ~ 1, lrc2 ~ 1) A1 lrc1 A2 lrc2 2.828 0.774 0.461 -1.344 Random effects: Formula: list(A1 ~ 1, lrc1 ~ 1, A2 ~ 1, lrc2 ~ 1) Level: Subject Structure: Diagonal A1 lrc1 A2 lrc2 Residual StdDev: 0.571 0.158 0.112 7.32e-06 0.0815 Number of Observations: 66 Number of Groups: 6 > ## IGNORE_RDIFF_END > fm2Indom.nlme <- update(fm1Indom.nlme, + random = pdDiag(A1 + lrc1 + A2 ~ 1)) > anova(fm1Indom.nlme, fm2Indom.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm1Indom.nlme 1 9 -91.2 -71.5 54.6 fm2Indom.nlme 2 8 -93.2 -75.7 54.6 1 vs 2 0.00871 0.926 > (fm3Indom.nlme <- update(fm2Indom.nlme, random = A1+lrc1+A2 ~ 1)) Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'! Nonlinear mixed-effects model fit by maximum likelihood Model: conc ~ SSbiexp(time, A1, lrc1, A2, lrc2) Data: Indometh Log-likelihood: 58.5 Fixed: list(A1 ~ 1, lrc1 ~ 1, A2 ~ 1, lrc2 ~ 1) A1 lrc1 A2 lrc2 2.815 0.829 0.561 -1.141 Random effects: Formula: list(A1 ~ 1, lrc1 ~ 1, A2 ~ 1) Level: Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr A1 0.6904 A1 lrc1 lrc1 0.1790 0.932 A2 0.1537 0.471 0.118 Residual 0.0781 Number of Observations: 66 Number of Groups: 6 > fm4Indom.nlme <- + update(fm3Indom.nlme, + random = pdBlocked(list(A1 + lrc1 ~ 1, A2 ~ 1))) > ## IGNORE_RDIFF_BEGIN > anova(fm3Indom.nlme, fm4Indom.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm3Indom.nlme 1 11 -94.9 -70.9 58.5 fm4Indom.nlme 2 9 -98.2 -78.4 58.1 1 vs 2 0.789 0.674 > ## IGNORE_RDIFF_END > anova(fm2Indom.nlme, fm4Indom.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm2Indom.nlme 1 8 -93.2 -75.7 54.6 fm4Indom.nlme 2 9 -98.2 -78.4 58.1 1 vs 2 6.97 0.0083 > plot(fm4Indom.nlme, id = 0.05, adj = -1) > qqnorm(fm4Indom.nlme) > plot(augPred(fm4Indom.nlme, level = 0:1)) > summary(fm4Indom.nlme) Nonlinear mixed-effects model fit by maximum likelihood Model: conc ~ SSbiexp(time, A1, lrc1, A2, lrc2) Data: Indometh AIC BIC logLik -98.2 -78.4 58.1 Random effects: Composite Structure: Blocked Block 1: A1, lrc1 Formula: list(A1 ~ 1, lrc1 ~ 1) Level: Subject Structure: General positive-definite StdDev Corr A1 0.720 A1 lrc1 0.149 1 Block 2: A2 Formula: A2 ~ 1 | Subject A2 Residual StdDev: 0.213 0.0782 Fixed effects: list(A1 ~ 1, lrc1 ~ 1, A2 ~ 1, lrc2 ~ 1) Value Std.Error DF t-value p-value A1 2.783 0.327 57 8.51 0 lrc1 0.898 0.111 57 8.11 0 A2 0.658 0.143 57 4.61 0 lrc2 -1.000 0.150 57 -6.67 0 Correlation: A1 lrc1 A2 lrc1 0.602 A2 -0.058 0.556 lrc2 -0.109 0.570 0.702 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.459 -0.437 0.110 0.504 3.057 Number of Observations: 66 Number of Groups: 6 > # 6.3 Growth of Soybean Plants > > head(Soybean) Grouped Data: weight ~ Time | Plot Plot Variety Year Time weight 1 1988F1 F 1988 14 0.106 2 1988F1 F 1988 21 0.261 3 1988F1 F 1988 28 0.666 4 1988F1 F 1988 35 2.110 5 1988F1 F 1988 42 3.560 6 1988F1 F 1988 49 6.230 > plot(Soybean, outer = ~ Year * Variety) > (fm1Soy.lis <- nlsList(weight ~ SSlogis(Time, Asym, xmid, scal), + data = Soybean, + ## in R >= 3.4.3, more iterations are needed for "1989P5" + ## due to a change of initial values in SSlogis(); + ## control is passed to getInitial() only since R 4.1.0 + control = list(maxiter = 60))) Warning: 1 error caught in nls(y ~ 1/(1 + exp((xmid - x)/scal)), data = xy, start = list(xmid = aux[[1L]], scal = aux[[2L]]), algorithm = "plinear", ...): step factor 0.000488281 reduced below 'minFactor' of 0.000976562 Call: Model: weight ~ SSlogis(Time, Asym, xmid, scal) | Plot Data: Soybean Coefficients: Asym xmid scal 1988F4 15.15 52.8 5.18 1988F2 19.75 56.6 8.41 1988F1 20.34 57.4 9.60 1988F7 19.87 56.2 8.07 1988F5 30.65 64.1 11.26 1988F8 22.78 59.3 9.00 1988F6 23.29 59.6 9.72 1988F3 23.70 56.4 7.64 1988P1 17.30 48.8 6.36 1988P5 17.70 51.3 6.81 1988P4 24.01 57.8 11.74 1988P8 28.25 63.0 10.95 1988P7 27.49 61.5 10.18 1988P3 24.94 56.3 8.32 1988P2 36.66 66.6 11.92 1988P6 163.70 105.0 17.93 1989F6 8.51 55.3 8.86 1989F5 9.67 51.3 7.21 1989F4 11.25 53.8 6.49 1989F1 11.25 56.6 6.07 1989F2 11.23 52.2 7.02 1989F7 10.07 51.4 5.50 1989F8 10.61 48.0 5.96 1989F3 18.42 66.1 9.22 1989P7 15.47 46.3 5.39 1989P4 18.18 57.2 8.40 1989P6 20.50 58.2 10.61 1989P5 17.89 54.1 6.05 1989P1 21.68 59.7 9.97 1989P3 22.28 53.4 7.90 1989P2 28.30 67.2 12.52 1989P8 NA NA NA 1990F2 19.46 66.3 13.16 1990F3 19.87 58.3 12.80 1990F4 27.44 70.3 14.56 1990F5 18.72 51.3 7.76 1990F1 19.79 55.7 9.62 1990F8 20.29 55.5 7.77 1990F7 19.84 54.7 6.79 1990F6 21.20 54.6 9.26 1990P8 18.51 52.4 8.58 1990P7 19.16 54.8 10.85 1990P3 19.20 49.7 9.32 1990P1 18.45 47.9 6.61 1990P6 17.69 50.2 6.63 1990P5 19.54 51.2 7.29 1990P2 25.79 62.4 11.66 1990P4 26.13 61.2 10.97 Degrees of freedom: 404 total; 263 residual Residual standard error: 1.04 > ## IGNORE_RDIFF_BEGIN > (fm1Soy.nlme <- nlme(fm1Soy.lis)) Nonlinear mixed-effects model fit by maximum likelihood Model: weight ~ SSlogis(Time, Asym, xmid, scal) Data: Soybean Log-likelihood: -740 Fixed: list(Asym ~ 1, xmid ~ 1, scal ~ 1) Asym xmid scal 19.3 55.0 8.4 Random effects: Formula: list(Asym ~ 1, xmid ~ 1, scal ~ 1) Level: Plot Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym 5.20 Asym xmid xmid 4.20 0.721 scal 1.40 0.711 0.959 Residual 1.12 Number of Observations: 412 Number of Groups: 48 > ## IGNORE_RDIFF_END > fm2Soy.nlme <- update(fm1Soy.nlme, weights = varPower()) Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'! Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 6, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8) > anova(fm1Soy.nlme, fm2Soy.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm1Soy.nlme 1 10 1500 1540 -740 fm2Soy.nlme 2 11 746 790 -362 1 vs 2 756 <.0001 > plot(ranef(fm2Soy.nlme, augFrame = TRUE), + form = ~ Year * Variety, layout = c(3,1)) > soyFix <- fixef(fm2Soy.nlme) > options(contrasts = c("contr.treatment", "contr.poly")) > ## IGNORE_RDIFF_BEGIN > (fm3Soy.nlme <- + update(fm2Soy.nlme, + fixed = Asym + xmid + scal ~ Year, + start = c(soyFix[1], 0, 0, soyFix[2], 0, 0, soyFix[3], 0, 0))) Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'! Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 6, LME step: nlminb() did not converge (code = 1). PORT message: false convergence (8) Nonlinear mixed-effects model fit by maximum likelihood Model: weight ~ SSlogis(Time, Asym, xmid, scal) Data: Soybean Log-likelihood: -326 Fixed: Asym + xmid + scal ~ Year Asym.(Intercept) Asym.Year1989 Asym.Year1990 20.208 -6.303 -3.465 xmid.(Intercept) xmid.Year1989 xmid.Year1990 54.099 -2.480 -4.848 scal.(Intercept) scal.Year1989 scal.Year1990 8.051 -0.932 -0.662 Random effects: Formula: list(Asym ~ 1, xmid ~ 1, scal ~ 1) Level: Plot Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym.(Intercept) 2.71e+00 As.(I) xm.(I) xmid.(Intercept) 8.34e-12 0.992 scal.(Intercept) 1.08e-01 0.999 0.993 Residual 2.16e-01 Variance function: Structure: Power of variance covariate Formula: ~fitted(.) Parameter estimates: power 0.95 Number of Observations: 412 Number of Groups: 48 > ## IGNORE_RDIFF_END > anova(fm3Soy.nlme) numDF denDF F-value p-value Asym.(Intercept) 1 356 2057 <.0001 Asym.Year 2 356 103 <.0001 xmid.(Intercept) 1 356 11420 <.0001 xmid.Year 2 356 9 1e-04 scal.(Intercept) 1 356 7967 <.0001 scal.Year 2 356 11 <.0001 > # The following line is not in the book but needed to fit the model > fm4Soy.nlme <- + nlme(weight ~ SSlogis(Time, Asym, xmid, scal), + data = Soybean, + fixed = list(Asym ~ Year*Variety, xmid ~ Year + Variety, scal ~ Year), + random = Asym ~ 1, + start = c(17, 0, 0, 0, 0, 0, 52, 0, 0, 0, 7.5, 0, 0), + weights = varPower(0.95), control = list(verbose = TRUE)) > # FIXME: An update doesn't work for the fixed argument when fixed is a list > ## p. 293-4 : > summary(fm4Soy.nlme) Nonlinear mixed-effects model fit by maximum likelihood Model: weight ~ SSlogis(Time, Asym, xmid, scal) Data: Soybean AIC BIC logLik 616 681 -292 Random effects: Formula: Asym ~ 1 | Plot Asym.(Intercept) Residual StdDev: 1.04 0.218 Variance function: Structure: Power of variance covariate Formula: ~fitted(.) Parameter estimates: power 0.943 Fixed effects: list(Asym ~ Year * Variety, xmid ~ Year + Variety, scal ~ Year) Value Std.Error DF t-value p-value Asym.(Intercept) 19.4 0.954 352 20.4 0.0000 Asym.Year1989 -8.8 1.072 352 -8.2 0.0000 Asym.Year1990 -3.7 1.177 352 -3.1 0.0018 Asym.VarietyP 1.6 1.038 352 1.6 0.1189 Asym.Year1989:VarietyP 5.6 1.171 352 4.8 0.0000 Asym.Year1990:VarietyP 0.1 1.176 352 0.1 0.9004 xmid.(Intercept) 54.8 0.755 352 72.6 0.0000 xmid.Year1989 -2.2 0.972 352 -2.3 0.0218 xmid.Year1990 -5.0 0.974 352 -5.1 0.0000 xmid.VarietyP -1.3 0.414 352 -3.1 0.0019 scal.(Intercept) 8.1 0.147 352 54.8 0.0000 scal.Year1989 -0.9 0.201 352 -4.4 0.0000 scal.Year1990 -0.7 0.212 352 -3.2 0.0016 Correlation: As.(I) As.Y1989 As.Y1990 Asy.VP A.Y1989: Asym.Year1989 -0.831 Asym.Year1990 -0.736 0.646 Asym.VarietyP -0.532 0.374 0.304 Asym.Year1989:VarietyP 0.339 -0.403 -0.249 -0.662 Asym.Year1990:VarietyP 0.318 -0.273 -0.447 -0.627 0.533 xmid.(Intercept) 0.729 -0.595 -0.523 -0.144 0.007 xmid.Year1989 -0.488 0.603 0.394 -0.021 0.133 xmid.Year1990 -0.489 0.433 0.661 -0.016 0.020 xmid.VarietyP -0.337 0.127 0.052 0.572 -0.114 scal.(Intercept) 0.432 -0.381 -0.345 0.023 -0.029 scal.Year1989 -0.311 0.369 0.252 -0.025 0.090 scal.Year1990 -0.296 0.263 0.398 -0.023 0.022 A.Y1990: xm.(I) x.Y198 x.Y199 xmd.VP Asym.Year1989 Asym.Year1990 Asym.VarietyP Asym.Year1989:VarietyP Asym.Year1990:VarietyP xmid.(Intercept) -0.011 xmid.Year1989 0.021 -0.705 xmid.Year1990 0.054 -0.706 0.545 xmid.VarietyP -0.057 -0.308 0.006 0.015 scal.(Intercept) -0.031 0.817 -0.629 -0.628 -0.022 scal.Year1989 0.023 -0.593 0.855 0.459 0.002 scal.Year1990 0.048 -0.563 0.437 0.840 0.004 sc.(I) s.Y198 Asym.Year1989 Asym.Year1990 Asym.VarietyP Asym.Year1989:VarietyP Asym.Year1990:VarietyP xmid.(Intercept) xmid.Year1989 xmid.Year1990 xmid.VarietyP scal.(Intercept) scal.Year1989 -0.731 scal.Year1990 -0.694 0.507 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.628 -0.608 -0.124 0.570 3.919 Number of Observations: 412 Number of Groups: 48 > plot(augPred(fm4Soy.nlme))# Fig 6.14, p. 295 > # 6.4 Clinical Study of Phenobarbital Kinetics > > (fm1Pheno.nlme <- + nlme(conc ~ phenoModel(Subject, time, dose, lCl, lV), + data = Phenobarb, fixed = lCl + lV ~ 1, + random = pdDiag(lCl + lV ~ 1), start = c(-5, 0), + na.action = NULL, naPattern = ~ !is.na(conc))) Nonlinear mixed-effects model fit by maximum likelihood Model: conc ~ phenoModel(Subject, time, dose, lCl, lV) Data: Phenobarb Log-likelihood: -505 Fixed: lCl + lV ~ 1 lCl lV -5.093 0.343 Random effects: Formula: list(lCl ~ 1, lV ~ 1) Level: Subject Structure: Diagonal lCl lV Residual StdDev: 0.44 0.45 2.79 Number of Observations: 155 Number of Groups: 59 > fm1Pheno.ranef <- ranef(fm1Pheno.nlme, augFrame = TRUE) > # (These plots used to encounter difficulties, now fine): > plot(fm1Pheno.ranef, form = lCl ~ Wt + ApgarInd) > plot(fm1Pheno.ranef, form = lV ~ Wt + ApgarInd) > options(contrasts = c("contr.treatment", "contr.poly")) > if(FALSE)## This fit just "ping-pongs" until max.iterations error + fm2Pheno.nlme <- + update(fm1Pheno.nlme, + fixed = list(lCl ~ Wt, lV ~ Wt + ApgarInd), + start = c(-5.0935, 0, 0.34259, 0, 0), + control = list(pnlsTol = 1e-4, maxIter = 500, + msVerbose = TRUE, opt = "nlm")) > ##summary(fm2Pheno.nlme) > ##fm3Pheno.nlme <- > ## update(fm2Pheno.nlme, > ## fixed = lCl + lV ~ Wt, > ## start = fixef(fm2Pheno.nlme)[-5]) > ##plot(fm3Pheno.nlme, conc ~ fitted(.), abline = c(0,1)) > > # cleanup > > summary(warnings()) No warnings ====== ch08.R ====== > #-*- R -*- > > # initialization > > library(nlme) > library(lattice) > 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 = "ch08.pdf") > # Chapter 8 Fitting Nonlinear Mixed-Effects Models > > # 8.1 Fitting Nonlinear Models in S with nls and nlsList > > ## outer = ~1 is used to display all five curves in one panel > plot(Orange, outer = ~1) > logist <- + function(x, Asym, xmid, scal) Asym/(1 + exp(-(x - xmid)/scal)) > logist <- deriv(~Asym/(1+exp(-(x-xmid)/scal)), + c("Asym", "xmid", "scal"), function(x, Asym, xmid, scal){}) > Asym <- 180; xmid <- 700; scal <- 300 > logist(Orange$age[1:7], Asym, xmid, scal) [1] 22.6 58.9 84.6 132.1 153.8 162.7 171.0 attr(,"gradient") Asym xmid scal [1,] 0.126 -0.0659 0.1279 [2,] 0.327 -0.1321 0.0951 [3,] 0.470 -0.1495 0.0179 [4,] 0.734 -0.1172 -0.1188 [5,] 0.854 -0.0746 -0.1321 [6,] 0.904 -0.0522 -0.1169 [7,] 0.950 -0.0286 -0.0841 > fm1Oran.nls <- nls(circumference ~ logist(age, Asym, xmid, scal), + data = Orange, start = c(Asym = 170, xmid = 700, scal = 500)) > summary(fm1Oran.nls) Formula: circumference ~ logist(age, Asym, xmid, scal) Parameters: Estimate Std. Error t value Pr(>|t|) Asym 192.7 20.2 9.52 7.5e-11 *** xmid 728.8 107.3 6.79 1.1e-07 *** scal 353.5 81.5 4.34 0.00013 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 23.4 on 32 degrees of freedom Number of iterations to convergence: 5 Achieved convergence tolerance: 4.39e-06 > plot(fm1Oran.nls) > plot(fm1Oran.nls, Tree ~ resid(.), abline = 0) > Orange.sortAvg <- sortedXyData("age", "circumference", Orange) > Orange.sortAvg x y 1 118 31.0 2 484 57.8 3 664 93.2 4 1004 134.2 5 1231 145.6 6 1372 173.4 7 1582 175.8 > NLSstClosestX(Orange.sortAvg, 130) [1] 969 > logistInit <- function(mCall, LHS, data) { + xy <- sortedXyData(mCall[["x"]], LHS, data) + if(nrow(xy) < 3) { + stop("Too few distinct input values to fit a logistic") + } + Asym <- max(abs(xy[,"y"])) + if (Asym != max(xy[,"y"])) Asym <- -Asym # negative asymptote + xmid <- NLSstClosestX(xy, 0.5 * Asym) + scal <- NLSstClosestX(xy, 0.75 * Asym) - xmid + value <- c(Asym, xmid, scal) + names(value) <- mCall[c("Asym", "xmid", "scal")] + value + } > logist <- selfStart(logist, initial = logistInit) > class(logist) [1] "selfStart" > logist <- selfStart(~ Asym/(1 + exp(-(x - xmid)/scal)), + initial = logistInit, parameters = c("Asym", "xmid", "scal")) > getInitial(circumference ~ logist(age, Asym, xmid, scal), Orange) Warning in getInitial.selfStart(func, data, mCall = as.list(match.call(func, : selfStart initializing functions should have a final '...' argument since R 4.1.0 Asym xmid scal 176 637 347 > nls(circumference ~ logist(age, Asym, xmid, scal), Orange) Warning in getInitial.selfStart(func, data, mCall = as.list(match.call(func, : selfStart initializing functions should have a final '...' argument since R 4.1.0 Nonlinear regression model model: circumference ~ logist(age, Asym, xmid, scal) data: Orange Asym xmid scal 193 729 354 residual sum-of-squares: 17480 Number of iterations to convergence: 4 Achieved convergence tolerance: 8.63e-07 > getInitial(circumference ~ SSlogis(age,Asym,xmid,scal), Orange) Asym xmid scal 193 729 354 > nls(circumference ~ SSlogis(age, Asym, xmid, scal), Orange) Nonlinear regression model model: circumference ~ SSlogis(age, Asym, xmid, scal) data: Orange Asym xmid scal 193 729 354 residual sum-of-squares: 17480 Number of iterations to convergence: 0 Achieved convergence tolerance: 2.2e-06 > fm1Oran.lis <- + nlsList(circumference ~ SSlogis(age, Asym, xmid, scal) | Tree, + data = Orange) > fm1Oran.lis <- nlsList(SSlogis, Orange) > fm1Oran.lis.noSS <- + nlsList(circumference ~ Asym/(1+exp(-(age-xmid)/scal)), + data = Orange, + start = c(Asym = 170, xmid = 700, scal = 500)) > fm1Oran.lis Call: Model: circumference ~ SSlogis(age, Asym, xmid, scal) | Tree Data: Orange Coefficients: Asym xmid scal 3 159 735 401 1 154 627 363 5 207 861 380 2 219 700 332 4 225 711 303 Degrees of freedom: 35 total; 20 residual Residual standard error: 7.98 > summary(fm1Oran.lis) Call: Model: circumference ~ SSlogis(age, Asym, xmid, scal) | Tree Data: Orange Coefficients: Asym Estimate Std. Error t value Pr(>|t|) 3 159 19.2 8.26 0.000460 1 154 13.6 11.34 0.000169 5 207 22.0 9.41 0.000738 2 219 13.4 16.39 0.000105 4 225 11.8 19.03 0.000104 xmid Estimate Std. Error t value Pr(>|t|) 3 735 130.8 5.62 0.002011 1 627 92.9 6.75 0.001263 5 861 108.0 7.98 0.001389 2 700 61.4 11.42 0.000435 4 711 51.2 13.89 0.000358 scal Estimate Std. Error t value Pr(>|t|) 3 401 94.8 4.23 0.00571 1 363 81.2 4.46 0.00586 5 380 66.8 5.69 0.00487 2 332 49.4 6.73 0.00324 4 303 41.6 7.29 0.00415 Residual standard error: 7.98 on 20 degrees of freedom > plot(intervals(fm1Oran.lis), layout = c(3,1)) > plot(fm1Oran.lis, Tree ~ resid(.), abline = 0) > Theoph[1:4,] Grouped Data: conc ~ Time | Subject Subject Wt Dose Time conc 1 1 79.6 4.02 0.00 0.74 2 1 79.6 4.02 0.25 2.84 3 1 79.6 4.02 0.57 6.57 4 1 79.6 4.02 1.12 10.50 > fm1Theo.lis <- nlsList(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), + data = Theoph) > fm1Theo.lis Call: Model: conc ~ SSfol(Dose, Time, lKe, lKa, lCl) | Subject Data: Theoph Coefficients: lKe lKa lCl 6 -2.31 0.152 -2.97 7 -2.28 -0.386 -2.96 8 -2.39 0.319 -3.07 11 -2.32 1.348 -2.86 3 -2.51 0.898 -3.23 2 -2.29 0.664 -3.11 4 -2.44 0.158 -3.29 9 -2.45 2.182 -3.42 12 -2.25 -0.183 -3.17 10 -2.60 -0.363 -3.43 1 -2.92 0.575 -3.92 5 -2.43 0.386 -3.13 Degrees of freedom: 132 total; 96 residual Residual standard error: 0.7 > plot(intervals(fm1Theo.lis), layout = c(3,1)) > pairs(fm1Theo.lis, id = 0.1) > # 8.2 Fitting Nonlinear Mixed-Effects Models with nlme > > ## no need to specify groups, as Orange is a groupedData object > ## random is omitted - by default it is equal to fixed > (fm1Oran.nlme <- + nlme(circumference ~ SSlogis(age, Asym, xmid, scal), + data = Orange, + fixed = Asym + xmid + scal ~ 1, + start = fixef(fm1Oran.lis))) Warning in nlme.formula(circumference ~ SSlogis(age, Asym, xmid, scal), : Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'! Nonlinear mixed-effects model fit by maximum likelihood Model: circumference ~ SSlogis(age, Asym, xmid, scal) Data: Orange Log-likelihood: -130 Fixed: Asym + xmid + scal ~ 1 Asym xmid scal 192 728 357 Random effects: Formula: list(Asym ~ 1, xmid ~ 1, scal ~ 1) Level: Tree Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym 27.05 Asym xmid xmid 24.25 -0.328 scal 36.60 -0.992 0.443 Residual 7.32 Number of Observations: 35 Number of Groups: 5 > summary(fm1Oran.nlme) Nonlinear mixed-effects model fit by maximum likelihood Model: circumference ~ SSlogis(age, Asym, xmid, scal) Data: Orange AIC BIC logLik 280 296 -130 Random effects: Formula: list(Asym ~ 1, xmid ~ 1, scal ~ 1) Level: Tree Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym 27.05 Asym xmid xmid 24.25 -0.328 scal 36.60 -0.992 0.443 Residual 7.32 Fixed effects: Asym + xmid + scal ~ 1 Value Std.Error DF t-value p-value Asym 192 14.1 28 13.7 0 xmid 728 34.6 28 21.0 0 scal 357 30.5 28 11.7 0 Correlation: Asym xmid xmid 0.277 scal -0.193 0.665 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.819 -0.522 0.174 0.518 1.645 Number of Observations: 35 Number of Groups: 5 > summary(fm1Oran.nls) Formula: circumference ~ logist(age, Asym, xmid, scal) Parameters: Estimate Std. Error t value Pr(>|t|) Asym 192.7 20.2 9.52 7.5e-11 *** xmid 728.8 107.3 6.79 1.1e-07 *** scal 353.5 81.5 4.34 0.00013 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 23.4 on 32 degrees of freedom Number of iterations to convergence: 5 Achieved convergence tolerance: 4.39e-06 > pairs(fm1Oran.nlme) > fm2Oran.nlme <- update(fm1Oran.nlme, random = Asym ~ 1) > anova(fm1Oran.nlme, fm2Oran.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm1Oran.nlme 1 10 280 296 -130 fm2Oran.nlme 2 5 273 281 -132 1 vs 2 3.19 0.671 > plot(fm1Oran.nlme) > ## level = 0:1 requests fixed (0) and within-group (1) predictions > plot(augPred(fm2Oran.nlme, level = 0:1), + layout = c(5,1)) > qqnorm(fm2Oran.nlme, abline = c(0,1)) > (fm1Theo.nlme <- nlme(fm1Theo.lis)) Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 2, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'! Nonlinear mixed-effects model fit by maximum likelihood Model: conc ~ SSfol(Dose, Time, lKe, lKa, lCl) Data: Theoph Log-likelihood: -173 Fixed: list(lKe ~ 1, lKa ~ 1, lCl ~ 1) lKe lKa lCl -2.433 0.451 -3.214 Random effects: Formula: list(lKe ~ 1, lKa ~ 1, lCl ~ 1) Level: Subject Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr lKe 0.131 lKe lKa lKa 0.638 0.012 lCl 0.251 0.995 -0.089 Residual 0.682 Number of Observations: 132 Number of Groups: 12 > ## IGNORE_RDIFF_BEGIN > try( intervals(fm1Theo.nlme, which="var-cov") ) ## could fail: Non-positive definite... Approximate 95% confidence intervals Random Effects: Level: Subject lower est. upper sd(lKe) 0.0574 0.1310 0.299 sd(lKa) 0.3845 0.6378 1.058 sd(lCl) 0.1557 0.2512 0.405 cor(lKe,lKa) -0.9302 0.0116 0.933 cor(lKe,lCl) -0.9950 0.9948 1.000 cor(lKa,lCl) -0.7711 -0.0892 0.688 Within-group standard error: lower est. upper 0.596 0.682 0.780 > ## IGNORE_RDIFF_END > (fm2Theo.nlme <- update(fm1Theo.nlme, + random = pdDiag(lKe + lKa + lCl ~ 1))) Nonlinear mixed-effects model fit by maximum likelihood Model: conc ~ SSfol(Dose, Time, lKe, lKa, lCl) Data: Theoph Log-likelihood: -177 Fixed: list(lKe ~ 1, lKa ~ 1, lCl ~ 1) lKe lKa lCl -2.455 0.466 -3.227 Random effects: Formula: list(lKe ~ 1, lKa ~ 1, lCl ~ 1) Level: Subject Structure: Diagonal lKe lKa lCl Residual StdDev: 1.93e-05 0.644 0.167 0.709 Number of Observations: 132 Number of Groups: 12 > fm3Theo.nlme <- + update(fm2Theo.nlme, random = pdDiag(lKa + lCl ~ 1)) > anova(fm1Theo.nlme, fm3Theo.nlme, fm2Theo.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm1Theo.nlme 1 10 367 395 -173 fm3Theo.nlme 2 6 366 383 -177 1 vs 2 7.4 0.116 fm2Theo.nlme 3 7 368 388 -177 2 vs 3 0.0 0.949 > plot(fm3Theo.nlme) > qqnorm(fm3Theo.nlme, ~ ranef(.)) > CO2 Grouped Data: uptake ~ conc | Plant Plant Type Treatment conc uptake 1 Qn1 Quebec nonchilled 95 16.0 2 Qn1 Quebec nonchilled 175 30.4 3 Qn1 Quebec nonchilled 250 34.8 4 Qn1 Quebec nonchilled 350 37.2 5 Qn1 Quebec nonchilled 500 35.3 6 Qn1 Quebec nonchilled 675 39.2 7 Qn1 Quebec nonchilled 1000 39.7 8 Qn2 Quebec nonchilled 95 13.6 9 Qn2 Quebec nonchilled 175 27.3 10 Qn2 Quebec nonchilled 250 37.1 11 Qn2 Quebec nonchilled 350 41.8 12 Qn2 Quebec nonchilled 500 40.6 13 Qn2 Quebec nonchilled 675 41.4 14 Qn2 Quebec nonchilled 1000 44.3 15 Qn3 Quebec nonchilled 95 16.2 16 Qn3 Quebec nonchilled 175 32.4 17 Qn3 Quebec nonchilled 250 40.3 18 Qn3 Quebec nonchilled 350 42.1 19 Qn3 Quebec nonchilled 500 42.9 20 Qn3 Quebec nonchilled 675 43.9 21 Qn3 Quebec nonchilled 1000 45.5 22 Qc1 Quebec chilled 95 14.2 23 Qc1 Quebec chilled 175 24.1 24 Qc1 Quebec chilled 250 30.3 25 Qc1 Quebec chilled 350 34.6 26 Qc1 Quebec chilled 500 32.5 27 Qc1 Quebec chilled 675 35.4 28 Qc1 Quebec chilled 1000 38.7 29 Qc2 Quebec chilled 95 9.3 30 Qc2 Quebec chilled 175 27.3 31 Qc2 Quebec chilled 250 35.0 32 Qc2 Quebec chilled 350 38.8 33 Qc2 Quebec chilled 500 38.6 34 Qc2 Quebec chilled 675 37.5 35 Qc2 Quebec chilled 1000 42.4 36 Qc3 Quebec chilled 95 15.1 37 Qc3 Quebec chilled 175 21.0 38 Qc3 Quebec chilled 250 38.1 39 Qc3 Quebec chilled 350 34.0 40 Qc3 Quebec chilled 500 38.9 41 Qc3 Quebec chilled 675 39.6 42 Qc3 Quebec chilled 1000 41.4 43 Mn1 Mississippi nonchilled 95 10.6 44 Mn1 Mississippi nonchilled 175 19.2 45 Mn1 Mississippi nonchilled 250 26.2 46 Mn1 Mississippi nonchilled 350 30.0 47 Mn1 Mississippi nonchilled 500 30.9 48 Mn1 Mississippi nonchilled 675 32.4 49 Mn1 Mississippi nonchilled 1000 35.5 50 Mn2 Mississippi nonchilled 95 12.0 51 Mn2 Mississippi nonchilled 175 22.0 52 Mn2 Mississippi nonchilled 250 30.6 53 Mn2 Mississippi nonchilled 350 31.8 54 Mn2 Mississippi nonchilled 500 32.4 55 Mn2 Mississippi nonchilled 675 31.1 56 Mn2 Mississippi nonchilled 1000 31.5 57 Mn3 Mississippi nonchilled 95 11.3 58 Mn3 Mississippi nonchilled 175 19.4 59 Mn3 Mississippi nonchilled 250 25.8 60 Mn3 Mississippi nonchilled 350 27.9 61 Mn3 Mississippi nonchilled 500 28.5 62 Mn3 Mississippi nonchilled 675 28.1 63 Mn3 Mississippi nonchilled 1000 27.8 64 Mc1 Mississippi chilled 95 10.5 65 Mc1 Mississippi chilled 175 14.9 66 Mc1 Mississippi chilled 250 18.1 67 Mc1 Mississippi chilled 350 18.9 68 Mc1 Mississippi chilled 500 19.5 69 Mc1 Mississippi chilled 675 22.2 70 Mc1 Mississippi chilled 1000 21.9 71 Mc2 Mississippi chilled 95 7.7 72 Mc2 Mississippi chilled 175 11.4 73 Mc2 Mississippi chilled 250 12.3 74 Mc2 Mississippi chilled 350 13.0 75 Mc2 Mississippi chilled 500 12.5 76 Mc2 Mississippi chilled 675 13.7 77 Mc2 Mississippi chilled 1000 14.4 78 Mc3 Mississippi chilled 95 10.6 79 Mc3 Mississippi chilled 175 18.0 80 Mc3 Mississippi chilled 250 17.9 81 Mc3 Mississippi chilled 350 17.9 82 Mc3 Mississippi chilled 500 17.9 83 Mc3 Mississippi chilled 675 18.9 84 Mc3 Mississippi chilled 1000 19.9 > plot(CO2, outer = ~Treatment*Type, layout = c(4,1)) > (fm1CO2.lis <- nlsList(SSasympOff, CO2)) Call: Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) | Plant Data: CO2 Coefficients: Asym lrc c0 Qn1 38.1 -4.38 51.2 Qn2 42.9 -4.67 55.9 Qn3 44.2 -4.49 54.6 Qc1 36.4 -4.86 31.1 Qc3 40.7 -4.95 35.1 Qc2 39.8 -4.46 72.1 Mn3 28.5 -4.59 47.0 Mn2 32.1 -4.47 56.0 Mn1 34.1 -5.06 36.4 Mc2 13.6 -4.56 13.1 Mc3 18.5 -3.47 67.8 Mc1 21.8 -5.14 -20.4 Degrees of freedom: 84 total; 48 residual Residual standard error: 1.8 > ## IGNORE_RDIFF_BEGIN > (fm1CO2.nlme <- nlme(fm1CO2.lis)) Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'! Nonlinear mixed-effects model fit by maximum likelihood Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) Data: CO2 Log-likelihood: -201 Fixed: list(Asym ~ 1, lrc ~ 1, c0 ~ 1) Asym lrc c0 32.47 -4.64 43.55 Random effects: Formula: list(Asym ~ 1, lrc ~ 1, c0 ~ 1) Level: Plant Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym 9.51 Asym lrc lrc 0.13 -0.165 c0 10.33 0.999 -0.133 Residual 1.77 Number of Observations: 84 Number of Groups: 12 > ## IGNORE_RDIFF_END > (fm2CO2.nlme <- update(fm1CO2.nlme, random = Asym + lrc ~ 1)) Nonlinear mixed-effects model fit by maximum likelihood Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) Data: CO2 Log-likelihood: -203 Fixed: list(Asym ~ 1, lrc ~ 1, c0 ~ 1) Asym lrc c0 32.41 -4.56 49.34 Random effects: Formula: list(Asym ~ 1, lrc ~ 1) Level: Plant Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym 9.66 Asym lrc 0.20 -0.777 Residual 1.81 Number of Observations: 84 Number of Groups: 12 > anova(fm1CO2.nlme, fm2CO2.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm1CO2.nlme 1 10 423 447 -201 fm2CO2.nlme 2 7 420 437 -203 1 vs 2 2.9 0.408 > plot(fm2CO2.nlme,id = 0.05,cex = 0.8,adj = -0.5) > fm2CO2.nlmeRE <- ranef(fm2CO2.nlme, augFrame = TRUE) > fm2CO2.nlmeRE Asym lrc Type Treatment conc uptake Qn1 6.172 0.04836 Quebec nonchilled 435 33.2 Qn2 10.533 -0.17284 Quebec nonchilled 435 35.2 Qn3 12.218 -0.05799 Quebec nonchilled 435 37.6 Qc1 3.352 -0.07559 Quebec chilled 435 30.0 Qc3 7.474 -0.19242 Quebec chilled 435 32.6 Qc2 7.928 -0.18032 Quebec chilled 435 32.7 Mn3 -4.073 0.03345 Mississippi nonchilled 435 24.1 Mn2 -0.142 0.00565 Mississippi nonchilled 435 27.3 Mn1 0.241 -0.19386 Mississippi nonchilled 435 26.4 Mc2 -18.799 0.31937 Mississippi chilled 435 12.1 Mc3 -13.117 0.29943 Mississippi chilled 435 17.3 Mc1 -11.787 0.16676 Mississippi chilled 435 18.0 > class(fm2CO2.nlmeRE) [1] "ranef.lme" "data.frame" > plot(fm2CO2.nlmeRE, form = ~ Type * Treatment) > contrasts(CO2$Type) [,1] Quebec -1 Mississippi 1 > contrasts(CO2$Treatment) [,1] nonchilled -1 chilled 1 > fm3CO2.nlme <- update(fm2CO2.nlme, + fixed = list(Asym ~ Type * Treatment, lrc + c0 ~ 1), + start = c(32.412, 0, 0, 0, -4.5603, 49.344)) > summary(fm3CO2.nlme) Nonlinear mixed-effects model fit by maximum likelihood Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) Data: CO2 AIC BIC logLik 394 418 -187 Random effects: Formula: list(Asym ~ 1, lrc ~ 1) Level: Plant Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym.(Intercept) 2.930 As.(I) lrc 0.164 -0.906 Residual 1.850 Fixed effects: list(Asym ~ Type * Treatment, lrc + c0 ~ 1) Value Std.Error DF t-value p-value Asym.(Intercept) 32.4 0.94 67 34.7 0.0000 Asym.Type1 -7.1 0.60 67 -11.9 0.0000 Asym.Treatment1 -3.8 0.59 67 -6.5 0.0000 Asym.Type1:Treatment1 -1.2 0.59 67 -2.0 0.0462 lrc -4.6 0.08 67 -54.1 0.0000 c0 49.5 4.46 67 11.1 0.0000 Correlation: As.(I) Asym.Ty1 Asym.Tr1 A.T1:T lrc Asym.Type1 -0.044 Asym.Treatment1 -0.021 0.151 Asym.Type1:Treatment1 -0.023 0.161 0.225 lrc -0.660 0.202 0.113 0.132 c0 -0.113 0.060 0.018 0.063 0.653 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.8929 -0.4616 -0.0328 0.5208 2.8877 Number of Observations: 84 Number of Groups: 12 > anova(fm3CO2.nlme, Terms = 2:4) F-test for: Asym.Type, Asym.Treatment, Asym.Type:Treatment numDF denDF F-value p-value 1 3 67 54.8 <.0001 > fm3CO2.nlmeRE <- ranef(fm3CO2.nlme, aug = TRUE) > plot(fm3CO2.nlmeRE, form = ~ Type * Treatment) > fm3CO2.fix <- fixef(fm3CO2.nlme) > fm4CO2.nlme <- update(fm3CO2.nlme, + fixed = list(Asym + lrc ~ Type * Treatment, c0 ~ 1), + start = c(fm3CO2.fix[1:5], 0, 0, 0, fm3CO2.fix[6])) Warning in (function (model, data = sys.frame(sys.parent()), fixed, random, : Iteration 1, LME step: nlminb() did not converge (code = 1). Do increase 'msMaxIter'! > ## IGNORE_RDIFF_BEGIN > summary(fm4CO2.nlme) Nonlinear mixed-effects model fit by maximum likelihood Model: uptake ~ SSasympOff(conc, Asym, lrc, c0) Data: CO2 AIC BIC logLik 388 420 -181 Random effects: Formula: list(Asym ~ 1, lrc ~ 1) Level: Plant Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr Asym.(Intercept) 2.3496 As.(I) lrc.(Intercept) 0.0796 -0.92 Residual 1.7920 Fixed effects: list(Asym + lrc ~ Type * Treatment, c0 ~ 1) Value Std.Error DF t-value p-value Asym.(Intercept) 32.3 0.78 64 41.2 0.0000 Asym.Type1 -8.0 0.78 64 -10.3 0.0000 Asym.Treatment1 -4.2 0.78 64 -5.4 0.0000 Asym.Type1:Treatment1 -2.7 0.78 64 -3.5 0.0008 lrc.(Intercept) -4.5 0.08 64 -55.7 0.0000 lrc.Type1 0.1 0.06 64 2.4 0.0185 lrc.Treatment1 0.1 0.06 64 1.8 0.0746 lrc.Type1:Treatment1 0.2 0.06 64 3.3 0.0014 c0 50.5 4.36 64 11.6 0.0000 Correlation: As.(I) Asym.Ty1 Asym.Tr1 A.T1:T lr.(I) Asym.Type1 -0.017 Asym.Treatment1 -0.010 -0.017 Asym.Type1:Treatment1 -0.020 -0.006 -0.011 lrc.(Intercept) -0.471 0.004 0.001 0.009 lrc.Type1 -0.048 -0.548 -0.005 -0.018 0.402 lrc.Treatment1 -0.031 -0.004 -0.551 -0.033 0.322 lrc.Type1:Treatment1 -0.026 -0.015 -0.032 -0.547 0.351 c0 -0.133 0.038 0.020 0.019 0.735 lrc.Ty1 lrc.Tr1 l.T1:T Asym.Type1 Asym.Treatment1 Asym.Type1:Treatment1 lrc.(Intercept) lrc.Type1 lrc.Treatment1 0.375 lrc.Type1:Treatment1 0.395 0.487 c0 0.104 0.083 0.140 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.8621 -0.4944 -0.0422 0.5661 3.0405 Number of Observations: 84 Number of Groups: 12 > ## IGNORE_RDIFF_END > fm5CO2.nlme <- update(fm4CO2.nlme, random = Asym ~ 1) > anova(fm4CO2.nlme, fm5CO2.nlme) Model df AIC BIC logLik Test L.Ratio p-value fm4CO2.nlme 1 13 388 420 -181 fm5CO2.nlme 2 11 387 414 -182 1 vs 2 2.64 0.268 > CO2$type <- 2 * (as.integer(CO2$Type) - 1.5) > CO2$treatment <- 2 * (as.integer(CO2$Treatment) - 1.5) > fm1CO2.nls <- nls(uptake ~ SSasympOff(conc, Asym.Intercept + + Asym.Type * type + Asym.Treatment * treatment + + Asym.TypeTreatment * type * treatment, lrc.Intercept + + lrc.Type * type + lrc.Treatment * treatment + + lrc.TypeTreatment * type * treatment, c0), data = CO2, + start = c(Asym.Intercept = 32.371, Asym.Type = -8.0086, + Asym.Treatment = -4.2001, Asym.TypeTreatment = -2.7253, + lrc.Intercept = -4.5267, lrc.Type = 0.13112, + lrc.Treatment = 0.093928, lrc.TypeTreatment = 0.17941, + c0 = 50.126)) > anova(fm5CO2.nlme, fm1CO2.nls) Model df AIC BIC logLik Test L.Ratio p-value fm5CO2.nlme 1 11 387 414 -182 fm1CO2.nls 2 10 418 443 -199 1 vs 2 33.3 <.0001 > # plot(augPred(fm5CO2.nlme, level = 0:1), ## FIXME: problem with levels > # layout = c(6,2)) ## Actually a problem with contrasts. > ## This fit just ping-pongs. > #fm1Quin.nlme <- > # nlme(conc ~ quinModel(Subject, time, conc, dose, interval, > # lV, lKa, lCl), > # data = Quinidine, fixed = lV + lKa + lCl ~ 1, > # random = pdDiag(lV + lCl ~ 1), groups = ~ Subject, > # start = list(fixed = c(5, -0.3, 2)), > # na.action = NULL, naPattern = ~ !is.na(conc), verbose = TRUE) > #fm1Quin.nlme > #fm1Quin.nlmeRE <- ranef(fm1Quin.nlme, aug = TRUE) > #fm1Quin.nlmeRE[1:3,] > # plot(fm1Quin.nlmeRE, form = lCl ~ Age + Smoke + Ethanol + ## FIXME: problem in max > # Weight + Race + Height + glyco + Creatinine + Heart, > # control = list(cex.axis = 0.7)) > #fm1Quin.fix <- fixef(fm1Quin.nlme) > #fm2Quin.nlme <- update(fm1Quin.nlme, > # fixed = list(lCl ~ glyco, lKa + lV ~ 1), > # start = c(fm1Quin.fix[3], 0, fm1Quin.fix[2:1])) > fm2Quin.nlme <- + nlme(conc ~ quinModel(Subject, time, conc, dose, interval, + lV, lKa, lCl), + data = Quinidine, fixed = list(lCl ~ glyco, lV + lKa ~ 1), + random = pdDiag(diag(c(0.3,0.3)), form = lV + lCl ~ 1), + groups = ~ Subject, + start = list(fixed = c(2.5, 0, 5.4, -0.2)), + na.action = NULL, naPattern = ~ !is.na(conc)) > summary(fm2Quin.nlme) # wrong values Nonlinear mixed-effects model fit by maximum likelihood Model: conc ~ quinModel(Subject, time, conc, dose, interval, lV, lKa, lCl) Data: Quinidine AIC BIC logLik 892 919 -439 Random effects: Formula: list(lV ~ 1, lCl ~ 1) Level: Subject Structure: Diagonal lV lCl.(Intercept) Residual StdDev: 0.000263 0.271 0.651 Fixed effects: list(lCl ~ glyco, lV + lKa ~ 1) Value Std.Error DF t-value p-value lCl.(Intercept) 3.12 0.0655 222 47.7 0.000 lCl.glyco -0.50 0.0428 222 -11.7 0.000 lV 5.27 0.0948 222 55.6 0.000 lKa -0.84 0.3039 222 -2.8 0.006 Correlation: lC.(I) lCl.gl lV lCl.glyco -0.880 lV -0.072 0.027 lKa -0.272 0.149 0.538 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.5458 -0.5342 -0.0221 0.5053 3.5016 Number of Observations: 361 Number of Groups: 136 > options(contrasts = c("contr.treatment", "contr.poly")) > fm2Quin.fix <- fixef(fm2Quin.nlme) > ## subsequent fits don't work > #fm3Quin.nlme <- update(fm2Quin.nlme, > # fixed = list(lCl ~ glyco + Creatinine, lKa + lV ~ 1), > # start = c(fm2Quin.fix[1:2], 0.2, fm2Quin.fix[3:4])) > #summary(fm3Quin.nlme) > #fm3Quin.fix <- fixef(fm3Quin.nlme) > #fm4Quin.nlme <- update(fm3Quin.nlme, > # fixed = list(lCl ~ glyco + Creatinine + Weight, lKa + lV ~ 1), > # start = c(fm3Quin.fix[1:3], 0, fm3Quin.fix[4:5])) > #summary(fm4Quin.nlme) > ## This fit just ping-pongs > ##fm1Wafer.nlmeR <- > ## nlme(current ~ A + B * cos(4.5679 * voltage) + > ## C * sin(4.5679 * voltage), data = Wafer, > ## fixed = list(A ~ voltage + I(voltage^2), B + C ~ 1), > ## random = list(Wafer = A ~ voltage + I(voltage^2), > ## Site = pdBlocked(list(A~1, A~voltage+I(voltage^2)-1))), > ### start = fixef(fm4Wafer), method = "REML", control = list(tolerance=1e-2)) > ## start = c(-4.255, 5.622, 1.258, -0.09555, 0.10434), > ## method = "REML", control = list(tolerance = 1e-2)) > ##fm1Wafer.nlmeR > ##fm1Wafer.nlme <- update(fm1Wafer.nlmeR, method = "ML") > > (fm2Wafer.nlme <- + nlme(current ~ A + B * cos(w * voltage + pi/4), + data = Wafer, + fixed = list(A ~ voltage + I(voltage^2), B + w ~ 1), + random = list(Wafer = pdDiag(list(A ~ voltage + I(voltage^2), B + w ~ 1)), + Site = pdDiag(list(A ~ voltage+I(voltage^2), B ~ 1))), + start = c(-4.255, 5.622, 1.258, -0.09555, 4.5679))) Nonlinear mixed-effects model fit by maximum likelihood Model: current ~ A + B * cos(w * voltage + pi/4) Data: Wafer Log-likelihood: 663 Fixed: list(A ~ voltage + I(voltage^2), B + w ~ 1) A.(Intercept) A.voltage A.I(voltage^2) B -4.265 5.633 1.256 -0.141 w 4.593 Random effects: Formula: list(A ~ voltage + I(voltage^2), B ~ 1, w ~ 1) Level: Wafer Structure: Diagonal A.(Intercept) A.voltage A.I(voltage^2) B w StdDev: 0.127 0.337 0.0488 0.00506 5.44e-05 Formula: list(A ~ voltage + I(voltage^2), B ~ 1) Level: Site %in% Wafer Structure: Diagonal A.(Intercept) A.voltage A.I(voltage^2) B Residual StdDev: 0.0618 0.269 0.0559 4.46e-06 0.00786 Number of Observations: 400 Number of Groups: Wafer Site %in% Wafer 10 80 > plot(fm2Wafer.nlme, resid(.) ~ voltage | Wafer, + panel = function(x, y, ...) { + panel.grid() + panel.xyplot(x, y) + panel.loess(x, y, lty = 2) + panel.abline(0, 0) + }) > ## anova(fm1Wafer.nlme, fm2Wafer.nlme, test = FALSE) > # intervals(fm2Wafer.nlme) > > # 8.3 Extending the Basic nlme Model > > #fm4Theo.nlme <- update(fm3Theo.nlme, > # weights = varConstPower(power = 0.1)) > # this fit is way off > #fm4Theo.nlme > #anova(fm3Theo.nlme, fm4Theo.nlme) > #plot(fm4Theo.nlme) > ## xlim used to hide an unusually high fitted value and enhance > ## visualization of the heteroscedastic pattern > # plot(fm4Quin.nlme, xlim = c(0, 6.2)) > #fm5Quin.nlme <- update(fm4Quin.nlme, weights = varPower()) > #summary(fm5Quin.nlme) > #anova(fm4Quin.nlme, fm5Quin.nlme) > #plot(fm5Quin.nlme, xlim = c(0, 6.2)) > var.nlme <- nlme(follicles ~ A + B * sin(2 * pi * w * Time) + + C * cos(2 * pi * w *Time), data = Ovary, + fixed = A + B + C + w ~ 1, random = pdDiag(A + B + w ~ 1), + # start = c(fixef(fm5Ovar.lme), 1)) + start = c(12.18, -3.298, -0.862, 1)) > ##fm1Ovar.nlme > ##ACF(fm1Ovar.nlme) > ##plot(ACF(fm1Ovar.nlme, maxLag = 10), alpha = 0.05) > ##fm2Ovar.nlme <- update(fm1Ovar.nlme, correlation = corAR1(0.311)) > ##fm3Ovar.nlme <- update(fm1Ovar.nlme, correlation = corARMA(p=0, q=2)) > ##anova(fm2Ovar.nlme, fm3Ovar.nlme, test = FALSE) > ##intervals(fm2Ovar.nlme) > ##fm4Ovar.nlme <- update(fm2Ovar.nlme, random = A ~ 1) > ##anova(fm2Ovar.nlme, fm4Ovar.nlme) > ##if (interactive()) fm5Ovar.nlme <- update(fm4Ovar.nlme, correlation = corARMA(p=1, q=1)) > # anova(fm4Ovar.nlme, fm5Ovar.nlme) > # plot(ACF(fm5Ovar.nlme, maxLag = 10, resType = "n"), > # alpha = 0.05) > # fm5Ovar.lmeML <- update(fm5Ovar.lme, method = "ML") > # intervals(fm5Ovar.lmeML) > # fm6Ovar.lmeML <- update(fm5Ovar.lmeML, random = ~1) > # anova(fm5Ovar.lmeML, fm6Ovar.lmeML) > # anova(fm6Ovar.lmeML, fm5Ovar.nlme) > # intervals(fm5Ovar.nlme, which = "fixed") > fm1Dial.lis <- + nlsList(rate ~ SSasympOff(pressure, Asym, lrc, c0) | QB, + data = Dialyzer) > fm1Dial.lis Call: Model: rate ~ SSasympOff(pressure, Asym, lrc, c0) | QB Data: Dialyzer Coefficients: Asym lrc c0 200 45.0 0.765 0.224 300 62.2 0.253 0.225 Degrees of freedom: 140 total; 134 residual Residual standard error: 3.8 > plot(intervals(fm1Dial.lis)) > fm1Dial.gnls <- gnls(rate ~ SSasympOff(pressure, Asym, lrc, c0), + data = Dialyzer, params = list(Asym + lrc ~ QB, c0 ~ 1), + start = c(53.6, 8.6, 0.51, -0.26, 0.225)) > fm1Dial.gnls Generalized nonlinear least squares fit Model: rate ~ SSasympOff(pressure, Asym, lrc, c0) Data: Dialyzer Log-likelihood: -383 Coefficients: Asym.(Intercept) Asym.QB300 lrc.(Intercept) 44.986 17.240 0.766 lrc.QB300 c0 -0.514 0.224 Degrees of freedom: 140 total; 135 residual Residual standard error: 3.79 > Dialyzer$QBcontr <- 2 * (Dialyzer$QB == 300) - 1 > fm1Dial.nls <- + nls(rate ~ SSasympOff(pressure, Asym.Int + Asym.QB * QBcontr, + lrc.Int + lrc.QB * QBcontr, c0), data = Dialyzer, + start = c(Asym.Int = 53.6, Asym.QB = 8.6, lrc.Int = 0.51, + lrc.QB = -0.26, c0 = 0.225)) > ## IGNORE_RDIFF_BEGIN > summary(fm1Dial.nls) Formula: rate ~ SSasympOff(pressure, Asym.Int + Asym.QB * QBcontr, lrc.Int + lrc.QB * QBcontr, c0) Parameters: Estimate Std. Error t value Pr(>|t|) Asym.Int 53.6065 0.7054 75.99 < 2e-16 *** Asym.QB 8.6201 0.6792 12.69 < 2e-16 *** lrc.Int 0.5087 0.0552 9.21 5.5e-16 *** lrc.QB -0.2568 0.0450 -5.70 7.0e-08 *** c0 0.2245 0.0106 21.13 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.79 on 135 degrees of freedom Number of iterations to convergence: 4 Achieved convergence tolerance: 7.24e-06 > ## IGNORE_RDIFF_END > logLik(fm1Dial.nls) 'log Lik.' -383 (df=6) > plot(fm1Dial.gnls, resid(.) ~ pressure, abline = 0) > fm2Dial.gnls <- update(fm1Dial.gnls, + weights = varPower(form = ~ pressure)) > anova(fm1Dial.gnls, fm2Dial.gnls) Model df AIC BIC logLik Test L.Ratio p-value fm1Dial.gnls 1 6 777 795 -383 fm2Dial.gnls 2 7 748 769 -367 1 vs 2 30.8 <.0001 > ACF(fm2Dial.gnls, form = ~ 1 | Subject) lag ACF 1 0 1.00000 2 1 0.71567 3 2 0.50454 4 3 0.29481 5 4 0.20975 6 5 0.13857 7 6 -0.00202 > plot(ACF(fm2Dial.gnls, form = ~ 1 | Subject), alpha = 0.05) > fm3Dial.gnls <- + update(fm2Dial.gnls, corr = corAR1(0.716, form = ~ 1 | Subject)) > fm3Dial.gnls Generalized nonlinear least squares fit Model: rate ~ SSasympOff(pressure, Asym, lrc, c0) Data: Dialyzer Log-likelihood: -323 Coefficients: Asym.(Intercept) Asym.QB300 lrc.(Intercept) 46.911 16.400 0.542 lrc.QB300 c0 -0.339 0.215 Correlation Structure: AR(1) Formula: ~1 | Subject Parameter estimate(s): Phi 0.744 Variance function: Structure: Power of variance covariate Formula: ~pressure Parameter estimates: power 0.572 Degrees of freedom: 140 total; 135 residual Residual standard error: 3.18 > intervals(fm3Dial.gnls) Approximate 95% confidence intervals Coefficients: lower est. upper Asym.(Intercept) 43.877 46.911 49.945 Asym.QB300 11.633 16.400 21.167 lrc.(Intercept) 0.435 0.542 0.648 lrc.QB300 -0.487 -0.339 -0.192 c0 0.206 0.215 0.223 Correlation structure: lower est. upper Phi 0.622 0.744 0.831 Variance function: lower est. upper power 0.443 0.572 0.702 Residual standard error: lower est. upper 2.59 3.13 3.77 > anova(fm2Dial.gnls, fm3Dial.gnls) Model df AIC BIC logLik Test L.Ratio p-value fm2Dial.gnls 1 7 748 769 -367 fm3Dial.gnls 2 8 661 685 -323 1 vs 2 89.4 <.0001 > # restore two fitted models > fm2Dial.lme <- + lme(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, + Dialyzer, ~ pressure + I(pressure^2), + weights = varPower(form = ~ pressure)) > fm2Dial.lmeML <- update(fm2Dial.lme, method = "ML") > fm3Dial.gls <- + gls(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, + Dialyzer, weights = varPower(form = ~ pressure), + corr = corAR1(0.771, form = ~ 1 | Subject)) > fm3Dial.glsML <- update(fm3Dial.gls, method = "ML") > anova( fm2Dial.lmeML, fm3Dial.glsML, fm3Dial.gnls, test = FALSE) Model df AIC BIC logLik fm2Dial.lmeML 1 18 652 705 -308 fm3Dial.glsML 2 13 648 686 -311 fm3Dial.gnls 3 8 661 685 -323 > # cleanup > > summary(warnings()) No warnings > > proc.time() user system elapsed 61.627 0.112 61.765 nlme/tests/extras/README0000644000176000001440000000044014251721455014571 0ustar ripleyusersThese extra test scripts (and their saved reference outputs) are included during R CMD check via tests/extras.Rin *only if* nlme:::doExtras(). In that case the extras.Rin script copies these extra contents to the parent tests directory where the scripts are found and run by R CMD check. nlme/tests/extras/nlme-stall.R0000644000176000001440000000435514610503740016107 0ustar ripleyusers## Taken from https://stat.ethz.ch/pipermail/r-devel/2018-January/075459.html ## Hung with x86_64 Linux/gcc 7.3 but not i686 Linux nor x86_64 macOS ## in early 2018. Resolved by nlme 3.1-136. ## Optional since it used to hang, on one platform only AFAWK. ## gfortran with -fbounds-check detected a problem on one x86_64 ## Fedora 26 system (but not another) and on one of winbuilder's ## subarchs. dat <- data.frame( x = rep(c(3.69, 3, 2.3, 1.61, 0.92, 0.22, -0.47, -1.86), each=12), y = c(0.35, 0.69, 0.57, 1.48, 6.08, -0.34, 0.53, 1.66, 0.02, 4.4, 8.42, 3.3, 2.32, -2.3, 7.52, -2.12, 3.41, -4.76, 7.9, 5.04,10.26, -1.42, 7.85, -1.88, 3.81, -2.59, 4.32, 5.7, 1.18, -1.74, 1.81, 6.16, 4.2, -0.39, 1.55, -1.4, 1.76, -4.14, -2.36, -0.24, 4.8, -7.07, 1.34, 1.98, 0.86, -3.96, -0.61, 2.68, -1.65, -2.06, 3.67, -0.19, 2.33, 3.78, 2.16, 0.35, -5.6, 1.32, 2.99, 4.21, -0.9, 4.32, -4.01, 2.03, 0.9, -0.74, -5.78, 5.76, 0.52, 1.37, -0.9, -4.06, -0.49, -2.39, -2.67,-0.71, -0.4, 2.55, 0.97, 1.96, 8.13, -5.93, 4.01, 0.79, -5.61, 0.29, 4.92, -2.89, -3.24, -3.06, -0.23, 0.71, 0.75, 4.6, 1.35, -3.35), f.block = rep(1:4, 24), id = factor(paste0("a", rep(c(2,1,3), each = 4)))) dd <- dat set.seed(33) dd$y <- dat$y + rnorm(nrow(dat), mean = 0, sd = 0.1) library(nlme) fpl.B.range <- function(lx,A,B,C,D) A/(1+exp(-B*(lx-C))) + D INIT <- c(A.a1=1, A.a2=0, A.a3=0, B = 1, B.a2=0, B.a3=0, C = 0, C.a2=0, C.a3=0, D = 1, D.a2=0, D.a3=0) ## Typically this will fail with a singularity, but it should not hang. try(nlme(y ~ fpl.B.range(x,A,B,C,D), data = dd, fixed = list(A ~ id, B ~ id, C ~ id, D ~ id), random = list(f.block = pdSymm(A+B+C+D ~ 1)), start = INIT, # control= nlmeControl(## NB: msMaxIter=200, ## gives singularity error at iter.55 # msVerbose=TRUE), #==> passed as 'trace' to nlminb() verbose = TRUE)) -> res ## it stalls, I need to kill the R process ## -- [on lynne Fedora 26 (4.14.11-200.fc26.x86_64), Jan.2018] ## in R 3.4.3 and R 3.4.3 patched with nlme 3.1.131 ## and R-devel with nlme 3.1.135 summary(warnings())# mostly "Singular precision matrix in level -1, block *" nlme/tests/extras/scripts.R0000644000176000001440000000067514251721455015535 0ustar ripleyusers## run reproduction scripts from the NLME book chapters testdir <- system.file("scripts", package = "nlme", mustWork = TRUE) scripts <- dir(testdir, pattern = "^ch[0-9]*\\.R$") for(f in scripts) { writeLines(c("", strrep("=", nchar(f)), basename(f), strrep("=", nchar(f)))) set.seed(3) options(warn = 1) # chapters set digits source(file.path(testdir, f), echo = TRUE, max.deparse.length = Inf, keep.source = TRUE) } nlme/tests/extras/mlbook.R0000644000176000001440000000067214251721455015326 0ustar ripleyusers## run reproduction scripts from the installed "mlbook" chapters testdir <- system.file("mlbook", package = "nlme", mustWork = TRUE) scripts <- dir(testdir, pattern = "^ch[0-9]*\\.R$") for(f in scripts) { writeLines(c("", strrep("=", nchar(f)), basename(f), strrep("=", nchar(f)))) set.seed(1) options(warn = 1, digits = 5) source(file.path(testdir, f), echo = TRUE, max.deparse.length = Inf, keep.source = TRUE) } nlme/tests/extras/mlbook.Rout.save0000644000176000001440000001665514660073244017023 0ustar ripleyusers R Under development (unstable) (2024-08-14 r87014) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## run reproduction scripts from the installed "mlbook" chapters > testdir <- system.file("mlbook", package = "nlme", mustWork = TRUE) > scripts <- dir(testdir, pattern = "^ch[0-9]*\\.R$") > for(f in scripts) { + writeLines(c("", strrep("=", nchar(f)), basename(f), strrep("=", nchar(f)))) + set.seed(1) + options(warn = 1, digits = 5) + source(file.path(testdir, f), echo = TRUE, + max.deparse.length = Inf, keep.source = TRUE) + } ====== ch04.R ====== > library(nlme) > # data(bdf) > ## Fit the null model > ## Compare with Table 4.1, p. 47 > fm1 <- lme(langPOST ~ 1, data = bdf, random = ~ 1 | schoolNR) > VarCorr(fm1) schoolNR = pdLogChol(1) Variance StdDev (Intercept) 19.633 4.4309 Residual 64.564 8.0352 > -2*c(logLik(fm1)) # deviance [1] 16253 > ## Fit model with fixed IQ term and random intercept > ## Compare with Table 4.2, p. 49 > ## From the results in Tables 4.2 and 4.4, it appears that > ## maximum likelihood fits are used, not REML fits. > fm2 <- update(fm1, langPOST ~ IQ.ver.cen) > summary(fm2) Linear mixed-effects model fit by REML Data: bdf AIC BIC logLik 15264 15287 -7627.9 Random effects: Formula: ~1 | schoolNR (Intercept) Residual StdDev: 3.0987 6.4996 Fixed effects: langPOST ~ IQ.ver.cen Value Std.Error DF t-value p-value (Intercept) 40.608 0.308186 2155 131.766 0 IQ.ver.cen 2.488 0.070081 2155 35.496 0 Correlation: (Intr) IQ.ver.cen 0.018 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -4.093938 -0.637456 0.057947 0.706070 3.144829 Number of Observations: 2287 Number of Groups: 131 > VarCorr(fm2) schoolNR = pdLogChol(1) Variance StdDev (Intercept) 9.6017 3.0987 Residual 42.2445 6.4996 > -2 * c(logLik(fm2)) # deviance [1] 15256 > ## Purely fixed-effects model for comparison > ## Compare with Table 4.3, p. 51 > fm3 <- lm(langPOST ~ IQ.ver.cen, data = bdf) > summary(fm3) Call: lm(formula = langPOST ~ IQ.ver.cen, data = bdf) Residuals: Min 1Q Median 3Q Max -28.702 -4.394 0.606 5.260 26.221 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 40.9348 0.1492 274.3 <2e-16 *** IQ.ver.cen 2.6539 0.0722 36.8 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.14 on 2285 degrees of freedom Multiple R-squared: 0.372, Adjusted R-squared: 0.372 F-statistic: 1.35e+03 on 1 and 2285 DF, p-value: <2e-16 > -2 * c(logLik(fm3)) # deviance [1] 15478 > ## Model with average IQ for the school > ## Compare with Table 4.4, p. 55 > fm4 <- update(fm2, langPOST ~ IQ.ver.cen + avg.IQ.ver.cen) > summary(fm4) Linear mixed-effects model fit by REML Data: bdf AIC BIC logLik 15242 15271 -7616.1 Random effects: Formula: ~1 | schoolNR (Intercept) Residual StdDev: 2.8082 6.494 Fixed effects: langPOST ~ IQ.ver.cen + avg.IQ.ver.cen Value Std.Error DF t-value p-value (Intercept) 40.741 0.286595 2155 142.155 0 IQ.ver.cen 2.415 0.071676 2155 33.690 0 avg.IQ.ver.cen 1.589 0.314772 129 5.049 0 Correlation: (Intr) IQ.vr. IQ.ver.cen 0.000 avg.IQ.ver.cen 0.077 -0.228 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -4.130749 -0.642218 0.060944 0.702342 3.152993 Number of Observations: 2287 Number of Groups: 131 > VarCorr(fm4) schoolNR = pdLogChol(1) Variance StdDev (Intercept) 7.8859 2.8082 Residual 42.1723 6.4940 > -2 * c(logLik(fm4)) # deviance [1] 15232 ====== ch05.R ====== > library(nlme) > # data(bdf) > ## Model with random slope for IQ.ver.cen > ## Compare with Table 5.1, p. 71. > fm5 <- lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, + data = bdf, random = ~ IQ.ver.cen, method = "ML") > summary(fm5) Linear mixed-effects model fit by maximum likelihood Data: bdf AIC BIC logLik 15228 15268 -7606.8 Random effects: Formula: ~IQ.ver.cen | schoolNR Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 2.81410 (Intr) IQ.ver.cen 0.44728 -0.652 Residual 6.43043 Fixed effects: langPOST ~ IQ.ver.cen + avg.IQ.ver.cen Value Std.Error DF t-value p-value (Intercept) 40.750 0.28610 2155 142.433 0 IQ.ver.cen 2.459 0.08324 2155 29.541 0 avg.IQ.ver.cen 1.405 0.32168 129 4.368 0 Correlation: (Intr) IQ.vr. IQ.ver.cen -0.274 avg.IQ.ver.cen 0.028 -0.214 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -4.17512 -0.63982 0.06693 0.70462 2.71089 Number of Observations: 2287 Number of Groups: 131 > VarCorr(fm5) schoolNR = pdLogChol(IQ.ver.cen) Variance StdDev Corr (Intercept) 7.91916 2.81410 (Intr) IQ.ver.cen 0.20006 0.44728 -0.652 Residual 41.35049 6.43043 > -2 * c(logLik(fm5)) # deviance [1] 15214 > ## Add centered class size and interaction > ## Compare with Table 5.2, p. 75 > fm6 <- update(fm5, langPOST ~ avg.IQ.ver.cen + IQ.ver.cen * grpSiz.cen) > summary(fm6) Linear mixed-effects model fit by maximum likelihood Data: bdf AIC BIC logLik 15226 15278 -7604.2 Random effects: Formula: ~IQ.ver.cen | schoolNR Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 2.76882 (Intr) IQ.ver.cen 0.42132 -0.658 Residual 6.43136 Fixed effects: langPOST ~ avg.IQ.ver.cen + IQ.ver.cen + grpSiz.cen + IQ.ver.cen:grpSiz.cen Value Std.Error DF t-value p-value (Intercept) 40.893 0.29249 2153 139.809 0.0000 avg.IQ.ver.cen 1.246 0.32642 129 3.818 0.0002 IQ.ver.cen 2.443 0.08233 2153 29.674 0.0000 grpSiz.cen 0.057 0.03691 2153 1.556 0.1198 IQ.ver.cen:grpSiz.cen -0.022 0.01091 2153 -1.989 0.0468 Correlation: (Intr) a.IQ.. IQ.vr. grpSz. avg.IQ.ver.cen -0.024 IQ.ver.cen -0.276 -0.195 grpSiz.cen 0.249 -0.175 -0.086 IQ.ver.cen:grpSiz.cen -0.118 0.169 0.032 -0.233 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -4.163071 -0.639694 0.063419 0.710478 2.687724 Number of Observations: 2287 Number of Groups: 131 > VarCorr(fm6) schoolNR = pdLogChol(IQ.ver.cen) Variance StdDev Corr (Intercept) 7.66639 2.76882 (Intr) IQ.ver.cen 0.17751 0.42132 -0.658 Residual 41.36242 6.43136 > -2 * c(logLik(fm6)) # deviance [1] 15208 > > proc.time() user system elapsed 0.846 1.606 0.491 nlme/tests/anova.gls.R0000644000176000001440000000417214251721455014424 0ustar ripleyusers## Example of scoping problem. ## Originally from a report by Markus Jantti: ## https://stat.ethz.ch/pipermail/r-help/2005-November/081382.html library(nlme) data(Ovary) ## stolen from example(anova.gls) # AR(1) errors within each Mare ## tolerance increased for flang (was 6e-6) fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) int1 <- intervals(fm1) ## no longer print attr(,"label"), PR#18196 : writeLines(intOut <- capture.output(int1)) stopifnot({ length(grep(',"label"', intOut, fixed=TRUE)) == 0 all.equal(int1$corStruct["Phi",], c(lower=0.66842829, est.=0.753207889, upper=0.81866619), tol = 1e-5)# 7e-6 needed for flan all.equal(as.vector(int1$sigma), c(3.9747061, 4.61617157, 5.361161), tol = 1e-5) }) # variance changes with a power of the absolute fitted values? fm2 <- update(fm1, weights = varPower()) (a12 <- anova(fm1, fm2)) stopifnot(identical(a12, anova(fm1, fm2, type = "seq")))# latter had failed ## now define a little function dummy <- function(obj) anova(obj[[1]], obj[[2]]) (d12 <- dummy(list(fm1, fm2))) ## last failed < 3.1-66 rownames(d12) <- rownames(a12) stopifnot(all.equal(a12, d12, tol = 1e-15), all.equal(a12[2,"p-value"], 0.111752516, tol = 1e-5) ) ## PR#13567 fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont, correlation = corSymm(form = ~ 1 | Subject), weights = varIdent(form = ~ 1 | age)) (aOr <- anova(fm1Orth.gls, Terms = "Sex")) stopifnot(all.equal(aOr[,"F-value"], 9.4030752449, aOr[,"p-value"], 0.0027608643857)) ## anova.gls(.) -- REML & ML (a1 <- anova(fm1)) (a1m <- anova(fm1, type="marginal")) ## fm1M <- update(fm1, method = "ML") (a1M <- anova(fm1M)) (a1Mm <- anova(fm1M, type = "marginal")) stopifnot( all.equal(a1M[,"F-value"], c(378.774471, 19.1105834, 1.71334909), tolerance = 1e-7) , all.equal(summary(fm1M)$tTable[,"t-value"] ^ 2, as.matrix(a1Mm)[,"F-value"], tolerance = 1e-14) , all.equal(summary(fm1 )$tTable[,"t-value"] ^ 2, as.matrix(a1m )[,"F-value"], tolerance = 1e-14) ) nlme/tests/nlme.R0000644000176000001440000001016314660073244013464 0ustar ripleyuserslibrary(nlme) ## from example(nlme.nlsList) fm1 <- nlsList(SSasymp, Loblolly) fm1 stopifnot( all.equal(as.matrix(coef(fm1)), array(c(94.1282, 94.9406, 89.8849, 110.699, 111.003, 109.986, 101.056, 127.134, 101.087, 95.6669, 95.5563, 113.514, 105.718, 99.1719, -8.25075, -7.75749, -8.75902, -8.16943, -8.46261, -8.55854, -8.44363, -7.67936, -8.50234, -9.07824, -9.66503, -7.59562, -8.90608, -9.91665, -3.21758, -3.22932, -3.08622, -3.39034, -3.39757, -3.36252, -3.23282, -3.57533, -3.21402, -3.11638, -3.09227, -3.35282, -3.22296, -3.08484), dim = c(14L, 3L), dimnames = list(c("329", "327", "325", "307", "331", "311", "315", "321", "319", "301", "323", "309", "303", "305"), c("Asym", "R0", "lrc"))), tol = 1e-5) , all.equal(pooledSD(fm1), structure(0.70039649, df = 42), tol = 1e-5) , 84 == sum(lengths(lapply(fm1, fitted))) # total deg.freedom ) ## confint(): if (getRversion() >= "4.4.0" || # confint.nls() taken from MASS (requireNamespace("MASS") && packageVersion("MASS") < "7.3-60.1")) { system.time(cnL1 <- confint(fm1)) # 0.4 sec stopifnot(exprs = { is.list(cnL1) identical(names(cnL1), names(fm1)) vapply(cnL1, is.matrix, NA) vapply(cnL1, dim, c(NA,0L)) == 3:2 identical(unname(sapply(cnL1, dim)), matrix(3:2, 2, length(fm1))) sapply(cnL1, is.finite) }) } ## build a random-effects model from the stratified nls fits fm2 <- nlme(fm1, random = Asym ~ 1) fm2 stopifnot( all.equal(fixef(fm2), c(Asym = 101.4483, R0 = -8.6274937, lrc = -3.2337304), tol = 4e-7) , all.equal(logLik(fm2), structure(-114.743, class = "logLik", nall = 84, nobs = 84, df = 5), tol = 4e-6) , all.equal(sigma(fm2), 0.71886244, tol = 1e-6) ) pm2.0 <- predict(fm2, Loblolly, level=0)## failed in nlme 3.1-123 stopifnot(all.equal(head(pm2.0), c(3.64694, 11.0597, 27.2258, 40.5006, 51.4012, 60.3522), tol = 1e-5)) # 4e-7 {64b nb-mm4} ## same as fm2 but fitted via nlme's formula interface fm3 <- nlme(height ~ SSasymp(age, Asym, R0, lrc), data = Loblolly, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1, groups = ~Seed) ## explicitly specifying 'groups' failed in 3.1-153 with ## Error in nlme::nlsList(model = height ~ SSasymp(age, Asym, R0, lrc), data = Loblolly, : ## unused argument (groups = ~Seed) fm2$origCall <- NULL stopifnot(all.equal(fm2, fm3)) ## reproduce a simple random-intercept lme() using nlme() BW1 <- subset(BodyWeight, Diet == 1, -Diet) fm1BW.lme <- lme(weight ~ 1, data = BW1, random = ~ 1 | Rat, method = "ML") fm1BW.nlme <- nlme(weight ~ b0, fixed = b0 ~ 1, random = b0 ~ 1 | Rat, data = BW1, start = fixef(fm1BW.lme), method = "ML") stopifnot(exprs = { all.equal(logLik(fm1BW.lme), logLik(fm1BW.nlme)) all.equal(fixef(fm1BW.lme), fixef(fm1BW.nlme), check.names = FALSE) all.equal(ranef(fm1BW.lme), ranef(fm1BW.nlme), check.attributes = FALSE) all.equal(as.numeric(VarCorr(fm1BW.lme)), as.numeric(VarCorr(fm1BW.nlme))) }) ## now the same with an additional spatial correlation structure (PR#18192) fm2BW.lme <- update(fm1BW.lme, correlation = corExp(form = ~ Time)) fm2BW.nlme <- try(update(fm1BW.nlme, correlation = corExp(form = ~ Time))) ## nlme() <= 3.1-166 would sometimes crash with varying memory errors, e.g.: ## segfault, possibly also reporting many "*** recursive gc invocation", ## or crash with "corrupted size vs. prev_size" or "double free or corruption (!prev)" if (!inherits(fm2BW.nlme, "try-error")) # may not have converged (seen on Apple M1) stopifnot(exprs = { all.equal(logLik(fm2BW.lme), logLik(fm2BW.nlme)) all.equal(fixef(fm2BW.lme), fixef(fm2BW.nlme), check.names = FALSE) all.equal(ranef(fm2BW.lme), ranef(fm2BW.nlme), check.attributes = FALSE, tolerance = 1e-5) # seen 4e-05 all.equal(as.numeric(VarCorr(fm1BW.lme)), as.numeric(VarCorr(fm1BW.nlme))) }) nlme/tests/getVarCov.R0000644000176000001440000000364414611757132014440 0ustar ripleyusers## PR#16744: ordering of variance weights (failed in nlme <= 3.1-149) library("nlme") fm3 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare), weights = ~as.integer(as.character(Mare))) # fixed variance weights stopifnot( identical( getVarCov(fm3, individual = 3), getVarCov(fm3, individual = levels(Ovary$Mare)[3]) ), all.equal( vapply(as.character(1:11), function (id) getVarCov(fm3, individual = id)[1,1], 0, USE.NAMES = FALSE), fm3$sigma^2 * (1:11) ) ) ## lme method had a similar issue for data not ordered by levels(group) ## is.unsorted(Orthodont$Subject) # TRUE fm4 <- lme(distance ~ age, Orthodont, weights = ~as.integer(Subject)) covmats <- getVarCov(fm4, individuals = levels(Orthodont$Subject), type = "conditional") stopifnot( all.equal( vapply(covmats, "[", 0, 1, 1), fm4$sigma^2 * seq_len(nlevels(Orthodont$Subject)), check.attributes = FALSE ) ) ## PR#16806: 1-observation groups in corSpatial fits (failed in nlme <= 3.1-164) data("Phenobarb") pheno <- subset(Phenobarb, !is.na(conc)) stopifnot(sum(getGroups(pheno) == "28") == 1) # Subject 28 has only 1 obs. lme1 <- lme(conc ~ time, data = pheno, random = ~1 | Subject, correlation = corExp(form = ~time | Subject)) condVarCov <- getVarCov(lme1, type = "conditional", individuals = "28") ## gave Error in dimnames(cond.var) <- list(1:nrow(cond.var), 1:ncol(cond.var)) : ## length of 'dimnames' [2] not equal to array extent stopifnot(all.equal(unname(diag(condVarCov[[1]])), lme1$sigma^2)) ## same for gls(): gls1 <- gls(conc ~ time, data = pheno, correlation = corExp(form = ~time | Subject)) margVarCov <- getVarCov(gls1, individual = "28") ## gave Error in rep(1, nrow(S)) : invalid 'times' argument stopifnot(all.equal(diag(margVarCov), gls1$sigma^2)) nlme/tests/missing.R0000644000176000001440000000132414251721455014201 0ustar ripleyuserslibrary(nlme) op <- options(digits = 3) # reduce rounding differences Ovary[c(1,272), 2] <- NA fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare), na.action=na.exclude) fitted(fm1) residuals(fm1) summary(fm1) Orthodont[100:102, 2] <- NA fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1, na.action=na.exclude) fitted(fm2, 0:1) fitted(fm2) residuals(fm2, 0:1) round(residuals(fm2), 2) summary(fm2) Soybean[1:5, "Time"] <- NA fm3 <- gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean, weights = varPower(), na.action=na.exclude) fitted(fm3) residuals(fm3) summary(fm3) options(op)# revert when this file is source()d nlme/MD50000644000176000001440000005525414772475235011600 0ustar ripleyusersb20ea21a815095a144e5a06c325e9bd9 *ChangeLog 534e7130af2b692ff9ad31a303426bec *DESCRIPTION 398eb829c5b09bf5b661094916d897e4 *LICENSE.note 5df894793407c151274dc06fb016c138 *NAMESPACE af82a6b780b7157da96d3e996fa2b949 *R/VarCorr.R 13bb8863af73e694424101586c2852d5 *R/VarCov.R bb90e652b48175d6df178bbe55f4e71f *R/corStruct.R c8529cbb1f83be7793cd8769c3d7410c *R/gls.R c0bf1258193153b9f5cfe639485aa250 *R/gnls.R f2f7bbf87037d1ca0abe3a35656bd278 *R/groupedData.R 43b9b0681497cd0e7811b357a28ed558 *R/lmList.R dd7324cadcfda59bfae555251052de4f *R/lme.R cf9c471ec0e6f401d7deab5cd1bce8ca *R/modelStruct.R 94a070f38169fb79b8b395c9ad2374a4 *R/newFunc.R 1548e7a2392e75a6ee7e676ee1e2495d *R/newGenerics.R d8885be3c7d8de6072c9aa1b97a74342 *R/newMethods.R be692e68e4e0f7fdd394f05c5bb4bb4e *R/nlme.R 910601699fd12696d553bd1bbb295bb6 *R/nlsList.R b3fe1989fa79251f4b7fa5828a2c8b8d *R/pdMat.R 4bf8261b66c6d694f989afaedd789525 *R/reStruct.R a6152e553e27c0e10a705050d11d45b5 *R/simulate.R d23e0c69d264388bbea3ef820e8c96ef *R/varFunc.R bd672851ead92908320b328bdf5996b3 *R/zzMethods.R b2a9dc6b6cdb787d0486e80d3454833b *TODO b52aabe9a2757fc86742763db9dafc9b *build/partial.rdb 8f2e4f663d2e4beb1143c28187c6653d *data/Alfalfa.rda 28e82e652a218134a9b880143f611516 *data/Assay.rda 041ca0f6b3ae898f7b0f7a62f16be9fd *data/BodyWeight.rda e92d38a9471ce6c044e6240497f213ce *data/Cefamandole.rda f3373d21b878a23bd0dbc9168368f6b0 *data/Dialyzer.rda 794cf9a27cadeb20605d166f757690da *data/Earthquake.rda 2bf54c335449d0cf84c87060817cd847 *data/Fatigue.rda 7a8885321ff744a538c777ab0c94fb88 *data/Gasoline.rda def2d556e4069732fc40b00f68488e75 *data/Glucose.rda b7c6a520042b9f417dd32c28739efe48 *data/Glucose2.rda 5bd218c31b1d2193bbfac2b94ee2e8f7 *data/Gun.rda b731176d404f75c1fe5ce37256df991f *data/IGF.rda 344d130fa8a987fa9dfeacb24c82f71f *data/Machines.rda e3d267b1b5e08ed808e1a5d9ddd5c6f3 *data/MathAchSchool.rda 18e9bfa7ba5bffdf0a2479b509949e42 *data/MathAchieve.rda 7f706f8027d407bcb73ef80442991d2c *data/Meat.rda 63b7630ae74fc63f0fb8beaa2fce0288 *data/Milk.rda 3a8ca6e7119ae0dd9c5840983a887306 *data/Muscle.rda 0d45165957569d326f34bc534d86e6fb *data/Nitrendipene.rda ed0808793f33df992bad0e3e646a3f25 *data/Oats.rda dfb988e33aac10f31d1045ebad9f59a7 *data/Orthodont.rda f138781c3e385131a7fb7d0ff718db15 *data/Ovary.rda 0d3221d4f65a37d5640d421e10bfeb1d *data/Oxboys.rda c6f5ef1b5d08f6621389253b526ab55c *data/Oxide.rda 9825eb1a55abd5454491207473b9932f *data/PBG.rda 85a8adb5e346e9d5dd4de41bd3e1535d *data/Phenobarb.rda 6cbdca31dab4c9aa5484ddf655c4fc83 *data/Pixel.rda 6cf94b35a677633a46c95d7191f64257 *data/Quinidine.rda 1af00982c07d785d78ee22ba2116ab98 *data/Rail.rda 28bd57dbb65abbc95f96440de6f746bb *data/RatPupWeight.rda 26b1019622e790dfacd78cb03f2fd9b0 *data/Relaxin.rda b58834d8ae881827a034615eedb6c69e *data/Remifentanil.rda c9d999719eb82ea836bb47b863fd6561 *data/Soybean.rda 93632e910d32f7d5a7534daf5d48eec2 *data/Spruce.rda 5e3ddf3dd71e9705b58044f8d97d94ef *data/Tetracycline1.rda 21982bd9f94e50afa7cc36fba49ca453 *data/Tetracycline2.rda 217764f4133061d311ce3852c95cbd8e *data/Wafer.rda 9999ac0304adfef7ace4b6d39b12fb79 *data/Wheat.rda e174f8f71cab6ed341577ff31036cf7b *data/Wheat2.rda 6526b92c436e1496d2753917e21354d9 *data/bdf.rda b1bd9c2311906426ed6c2e7c71b0cae6 *data/ergoStool.rda a9be62f8c16674c43176d0715b2bf185 *inst/CITATION 64501fa44a098a7b4c9148de789bacf4 *inst/mlbook/README fd6efb34026508f27de122da7d5e712f *inst/mlbook/ch04.R 9404575eddb8ed2cbb53d645df35210a *inst/mlbook/ch05.R 005df16c4b3b9f91c6c33b8dba700b48 *inst/po/de/LC_MESSAGES/R-nlme.mo 50ad75cead99646de10ed16e24ae9bff *inst/po/de/LC_MESSAGES/nlme.mo 685c35e107cc75e1476d30102f1754de *inst/po/en@quot/LC_MESSAGES/R-nlme.mo e544d4191cc388eb46a2e61546654f15 *inst/po/en@quot/LC_MESSAGES/nlme.mo 2cac3ad372ffa4a49cecd260f9b052e4 *inst/po/fr/LC_MESSAGES/R-nlme.mo 61cdc9b98e9a1006828d9d423ddb8849 *inst/po/fr/LC_MESSAGES/nlme.mo 46478ee898fb84041c8f1ea15d4242a0 *inst/po/ko/LC_MESSAGES/R-nlme.mo ba0dd5d00369b21b40a661864683998b *inst/po/ko/LC_MESSAGES/nlme.mo 47752c932b74050759cc213d7e679e0d *inst/po/pl/LC_MESSAGES/R-nlme.mo c402ec1604f305a3efa36ac62be79a7e *inst/po/pl/LC_MESSAGES/nlme.mo 116aec6829eafcf961a3d7636b0dd121 *inst/scripts/ch01.R 0260505d3ca6ef08e67d8b20eeb50a60 *inst/scripts/ch02.R fdce7eba58197935140a51dd46a78edb *inst/scripts/ch03.R 0d132325a11270edd1d6875e1cb96783 *inst/scripts/ch04.R 1eea147b98c28dca4234533f0bb777b5 *inst/scripts/ch05.R 63626f8434af16982c28554a95282b92 *inst/scripts/ch06.R 02a37c850ed513f6ae6354a76615b2e8 *inst/scripts/ch08.R 12542948945ade584e405cdbfaced674 *inst/scripts/runme.R aa549206ac4749200a23760b13d742c8 *inst/scripts/sims.rda e98662c31cbb0053448b596f3a3b06c7 *man/ACF.Rd 6e762e25a29d49c66cb9f86386d3b7c8 *man/ACF.gls.Rd 018003b645a6a5b3e23cf6a2f408db58 *man/ACF.lme.Rd 57595346850b70559bd5f5a00af2f3d1 *man/Alfalfa.Rd 1bb3b6a1b472e0ba2c26720a3045601a *man/Assay.Rd 8f75d99043adb16c01650f2840be13c1 *man/BodyWeight.Rd cefccd213c87d53359b03a2bf7bea088 *man/Cefamandole.Rd 9c1309814dce36ecb5675c40e045950f *man/Coef.Rd 5cb338478f8c2aae28512dff54cb80c7 *man/Covariate.Rd 951b571773a1a0893ab8a45aa3c1ae73 *man/Covariate.varFunc.Rd a5e5047ed3e37c8114000349a0f4d402 *man/Dialyzer.Rd fa9b810cf43b9474b79f278e6976de4a *man/Dim.Rd 7836c68f3dc446bddb4f2b7aa138872b *man/Dim.corSpatial.Rd 3edd657be50778bc21b97dbadae5eaa0 *man/Dim.corStruct.Rd f50e4d8be6375408fafa6900f475de7c *man/Dim.pdMat.Rd 72833569dbae9d92e7279d3bbc75cfdd *man/Earthquake.Rd 9c53be2ff65213c90256f7779d51fa55 *man/Extract.pdMat.Rd f08b06991edf2d9d088c0d0e74f3c12b *man/Fatigue.Rd d15d0820b97a1d3747d3d810edc4499b *man/Gasoline.Rd bc795b9a76a4d9f551b2232bec78f407 *man/Glucose.Rd 63a86784e7b69c12a783f11a494a7543 *man/Glucose2.Rd cd7c839372f3ce09142c32d26dbb7378 *man/Gun.Rd 546284bab7b2c8451b6a45aaed224025 *man/IGF.Rd 5b71505a878139890ec970efff7f42a6 *man/Initialize.Rd 74c67b15c21303640eee450b20993ff5 *man/Initialize.corStruct.Rd e27e73db4fd3b6818e2a48ef04582e45 *man/Initialize.glsStruct.Rd bd7073bcbe4875e08704cd79bc2b6be7 *man/Initialize.lmeStruct.Rd bdee483d50bf6e5ab30526af62e42516 *man/Initialize.reStruct.Rd a1457edef10ec2087d904cb2f522cac0 *man/Initialize.varFunc.Rd f1ed61540b8f100beb20b7b546c35033 *man/LDEsysMat.Rd 3cb4792ead6504d766d2715f90c472ee *man/Machines.Rd e4025869be76a7a91f5ee6009c0a191d *man/MathAchSchool.Rd c2975c5117961c5844804db3043dc911 *man/MathAchieve.Rd 20941081181ec027f357c7eabcda56fd *man/Matrix.Rd 10bf2d3b61d0feb71c2def9f1c50c575 *man/Matrix.pdMat.Rd ce9280e1b047c882d6ff47d21f778535 *man/Matrix.reStruct.Rd bef94237086085fa8b74ffced33357e8 *man/Meat.Rd 20f4197fb4b7d4a1c8aae881130ee350 *man/Milk.Rd db929172c8ac73f4f3374e1bfa7939fa *man/Muscle.Rd c7dcbbfab0923335fdbc693fb1b5aeaa *man/Names.Rd 8eb7a6cf9302bbcbaec81cfddda978a6 *man/Names.formula.Rd a70a87adca3942d9debcc3324ccee584 *man/Names.pdBlocked.Rd 0b55d575aa734b38fe35acb3ecc46d59 *man/Names.pdMat.Rd 2a525ef4329e34792448108773a58c95 *man/Names.reStruct.Rd efd66bcf15f4e05fca9394e98b8b22f5 *man/Nitrendipene.Rd ec3c2af6fc7d7e9906a5c0d88691d9e0 *man/Oats.Rd b6ff3a9f4f7c9364dd5427ed44e78850 *man/Orthodont.Rd 596839fecefde28fd31df15bc2443111 *man/Ovary.Rd 14d46f9380f9bf16bcd3da2ed1414618 *man/Oxboys.Rd 4830173e57672328a5d0c60b5b4b2ef0 *man/Oxide.Rd d62d8d5c2c0643b47ade54dc0c12d036 *man/PBG.Rd e28be754a322c6c1fc993a93ad921e99 *man/Phenobarb.Rd 8412274b3c55c6f85eb07a696173a62a *man/Pixel.Rd c3833cb2fd6fdbb86b0bfa760b1be201 *man/Quinidine.Rd 989b9a8b115d3f44e60c0e0d7bce44d3 *man/Rail.Rd 24e778152c340144b44e5f07cae17ba1 *man/RatPupWeight.Rd 1ad997fd585e41017b58c925d417880d *man/Relaxin.Rd ba7efa21ca725b3b51ef45e20eff5dc9 *man/Remifentanil.Rd 52abbbafe089df98d7215a4260584162 *man/Soybean.Rd 3dc4e57e32facf457b1608fe6a615d7c *man/Spruce.Rd 9daa6d475775413dd4ea64c99cfe17d1 *man/Tetracycline1.Rd e5180117cd260b6b0f55334d1fbfed27 *man/Tetracycline2.Rd af8bcaa378f06bef9ac6436d6169e157 *man/VarCorr.Rd c860612f2203d18ee3c719b6d1cd4232 *man/Variogram.Rd 29751263c30392b4e2beb5369bc55165 *man/Variogram.corExp.Rd 0835aada9e25aff1495636cf044a641e *man/Variogram.corGaus.Rd d2a1838f7649189356c1699974a0a064 *man/Variogram.corLin.Rd 0ab3b3222151278bf8b2c5d8d0580517 *man/Variogram.corRatio.Rd 4870feebe7b61f4a5d3bbddb0d6786ee *man/Variogram.corSpatial.Rd 46a38f7ec456eb0160d745b44e8e219f *man/Variogram.corSpher.Rd ab07461ee46862da384efec55f6ca907 *man/Variogram.default.Rd 328af0c785dec73aaa77b5bd1aca454b *man/Variogram.gls.Rd 660159573e2d3e1ec8a2cbcaf7d92d49 *man/Variogram.lme.Rd f0037b641609bbeb2e1cd6ee9ac35468 *man/Wafer.Rd 68ac1efa524cb04bf1b5d3aedf83096c *man/Wheat.Rd 6f1948aad833c32faecbc33dbe5797d9 *man/Wheat2.Rd be24f3ff3dd6be6e8a540aec4c11c353 *man/allCoef.Rd b2eb52593944fda58fed100e12f18f20 *man/anova.gls.Rd 8e0656b4d5fb2aba932cb39077ff7261 *man/anova.lme.Rd 898315fc8ee0502e8c2f19700868a941 *man/as.matrix.corStruct.Rd 222b482c4d6d320c4ff69edddb1c7a4d *man/as.matrix.pdMat.Rd e6a8d1d9d5080d284a853b032c354d7e *man/as.matrix.reStruct.Rd b015ee9aaf0f2b1b7ace91f735793f05 *man/asOneFormula.Rd a436ea4b16ebbb07fae895a9c5a04429 *man/asTable.Rd 7025b427cda87d435e2b3b5ddda93b8b *man/augPred.Rd 4d05a8e7243f763e96c185a727d7ad12 *man/balancedGrouped.Rd c7dd15796662e9f1a7794db8b7dbbefd *man/bdf.Rd 96aeae7dfa18cc9aa64dab9fcca1ecb2 *man/coef.corStruct.Rd d650aace7475c64096f490cdff42f9d7 *man/coef.gnls.Rd ad26050059ff7432708d14c90a5d3a11 *man/coef.lmList.Rd 2cf5a03f045515cc92dae3ecebaf2c9a *man/coef.lme.Rd a718222d2e3c6ee50b3622380f74cd40 *man/coef.modelStruct.Rd e5223021d4ef963c2e0e0bd8b2b56ebb *man/coef.pdMat.Rd 91c195e9bde7d811621ece32da2258d2 *man/coef.reStruct.Rd a59b202e7637e57a511e58b5ee05d99a *man/coef.varFunc.Rd b6d3c53e9fcaef02e96d2bf52a887df2 *man/collapse.Rd 28e87db614ebfb8fd4af7dcedae410eb *man/collapse.groupedData.Rd 27e55b7b9a68f8075ca26a74c270e51b *man/compareFits.Rd 6ac3888e9938d2e2bfdb0cb0729783ce *man/comparePred.Rd 985a21425643a7dda7bb839bbfd1f038 *man/corAR1.Rd 06382205fa98024f8f042e0ebd2af953 *man/corARMA.Rd 3f85c73a45692372ec4ba7916d2e5a0d *man/corCAR1.Rd d2664b153c1668788ac3aaabbb574332 *man/corClasses.Rd 8b3f5f8ec8aebe1db7b8d8e59dc5b71e *man/corCompSymm.Rd 0a3760bb126319c8226e16b009176148 *man/corExp.Rd a4a15ec1982a5cf6e60acd22ead025e2 *man/corFactor.Rd b25748c98c8d9f6e8251064b8fd1934b *man/corFactor.corStruct.Rd dc8b5bf3670668171ff4e49c4d8c9030 *man/corGaus.Rd 820976dd9400db2c92be65b2a7ae235e *man/corLin.Rd e2160ac32426fb86991c8f142f5723c5 *man/corMatrix.Rd ec2450e475c20ca82670bc36115f1f4f *man/corMatrix.corStruct.Rd fbc3933ddfd96f130d5a385d4ca21b53 *man/corMatrix.pdMat.Rd db07e76194a00cf63b58d2e0aca8b4b3 *man/corMatrix.reStruct.Rd 06efff79ef8160759b1641308816941f *man/corNatural.Rd 17f1dedd9c18629e489cec264f970d34 *man/corRatio.Rd d06030a80389318a197a400d95c84bac *man/corSpatial.Rd edf4f1aafae697c815c742262d539f6f *man/corSpher.Rd 2f9a8eff49e2548469744b1d6e8fde90 *man/corSymm.Rd f348ba7472c8fb3cd380fe2cbc8fa1a5 *man/ergoStool.Rd 84135028fead36c10d62e35c7ce48054 *man/fdHess.Rd 994834a9db29d4b84be42ee55d0a4d74 *man/fitted.glsStruct.Rd 73f329bdd6e26ec82028104be3cde970 *man/fitted.gnlsStruct.Rd 8a9a06c1084d5cffd9ff10735252ecca *man/fitted.lmList.Rd 55dec363e1a39915184fea67b745cddc *man/fitted.lme.Rd f1d54fd06f9de3382de88bad5d47b10e *man/fitted.lmeStruct.Rd a4b79221d0b90322544a15d84aefb75f *man/fitted.nlmeStruct.Rd 440802aeaaa55599eb2c0cf46f09b544 *man/fixed.effects.Rd 615266ab88459fefe3446afd2e506b24 *man/fixef.lmList.Rd 0974baa3e8400d76bf7974e37b86a468 *man/formula.pdBlocked.Rd 194c4e56d24a7df6a8f7042e3da10c37 *man/formula.pdMat.Rd 9da3d0d1447f651b9c75950c5cf1a352 *man/formula.reStruct.Rd 99b53109238f2bba2365191a68a0a251 *man/gapply.Rd 2caa5754301d0be95efed90a70b89953 *man/getCovariate.Rd 6885d1d68928f3a97645d2c17baf5173 *man/getCovariate.corStruct.Rd d6c724bdb3eacb6c69918bc22d4e2f53 *man/getCovariate.data.frame.Rd 16df689674c1a6cc5319319f921fde1d *man/getCovariate.varFunc.Rd 15905e7cf3055484b47074b989f4cdfd *man/getCovariateFormula.Rd 58604df12c7ecd59b7ecc26d0cd55d01 *man/getData.Rd 52ab521c89457facdcd1f4a9c5b4fbdf *man/getData.gls.Rd eb7a4684eec0276b70799634c73244b5 *man/getData.lmList.Rd 023488fea394ab866533696a4044fbce *man/getData.lme.Rd 5d5987dcee222e8430b898f09b30a0bd *man/getGroups.Rd b0b5a891e5c29d60d19e3086ffdc848e *man/getGroups.corStruct.Rd d20850fd0b7480e603e3e77dcf62e49a *man/getGroups.data.frame.Rd 8335ab3aeec4334ec484d9430be62880 *man/getGroups.gls.Rd f0b677e111638c8d4ccd1ba758457428 *man/getGroups.lmList.Rd 6763cd670d69b0e34d00d96f9a73f0c4 *man/getGroups.lme.Rd fd60d299d1edf68fdbd0f899f3b1b0c6 *man/getGroups.varFunc.Rd 51173e8db654743b984c8103af884881 *man/getGroupsFormula.Rd 60d421d32f08f5c1c04dbe872bdb52c5 *man/getResponse.Rd 8fa7e2679c0096450808e7c1c605a037 *man/getResponseFormula.Rd 547cb0f9e4fadeacb081e70a8d9ee747 *man/getVarCov.Rd 779f3dafb2559309735105ff42bb20f2 *man/gls-internal.Rd e7427bd7f2c511c2bf160ada880a210c *man/gls.Rd 7408d4cd46a74ef19168ef77630f2270 *man/glsControl.Rd 8af9bd5cd4e738633857ef5e7b952999 *man/glsObject.Rd c1de1feec9dc68a271924825dbe6f120 *man/glsStruct.Rd fff814c106f8cbdefcd78ea2e7fc79e1 *man/gnls.Rd cdab2ded0356665459d9e628ee22bc0d *man/gnlsControl.Rd eb8a3747def8edfa5cc2592115ca0f15 *man/gnlsObject.Rd 37dab43440c017afb0748d7c8cbb13a6 *man/gnlsStruct.Rd cd128da422c2e250bf851d46cc060993 *man/groupedData.Rd e2ab35ef4fa7fda5ed7bfda5aac493b8 *man/gsummary.Rd 3aac69ae1c20ccb7c4132c2ec6825da3 *man/intervals.Rd b504c0caec70350f786789738c0aa067 *man/intervals.gls.Rd 1ca1dbb5d3b65228a92724ebf6078175 *man/intervals.lmList.Rd 4c1bba95f26810ab7bc1e0008c02ef4a *man/intervals.lme.Rd a3a54a6f6ea3258ed61dbcb9caabb538 *man/isBalanced.Rd b399ad8ac30ebae148c2750863b9577b *man/isInitialized.Rd 3289fa5f6d4f4e7cd614504c69538a09 *man/lmList.Rd 8a6d79489fc6bbec424940f7daafdef8 *man/lmList.groupedData.Rd 2bad827b15465de8a394d2f6dcb47677 *man/lme.Rd 7d0160a0c7656bb1a3632f4336454a39 *man/lme.groupedData.Rd 7e78ec5d4fdcdae036d9cf4e70bbaee9 *man/lme.lmList.Rd 4257551babf30ab7125feca0866d22a7 *man/lmeControl.Rd 9f3a52e839e722698aef87047d74cc97 *man/lmeObject.Rd 13dc0abcf5cefea56089b4e02e627b4d *man/lmeStruct.Rd 3b48ef58e0ab225439782ab0bd09347a *man/logDet.Rd 4817c71888e52eb51d92c970c160731e *man/logDet.corStruct.Rd 1aabffa0c11b521d5030dffd4ff13d8c *man/logDet.pdMat.Rd dd735008904c20627fafef5b7c6f03b6 *man/logDet.reStruct.Rd 1592be45d8ea775516fed6cfb45b3153 *man/logLik.corStruct.Rd fb931127a66a884ece9340b1ec229c40 *man/logLik.glsStruct.Rd eb27e04e3e0bc7f14bf1a55d987c5ed3 *man/logLik.gnls.Rd 899beba3839e32c4471ef5049cc9834a *man/logLik.gnlsStruct.Rd db65ecf96fe3e65efc9becacb342629a *man/logLik.lmList.Rd a4972d609644acfcf8001d8b92bab966 *man/logLik.lme.Rd 5d3d7473099fd000decbb974dcb8bca4 *man/logLik.lmeStruct.Rd 3230bcef111d815fc75bcd2b3205e0b1 *man/logLik.reStruct.Rd f3b113b8aedae437708a7fcd167d3d73 *man/logLik.varFunc.Rd 4751793249ec770d44339a9561866ab6 *man/model.matrix.reStruct.Rd 60a29b3fd8b1e118e73473e1db207c42 *man/needUpdate.Rd 3e05ee655b352dbb2f67cdc09fa80ed3 *man/needUpdate.modelStruct.Rd 33b326a90626f4e75786d66a5cf2ba77 *man/nlme-deprecated.Rd 2bb7e4b6ff4140b83858288c9cdc8b83 *man/nlme.Rd 582f5887dc51226e2c0f859b7d9a7169 *man/nlme.nlsList.Rd 6e65c70f06db1be400147344da3f1c84 *man/nlmeControl.Rd bef2b44254061ff95fce8520d0a522cc *man/nlmeObject.Rd dd1fd42b2801e78eb9ba1fa11326ebe5 *man/nlmeStruct.Rd 9264ddd66db6aef6c479da678b0154a1 *man/nlsList.Rd 5981ab2375b29c7fb30643fe291f5909 *man/nlsList.selfStart.Rd dc78ee83b99f2ab166688c3410ab7fd0 *man/pairs.compareFits.Rd 0f5215a8584484ddc311a4becf93f315 *man/pairs.lmList.Rd d0c466ff83e703afc01c63a583a9a488 *man/pairs.lme.Rd a2f66466b56f892f9585627f17ff229e *man/pdBlocked.Rd 6b44f9b45150910e894f03b49c41fa93 *man/pdClasses.Rd b9d2f6d2a832a5213df9a87e841aee64 *man/pdCompSymm.Rd 4e7b194bc65fbb63bf97429560ec849b *man/pdConstruct.Rd 343c300545edb4cb6b02bfa8032bc00b *man/pdConstruct.pdBlocked.Rd 16467eb2592cd9c3f427d055846f2b13 *man/pdDiag.Rd f9f9c13acf74dfea291e23c7c63c9983 *man/pdFactor.Rd 7dae36911817b4ce144eee042f50eb27 *man/pdFactor.reStruct.Rd 7799a8aafc9e4d25878beec1d08c9a50 *man/pdIdent.Rd 29fd73d168d9dcc80413d0f1a3988388 *man/pdLogChol.Rd a735a9267525321ff4e452d203075ef3 *man/pdMat.Rd 910b0a2544e31cd107a6ea511ead012e *man/pdMatrix.Rd b84f89573def38056f3010d3d1a87dcf *man/pdMatrix.reStruct.Rd 5f06972eb22dfccd71057d67654f4eed *man/pdNatural.Rd 4a2e34fa8aed0c6d04be6269d15b24a8 *man/pdSymm.Rd 93a351b884476ef521c536902dda5947 *man/phenoModel.Rd 910de977f3e6e9337ad5180027287be5 *man/plot.ACF.Rd d55dabdb4169e6b8a506d30c95b1b289 *man/plot.Variogram.Rd 6fa1e07ad8c57b6611a129aea86cff72 *man/plot.augPred.Rd bb05371770bf4eda1295c4489bd7c2ec *man/plot.compareFits.Rd 2540d28589b3e31f01bfd47a8ce9d78f *man/plot.gls.Rd 1bd1e4075c0f0dcf50b0cc2cb88d0e9c *man/plot.intervals.lmList.Rd c13d80e21488a161386947712a51d575 *man/plot.lmList.Rd 0d2735178ea9272d068545911e87899a *man/plot.lme.Rd d025250c6943c2893e8898b5e85a8acb *man/plot.nffGroupedData.Rd e8a35d0937203dd5c6f382a1d7dc3176 *man/plot.nfnGroupedData.Rd 37b580cbb5fe607c54cd4c0652ac579c *man/plot.nmGroupedData.Rd 0615106e9151f60d1faf4b2e969117e8 *man/plot.ranef.lmList.Rd a177b8b5bd33f21ca09c531dc45e9f65 *man/plot.ranef.lme.Rd 5be17470ec36c0536de12f30eb3fcc01 *man/pooledSD.Rd 6d2e3289690dc40de6ca67a2a5169e27 *man/predict.gls.Rd 8e02e0690941f9618bcfd6987a7cd14e *man/predict.gnls.Rd b8bf3369965838b2dde2f82e6d8b9ba8 *man/predict.lmList.Rd c92a132e95e76496e7169d1c98b2f82a *man/predict.lme.Rd b0430fc0ce2ee0eb46da8bbc9e6ea466 *man/predict.nlme.Rd a24baf9d274faf0ee6a0b812bf0c67c3 *man/print.summary.pdMat.Rd 02e3f9d9a12c6c9d56ff14a247451f90 *man/print.varFunc.Rd 972006af5df348873567b608f8d77689 *man/qqnorm.gls.Rd 9917d10489f1027e4cedc2cabd2d9cf6 *man/qqnorm.lme.Rd 2964cb136bfd01e04e013c4fa93ef6cd *man/quinModel.Rd 1fe08acb34efaf5e8a20a6d402fcf9aa *man/random.effects.Rd a29f4b3be852c55acdfc15b09c3ffca4 *man/ranef.lmList.Rd 3c1cfac382e04a0147e047c27ac32696 *man/ranef.lme.Rd 6824ed4cbfa520ad4ac83be675ab9646 *man/reStruct.Rd 09c06f45f86eb484a849b8e8c6696026 *man/recalc.Rd 53ea28c80b52b0fda84d6f5dcffa140a *man/recalc.corStruct.Rd c2bee8f3f6936f91cf4c9e14ff584f55 *man/recalc.modelStruct.Rd 4fa814469f33501c7c03deded49bbf53 *man/recalc.reStruct.Rd 317a99b8dd4d9d3f8bfc99fcb8986070 *man/recalc.varFunc.Rd f31a50fe948fbbf6f5ef16a49b498232 *man/residuals.gls.Rd 00520c2db40f534412eba33b691f6571 *man/residuals.glsStruct.Rd 60647b5fef599cc688ac18b1a10abbbf *man/residuals.gnlsStruct.Rd bddd6554150a0fb58d9a3f6292e6e161 *man/residuals.lmList.Rd b87b469b48e1d1e3f61d2facbd0b973d *man/residuals.lme.Rd 99f2c846413a4e4efa115bef0dd57ebf *man/residuals.lmeStruct.Rd deb3a9c9c02c7828e4d02f9ae970fca5 *man/residuals.nlmeStruct.Rd 89cfd1d0411f29981c1d64017876fd36 *man/simulate.lme.Rd 9d3eb773650975aa8a91058bb091ac67 *man/solve.pdMat.Rd 23fc485c76bac59b5697957ba1c46b1f *man/solve.reStruct.Rd 2d335ff87e586bddd602dec64bedf103 *man/splitFormula.Rd 959ffa500a1035b2700be7f7106bd08b *man/summary.corStruct.Rd e2677fd6b951febd9b689bac8bacc5cb *man/summary.gls.Rd 6780ee835f6865026f484dfe3880de0b *man/summary.lmList.Rd f41e828650555ee9c9360cfd97c87c21 *man/summary.lme.Rd 6c686321938f6e4808b6efd371af7829 *man/summary.modelStruct.Rd 77742610400af09eb172489893c8003d *man/summary.nlsList.Rd f36698a423ebeefc8ab08a40c82488e4 *man/summary.pdMat.Rd 1803ce4dd37e5310e2bb7c03af23f14c *man/summary.varFunc.Rd 500c2e217a6f3ea216fa90ad7fde69a0 *man/update.modelStruct.Rd 8113cd9978a39dea1a29d5c4a2f6b589 *man/update.varFunc.Rd b6f60bd49d41c89c227a9c3d7c3e7888 *man/varClasses.Rd 90931caface7ab83c19fba204c7ac818 *man/varComb.Rd 9bab47d7d6c2b84ef6794ea19134a86f *man/varConstPower.Rd a56851baa939adc7ae87656d138e78e1 *man/varConstProp.Rd cf8f1ea7b02994d05cafdeac8afb78f0 *man/varExp.Rd 375a932377dee2e8f5e1227097368f5b *man/varFixed.Rd aaa21f512316ef598fe339c2d0fd9be1 *man/varFunc.Rd b81e58586f6a5e40d4744d2ec30f4068 *man/varIdent.Rd f75556c06a03f93a42697a1d2b6edbdb *man/varPower.Rd 7c37faad620348de3bef118def08ea00 *man/varWeights.Rd 974ac1176d9397c4cec9a625b4b9cd73 *man/varWeights.glsStruct.Rd ec5bee030bd1d4425fa01febc9d91ccd *man/varWeights.lmeStruct.Rd 4245e0cbb509b63324c8653eafb9a1f8 *po/R-de.po da696c406df80c2dd45f04bf2946ffa4 *po/R-fr.po f560929d13636785648e7ac8af289efc *po/R-ko.po 6ee42fb5ba450683942c71586d0d864e *po/R-nlme.pot 96e899f16c1eb2ca2a85f62750446d29 *po/R-pl.po a89b6f3e5fc832a549b117ec8ad7abc8 *po/de.po fd0244289738fe659d0314b2923cd018 *po/fr.po 2e26a2d616089ec6f01a436286063782 *po/ko.po f3eb31cdae104c7c4d3fecb3303b0e12 *po/nlme.pot 2bceb6d127ca703e7316ddbb2e9dcdab *po/pl.po 4a6ee9d66b62b2838b5d54e20f04f8b0 *src/Makevars 1a41e1d0a55c611ee6a8d4c7d873160b *src/base.h 50706c74629dbfa8b03d472135e7165f *src/chol.f 13176a10ffd9db31dd9426a7a2260d7c *src/corStruct.c 59e58da5e82c8201467cb34c4941e168 *src/gnls.c ee1ee57435cd51e17eff7cfcb765d89b *src/init.c cae840248758d7109b86c47859d77dec *src/matrix.c 6d464e1580ce2e374150e0d9ff9ab64e *src/matrix.h 183fb67b22d772170ee934151870daa1 *src/nlOptimizer.c aee83096167846e585d243c9e7e93da7 *src/nlOptimizer.h 2720e2ee156e1e601d35052c06ed0b4c *src/nlme.c 4f129b44764aaeb3f5ef817d25de998a *src/nlmefit.c 716000afd0baf90c06b6b4c209654ccc *src/nlmefit.h b8c6d062880cbe572d90123ca2cb88f1 *src/pdMat.c 87f59f283d5378beccb42f205be507cf *src/pdMat.h 40882409fb463a6dc1cbde0cf7d93661 *src/pythag.c a42b9bd64351934ca5b021009e777a63 *src/rs.f c6880c86c61ad13396c474847888cbe9 *tests/anova.gls.R f6905f7643195bb1f96125b8365915be *tests/augPred_lab.R cdced2c0665ee6e3f80188b92267e8c8 *tests/augPredmissing.R ab25428328f64b827b7ff267fc84ab5e *tests/coef.R 17c621b1a1a464be81f962133e61ca9b *tests/coef.Rout.save 8ff37dbadc319edc1c2c0a737ab2f845 *tests/contrMat.R e2f2b1b39a7dce5fd1d32faa8316632d *tests/corMatrix.R e06f267cc597e39272f42ad4f54d289d *tests/corStruct.R ad776daa5d5177802d1f54cfd836fa68 *tests/data.frame.R f0a206bb1886e769376cd5b0f306e364 *tests/deparse.R 486b6ff093d347aca8ea181b747447f2 *tests/deviance.R c85119c8b15bd636e35ecaa847316159 *tests/extras.Rin 5192af83fc732b9c0c2267243436c513 *tests/extras/README 0339806d0405cbe8aa05d2dea4a7b7c2 *tests/extras/mlbook.R c1ef873424da8eb7e650396e1dd2181f *tests/extras/mlbook.Rout.save 6551eeaec7976f5ed7c9838fd1e21df3 *tests/extras/nlme-stall.R 5ba3a071ee030cf598e8b30bd836e165 *tests/extras/scripts.R 83956dd47fd27fd92612de6385dff6c6 *tests/extras/scripts.Rout.save dea84bf6c5e3f953ea2c523ef749bfae *tests/fitted.R 2d06207872197b9abd28f869ff06f086 *tests/getData.R 8b1ba90502610671307a9246ad1fc5b8 *tests/getVarCov.R 7a238223e431f6bd1a107406cc178fd6 *tests/gls.R 8c6c3eb850ed8c354ba02b1cbbc560bf *tests/gnls-ch8.R 7999e52c6f9bd03c98dd313177f8ed34 *tests/lmList.R ab4666adda2d4f74b693b3a057c834cb *tests/lme.R 9b8c2f332beae4dc032fda946787bf82 *tests/lme.Rout.save 4191899f37fc372e70793b9c71d72304 *tests/missing.R 99f829516656a88d97a9e9617af9fdaf *tests/missing.Rout.save aae142bf4fa00e630823d33e54cb4887 *tests/nlme.R 90102927f576880c5bcbaead004b1537 *tests/nlme2.R b21df5718ac58bbc5c73fe106633d882 *tests/predict.lme.R 3af9e6227d76510d9b8216dd0e5f9953 *tests/scoping.R ad9e8c74401a27ce836fe5f3253dd543 *tests/sigma-fixed-etc.R 52e8f5b5ecbec55ced361ee194ff972a *tests/ss2.rds f0720dee91838d24d1a169b62eec4eeb *tests/updateLme.R ffe6a13d13fcfb77ba53f5d259b0aaf7 *tests/varConstProp.R ce853fa02b5ebb61c41a0e96fcb97733 *tests/varFixed.R 8bb1eb5670f185f8aaaa51b542866ee5 *tests/varIdent.R nlme/po/0000755000176000001440000000000014772467244011674 5ustar ripleyusersnlme/po/ko.po0000644000176000001440000000525314632316272012637 0ustar ripleyusers# Korean translation for R nlme package # Recommended/nlme/po/ko.po # Maintainer: R Core Team # Sent to Brian Ripley # Copyright (C) 1995-2013 The R Core Team # This file is distributed under the same license as the R nlme package. # R Development Translation Team - Korean # Chel Hee Lee , 2013. # Chel Hee Lee , 2013. # msgid "" msgstr "" "Project-Id-Version: nlme 3.1-105\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-06-06 12:49+0200\n" "PO-Revision-Date: 2013-08-16 18:27-0600\n" "Last-Translator: Chel Hee Lee \n" "Language-Team: R Development Translation Teams (Korean) \n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Poedit-SourceCharset: utf-8\n" "X-Generator: Poedit 1.5.4\n" #: corStruct.c:424 msgid "All parameters must be less than 1 in absolute value" msgstr "모든 파라미터들의 절대값이 반드시 1 보다 작아야 합니다" #: corStruct.c:535 msgid "Coefficient matrix not invertible" msgstr "가역적이지 않은 계수행렬입니다" #: corStruct.c:872 corStruct.c:927 corStruct.c:987 corStruct.c:1029 msgid "Unknown spatial correlation class" msgstr "알 수 없는 spatial correlation 클래스입니다" #: nlme.c:468 msgid "First observation on an individual must have a dose" msgstr "개인의 첫번째 관측값은 반드시 dose 이어야 합니다" #: nlmefit.c:426 #, c-format msgid "Singularity in backsolve at level %ld, block %ld" msgstr "" #: nlmefit.c:464 #, c-format msgid "" "Too many parameters for finite-difference Hessian; npar = %d, nTot = %g." msgstr "" #: nlmefit.c:575 nlmefit.c:756 msgid "Overfitted model!" msgstr "" #: nlmefit.c:601 msgid "analytic gradient is not available with matrix logarithm" msgstr "analytic gradient는 matrix logarithm과 함께 사용할 수 없습니다" #: nlmefit.c:624 msgid "analytic gradient is not available with compound symmetry" msgstr "analytic gradient는 compound symmetry와 함께 사용할 수 없습니다" #: nlmefit.c:917 #, fuzzy, c-format msgid "Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]" msgstr "고유값-고유벡터 분해를 할 수 없습니다" #: nlmefit.c:949 #, fuzzy, c-format msgid "" "Unable to form Cholesky decomposition: the leading minor of order %d is not " "pos.def." msgstr "콜레스키 분해를 할 수 없습니다" #: nlmefit.c:981 msgid "Haven't written the compound symmetry case for this yet" msgstr "이것에 대하여 compound symmetry의 경우는 아직 작성되지 않았습니다" nlme/po/de.po0000644000176000001440000000500614632316272012612 0ustar ripleyusers# Translation of nlme.pot to German # Copyright (C) 2007-2009 The R Foundation # This file is distributed under the same license as the nlme package. msgid "" msgstr "" "Project-Id-Version: R 4.0.0 / nlme 3.1-145\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-06-06 12:49+0200\n" "PO-Revision-Date: 2020-04-01 15:16+0200\n" "Last-Translator: Detlef Steuer \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: corStruct.c:424 msgid "All parameters must be less than 1 in absolute value" msgstr "Der Betrag aller Parameter muss kleiner 1 sein." #: corStruct.c:535 msgid "Coefficient matrix not invertible" msgstr "Koeffizientenmatrix nicht invertierbar" #: corStruct.c:872 corStruct.c:927 corStruct.c:987 corStruct.c:1029 msgid "Unknown spatial correlation class" msgstr "Unbekannte räumliche Korrelations-Klasse" #: nlme.c:468 msgid "First observation on an individual must have a dose" msgstr "Erste Beobachtung eines Individuums muss eine Dosis haben" #: nlmefit.c:426 #, c-format msgid "Singularity in backsolve at level %ld, block %ld" msgstr "Singularität in backsolve auf Stufe %ld, Block %ld" #: nlmefit.c:464 #, c-format msgid "" "Too many parameters for finite-difference Hessian; npar = %d, nTot = %g." msgstr "" "Zu viele Parameter für eine finite-differenzen Hesse-matrix; npar = %d, nTot " "= %g." #: nlmefit.c:575 nlmefit.c:756 msgid "Overfitted model!" msgstr "Überangepasstes Modell!" #: nlmefit.c:601 msgid "analytic gradient is not available with matrix logarithm" msgstr "analytischer Gradient ist nicht mit Matrixlogarithmus verfügbar" #: nlmefit.c:624 msgid "analytic gradient is not available with compound symmetry" msgstr "" "analytischer Gradient ist nicht mit zusammengesetzter Symmetrie verfügbar" #: nlmefit.c:917 #, c-format msgid "Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]" msgstr "" "Unfähig eine Eigenwert-Eigenvektor-Zerlegung zu bilden [RS(.) ierr = %d]" #: nlmefit.c:949 #, c-format msgid "" "Unable to form Cholesky decomposition: the leading minor of order %d is not " "pos.def." msgstr "" "Cholesky-Zerlegung kann nicht bestimmt werden: Führender Minor der Ordnung " "%d\n" "ist nicht positiv definit" #: nlmefit.c:981 msgid "Haven't written the compound symmetry case for this yet" msgstr "" "Fall von zusammengesetzter Symmetrie wurde für dies noch nicht geschrieben" nlme/po/R-fr.po0000644000176000001440000013353214772467244013051 0ustar ripleyusers# Translation of R-nlme.pot to French # Copyright (C) 2005 The R Foundation # This file is distributed under the same license as the nlme R package. # Philippe Grosjean 2005. # msgid "" msgstr "" "Project-Id-Version: nlme 3.1-65\n" "Report-Msgid-Bugs-To: bugs@r-project.org\n" "POT-Creation-Date: 2025-03-31 10:29\n" "PO-Revision-Date: 2014-03-30 08:37+0100\n" "Last-Translator: Philippe Grosjean \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 1.6.4\n" msgid "not implemented for \"nlme\" objects" msgstr "Pas implment pour des objets \"nlme\"" msgid "not implemented for multiple levels of nesting" msgstr "Pas implment pour des niveaux multiples d'imbrication" msgid "individual %s was not used in the fit" msgstr "l'individu %s n'a pas t utilis dans l'ajustement" #, fuzzy msgid "not implemented for uncorrelated errors" msgstr "Pas implment pour des objets \"nlme\"" msgid "not implemented for correlation structures without a grouping factor" msgstr "" msgid "do not know how to calculate correlation matrix of %s object" msgstr "Incapable de calculer la matrice de corrlation de l'objet %s" msgid "\"corStruct\" object must have a \"fixed\" attribute" msgstr "l'objet \"corStruct\" doit avoir un attribut \"fixed\"" msgid "do not know how to obtain parameters of %s object" msgstr "incapable d'obtenir les paramtres de l'objet %s" msgid "cannot change the length of the parameter of a \"corStruct\" object" msgstr "" "impossible de changer la longueur des paramtres d'un objet \"corStruct\"" msgid "" "'sumLenSq := sum(table(groups)^2)' = %g is too large.\n" " Too large or no groups in your correlation structure?" msgstr "" msgid "cannot change 'form'" msgstr "Impossible de changer 'form'" msgid "need data to calculate covariate of \"corStruct\" object" msgstr "" "des donnes sont ncessaires pour calculer les covariables d'un objet " "\"corStruct\"" msgid "cannot change the length of the parameter of a \"corSymm\" object" msgstr "" "impossible de changer la longueur des paramtres d'un objet \"corSymm\"" msgid "covariate must have unique values within groups for \"corSymm\" objects" msgstr "" "La covariable doit avoir des valeurs uniques l'intrieur des groupes pour " "les objets \"corSymm\"" msgid "" "unique values of the covariate for \"corSymm\" objects must be a sequence " "of consecutive integers" msgstr "" "les valeurs uniques des covariables pour les objets \"corSymm\" doivent tre " "des squences d'entiers conscutifs" msgid "initial value for \"corSymm\" parameters of wrong dimension" msgstr "" "La valeur initiale pour les paramtres de \"corSymm\" n'ont pas les bonnes " "dimensions" msgid "initial values for \"corSymm\" must be between -1 and 1" msgstr "Les valeurs initiales pour \"corSymm\" doivent se situer entre -1 et 1" msgid "" "initial values for \"corSymm\" do not define a positive-definite correlation " "structure" msgstr "" "les valeurs initiales pour \"corSymm\" ne dfinissent pas une structure de " "corrlation positive-dfinie" msgid "cannot change the length of the parameter of a \"corNatural\" object" msgstr "" "impossible de changer la longueur des paramtres d'un objet \"corNatural\"" msgid "" "covariate must have unique values within groups for \"corNatural\" objects" msgstr "" "la cavariable doit avoir des valeurs uniques pour les intragroupes des " "objets 'corNatural'" msgid "" "unique values of the covariate for \"corNatural\" objects must be a sequence " "of consecutive integers" msgstr "" "les valeurs uniques pour la covariables des objets \"corNatural\" doivent " "tre une squence d'entiers conscutifs" msgid "initial value for \"corNatural\" parameters of wrong dimension" msgstr "" "La valeur initiale pour les paramtres \"corNatural\" n'a pas la bonne " "dimension" msgid "initial values for \"corNatural\" must be between -1 and 1" msgstr "" "Les valeurs initiales pour \"corNatural\" doivent se situer entre -1 et 1" msgid "" "initial values for \"corNatural\" do not define a positive-definite " "correlation structure" msgstr "" "Les valeurs initiales pour \"corNatural\" ne sont pas dfinies sous forme " "d'une structure de corrlation positive-dfinie" msgid "parameter in AR(1) structure must be between -1 and 1" msgstr "Le paramtre dans la structure AR(1) doit se situer entre - 1 et 1" msgid "'sumLenSq' = %g is too large (larger than maximal integer)" msgstr "" msgid "cannot change the length of the parameter of a \"corAR1\" object" msgstr "Impossible de changer la longueur des paramtres d'un objet \"corAR1\"" msgid "covariate must have unique values within groups for \"corAR1\" objects" msgstr "" "La covariable doit avoir des valeurs uniques pour les intragroupes des " "objets \"corAR1\"" msgid "parameter in CAR(1) structure must be between 0 and 1" msgstr "Le paramtre dans la structure CAR(1) doit se situer entre -1 et 1" msgid "cannot change the length of the parameter of a \"corCAR1\" object" msgstr "" "Impossible de changer la longueur des paramtres d'un objet \"corCAR1\"" msgid "covariate must have unique values within groups for \"corCAR1\" objects" msgstr "" "la covariable doit avoir des valeurs uniques pour les intragroupes des " "objets \"corCAR1\"" msgid "autoregressive order must be a non-negative integer" msgstr "l'ordre autorgressif doit tre un entier positif ou nul" msgid "moving average order must be a non-negative integer" msgstr "l'ordre de la moyenne mobile doit tre un entier positif ou nul" #, fuzzy msgid "at least one of 'p' and 'q' must be > 0" msgstr "les valeurs initiales pour 'varIdent' doivent tre > 0" msgid "initial value for parameter of wrong length" msgstr "la valeur initiale du paramtre est de la mauvaise taille" msgid "parameters in ARMA structure must be < 1 in absolute value" msgstr "les paramtres d'une structure ARMA doivent tre < 1 en valeur absolue" msgid "'object' has not been Initialize()d" msgstr "'object' n'a pas t initialis ; utilisez Initialize()" msgid "cannot change the length of the parameter of a \"corARMA\" object" msgstr "" "impossible de changer la longueur des paramtres d'un objet \"corARMA\"" #, fuzzy msgid "" "covariate must have unique integer values within groups for \"corARMA\" " "objects" msgstr "" "la covariable doit avoir des valeurs uniques pour les intragroupes des " "objets \"corARMA\"" msgid "\"corARMA\" order (%g, %g) exceeds maximum lag in data (%g)" msgstr "" msgid "parameter in \"corCompSymm\" structure must be < 1 in absolute value" msgstr "" "les paramtres d'une structure \"corCompSymm\" doivent tre < 1 en valeur " "absolue" msgid "cannot change the length of the parameter of a \"corCompSymm\" object" msgstr "" "impossible de changer la longueur des paramtres d'un objet \"corCompSymm\"" msgid "initial value in \"corCompSymm\" must be greater than %s" msgstr "La valeur initiale dans \"corCompSymm\" doit tre plus grande que %s" msgid "cannot change the length of the parameter after initialization" msgstr "impossible de changer la longueur du paramtre aprs l'initialisation" msgid "need data to calculate covariate" msgstr "des donnes sont ncessaires pour calculer la covariable" msgid "cannot have zero distances in \"corSpatial\"" msgstr "distances nulles non autorises dans \"corSpatial\"" msgid "'range' must be > 0 in \"corSpatial\" initial value" msgstr "" "l'tendue des valeurs initiales ('range') dans \"corSpatial\" doit tre > 0 " msgid "initial value for \"corSpatial\" parameters of wrong dimension" msgstr "" "la valeur initiale pour les paramtres \"corSpatial\" n'ont pas la bonne " "taille" msgid "initial value of nugget ratio must be between 0 and 1" msgstr "" "la valeur initiale du coefficient de ppite doit tre comprise entre 0 et 1" msgid "'range' must be > 0 in \"corLin\" initial value" msgstr "" "l'tendue ('range') doit tre > 0 pour les valeurs initiales dans \"corLin\"" msgid "" "initial value for 'range' less than minimum distance. Setting it to 1.1 * " "min(distance)" msgstr "" "la valeur initiale pour l'tendue ('range') est infrieure la distance " "minimale. Elle est fixe 1.1 * min(distance)" msgid "initial value for \"corLin\" parameters of wrong dimension" msgstr "" "la valeur initiale pour les paramtres \"corLin\" n'ont pas la bonne taille" msgid "range must be > 0 in \"corSpher\" initial value" msgstr "l'tendue des valeurs initiales dans \"corSpher\" doit tre > 0" msgid "initial value for \"corSpher\" parameters of wrong dimension" msgstr "" "la valeur initiale pour les paramtres \"corSpher\" sont de la mauvaise " "taille" msgid "model must be a formula of the form \"resp ~ pred\"" msgstr "le modle doit tre une formule de la forme \"resp ~ pred\"" msgid "offset() terms are not supported" msgstr "" msgid "no coefficients to fit" msgstr "pas de coefficients ajuster" msgid "maximum number of iterations reached without convergence" msgstr "le nombre maximum d'itrations est atteint, mais pas la convergence" msgid "computed \"gls\" fit is singular, rank %s" msgstr "l'ajustement \"gls\" calcul est singulier, de rang %s" msgid "object must inherit from class %s" msgstr "l'objet doit hriter de la classe %s" msgid "'Terms' must be between 1 and %d" msgstr "'Terms' doivent tre compris entre 1 et %d" msgid "terms can only be integers or characters" msgstr "" "Les termes peuvent tre seulement des entiers ou des chanes de caractres" msgid "data in %s call must evaluate to a data frame" msgstr "" "les donnes dans l'appel %s doivent tre values comme un tableau de " "donnes (\"data frame\")" msgid "" "%s without \"primary\" can only be used with fits of \"groupedData\" objects" msgstr "" "%s sans \"primary\" ne peut tre utilis avec des ajustement d'objets " "\"groupedData\"" msgid "only one level allowed for predictions" msgstr "seul un niveau est permis pour les prdictions" msgid "%s and %s must have the same group levels" msgstr "%s et %s doivent avoir les mmes niveaux de groupes" msgid "wrong group levels" msgstr "niveaux de groupes errons" msgid "cannot get confidence intervals on var-cov components: %s" msgstr "" "impossible de calculer un intervalle de confiance sur les composantes var-" "cov : %s" msgid "need an object with call component" msgstr "ncessite un objet avec une composante 'call'" msgid "'nint' is not consistent with 'breaks'" msgstr "'nint' n'est pas consistant avec 'breaks'" msgid "Within-group std. dev. must be a positive numeric value" msgstr "" msgid "'object' must be a formula" msgstr "'object' doit tre une formule" msgid "object formula must be of the form \"resp ~ pred\"" msgstr "l'objet formule doit tre de la forme \"rep ~ pred\"" msgid "'data' must be given explicitly to use 'nls' to get initial estimates" msgstr "" "'data' doit tre fourni de manire explicite pour utiliser 'nls' afin " "d'obtenir les estimateurs initiaux" msgid "no initial values for model parameters" msgstr "pas de valeurs initiales pour les paramtres du modle" msgid "starting estimates must have names when 'params' is missing" msgstr "" "les estimations initiales doivent tre nomms lorsque 'params' est manquant" msgid "'params' must be a formula or list of formulae" msgstr "'params' doit tre une formule ou une liste de formules" msgid "formulae in 'params' must be of the form \"parameter ~ expr\"" msgstr "" "les formules dans 'params' doivent tre de la forme \"parameter ~ expr\"" msgid "step halving factor reduced below minimum in NLS step" msgstr "" "le facteur de division par deux du pas est rduit en dessous du minimum dans " "un pas NLS" msgid "cannot calculate REML log-likelihood for \"gnls\" objects" msgstr "" "impossible de calculer la log-vraissemblance REML pour les objets \"gnls\"" msgid "first argument to 'groupedData' must be a two-sided formula" msgstr "" "le premier argument 'groupedData' doit tre une formule deux membres" msgid "right-hand side of first argument must be a conditional expression" msgstr "" "le membre de droite du premier argument doit tre une expression " "conditionnelle" msgid "first argument to 'nfGroupedData' must be a two-sided formula" msgstr "" "le premier argument de 'nfGroupedData' doit tre une formule deux membres" msgid "only one level of grouping allowed" msgstr "seul un niveau de regroupement est autoris" msgid "second argument to 'groupedData' must inherit from data.frame" msgstr "le second argument de 'groupedData' doit hriter d'un data.frame" msgid "first argument to 'nmGroupedData' must be a two-sided formula" msgstr "" "le premier argument de 'nmGroupedData' doit tre une formule deux membres" msgid "single group not supported -- use groupedData()" msgstr "" msgid "'subset' ignored with single grouping factor" msgstr "" "'subset' ignor lors de l'utilisation d'un seul facteur pour le regroupement" msgid "'subset' must be a list" msgstr "'subset' doit tre une liste" msgid "undefined group declared in 'subset'" msgstr "groupe non dclar dans 'subset'" msgid "only one display level allowed" msgstr "un seul niveau d'affichage est permis" msgid "undefined display level %s for %s" msgstr "niveau d'affichage non dfini %s pour %s" msgid "undefined collapsing level %s for %s" msgstr "niveau de fusion non dfini %s pour %s" msgid "" "collapsing level cannot be smaller than display level; setting it to the " "display level" msgstr "" "le niveau de fusion ne peut tre plus petit que le niveau d'affichage ; il " "est fix au niveau d'affichage" msgid "'preserve' must be a two-sided formula" msgstr "'preserve' doit tre une formule deux membres" msgid "'asTable' cannot be used with multilevel grouped data" msgstr "" "'asTable' ne peut tre utilis avec des donnes groupements multiniveaux" msgid "'asTable' can only be used with balanced 'groupedData' objects" msgstr "" "'asTable' ne peut tre utilis qu'avec des objets 'groupedData' balancs" #, fuzzy msgid "'data' argument not used, but taken from groupedData object" msgstr "le second argument doit tre un objet 'groupedData'" msgid "multiple levels not allowed" msgstr "niveaux multiples non permis" msgid "'data' must be a \"groupedData\" object if 'groups' argument is missing" msgstr "" "'data' doit tre un objet \"groupedData\" si l'argument 'groups' est manquant" msgid "'data' in %s call must evaluate to a data frame" msgstr "'data dans l'appel %s doit tre valu comme un data.frame" msgid "nonexistent groups requested in 'subset'" msgstr "groupes inexistants demands dans 'subset'" msgid "'subset' can only be character or integer" msgstr "" "'subset' ne peut qu'tre une chane de caractres ou une valeur numrique" msgid "log-likelihood not available with NULL fits" msgstr "la log-vraissemblance n'est pas disponible avec des ajustements NULL" msgid "'form' must be a formula" msgstr "'form' doit tre une formule" msgid "'form' must be a one-sided formula" msgstr "'form' doit tre une formule un seul membre" msgid "covariate must be a data frame" msgstr "la covariable doit tre un tableau de donnes (data.frame)" msgid "cannot do pairs of just one variable" msgstr "impossible d'apparier avec seulement une variable" msgid "'id' must be between 0 and 1" msgstr "'id' doit tre compris entre 0 et 1" msgid "'id' can only be a formula or numeric" msgstr "'id' doit tre une formule ou une valeur numrique" msgid "'idLabels' of incorrect length" msgstr "'idLabels' de longueur incorrecte" msgid "'idLabels' can only be a formula or a vector" msgstr "'idLabels' ne peut tre qu'une formule ou un vecteur" msgid "covariate must be numeric" msgstr "la covariable doit tre numrique" msgid "nonexistent group in 'newdata'" msgstr "groupe inexistant dans 'newdata'" msgid "nonexistent group requested in 'subset'" msgstr "groupe inexistant mais requis dans 'subset'" msgid "only residuals and random effects allowed" msgstr "seuls les rsidus et les effets alatoires sont permis" msgid "can only fit \"lmList\" objects with single grouping variable" msgstr "" "seuls les objets \"lmList\" peuvent tre ajusts avec une seule variable de " "groupe" msgid "'lme.lmList' will redefine 'data'" msgstr "'lme.lmList' va redfinir 'data'" msgid "initial value for \"reStruct\" overwritten in 'lme.lmList'" msgstr "la valeur initiale de \"reStruct\" est remplace dans 'lme.lmList'" msgid "fixed-effects model must be a formula of the form \"resp ~ pred\"" msgstr "" "un modle effet fixe doit tre une formule de la forme \"resp ~ pred\"" msgid "incompatible lengths for 'random' and grouping factors" msgstr "tailles incompatibles entre 'random' et les facteurs de regroupement" msgid "incompatible formulas for groups in 'random' and 'correlation'" msgstr "" "formules incompatibles entre les groupes dans 'random' et 'correlation'" msgid "" "cannot use smaller level of grouping for 'correlation' than for 'random'. " "Replacing the former with the latter." msgstr "" "impossible d'utiliser un niveau plus petit pour le regroupement de " "'correlation' par rapport 'random'. Replacement du premier par le second." msgid "fewer observations than random effects in all level %s groups" msgstr "" "moins d'observations qu'il n'y a d'effets alatoires dans les niveaux des " "groupes %s" msgid "" "%s problem, convergence error code = %s\n" " message = %s" msgstr "" "problme %s, code d'erreur de convergence = %s\n" " message = %s" msgid "" "maximum number of iterations (lmeControl(maxIter)) reached without " "convergence" msgstr "" "le nombre maximum d'itrations (lmeControl(maxIter)) est atteint, mais pas " "la convergence" msgid "terms must all have the same denominator DF" msgstr "" "Les termes doivent tous avoir le mme nombre de degrs de libert au " "dnominateur" msgid "L may only involve fixed effects with the same denominator DF" msgstr "" "'L' ne peut que prendre en compte des effets fixes ayant mme degr de " "libert au dnominateur" #, fuzzy msgid "objects must inherit from classes %s, or %s" msgstr "l'objet doit hriter de la classe %s ou %s" msgid "" "some fitted objects deleted because response differs from the first model" msgstr "" "certains objets ajusts sont limins parce que leur rponse diffre du " "premier modle" msgid "first model has a different response from the rest" msgstr "le premier modle a une rponse diffrente du reste" msgid "all fitted objects must have the same estimation method" msgstr "" "tous les objets ajusts doivent l'tre l'aide de la mme mthode " "d'estimation" msgid "" "fitted objects with different fixed effects. REML comparisons are not " "meaningful." msgstr "" "les objets ont t ajusts avec diffrents effets fixes. Les comparaisons " "REML n'ont aucun sens dans ce cas." msgid "objects must have a \"call\" component or attribute" msgstr "les objets doivent avoir une composante ou un attribut \"call\"" msgid "all fitted objects must use the same number of observations" msgstr "tous les objets ajusts doivent utiliser le mme nombre d'observations" msgid "only single level allowed" msgstr "seul un niveau est autoris" #, fuzzy msgid "" "cannot get confidence intervals on var-cov components: %s\n" " Consider '%s'" msgstr "" "impossible de calculer un intervalle de confiance sur les composantes var-" "cov : %s" msgid "covariate must have a level attribute when groups are present" msgstr "" "la covariable doit avoir un attribut 'level', lorsque des groupes sont " "prsents" msgid "covariate must have a level attribute when 'id' is a formula" msgstr "" "la covariable doit avoir un attribut 'level', lorsque 'id' est une formule" msgid "covariate must have a level attribute when 'idLabels' is a formula" msgstr "" "la covariable doit avoir un attribut 'level', lorsque 'idLabels' est une " "formule" msgid "'form' must be a formula when not NULL" msgstr "'form' doit tre une formule, lorsqu'il n'est pas NULL." msgid "only single effects allowed in left side of 'form'" msgstr "seul un effet est permis dans le membre de gauche de 'form'" msgid "%s is not a valid effect name" msgstr "%s n'est pas un nom valide pour un effet" msgid "no effects allowed in right side of formula" msgstr "aucun effet n'est autoris dans le membre de droite de la formule" msgid "cannot evaluate groups for desired levels on 'newdata'" msgstr "impossible d'valuer les groupes pour les niveaux dsirs de 'newdata'" msgid "'Id' must be between 0 and 1" msgstr "'id' doit tre compris entre 0 et 1" msgid "augmentation of random effects only available for single level" msgstr "" "l'augmentation des effets alatoires n'est disponible que pour un seul niveau" msgid "no condensed linear model" msgstr "aucun modle linaire condens" msgid "no fitted \"lme\" object" msgstr "pas d'objet \"lme\" ajust" msgid "objects must have coefficients with same row names" msgstr "les objets doivent avoir des coefficients qui ont mmes noms de lignes" msgid "only one level allowed in 'gapply'" msgstr "seul un niveau est autoris pour 'gapply'" msgid "'which' must be between 1 and %d" msgstr "'which' doit tre compris entre 1 et %d" msgid "'which' can only be character or integer" msgstr "'which' ne peut tre qu'une chane de caractres ou un entier" msgid "formula(object) must return a formula" msgstr "formula(object) doit renvoyer une formule" msgid "'form' must be a two-sided formula" msgstr "'formf doit tre une formule deux membres" msgid "only one level allowed in 'gsummary'" msgstr "seul un niveau est permis dans 'gsummary'" msgid "'FUN' can only be a function or a list of functions" msgstr "'FUN' ne peut qu'tre une fonction ou une liste de fonctions" msgid "cannot omit grouping factor without 'form'" msgstr "le facteur utilis pour le regroupement ne peut tre omis sans 'form'" msgid "no degrees of freedom for estimating std. dev." msgstr "aucun nombre de degrs de libert pour l'estimation de l'cart type" msgid "" "data argument to \"data.frame\" method for 'getGroups' does not make sense" msgstr "" "l'argument 'data' pour la mthode \"data.frame\" de 'getGroups' n'a pas de " "sens" msgid "invalid formula for groups" msgstr "formule incorrecte pour les groupes" msgid "'form' must have all components as formulas" msgstr "'form' doit avoir tous ses composantes sous forme de formules" msgid "'form' can only be a formula, or a list of formulas" msgstr "'form' ne peut tre qu'une formule, ou une liste de formules" msgid "level of %s does not match formula %s" msgstr "le niveau de %s ne correspond pas la formule %s" msgid "'form' argument must be a formula" msgstr "l'argument 'form' doit tre une formule" msgid "at least two coefficients are needed" msgstr "il faut au moins deux coefficients" msgid "no model variogram available with 'showModel = TRUE'" msgstr "" "aucun variogramme n'est disponible pour le modle avec 'showModel = TRUE'" msgid "only residuals allowed" msgstr "seuls les rsidus sont autoriss" msgid "'distance' and 'object' have incompatible lengths" msgstr "'distance' et 'object' ont des tailles incompatibles" msgid "'nlme.nlsList' will redefine 'fixed', 'data', and 'start'" msgstr "'nlme.nlsList' va redfinir 'fixed', 'data', et 'start'" msgid "can only fit \"nlsList\" objects with single grouping variable" msgstr "" "seuls les objets \"nlsList\" peuvent tre ajusts avec une seule variable de " "groupe" msgid "initial value for 'reStruct' overwritten in 'nlme.nlsList'" msgstr "la valeur initiale pour 'reStruct' est remplace dans 'nlme.nlsList'" msgid "'model' must be a formula" msgstr "'model' doit tre une formule" msgid "model formula must be of the form \"resp ~ pred\"" msgstr "la formule du modle doit tre de la forme \"rep ~ pred\"" msgid "'data' must be given explicitly to use 'nlsList'" msgstr "'data' doit tre fourni explicitement pour utiliser 'nlsList'" msgid "'fixed' must be a formula or list of formulae" msgstr "'fixed' doit tre une formule ou une liste de formules" msgid "formulae in 'fixed' must be of the form \"parameter ~ expr\"" msgstr "" "les formules dans 'fixed' doivent tre de la forme \"paramtre ~ expression\"" msgid "'random' must be a formula or list of formulae" msgstr "'random' doit tre une formule ou une liste de formules" msgid "formulae in 'random' must be of the form \"parameter ~ expr\"" msgstr "" "les formules dans 'random' doivent tre de la forme \"paramtre ~ " "expression\"" msgid "incompatible formulas for groups in \"random\" and \"correlation\"" msgstr "" "formules incompatibles entre les groupes dans \"random\" et \"correlation\"" msgid "" "cannot use smaller level of grouping for \"correlation\" than for " "\"random\". Replacing the former with the latter." msgstr "" "impossible d'utiliser un niveau plus petit pour le regroupement de " "\"correlation\" par rapport \"random\". Replacement du premier par le " "second." msgid "'start' must have a component called 'fixed'" msgstr "'start' doit avoir une composante nomme 'fixed'" msgid "starting values for the 'fixed' component are not the correct length" msgstr "" "les valeurs de dpart pour la composante 'fixed' n'ont pas la bonne taille" msgid "starting values for random effects should be a list, or a matrix" msgstr "" "les valeurs de dpart pour les effets alatoires doivent tre dans une liste " "ou dans une matrice" msgid "" "list with starting values for random effects must have names or be of length " "%d" msgstr "" "la liste contenant les valeurs de dpart pour les effets alatoires doit " "tre nommes ou de longueur %d" msgid "starting values for the random components should be a list of matrices" msgstr "" "les valeurs de dpart pour les composantes alatoires devraient tre un " "liste de matrices" msgid "" "number of rows in starting values for random component at level %s should be " "%d" msgstr "" "le nombre de lignes dans les valeurs de dpart pour la composante alatoire " "au niveau %s doit tre %d" msgid "" "number of columns in starting values for random component at level %s should " "be %d" msgstr "" "le nombre de colonnes dans les valeurs de dpart pour la composante " "alatoire au niveau %s doit tre %d" msgid "starting values for random effects must include group levels" msgstr "" "les valeurs de dpart pour les effets alatoires doivent inclure les niveaux " "de groupe" msgid "" "groups levels mismatch in 'random' and starting values for 'random' at level " "%s" msgstr "" "niveaux de groupes incohrents dans 'random' et dans les valeurs de dpart " "pour 'random' au niveau %s" msgid "" "names mismatch in 'random' and starting values for 'random' at level %s" msgstr "" "incohrence de noms entre 'random' et les valeurs de dpart pour 'random' au " "niveau %s" msgid "Iteration %d, LME step: nlminb() did not converge (code = %d)." msgstr "" msgid "Do increase 'msMaxIter'!" msgstr "" msgid "PORT message:" msgstr "" msgid "Iteration %d, LME step: nlm() did not converge (code = %d)." msgstr "" msgid "step halving factor reduced below minimum in PNLS step" msgstr "" "le facteur de rduction chaque tape est abaiss en dessous du minimum " "une tape PNLS" msgid "maximum number of iterations (maxIter = %d) reached without convergence" msgstr "" "le nombre maximum d'itrations (maxIter = %d) est atteint, mais pas la " "convergence" msgid "second argument must be a groupedData object" msgstr "le second argument doit tre un objet 'groupedData'" msgid "cannot use an anonymous function for the model" msgstr "impossible d'utiliser une formule anonyme pour le modle" msgid "" "'data' must be a \"groupedData\" object if 'formula' does not include groups" msgstr "" "'data' doit tre dans un objet \"groupedData\" si 'formula' n'inclus pas de " "groupes" msgid "" "old-style self-starting model functions\n" "are no longer supported.\n" "New selfStart functions are available.\n" "Use\n" " SSfpl instead of fpl,\n" " SSfol instead of first.order.log,\n" " SSbiexp instead of biexp,\n" " SSlogis instead of logistic.\n" "If writing your own selfStart model, see\n" " \"help(selfStart)\"\n" "for the new form of the \"initial\" attribute." msgstr "" "les fonctions de modles 'self-start' d'un ancien style\n" "ne sont plus supportes.\n" "Les nouvelles fonctions selfStart sont disponibles.\n" "Utilisez\n" " SSfpl la place de fpl,\n" " SSfol la place de first.order.log,\n" " SSbiexp la place de biexp,\n" " SSlogis la place de logistic.\n" "Si vous crez votre propre fonction de modle selfStart, voyez\n" " \"help(selfStart)\"\n" "pour la nouvelle forme de l'attribut \"initial\"." msgid "missing call attribute in \"nlsList\" object" msgstr "attribut d'appel manquant dans l'objet \"nlsList\"" msgid "cannot access the matrix of uninitialized objects" msgstr "impossible d'accder la matrice d'objets non initialiss" msgid "ignoring argument 'form'" msgstr "L'argument 'form' est ignor" msgid "ignoring argument 'nam'" msgstr "L'argument 'nam' est ignor" msgid "'value' must be a square matrix" msgstr "'value' doit tre une matrice carre" msgid "dimnames of 'value' must match or be NULL" msgstr "" "les noms de dimensions ('dimnames') des valeurs doivent correspondre ou bien " "tre NULL" msgid "names of 'value' are not consistent with 'nam' argument" msgstr "Les noms de 'value' ne sont pas conformes avec l'argument 'nam'" msgid "%s is not a valid object for \"pdMat\"" msgstr "%s n'est pas un objet correct pour \"pdMat\"" msgid "all elements of 'form' list must be two-sided formulas" msgstr "" "tous les lments de la liste 'form' doivent tre des formules double " "membres" msgid "'form' can only be a formula or a list of formulae" msgstr "'form' ne peut qu'tre une formule ou une liste de formules" msgid "'form' not consistent with 'nam'" msgstr "'form' non conforme avec 'nam'" msgid "length of 'nam' not consistent with dimensions of initial value" msgstr "la longueur de 'nam' ne correspond pas aux dimensions initiales" msgid "no default method for extracting the square root of a \"pdMat\" object" msgstr "" "pas de mthode par dfaut pour extraire la racine carre de l'objet \"pdMat\"" msgid "do not know how to obtain constrained coefficients" msgstr "impossible d'obtenir les coefficients de contrainte" msgid "" "cannot access the number of columns of uninitialized objects without names" msgstr "" "impossible de changer le nombre de colonnes d'un objet non initialis et " "sans noms" msgid "cannot extract the log of the determinant from an uninitialized object" msgstr "" "impossible d'extraire le logarithme du dterminant d'un objet non initialis" msgid "cannot change dimensions on an initialized \"pdMat\" object" msgstr "impossible de changer les dimensions d'un objet \"pdMat\" initialis" msgid "Length of names should be %d" msgstr "La longueur des noms devrait tre %d" msgid "" "names being assigned do not correspond to a permutation of previous names" msgstr "" "les noms affect ne correspondent pas une permutation des noms de dpart" msgid "x-y data to splom got botched somehow" msgstr "les donnes x-y de 'splom' ont t corrompus" msgid "cannot get the inverse of an uninitialized object" msgstr "impossible d'obtenir l'inverse d'un objet non initialis" msgid "an object of length %d does not match the required parameter size" msgstr "" "un objet de longeur %d ne correspond pas la taille requise du paramtre" msgid "cannot extract matrix from an uninitialized object" msgstr "impossible d'extraire une matrice pour un objet non initialis" msgid "cannot extract the inverse from an uninitialized object" msgstr "impossible d'extraire l'inverse d'un objet non initialis" msgid "an object of length %d does not match a Cholesky factor" msgstr "" "un objet de longueur %d ne correspond pas une factorisation de Cholesky" msgid "cannot extract the matrix from an uninitialized object" msgstr "impossible d'extraire la matrice d'un objet non initialis" msgid "cannot extract the matrix from an uninitialized \"pdIdent\" object" msgstr "impossible d'extraire la matrice d'un objet \"pdIdent\" non initialis" msgid "cannot extract the matrix with uninitialized dimensions" msgstr "" "impossible d'extraire la matrice en utilisant des dimensions non initialises" msgid "" "must give names when initializing \"pdIdent\" from parameter without a " "formula" msgstr "" "il faut fournir les noms lorsqu'un objet \"pdIdent\" est initialis depuis " "un paramtre sans fournir de formule" msgid "cannot extract the dimensions" msgstr "impossible d'extraire les dimensions" msgid "cannot extract the matrix from an uninitialized \"pdCompSymm\" object" msgstr "" "impossible d'extraire la matrice d'un objet \"pdCompSymm\" non initialis" msgid "initializing \"pdCompSymm\" object is not positive definite" msgstr "l'initialisation d'un objet \"pdCompSymm\" n'est pas fini et positif" msgid "" "must give names when initializing \"pdCompSymm\" from parameter without a " "formula" msgstr "" "il faut fournir les noms lors de l'initialisation de \"pdCompSymm\" depuis " "un paramtre sans fournir de formule" msgid "cannot obtain constrained coefficients with uninitialized dimensions" msgstr "" "impossible d'obtenir les coefficients de contrainte avec des dimensions non " "initialises" msgid "cannot access the matrix of object without names" msgstr "" "impossible d'accder la matrice d'un objet dont les noms ne sont pas " "dfinis" msgid "'form' must be a list" msgstr "'form' doit tre une liste" msgid "'nam' must be a list" msgstr "'nam' doit tre une liste" msgid "'form' and 'nam' have incompatible lengths" msgstr "'form' et 'nam' ont des tailles incompatibles" msgid "'pdClass' must be a character vector" msgstr "'pdClass' doit tre un vecteur de chanes de caractres" msgid "'form' and 'pdClass' have incompatible lengths" msgstr "'form' et 'pdClass' ont des longueurs incompatibles" msgid "'nam' and 'pdClass' have incompatible lengths" msgstr "'nam' et 'pdClass' ont des longueurs incompatibles" msgid "LNone of the arguments specify more than one block" msgstr "Aucun des arguments ne spcifie plus d'un bloc" msgid "'object' must be a list when not missing, not a matrix, and not numeric" msgstr "" "'object' doit tre une liste, lorsqu'il n'est pas manquant, pas une matrice " "ou un nombre" msgid "arguments imply different number of blocks" msgstr "les arguments impliquent des nombres diffrents de blocs" msgid "all elements in the argument must generate \"pdMat\" objects" msgstr "tous les lments dans l'argument doivent gnrer des objets \"pdMat\"" msgid "cannot have duplicated column names in a \"pdMat\" object" msgstr "" "les noms de colonnes dupliqus ne sont pas permis dans un objet \"pdMat\"" msgid "must have formula when no names are given" msgstr "une formule est ncessaire lorsque les noms ne sont pas fournis" msgid "must give names when initializing from matrix or parameter" msgstr "" "lors de l'initialisation depuis une matrice ou un paramtre, il faut fournir " "les noms" msgid "all elements must have names when any has names" msgstr "tous les lments doivent tre nomms, lorsqu'au moins un l'est" msgid "all elements must have a non-zero size" msgstr "tous les lments doivent avoir une taille non nulle" msgid "cannot change the parameter when length of parameters is undefined" msgstr "" "le paramtre ne peut tre modifi lorsque la longueur des paramtres est " "indfinie" msgid "cannot change parameter length of initialized \"pdMat\" object" msgstr "" "impossible de changer la longueur des paramtres dans un objet \"pdMat\" " "initialis" msgid "all elements must have formulas when any has a formula" msgstr "" "tous les lments doivent contenir des formules, si au moins l'un d'eux en " "contient une" msgid "" "all elements of formula must be list of two-sided formulae or two-sided " "formulae" msgstr "" "tous les lments de type formule doivent tre des listes de formules deux " "membres ou des formules deux membres" msgid "cannot change the number of columns on an initialized object" msgstr "impossible de changer le nombre de colonnes d'un objet initialis" msgid "names of object and value must match" msgstr "les noms de l'objet et ses valeurs ne correspondent pas" msgid "\"pdMat\" element must have a formula" msgstr "l'lment \"pdMat\" doit contenir une formule" msgid "'object' must be a list or a formula" msgstr "'object' doit tre une liste ou une formule" msgid "\"pdMat\" elements must have a formula" msgstr "les lments de \"pdMat\" doivent contenir des formules" msgid "elements in 'object' must be formulas or \"pdMat\" objects" msgstr "" "les lments dans 'object' doivent tre des formules ou des objets \"pdMat\"" msgid "cannot change parameter length of initialized objects" msgstr "" "la longueur du paramtre ne peut tre modifie dans les objets initialiss" msgid "cannot extract groups formula without a formula" msgstr "impossible d'extraire les groupes sans une formule disposition" msgid "all elements of a \"reStruct\" object must have a non-zero size" msgstr "" "tous les lments d'un objet \"reStruct\" doivent avoir une taille non nulle" msgid "cannot change the length of 'object'" msgstr "impossible de modifier la taille de 'object'" msgid "cannot extract model matrix without formula" msgstr "" "impossible d'extraire la matrice du modle sans une formule disposition" msgid "incompatible lengths for object names" msgstr "longueurs non compatibles pour les noms de l'objet" msgid "" "'data' must inherit from \"groupedData\" class if 'random' does not define " "groups" msgstr "" "'data' doit hriter de la classe \"groupedData\" si 'random' ne dfinit pas " "les groupes" msgid "models with \"corStruct\" and/or \"varFunc\" objects not allowed" msgstr "" "les modles avec objets \"corStruct\" et / ou \"varFunc\" ne sont pas " "autoriss" msgid "no degrees of freedom specified" msgstr "aucun degr de libert n'est spcifi" msgid "plot method only implemented for comparing models" msgstr "la mthode 'plot' n'est implmente que pour la comparaison de modles" msgid "degrees of freedom and weights must have the same length" msgstr "les degrs de libert et les pondrations doivent avoir la mme taille" msgid "negative degrees of freedom not allowed" msgstr "des degrs de libert ngatifs ne sont pas permis" msgid "more than one degree of freedom is needed when one them is zero." msgstr "" "plus d'un degr de libert est ncessaire lorsque l'un d'entre eux vaut zro." msgid "" "can only construct \"varFunc\" object from another \"varFunc\" object, a " "formula, or a character string" msgstr "" "un objet \"varFunc\" ne peut tre construit qu' partir d'un autre objet " "\"varFunc\", une formula ou une chane de caractres" msgid "cannot extract parameters of uninitialized object" msgstr "impossible d'extraire les paramtres d'objets non initialiss" msgid "do not know how to get coefficients for %s object" msgstr "impossible d'obtenir les coefficients de l'objet %s" msgid "cannot change the length of covariate in \"varFunc\" object" msgstr "" "impossible de changer la longueur de la covariable dans l'objet \"varFunc\"" msgid "'value' must be a one sided formula" msgstr "'value' doit tre une formule un seul membre" msgid "'form' must have a covariate" msgstr "'form' doit avoir une covariable" msgid "ignoring 'group' in \"varFixed\" formula" msgstr "'group' est ignor dans la formule \"varFixed\"" msgid "all variables used in 'formula' must be in 'data'" msgstr "" "toutes les variables utilises dans 'formula' doivent aussi se retrouver " "dans 'data'" #, fuzzy msgid "ignoring initial values (no grouping factor)" msgstr "" "'subset' ignor lors de l'utilisation d'un seul facteur pour le regroupement" msgid "initial values must have group names in 'varIdent'" msgstr "" "les valeurs initiales doivent avoir des noms de groupes dans 'varIdent'" msgid "initial values for 'varIdent' must be > 0" msgstr "les valeurs initiales pour 'varIdent' doivent tre > 0" msgid "fixed parameters must have names in 'varIdent'" msgstr "les paramtres fixs doivent avoir leurs noms dans 'varIdent'" msgid "" "cannot change the length of the \"varIdent\" parameter after initialization" msgstr "" "impossible de changer la longueur du paramtre \"varIdent\" aprs " "l'initialisation" msgid "fixed parameter names in 'varIdent' must be a subset of group names" msgstr "" "les noms des paramtres fixs dans 'varIdent' doivent tre un sous-ensemble " "des noms de groupes" msgid "cannot fix variances in all groups" msgstr "impossible de fixer les variances de tous les groupes" msgid "initial value for \"varIdent\" should be of length %d" msgstr "la valeur initiale de \"varIdent\" doit tre de longueur %d" msgid "" "names of starting value for \"varIdent\" object must contain all but one of " "the stratum levels" msgstr "" "les noms des valeurs de dpart pour \"varIdent\" doivent contenir tous les " "niveaux stratifis sauf un" msgid "nonexistent group names for initial values in 'varIdent'" msgstr "noms de groupes inexistants pour les valeurs initiales dans 'varIdent'" msgid "initial values must have group names in 'varPower'" msgstr "" "les valeurs initiales doivent avoir des noms de groupes dans 'varPower'" msgid "fixed parameters must have group names in 'varPower'" msgstr "les paramtres fixs doivent avoir des noms de groupes dans 'varPower'" msgid "" "cannot change the length of the \"varStruct\" parameter after initialization" msgstr "" "impossible de changer la longueur du paramtre \"varStruct\" aprs " "l'initialisation" msgid "" "cannot change coefficients before initialization or when all parameters are " "fixed" msgstr "" "impossible de changer les coefficients avant initialisation ou lorsque tous " "les paramtres sont fixs" msgid "fixed parameters must have group names" msgstr "les paramtres fixs doivent avoir des noms de groupes" msgid "mismatch between group names and fixed values names" msgstr "incohrence entre les noms de groupes et les noms des valeurs fixes" msgid "initial value for \"varPower\" should be of length %d" msgstr "la valeur initiale pour \"varPower\" devrait tre de longueur %d" msgid "nonexistent group names for initial values in \"varPower\"" msgstr "noms de groupes inexistants pour les valeurs initiales de \"varPower\"" msgid "initial value for \"varPower\" should be of length 1" msgstr "la valeur initiale pour \"varPower\" devrait tre de longueur 1" msgid "initial values must have group names in 'varExp'" msgstr "les valeurs initiales doivent avoir des noms de groupes dans 'varExp'" msgid "fixed parameters must have group names in 'varExp'" msgstr "les paramtres fixes doivent avoir des noms de groupes dans 'varExp'" msgid "" "cannot change the length of the \"varExp\" parameter after initialization" msgstr "" "impossible de changer la longueur du paramtre \"varExp\" aprs " "l'initialisation" msgid "initial value for \"varExp\" should be of length %d" msgstr "la valeur initiale pour \"varExp\" doit tre de longueur %d" msgid "nonexistent group names for initial values in \"varExp\"" msgstr "noms de groupes inexistants pour les valeurs initiales de \"varExp\"" msgid "initial value for \"varExp\" should be of length 1" msgstr "la valeur initiale pour \"varExp\" devrait tre de longueur 1" msgid "%s can have at most two components" msgstr "%s peut avoir jusqu' deux composantes" msgid "%s can only have names \"const\" and \"power\"" msgstr "%s ne peut avoir que les noms \"const\" et \"power\"" msgid "%s can only be a list or numeric" msgstr "%s ne peut qu'tre une liste, ou un nombre" msgid "%s must have group names in 'varConstPower'" msgstr "%s doit avoir des noms de groupes dans 'varConstPower'" msgid "constant in \"varConstProp\" structure must be > 0" msgstr "la constante dans la structure \"varConstPower\" doit tre > O" msgid "initial value should be of length %d" msgstr "la valeur initiale doit tre de longueur %d" msgid "nonexistent group names for initial values" msgstr "noms de groupes inexistants pour les valeurs initiales" msgid "%s can only have names \"const\" and \"prop\"" msgstr "%s ne peut avoir que les noms \"const\" et \"prop\"" msgid "%s must have group names in 'varConstProp'" msgstr "%s doit avoir des noms de groupes dans 'varConstProp'" msgid "all arguments to 'varComb' must be of class \"varFunc\"." msgstr "tous les arguments de 'varComb' doivent tre de classe \"varFunc\"." msgid "cannot change parameter length of initialized \"varComb\" object" msgstr "" "impossible de modifier la longueur du paramtre pour des objets \"varComb\" " "initialiss" msgid "deviance undefined for REML fit" msgstr "" msgid "AIC undefined for REML fit" msgstr "" msgid "" "not (yet) implemented. Contributions are welcome; use intervals() instead " "(for now)" msgstr "" msgid "term %s not matched" msgid_plural "terms %s not matched" msgstr[0] "le terme %s est incohrent" msgstr[1] "les termes %s sont incohrents" msgid "'L' must have at most %d column" msgid_plural "'L' must have at most %d columns" msgstr[0] "'L' doit avoir au moins %d colonne" msgstr[1] "'L' doit avoir au moins %d colonnes" msgid "effect %s not matched" msgid_plural "effects %s not matched" msgstr[0] "effet %s incohrent" msgstr[1] "effets %s incohrent" msgid "supplied %d starting value, need %d" msgid_plural "supplied %d starting values, need %d" msgstr[0] "" msgstr[1] "" msgid "%s not found in data" msgid_plural "%s not found in data" msgstr[0] "%s non trouv dans les donnes" msgstr[1] "%s non trouv dans les donnes" msgid "nonexistent level %s" msgid_plural "nonexistent levels %s" msgstr[0] "niveau inexistant %s" msgstr[1] "niveaux inexistants %s" msgid "%s not available for plotting" msgid_plural "%s not available for plotting" msgstr[0] "%s non disponible pour le graphe" msgstr[1] "%s non disponibles pour le graphe" msgid "%s not matched" msgid_plural "%s not matched" msgstr[0] "%s non assorti" msgstr[1] "%s non assortis" msgid "group name not matched in starting values for random effects: %s" msgid_plural "" "group names not matched in starting values for random effects: %s" msgstr[0] "" "le nom de groupe ne correspond pas aux valeurs de dpart pour les effets " "alatoires : %s" msgstr[1] "" "les noms des groupes ne correspondent pas aux valeurs de dpart pour les " "effets alatoires : %s" #~ msgid "" #~ "approximate covariance matrix for parameter estimates not of full rank" #~ msgstr "" #~ "matrice de covariance approximative pour les estimateurs de paramtres " #~ "qui ne sont pas de rang complet" nlme/po/pl.po0000644000176000001440000000440214632316272012634 0ustar ripleyusersmsgid "" msgstr "" "Project-Id-Version: nlme 3.1-115\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-06-06 12:49+0200\n" "PO-Revision-Date: 2012-05-29 07:55+0100\n" "Last-Translator: Łukasz Daniel \n" "Language-Team: Łukasz Daniel \n" "Language: pl_PL\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: corStruct.c:424 msgid "All parameters must be less than 1 in absolute value" msgstr "Wszystkie parametry muszą być na moduł mniejsze niż 1" #: corStruct.c:535 msgid "Coefficient matrix not invertible" msgstr "Macierz współczynników nie jest odwracalna" #: corStruct.c:872 corStruct.c:927 corStruct.c:987 corStruct.c:1029 msgid "Unknown spatial correlation class" msgstr "Nieznana klasa przestrzennej korelacji" #: nlme.c:468 msgid "First observation on an individual must have a dose" msgstr "Pierwsza obserwacja jednostki musi mieć zamknięcie" #: nlmefit.c:426 #, c-format msgid "Singularity in backsolve at level %ld, block %ld" msgstr "Osobliwość w 'backsolve' na poziomie %ld, blok %ld" #: nlmefit.c:464 #, c-format msgid "" "Too many parameters for finite-difference Hessian; npar = %d, nTot = %g." msgstr "" #: nlmefit.c:575 nlmefit.c:756 msgid "Overfitted model!" msgstr "" #: nlmefit.c:601 msgid "analytic gradient is not available with matrix logarithm" msgstr "gradient analityczny nie jest dostępny z algorytmem macierzowym" #: nlmefit.c:624 msgid "analytic gradient is not available with compound symmetry" msgstr "gradient analityczny nie jest dostępny dla złożonej symetrii" #: nlmefit.c:917 #, c-format msgid "Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]" msgstr "" "Nie można uformować dekompozycji wartość własna-wektor własny [RS(.) ierr = " "%d]" #: nlmefit.c:949 #, fuzzy, c-format msgid "" "Unable to form Cholesky decomposition: the leading minor of order %d is not " "pos.def." msgstr "Nie można uformować dekompozycji Cholesky'ego" #: nlmefit.c:981 msgid "Haven't written the compound symmetry case for this yet" msgstr "Jak na razie nie została napisany przypadek dla tej złożonej symetrii" nlme/po/R-pl.po0000644000176000001440000040320014772467244013045 0ustar ripleyusersmsgid "" msgstr "" "Project-Id-Version: nlme 3.1-115\n" "Report-Msgid-Bugs-To: bugs@r-project.org\n" "POT-Creation-Date: 2025-03-31 10:29\n" "PO-Revision-Date: 2014-03-25 17:00+0100\n" "Last-Translator: Łukasz Daniel \n" "Language-Team: Łukasz Daniel \n" "Language: pl_PL\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" "X-Poedit-SourceCharset: iso-8859-1\n" "X-Generator: Poedit 1.5.4\n" "X-Poedit-Bookmarks: -1,-1,-1,72,-1,-1,-1,-1,-1,-1\n" msgid "not implemented for \"nlme\" objects" msgstr "" "funkcja 'getVarCov.lme()' nie jest zaimplementowana dla obiektów klasy " "\"nlme\"" # nlme/R/VarCov.R: 28 # stop("'getVarCov.lme()' is not implemented for multiple levels of nesting") msgid "not implemented for multiple levels of nesting" msgstr "" "funkcja 'getVarCov.lme()' nie jest zaimplementowana dla wielu poziomów " "zagnieżdżenia" # nlme/R/VarCov.R: 47 # stop(gettextf("individual %s was not used in the fit", sQuote(individ)), domain = "R-nlme") # nlme/R/VarCov.R: 49 # stop(gettextf("individual %s was not used in the fit", sQuote(individ)), domain = "R-nlme") msgid "individual %s was not used in the fit" msgstr "jednostka %s nie została użyta w dopasowaniu" #, fuzzy msgid "not implemented for uncorrelated errors" msgstr "" "funkcja 'getVarCov.lme()' nie jest zaimplementowana dla obiektów klasy " "\"nlme\"" #, fuzzy msgid "not implemented for correlation structures without a grouping factor" msgstr "Niezainicjalizowana struktura korelacji klasy %s" # nlme/R/corStruct.R: 60 # stop(gettextf("do not know how to calculate correlation matrix of %s object", dQuote(class(object)[1])), domain = "R-nlme") msgid "do not know how to calculate correlation matrix of %s object" msgstr "nie wiadomo jak policzyć macierz korelacji obiektu %s" # nlme/R/corStruct.R: 107 # stop("\"corStruct\" object must have a \"fixed\" attribute") msgid "\"corStruct\" object must have a \"fixed\" attribute" msgstr "obiekt \"corStruct\" musi posiadać atrybut \"fixed\"." # nlme/R/corStruct.R: 115 # stop(gettextf("do not know how to obtain parameters of %s object", dQuote(class(object)[1])), domain = "R-nlme") msgid "do not know how to obtain parameters of %s object" msgstr "nie wiadomo jak uzyskać parametry obiektu %s" msgid "cannot change the length of the parameter of a \"corStruct\" object" msgstr "nie można zmienić długości parametru obiektu klasy \"corStruct\"" msgid "" "'sumLenSq := sum(table(groups)^2)' = %g is too large.\n" " Too large or no groups in your correlation structure?" msgstr "" # nlme/R/corStruct.R: 160 # warning("cannot change 'form' argument") msgid "cannot change 'form'" msgstr "nie można zmienić argumentu 'form'" msgid "need data to calculate covariate of \"corStruct\" object" msgstr "" "argument 'data' jest wymagany aby wyliczyć zmienną wyjaśniającą obiektu " "klasy \"corStruct\"" msgid "cannot change the length of the parameter of a \"corSymm\" object" msgstr "nie można zmienić długości parametru obiektu klasy \"corSymm\"" msgid "covariate must have unique values within groups for \"corSymm\" objects" msgstr "" "zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów " "klasy \"corSymm\"" msgid "" "unique values of the covariate for \"corSymm\" objects must be a sequence " "of consecutive integers" msgstr "" "unikalne wartości zmiennej wyjaśniającej dla obiektów klasy \"corSymm\" " "muszą być ciągiem kolejnych liczb całkowitych" # nlme/R/corStruct.R: 465 # stop("initial value for \"corSymm\" parameters are of wrong dimension") msgid "initial value for \"corSymm\" parameters of wrong dimension" msgstr "" "początkowe wartości dla parametrów \"corSymm\" posiadają niepoprawne wymiary" msgid "initial values for \"corSymm\" must be between -1 and 1" msgstr "początkowe wartości dla \"corNatural\" muszą być pomiędzy -1 a 1" # nlme/R/corStruct.R: 475 # stop("initial values for \"corSymm\" do not define a positive-definite correlation structure") msgid "" "initial values for \"corSymm\" do not define a positive-definite correlation " "structure" msgstr "" "początkowe wartości dla \"corSymm\" nie definiują dodatnio określonej " "struktury korelacji" msgid "cannot change the length of the parameter of a \"corNatural\" object" msgstr "nie można zmienić długości parametru obiektu klasy \"corNatural\"" msgid "" "covariate must have unique values within groups for \"corNatural\" objects" msgstr "" "zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów " "klasy \"corNatural\"" msgid "" "unique values of the covariate for \"corNatural\" objects must be a sequence " "of consecutive integers" msgstr "" "unikalne wartości zmiennej wyjaśniającej dla obiektów klasy \"corNatural\" " "muszą być ciągiem kolejnych liczb całkowitych" # nlme/R/corStruct.R: 705 # stop("initial value for \"corNatural\" parameters of wrong dimension") msgid "initial value for \"corNatural\" parameters of wrong dimension" msgstr "" "początkowe wartości dla parametrów \"corNatural\" posiadają niepoprawne " "wymiary" msgid "initial values for \"corNatural\" must be between -1 and 1" msgstr "początkowe wartości dla \"corNatural\" muszą być pomiędzy -1 a 1" # nlme/R/corStruct.R: 715 # stop("initial values for \"corNatural\" do not define a positive-definite correlation structure") msgid "" "initial values for \"corNatural\" do not define a positive-definite " "correlation structure" msgstr "" "początkowe wartości dla \"corNatural\" nie definiują dodatnio określonej " "strukture korelacji" msgid "parameter in AR(1) structure must be between -1 and 1" msgstr "parametr w strukturze AR(1) musi być pomiędzy -1 a 1" msgid "'sumLenSq' = %g is too large (larger than maximal integer)" msgstr "" msgid "cannot change the length of the parameter of a \"corAR1\" object" msgstr "nie można zmienić długości parametru obiektu klasy \"corCAR1\"" msgid "covariate must have unique values within groups for \"corAR1\" objects" msgstr "" "zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów " "klasy \"corCAR1\"" msgid "parameter in CAR(1) structure must be between 0 and 1" msgstr "parametr w strukturze AR(1) musi być pomiędzy 0 a 1" msgid "cannot change the length of the parameter of a \"corCAR1\" object" msgstr "nie można zmienić długości parametru obiektu klasy \"corCAR1\"" msgid "covariate must have unique values within groups for \"corCAR1\" objects" msgstr "" "zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów " "klasy \"corCAR1\"" # nlme/R/corStruct.R: 1177 # stop("autoregressive order must be a non-negative integer") msgid "autoregressive order must be a non-negative integer" msgstr "rząd autoregresji musi być nieujemną liczbą całkowitą" # nlme/R/corStruct.R: 1180 # stop("moving average order must be a non-negative integer") msgid "moving average order must be a non-negative integer" msgstr "rząd średniej ruchomej musi być nieujemną liczbą całkowitą" # nlme/R/varFunc.R: 270 # stop("initial values for 'varIdent' must be > 0") #, fuzzy msgid "at least one of 'p' and 'q' must be > 0" msgstr "początkowe wartości dla 'varIdent' muszą być > 0" # nlme/R/corStruct.R: 1186 # stop("initial value for parameter of wrong length") msgid "initial value for parameter of wrong length" msgstr "początkowa wartość parametru posiada niepoprawną długość" msgid "parameters in ARMA structure must be < 1 in absolute value" msgstr "parametry w strukturze ARMA muszą być pomiędzy -1 a 1" # nlme/R/corStruct.R: 1208 # stop("'object' argument has not been initialized with 'Initialize()' function") # nlme/R/corStruct.R: 1241 # stop("'object' argument has not been initialized with 'Initialize()' function") # nlme/R/corStruct.R: 1311 # stop("'object' argument has not been initialized with 'Initialize()' function") # nlme/R/corStruct.R: 1364 # stop("'object' argument has not been initialized with 'Initialize()' function") msgid "'object' has not been Initialize()d" msgstr "argument 'object' nie został zainicjalizowany metodą 'Initialize()'" msgid "cannot change the length of the parameter of a \"corARMA\" object" msgstr "nie można zmienić długości parametru obiektu klasy \"corARMA\"" #, fuzzy msgid "" "covariate must have unique integer values within groups for \"corARMA\" " "objects" msgstr "" "zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów " "klasy \"corARMA\"" msgid "\"corARMA\" order (%g, %g) exceeds maximum lag in data (%g)" msgstr "" msgid "parameter in \"corCompSymm\" structure must be < 1 in absolute value" msgstr "parametr w strukturze \"corCompSymm\" musi być pomiędzy -1 a 1" msgid "cannot change the length of the parameter of a \"corCompSymm\" object" msgstr "nie można zmienić długości parametru obiektu klasy \"corCompSymm\"" # nlme/R/corStruct.R: 1516 # stop(sprintf(gettext("initial value in \"corCompSymm\" must be greater than %s", domain = "R-nlme"), attr(object, "inf")), domain = NA) msgid "initial value in \"corCompSymm\" must be greater than %s" msgstr "początkowa wartość w \"corCompSymm\" musi być większa niż %s" # nlme/R/corStruct.R: 1851 # stop("cannot change the length of the parameter after initialization") # nlme/R/varFunc.R: 998 # stop("cannot change the length of the parameter after initialization") # nlme/R/pdMat.R: 256 # stop("cannot change the length of the parameter after initialization") msgid "cannot change the length of the parameter after initialization" msgstr "nie można zmienić długości parametru po jego zainicjowaniu" msgid "need data to calculate covariate" msgstr "" "argument 'data' jest wymagany aby wyliczyć zmienną wyjaśniającą obiektu " "klasy \"corSpatial\"" # nlme/R/corStruct.R: 1930 # stop("cannot have zero distances in \"corSpatial\"") msgid "cannot have zero distances in \"corSpatial\"" msgstr "nie można mieć zerowych odległości w \"corSpatial\"" # nlme/R/corStruct.R: 1948 # stop("'range' must be > 0 in \"corSpatial\" initial value") msgid "'range' must be > 0 in \"corSpatial\" initial value" msgstr "argument 'range' musi być > 0 w początkowej wartości \"corSpatial\"" # nlme/R/corStruct.R: 1955 # stop("initial value for \"corSpatial\" parameters of wrong dimension") # nlme/R/corStruct.R: 1963 # stop("initial value for \"corSpatial\" parameters of wrong dimension") msgid "initial value for \"corSpatial\" parameters of wrong dimension" msgstr "początkowa wartość parametrów \"corSpatial\" ma niepoprawny wymiar" # nlme/R/corStruct.R: 1959 # stop("initial value of nugget ratio must be between 0 and 1") # nlme/R/corStruct.R: 2133 # stop("initial value of nugget ratio must be between 0 and 1") # nlme/R/corStruct.R: 2254 # stop("initial value of nugget ratio must be between 0 and 1") msgid "initial value of nugget ratio must be between 0 and 1" msgstr "początkowa wartość proporcji samorodka musi być pomiędzy 0 a 1" # nlme/R/corStruct.R: 1948 # stop("'range' must be > 0 in \"corSpatial\" initial value") msgid "'range' must be > 0 in \"corLin\" initial value" msgstr "argument 'range' musi być > 0 w początkowej wartości \"corLin\"" # nlme/R/corStruct.R: 2121 # warning("initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)") # nlme/R/corStruct.R: 2242 # warning("initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)") msgid "" "initial value for 'range' less than minimum distance. Setting it to 1.1 * " "min(distance)" msgstr "" "początkowa wartość 'range' mniejsza niż minimalna odległość. Ustawianie jej " "na '1.1 * min(distance)'" # nlme/R/corStruct.R: 2129 # stop("initial value for \"corLin\" parameters of wrong dimension") # nlme/R/corStruct.R: 2137 # stop("initial value for \"corLin\" parameters of wrong dimension") msgid "initial value for \"corLin\" parameters of wrong dimension" msgstr "początkowa wartość parametrów \"corLin\" ma niepoprawny wymiar" # nlme/R/corStruct.R: 2239 # stop("range must be > 0 in \"corSpher\" initial value") msgid "range must be > 0 in \"corSpher\" initial value" msgstr "zakres musi być > 0 w początkowej wartości \"corShere\"" # nlme/R/corStruct.R: 2250 # stop("initial value for \"corSpher\" parameters of wrong dimension") # nlme/R/corStruct.R: 2258 # stop("initial value for \"corSpher\" parameters of wrong dimension") msgid "initial value for \"corSpher\" parameters of wrong dimension" msgstr "początkowa wartość parametrów \"corSpher\" ma niepoprawny wymiar" # nlme/R/gls.R: 48 # stop("'model' argument must be a formula of the form \"resp ~ pred\"") msgid "model must be a formula of the form \"resp ~ pred\"" msgstr "" "argument 'model' musi być formułą o formie \"zmienna zależna ~ zmienna " "niezależna\"" msgid "offset() terms are not supported" msgstr "" # nlme/R/gls.R: 93 # stop("no coefficients to fit") msgid "no coefficients to fit" msgstr "brak współczynników do dopasowania" # nlme/R/gls.R: 173 # stop("maximum number of iterations reached without convergence") # nlme/R/gnls.R: 466 # warning("maximum number of iterations reached without convergence") # nlme/R/gnls.R: 469 # stop("maximum number of iterations reached without convergence") # nlme/R/nlme.R: 948 # warning("maximum number of iterations reached without convergence") # nlme/R/nlme.R: 951 # stop("maximum number of iterations reached without convergence") msgid "maximum number of iterations reached without convergence" msgstr "maksymalna liczba iteracji została osiągnięta bez uzyskania zbieżności" # nlme/R/gls.R: 322 # stop(gettextf("computed \"gls\" fit is singular, rank %s", rnk), domain = "R-nlme") msgid "computed \"gls\" fit is singular, rank %s" msgstr "obliczone dopasowanie \"gls\" jest osobliwe, ranga %s" msgid "object must inherit from class %s" msgstr "argument 'object' nie jest obiektem klasy %s" msgid "'Terms' must be between 1 and %d" msgstr "argument 'Terms' musi być pomiędzy 1 a %d" # nlme/R/gls.R: 466 # stop("terms can only be integers or characters") # nlme/R/lme.R: 902 # stop("terms can only be integers or characters") msgid "terms can only be integers or characters" msgstr "człony mogą być tylko liczbami całkowitymi lub tekstami" # nlme/R/gls.R: 541 # stop(gettextf("data in %s call must evaluate to a data frame", sQuote(substitute(object))), domain = "R-nlme") # nlme/R/lme.R: 1084 # stop(gettextf("data in %s call must evaluate to a data frame", sQuote(substitute(object))), domain = "R-nlme") msgid "data in %s call must evaluate to a data frame" msgstr "dane w wywołaniu %s muszą wyliczać się do ramki danych" # nlme/R/gls.R: 545 # stop(gettextf("%s without \"primary\" can only be used with fits of \"groupedData\" objects", sys.call()[[1L]]), domain = "R-nlme") # nlme/R/lme.R: 1088 # stop(gettextf("%s without \"primary\" can only be used with fits of \"groupedData\" objects", sys.call()[[1L]]), domain = "R-nlme") # nlme/R/lmList.R: 117 # stop(gettextf("%s without \"primary\" can only be used with fits of \"groupedData\" objects", sys.call()[[1]]), domain = "R-nlme") msgid "" "%s without \"primary\" can only be used with fits of \"groupedData\" objects" msgstr "" "%s bez \"primary\" może być użyte jedynie z dopasowaniami obiektów " "\"groupedData\"" # nlme/R/gls.R: 628 # stop("only one level allowed for predictions") msgid "only one level allowed for predictions" msgstr "tylko jeden poziom jest dozwolony dla przewidywań" # nlme/R/gls.R: 657 # stop(gettextf("%s and %s must have the same group levels", sQuote(c1), sQuote(c2)), domain = "R-nlme") msgid "%s and %s must have the same group levels" msgstr "%s oraz %s muszą mieć te same poziomy grup" # nlme/R/gls.R: 670 # stop("wrong group levels") # nlme/R/gls.R: 684 # stop("wrong group levels") msgid "wrong group levels" msgstr "błędne poziomy grupy" # nlme/R/gls.R: 772 # stop(gettextf("cannot get confidence intervals on var-cov components: %s", aV), domain = "R-nlme") # nlme/R/lme.R: 1302 # stop(gettextf("cannot get confidence intervals on var-cov components: %s", aV), domain = "R-nlme") msgid "cannot get confidence intervals on var-cov components: %s" msgstr "nie można uzyskać przedziałów ufności na komponentach var-cov: %s" # nlme/R/lmList.R: 1443 # stop("need an object with call component") msgid "need an object with call component" msgstr "wymagany jest obiekt z komponentem 'call'" # nlme/R/gls.R: 1217 # stop("'nint' is not consistent with 'breaks'") # nlme/R/lme.R: 2761 # stop("'nint' is not consistent with 'breaks'") msgid "'nint' is not consistent with 'breaks'" msgstr "'nint' jest niespójne z 'breaks'" msgid "Within-group std. dev. must be a positive numeric value" msgstr "" msgid "'object' must be a formula" msgstr "argument 'model' nie jest obiektem klasy \"formula\"" msgid "object formula must be of the form \"resp ~ pred\"" msgstr "" "formuła modelu musi mieć formę \"zmienna zależna ~ zmienna niezależna\"" # nlme/R/gnls.R: 85 # stop("'data' must be given explicitly to use 'nls' to get initial estimates") msgid "'data' must be given explicitly to use 'nls' to get initial estimates" msgstr "" "argument 'data' musi być podany bezpośrednio aby użyć 'nls()' w celu " "uzyskania początkowych oszacowań" # nlme/R/gnls.R: 89 # stop("no initial values for model parameters") msgid "no initial values for model parameters" msgstr "brak początkowych wartości dla parametrów modelu" # nlme/R/gnls.R: 102 # stop("starting estimates must have names when 'params' is missing") msgid "starting estimates must have names when 'params' is missing" msgstr "początkowe oszacowania muszą mieć nazwy gdy brakuje 'params'" msgid "'params' must be a formula or list of formulae" msgstr "argument 'params' musi być formułą lub listą formuł" msgid "formulae in 'params' must be of the form \"parameter ~ expr\"" msgstr "formuły w argumencie 'param' muszą mieć formę \"parametr ~ wyrażenie\"" msgid "step halving factor reduced below minimum in NLS step" msgstr "czynnik skracający krok został zredukowany poniżej minimum w kroku NLS" # nlme/R/gnls.R: 654 # stop("cannot calculate REML log-likelihood for \"gnls\" objects") msgid "cannot calculate REML log-likelihood for \"gnls\" objects" msgstr "" "nie można obliczyć REML logarytmu funkcji wiarygodności dla obiektów klasy " "\"gnls\"" msgid "first argument to 'groupedData' must be a two-sided formula" msgstr "" "pierwszy argument przekazywany do funkcji 'groupedData()' musi być " "dwustronną formułą" # nlme/R/groupedData.R: 34 # stop("right-hand side of first argument must be a conditional expression") # nlme/R/groupedData.R: 54 # stop("right-hand side of first argument must be a conditional expression") # nlme/R/groupedData.R: 154 # stop("right-hand side of first argument must be a conditional expression") msgid "right-hand side of first argument must be a conditional expression" msgstr "prawa strona pierwszego argumentu musi być wyrażeniem warunkowym" msgid "first argument to 'nfGroupedData' must be a two-sided formula" msgstr "" "pierwszy argument przekazywany do funkcji 'nmGroupedData()' musi być " "dwustronną formułą" # nlme/R/groupedData.R: 57 # stop("only one level of grouping allowed") msgid "only one level of grouping allowed" msgstr "tylko jeden poziom grupowania jest dozwolony" # nlme/R/groupedData.R: 67 # stop("second argument passed to 'groupedData()' function must inherit from \"data.frame\"") # nlme/R/groupedData.R: 176 # stop("second argument passed to 'groupedData()' function must inherit from \"data.frame\"") msgid "second argument to 'groupedData' must inherit from data.frame" msgstr "" "drugi argument przekazywany do funkcji 'groupedData()' musi dziedziczyć z " "klasy \"data.frame\"" msgid "first argument to 'nmGroupedData' must be a two-sided formula" msgstr "" "pierwszy argument przekazywany do funkcji 'nmGroupedData()' musi być " "dwustronną formułą" msgid "single group not supported -- use groupedData()" msgstr "" # nlme/R/groupedData.R: 219 # warning("'subset' ignored with single grouping factor") msgid "'subset' ignored with single grouping factor" msgstr "argument 'subset' został zignorowany z jednym czynnikem grupującym" msgid "'subset' must be a list" msgstr "argument 'subset' musi być listą" # nlme/R/groupedData.R: 234 # stop("undefined group declared in 'subset'") msgid "undefined group declared in 'subset'" msgstr "niezdefiniowana grupa zadeklarowana w argumencie 'subset'" # nlme/R/groupedData.R: 245 # stop("only one display level allowed") msgid "only one display level allowed" msgstr "tylko jeden poziom wyświetlenia jest dozwolony" # nlme/R/groupedData.R: 248 # stop(gettextf("undefined display level %s for %s", displayLevel, sQuote(substitute(object))), domain = "R-nlme") msgid "undefined display level %s for %s" msgstr "niezdefiniowany poziom %s wyświetlenia dla %s" # nlme/R/groupedData.R: 273 # stop(gettextf("undefined collapsing level %s for %s", collapseLevel, sQuote(substitute(object))), domain = "R-nlme") msgid "undefined collapsing level %s for %s" msgstr "niezdefiniowany poziom %s zapadania dla %s" # nlme/R/groupedData.R: 282 # warning("collapsing level cannot be smaller than display level; setting it to the display level") msgid "" "collapsing level cannot be smaller than display level; setting it to the " "display level" msgstr "" "poziom zapadania nie może być mniejszy niż poziom wyświetlania; ustawianie " "go do poziomu wyświetlania" msgid "'preserve' must be a two-sided formula" msgstr "argument 'preserve' musi być dwustronną formułą" # nlme/R/groupedData.R: 626 # stop("'asTable()' cannot be used with multilevel grouped data") msgid "'asTable' cannot be used with multilevel grouped data" msgstr "" "funkcja 'asTable()' nie może być użyta z wielopoziomowymi zgrupowanymi danymi" # nlme/R/groupedData.R: 630 # stop("'asTable()' can only be used with balanced 'groupedData' objects") msgid "'asTable' can only be used with balanced 'groupedData' objects" msgstr "" "funkcja 'asTable()' może być użyta jedynie ze zbalansowanymi obiektami klasy " "\"groupedData\"" # nlme/R/nlsList.R: 31 # stop("second argument must be a groupedData object") #, fuzzy msgid "'data' argument not used, but taken from groupedData object" msgstr "drugi argument musi być obiektem \"groupedData\"" # nlme/R/lmList.R: 56 # stop("multiple levels not allowed") # nlme/R/lmList.R: 71 # stop("multiple levels not allowed") # nlme/R/nlsList.R: 63 # stop("multiple levels not allowed") # nlme/R/nlsList.R: 74 # stop("multiple levels not allowed") msgid "multiple levels not allowed" msgstr "wielokrotne poziomy nie są dozwolone" # nlme/R/lmList.R: 65 # stop ("'data' must be a \"groupedData\" object if 'groups' argument is missing") msgid "'data' must be a \"groupedData\" object if 'groups' argument is missing" msgstr "" "argument 'data' musi być obiektem klasy \"groupedData\" jeśli brakuje " "argumentu 'groups' " # nlme/R/lmList.R: 113 # stop(gettextf("'data' in %s call must evaluate to a data frame", sQuote(substitute(object))), domain = "R-nlme") msgid "'data' in %s call must evaluate to a data frame" msgstr "argument 'data' w wywołaniu %s musi wyliczać się do ramki danych" # nlme/R/lmList.R: 232 # stop("nonexistent groups requested in 'subset'") # nlme/R/lmList.R: 237 # stop("nonexistent groups requested in 'subset'") # nlme/R/lmList.R: 1264 # stop("nonexistent groups requested in 'subset'") # nlme/R/lmList.R: 1269 # stop("nonexistent groups requested in 'subset'") msgid "nonexistent groups requested in 'subset'" msgstr "zażądano nieistniejących grup w argumencie 'subset'" # nlme/R/lmList.R: 240 # stop("'subset' can only be character or integer") # nlme/R/lmList.R: 1272 # stop("'subset' can only be character or integer") msgid "'subset' can only be character or integer" msgstr "argument 'subset' może być jedynie znakiem lub liczbą całkowitą" # nlme/R/lmList.R: 345 # stop("log-likelihood not available with NULL fits") msgid "log-likelihood not available with NULL fits" msgstr "logarytm funkcji wiarygodności nie jest dostępny z dopasowaniami NULL" msgid "'form' must be a formula" msgstr "argument 'form' nie jest obiektem klasy \"formula\"" msgid "'form' must be a one-sided formula" msgstr "argument 'form' musi być jednostronną formułą" # nlme/R/lme.R: 1462 # stop("covariate must be a data frame") # nlme/R/lmList.R: 422 # stop("covariate must be a data frame") msgid "covariate must be a data frame" msgstr "zmienna niezależna musi być ramką danych" # nlme/R/lme.R: 1473 # stop("cannot do pairs of just one variable") # nlme/R/lmList.R: 432 # stop("cannot do pairs of just one variable") msgid "cannot do pairs of just one variable" msgstr "nie można zrobić par tylko jednej zmiennej" msgid "'id' must be between 0 and 1" msgstr "argument 'id' musi być pomiędzy 0 a 1" msgid "'id' can only be a formula or numeric" msgstr "argument 'id' może być jedynie formułą lub liczbą" msgid "'idLabels' of incorrect length" msgstr "argument 'IdLabels' ma niepoprawną długość" msgid "'idLabels' can only be a formula or a vector" msgstr "argument 'IdLabels' może być jedynie formułą lub wektorem" # nlme/R/newMethods.R: 317 # stop("covariate must be numeric") # nlme/R/lmList.R: 696 # stop("covariate must be numeric") msgid "covariate must be numeric" msgstr "zmienna niezależna musi być liczbą" # nlme/R/lmList.R: 861 # stop("nonexistent group in 'newdata'") msgid "nonexistent group in 'newdata'" msgstr "nieistniejąca grupa w 'newdata'" # nlme/R/lmList.R: 870 # stop("nonexistent group requested in 'subset'") msgid "nonexistent group requested in 'subset'" msgstr "zażądano nieistniejącej grupy w 'subset'." # nlme/R/lme.R: 2279 # stop("only residuals and random effects allowed") # nlme/R/lmList.R: 1072 # stop("only residuals and random effects allowed") msgid "only residuals and random effects allowed" msgstr "tylko reszty oraz efekty losowe są dozwolone" # nlme/R/nlme.R: 90 # stop("can only fit \"nlsList\" objects with single grouping variable") msgid "can only fit \"lmList\" objects with single grouping variable" msgstr "" "można dopasować jedynie obiekty klasy \"lmList\" z pojedynczą zmienną " "grupującą" # nlme/R/lme.R: 72 # warning("'lme.lmList()' will redefine 'data' argument") msgid "'lme.lmList' will redefine 'data'" msgstr "funkcja 'lme.lmList()' przedefiniuje argument 'data'" # nlme/R/lme.R: 112 # warning("initial value for \"reStruct\" overwritten in 'lme.lmList()'") msgid "initial value for \"reStruct\" overwritten in 'lme.lmList'" msgstr "" "początkowa wartość dla \"reStruct\" została nadpisana w funkcji 'lme." "lmList()'" # nlme/R/simulate.R: 26 # stop("fixed-effects model must be a formula of the form \"resp ~ pred\"") # nlme/R/lme.R: 155 # stop("fixed-effects model must be a formula of the form \"resp ~ pred\"") msgid "fixed-effects model must be a formula of the form \"resp ~ pred\"" msgstr "" "model stałych efektów musi być formułą o formie \"zmienna zależna ~ zmienna " "niezależna\"" # nlme/R/simulate.R: 39 # stop("incompatible lengths for 'random' and grouping factors") # nlme/R/nlme.R: 206 # stop("incompatible lengths for 'random' and grouping factors") # nlme/R/lme.R: 168 # stop("incompatible lengths for 'random' and grouping factors") msgid "incompatible lengths for 'random' and grouping factors" msgstr "niespójne długości dla 'random' oraz czynników grupujących" msgid "incompatible formulas for groups in 'random' and 'correlation'" msgstr "niespójne formuły dla grup w 'random' oraz 'correlation'" # nlme/R/lme.R: 199 # warning("cannot use smaller level of grouping for 'correlation' than for 'random'. Replacing the former with the latter.") msgid "" "cannot use smaller level of grouping for 'correlation' than for 'random'. " "Replacing the former with the latter." msgstr "" "nie można użyć mniejszego poziomu grupowania dla 'correlation' niż dla " "'random'. Zastępowanie pierwszego drugim." # nlme/R/nlme.R: 559 # warning(gettextf("fewer observations than random effects in all level %s groups", Q), domain = "R-nlme") # nlme/R/lme.R: 292 # warning(gettextf("fewer observations than random effects in all level %s groups", Q), domain = "R-nlme") msgid "fewer observations than random effects in all level %s groups" msgstr "" "mniej obserwacji niż losowych efektów we wszystkich grupach w poziomie %s" # nlme/R/lme.R: 342 # gettextf("%s problem, convergence error code = %s\n message = %s", controlvals$opt, optRes$convergence, paste(optRes$message, collapse = "")) msgid "" "%s problem, convergence error code = %s\n" " message = %s" msgstr "" "problem %s, kod błędu zbieżności = %s\n" " komunikat = %s" # nlme/R/lme.R: 368 # gettext("maximum number of iterations (lmeControl(maxIter)) reached without convergence") msgid "" "maximum number of iterations (lmeControl(maxIter)) reached without " "convergence" msgstr "" "maksymalna liczba iteracji ('lmeControl(maxIter)') została osiągnięta bez " "uzyskania zbieżności" # nlme/R/lme.R: 907 # stop("terms must all have the same denominator DF") msgid "terms must all have the same denominator DF" msgstr "wszystkie człony muszą mieć ten sam mianownik DF" # nlme/R/lme.R: 950 # stop("L may only involve fixed effects with the same denominator DF") msgid "L may only involve fixed effects with the same denominator DF" msgstr "" "'L' może zawierać jedynie stałe efekty z tą samą liczbą stopni swobody " "mianownika" #, fuzzy msgid "objects must inherit from classes %s, or %s" msgstr "argument 'object' nie jest obiektem klasy \"gls\"" # nlme/R/lme.R: 988 # warning("some fitted objects deleted because response differs from the first model") msgid "" "some fitted objects deleted because response differs from the first model" msgstr "" "niektóre dopasowane obiekty zostały usunięte ponieważ zmienne zależne różnią " "się od pierwszego modelu" # nlme/R/lme.R: 990 # stop("first model has a different response from the rest") msgid "first model has a different response from the rest" msgstr "pierwszy model ma inną zmienną zależną od reszty" # nlme/R/lme.R: 1002 # stop("all fitted objects must have the same estimation method") msgid "all fitted objects must have the same estimation method" msgstr "wszystkie dopasowane obiekty muszą mieć tę samą metodę oszacowania" # nlme/R/lme.R: 1019 # warning("fitted objects with different fixed effects. REML comparisons are not meaningful.") msgid "" "fitted objects with different fixed effects. REML comparisons are not " "meaningful." msgstr "" "dopasowane obiekty z różnymi stałymi efektami. Porównania REML nie mają " "sensu." # nlme/R/lme.R: 1026 # stop("objects must have a \"call\" component or attribute") msgid "objects must have a \"call\" component or attribute" msgstr "obiekty muszą mieć komponent 'call' lub atrybut" # nlme/R/lme.R: 1036 # stop("all fitted objects must use the same number of observations") msgid "all fitted objects must use the same number of observations" msgstr "wszystkie dopasowane obiekty muszą używać tej samej liczby obserwacji" # nlme/R/lme.R: 1159 # stop("only single level allowed") # nlme/R/lme.R: 1655 # stop("only single level allowed") msgid "only single level allowed" msgstr "jedynie pojedynczy poziom jest dozwolony" # nlme/R/gls.R: 772 # stop(gettextf("cannot get confidence intervals on var-cov components: %s", aV), domain = "R-nlme") # nlme/R/lme.R: 1302 # stop(gettextf("cannot get confidence intervals on var-cov components: %s", aV), domain = "R-nlme") #, fuzzy msgid "" "cannot get confidence intervals on var-cov components: %s\n" " Consider '%s'" msgstr "nie można uzyskać przedziałów ufności na komponentach var-cov: %s" # nlme/R/lme.R: 1519 # stop("covariate must have a level attribute when groups are present") msgid "covariate must have a level attribute when groups are present" msgstr "zmienna niezależna musi mieć atrybut poziomu, gdy grupy są obecne" msgid "covariate must have a level attribute when 'id' is a formula" msgstr "" "zmienna niezależna musi mieć atrybut poziomu, gdy argument 'id' jest formułą" msgid "covariate must have a level attribute when 'idLabels' is a formula" msgstr "" "zmienna niezależna musi mieć atrybut poziomu, gdy 'idLabels' jest formułą" # nlme/R/lme.R: 1728 # stop(gettextf("'%s' argument must be a formula when not NULL", "form")) msgid "'form' must be a formula when not NULL" msgstr "argument 'form' musi być formułą, gdy nie jest wartością NULL" # nlme/R/lme.R: 1734 # stop("only single effects allowed in left side of 'form'") msgid "only single effects allowed in left side of 'form'" msgstr "tylko pojedynczy efekt jest dozwolony po lewej stronie 'form'" # nlme/R/lme.R: 1738 # stop(gettextf("%s is not a valid effect name", sQuote(reName)), domain = "R-nlme") msgid "%s is not a valid effect name" msgstr "%s nie jest poprawną nazwą efektu" # nlme/R/lme.R: 1742 # stop("no effects allowed in right side of formula") msgid "no effects allowed in right side of formula" msgstr "nie są dozwolone żadne efekty po prawej stronie fomuły" # nlme/R/nlme.R: 1109 # stop("cannot evaluate groups for desired levels on 'newdata'") # nlme/R/lme.R: 1872 # stop("cannot evaluate groups for desired levels on 'newdata'") msgid "cannot evaluate groups for desired levels on 'newdata'" msgstr "nie można wyznaczyć grup dla pożądanych poziomów w 'newdata'" msgid "'Id' must be between 0 and 1" msgstr "argument 'id' musi być pomiędzy 0 a 1" # nlme/R/lme.R: 2469 # stop("augmentation of random effects only available for single level") msgid "augmentation of random effects only available for single level" msgstr "" "rozszerzenie efektów losowych dostępne jedynie dla pojedynczego poziomu" # nlme/R/lme.R: 2831 # stop("no condensed linear model") msgid "no condensed linear model" msgstr "brak skondensowanego modelu liniowego" # nlme/R/lme.R: 2834 # stop("no fitted \"lme\" object") msgid "no fitted \"lme\" object" msgstr "brak dopasowanego obiektu \"lme\"" # nlme/R/newFunc.R: 83 # stop("objects must have coefficients with same row names") msgid "objects must have coefficients with same row names" msgstr "obiekty muszą mieć współczynniki z tymi samymi nazwami wierszy" msgid "only one level allowed in 'gapply'" msgstr "tylko jeden poziom jest dozwolony w funkcji 'gapply()'" msgid "'which' must be between 1 and %d" msgstr "argument 'which' musi być pomiędzy 1 a %d" msgid "'which' can only be character or integer" msgstr "argument 'which' może być jedynie tekstem lub liczbą całkowitą" msgid "formula(object) must return a formula" msgstr "'formuła(obiekt)' musi zwracać formułę" msgid "'form' must be a two-sided formula" msgstr "argument 'form' musi być dwustronną formułą" msgid "only one level allowed in 'gsummary'" msgstr "tylko jeden poziom jest dostępny w funkcji 'gsummary()'" # nlme/R/newFunc.R: 253 # stop("'FUN' can only be a function or a list of functions") msgid "'FUN' can only be a function or a list of functions" msgstr "argument 'FUN' może być jedynie funkcją lub listą funkcji" # nlme/R/newFunc.R: 282 # stop("cannot omit grouping factor without 'form'") msgid "cannot omit grouping factor without 'form'" msgstr "nie można pominąć czynnika grupującego bez 'form'" # nlme/R/newFunc.R: 313 # stop("no degrees of freedom for estimating standard deviation") msgid "no degrees of freedom for estimating std. dev." msgstr "brak stopni swobody na potrzeby oszacowania odchylenia standardowego" # nlme/R/newMethods.R: 52 # stop("'data' argument passed to \"data.frame\" method for 'getGroups()' does not make sense") msgid "" "data argument to \"data.frame\" method for 'getGroups' does not make sense" msgstr "" "argument danych przekazywany do metody 'data.frame()' dla 'getGroups()' nie " "ma sensu" # nlme/R/newMethods.R: 66 # stop("invalid formula for groups") msgid "invalid formula for groups" msgstr "niepoprawna formuła dla grup" # nlme/R/newMethods.R: 71 # stop("'form' must have all components as formulas") msgid "'form' must have all components as formulas" msgstr "" "argument 'form' musi mieć wszystkie komponenty przedstawione jako formuły" msgid "'form' can only be a formula, or a list of formulas" msgstr "argument 'form' może być jedynie formułą lub listą formuł" # nlme/R/newMethods.R: 92 # stop(gettextf("level of %s does not match formula %s", level[aux], sQuote(deparse(form))), domain = "R-nlme") # nlme/R/newMethods.R: 97 # stop(gettextf("level of %s does not match formula %s", level[aux], sQuote(deparse(form))), domain = "R-nlme") msgid "level of %s does not match formula %s" msgstr "poziom %s nie zgadza się z formułą %s" # nlme/R/reStruct.R: 66 # stop(gettextf("'%s' argument must have a formula", "object")) # nlme/R/reStruct.R: 84 # stop(gettextf("'%s' argument must have a formula", "object")) msgid "'form' argument must be a formula" msgstr "argument 'form' musi być formułą" # nlme/R/newMethods.R: 209 # stop("at least two coefficients are needed") msgid "at least two coefficients are needed" msgstr "przynajmniej dwa współczynniki są potrzebne" # nlme/R/newMethods.R: 619 # stop("no model variogram available with 'showModel = TRUE'") msgid "no model variogram available with 'showModel = TRUE'" msgstr "brak dostępnego modelu wariogramu w 'showModel = TRUE'" # nlme/R/newMethods.R: 730 # stop("only residuals allowed") msgid "only residuals allowed" msgstr "jedynie reszty są dozwolone" msgid "'distance' and 'object' have incompatible lengths" msgstr "argumenty 'distance' oraz 'object' mają niespójne długości" # nlme/R/nlme.R: 63 # warning("'nlme.nlsList' will redefine 'fixed', 'data', and 'start'") msgid "'nlme.nlsList' will redefine 'fixed', 'data', and 'start'" msgstr "" "funkcja 'nlme.nlsList()' ponownie przedefiniuje argumenty 'fixed', 'data' " "oraz 'start'" # nlme/R/nlme.R: 90 # stop("can only fit \"nlsList\" objects with single grouping variable") msgid "can only fit \"nlsList\" objects with single grouping variable" msgstr "" "można dopasować jedynie obiekty klasy \"nlsList\" z pojedynczą zmienną " "grupującą" # nlme/R/nlme.R: 122 # warning("initial value for 'reStruct' overwritten in 'nlme.nlsList'") msgid "initial value for 'reStruct' overwritten in 'nlme.nlsList'" msgstr "początkowa wartość dla 'reStruct' nadpisana w funkcji 'nlme.nlsList()'" msgid "'model' must be a formula" msgstr "argument 'model' musi być formułą" # nlme/R/gnls.R: 73 # stop("model formula must be of the form \"resp ~ pred\"") # nlme/R/nlme.R: 188 # stop("model formula must be of the form \"resp ~ pred\"") msgid "model formula must be of the form \"resp ~ pred\"" msgstr "" "formuła modelu musi mieć formę \"zmienna zależna ~ zmienna niezależna\"" # nlme/R/nlme.R: 239 # stop("'data' must be given explicitly to use 'nlsList'") msgid "'data' must be given explicitly to use 'nlsList'" msgstr "" "argument 'data' musi być podane bezpośrednio aby użyć funkcji 'nlsList()'" msgid "'fixed' must be a formula or list of formulae" msgstr "argument 'fixed' musi być formułą lub listą formuł" msgid "formulae in 'fixed' must be of the form \"parameter ~ expr\"" msgstr "" "formuły w argumencie 'fixed' muszą mieć formę \"parametr ~ wyrażenie\"." msgid "'random' must be a formula or list of formulae" msgstr "argument 'random' musi być formułą lub listą formuł" msgid "formulae in 'random' must be of the form \"parameter ~ expr\"" msgstr "" "formuły w argumencie 'random' muszą mieć formę \"parametr ~ wyrażenie\"" # nlme/R/nlme.R: 329 # stop("incompatible formulas for groups in \"random\" and \"correlation\"") # nlme/R/nlme.R: 340 # stop("incompatible formulas for groups in \"random\" and \"correlation\"") # nlme/R/lme.R: 196 # stop("incompatible formulas for groups in \"random\" and \"correlation\"") # nlme/R/lme.R: 207 # stop("incompatible formulas for groups in \"random\" and \"correlation\"") msgid "incompatible formulas for groups in \"random\" and \"correlation\"" msgstr "niespójne formuły dla grup w \"random\" oraz \"correlation\"" # nlme/R/nlme.R: 332 # warning("cannot use smaller level of grouping for \"correlation\" than for \"random\". Replacing the former with the latter.") msgid "" "cannot use smaller level of grouping for \"correlation\" than for " "\"random\". Replacing the former with the latter." msgstr "" "nie można użyć mniejszego poziomu grupowania dla \"correlation\" niż dla " "\"random\". Zastępowanie pierwszego drugim." # nlme/R/nlme.R: 481 # stop ("'start' must have a component called 'fixed'") msgid "'start' must have a component called 'fixed'" msgstr "argument 'start' musi mieć komponent o nazwie 'fixed'" # nlme/R/nlme.R: 521 # stop ("starting values for the 'fixed' component are not the correct length") msgid "starting values for the 'fixed' component are not the correct length" msgstr "początkowe wartości dla komponentu 'fixed' nie mają poprawnej długości" # nlme/R/nlme.R: 569 # stop("starting values for random effects should be a list, or a matrix") msgid "starting values for random effects should be a list, or a matrix" msgstr "" "początkowe wartości dla efektów losowych powinny być listą lub macierzą" # nlme/R/nlme.R: 576 # stop(gettextf("list with starting values for random effects must have names or be of length %d", Q), domain = "R-nlme") msgid "" "list with starting values for random effects must have names or be of length " "%d" msgstr "" "lista z początkowymi wartościami dla efektów losowych musi zawierać nazwy " "lub być długości %d" # nlme/R/nlme.R: 594 # stop("starting values for the random components should be a list of matrices") msgid "starting values for the random components should be a list of matrices" msgstr "" "wartości początkowe dla losowych komponentów powinny być listą macierzy" # nlme/R/nlme.R: 597 # stop(gettextf("number of rows in starting values for random component at level %s should be %d", namGrp[i], Dims$ngrps[i]), domain = "R-nlme") msgid "" "number of rows in starting values for random component at level %s should be " "%d" msgstr "" "liczba wierszy w wartościach początkowych dla losowego komponentu na " "poziomie %s powinna wynosić %d" # nlme/R/nlme.R: 600 # stop(gettextf("number of columns in starting values for random component at level %s should be %d", namGrp[i], rlength[i]), domain = "R-nlme") msgid "" "number of columns in starting values for random component at level %s should " "be %d" msgstr "" "liczba kolumn w wartościach początkowych dla losowego komponentu na poziomie " "%s powinna wynosić %d" # nlme/R/nlme.R: 604 # stop("starting values for random effects must include group levels") msgid "starting values for random effects must include group levels" msgstr "" "wartości początkowe dla losowych efektów muszą zawierać w sobie poziomy grup" # nlme/R/nlme.R: 608 # stop(gettextf("groups levels mismatch in 'random' and starting values for 'random' at level %s", namGrp[i]), domain = "R-nlme") msgid "" "groups levels mismatch in 'random' and starting values for 'random' at level " "%s" msgstr "" "poziomy grup nie zgadzają się w 'random' oraz początkowych wartościach " "'random' na poziomie %s" # nlme/R/nlme.R: 626 # stop (gettextf("names mismatch in 'random' and starting values for 'random' at level %s", namGrp[i]), domain = "R-nlme") msgid "" "names mismatch in 'random' and starting values for 'random' at level %s" msgstr "" "nazwy nie zgadzają się w 'random' oraz początkowych wartościach dla 'random' " "na poziomie %s" msgid "Iteration %d, LME step: nlminb() did not converge (code = %d)." msgstr "" msgid "Do increase 'msMaxIter'!" msgstr "" msgid "PORT message:" msgstr "" msgid "Iteration %d, LME step: nlm() did not converge (code = %d)." msgstr "" msgid "step halving factor reduced below minimum in PNLS step" msgstr "" "czynnik skracający krok został zredukowany poniżej minimum w kroku PNLS" # nlme/R/lme.R: 368 # gettext("maximum number of iterations (lmeControl(maxIter)) reached without convergence") msgid "maximum number of iterations (maxIter = %d) reached without convergence" msgstr "" "maksymalna liczba iteracji (maxIter = %d) została osiągnięta bez uzyskania " "zbieżności" # nlme/R/nlsList.R: 31 # stop("second argument must be a groupedData object") msgid "second argument must be a groupedData object" msgstr "drugi argument musi być obiektem \"groupedData\"" # nlme/R/nlsList.R: 35 # stop("cannot use an anonymous function for the model") msgid "cannot use an anonymous function for the model" msgstr "nie można użyć anonimowej funkcji dla modelu" # nlme/R/nlsList.R: 68 # stop("'data' must be a \"groupedData\" object if 'formula' does not include groups") msgid "" "'data' must be a \"groupedData\" object if 'formula' does not include groups" msgstr "" "argument 'data' musi być obiektem klasy \"groupedData\" jeśli argument " "'fomula' nie zawiera grup" # nlme/R/nlsList.R: 87 # stop("old-style self-starting model functions\nare no longer supported.\nNew selfStart functions are available.\nUse\n SSfpl instead of fpl,\n SSfol instead of first.order.log,\n SSbiexp instead of biexp,\n SSlogis instead of logistic.\nIf writing your own selfStart model, see\n \"help(selfStart)\"\nfor the new form of the \"initial\" attribute.", domain = "R-nlme") msgid "" "old-style self-starting model functions\n" "are no longer supported.\n" "New selfStart functions are available.\n" "Use\n" " SSfpl instead of fpl,\n" " SSfol instead of first.order.log,\n" " SSbiexp instead of biexp,\n" " SSlogis instead of logistic.\n" "If writing your own selfStart model, see\n" " \"help(selfStart)\"\n" "for the new form of the \"initial\" attribute." msgstr "" "samoinicjujące się funkcje modelu starego stylu nie są już dłużej wspierane\n" "Brak dostępnych funkcji 'selfStart'.\n" "Użyj\n" " 'SSfpl' zamiast 'fpl',\n" " 'SSfol' zamiast 'first.order.log',\n" " 'SSbiexp' zamiast 'biexp',\n" " 'SSlogis' zamiast 'logistic'.\n" "Jeśli piszesz swój własny model 'selfStart', zobacz\n" " 'help(selfStart)'\n" "aby uzyskać informację o nowej formie atrybutu 'initial'." # nlme/R/nlsList.R: 148 # stop("missing call attribute in \"nlsList\" object") msgid "missing call attribute in \"nlsList\" object" msgstr "brakuje wywoływanego atrybutu w obiekcie klasy \"nlsList\"" # nlme/R/reStruct.R: 153 # stop("cannot access the matrix of uninitialized objects") # nlme/R/reStruct.R: 168 # stop("cannot access the matrix of uninitialized objects") # nlme/R/pdMat.R: 53 # stop("cannot access the matrix of uninitialized objects") # nlme/R/pdMat.R: 226 # stop("cannot access the matrix of uninitialized objects") # nlme/R/pdMat.R: 1699 # stop("cannot access the matrix of uninitialized objects") # nlme/R/pdMat.R: 1938 # stop("cannot access the matrix of uninitialized objects") msgid "cannot access the matrix of uninitialized objects" msgstr "nie można uzyskać dostępu do macierzy niezainicjalizowanych obiektów" msgid "ignoring argument 'form'" msgstr "ignorowanie argumentu 'form'" msgid "ignoring argument 'nam'" msgstr "ignorowanie argumentu 'nam'" # nlme/R/pdMat.R: 104 # stop("'value' must be a square matrix") msgid "'value' must be a square matrix" msgstr "argument 'value' musi być kwadratową macierzą" # nlme/R/pdMat.R: 109 # stop("dimnames of 'value' must match or be NULL") msgid "dimnames of 'value' must match or be NULL" msgstr "" "nazwy wymiarów argumentu 'value' muszą się zgadzać lub być wartością NULL" # nlme/R/pdMat.R: 114 # stop("names of 'value' are not consistent with 'nam' argument") msgid "names of 'value' are not consistent with 'nam' argument" msgstr "nazwy argumentu 'value' nie są spójne z argumentem 'nam'" # nlme/R/pdMat.R: 137 # stop(gettextf("%s is not a valid object for \"pdMat\"", sQuote(deparse(object))), domain = "R-nlme") msgid "%s is not a valid object for \"pdMat\"" msgstr "%s nie jest poprawnym obiektem dla klasy \"pdMat\"" # nlme/R/pdMat.R: 150 # stop("all elements of 'form' list must be two-sided formulas") msgid "all elements of 'form' list must be two-sided formulas" msgstr "wszystkie elementy listy 'form' muszą być dwustronnymi formułami" msgid "'form' can only be a formula or a list of formulae" msgstr "argument 'form' może być jedynie formułą lub listą formuł" # nlme/R/pdMat.R: 200 # stop("'form' not consistent with 'nam'") msgid "'form' not consistent with 'nam'" msgstr "argument 'form' nie jest spójny z argumentem 'nam'" # nlme/R/pdMat.R: 208 # stop("length of 'nam' not consistent with dimensions of initial value") msgid "length of 'nam' not consistent with dimensions of initial value" msgstr "" "długość argumentu 'nam' nie jest spójna z wymiarami początkowej wartości" # nlme/R/pdMat.R: 229 # stop("no default method for extracting the square root of a \"pdMat\" object") msgid "no default method for extracting the square root of a \"pdMat\" object" msgstr "" "brak domyślnej metody dla uzyskania pierwiastka z obiektu klasy \"pdMat\"" # nlme/R/pdMat.R: 246 # stop("do not know how to obtain constrained coefficients") msgid "do not know how to obtain constrained coefficients" msgstr "nie wiadomo jak uzyskać ograniczone współczynniki" # nlme/R/pdMat.R: 274 # stop("cannot access the number of columns of uninitialized objects without names") msgid "" "cannot access the number of columns of uninitialized objects without names" msgstr "" "nie można uzyskać liczby kolumn niezainicjalizowanych obiektów bez nazw" # nlme/R/pdMat.R: 290 # stop("cannot extract the log of the determinant from an uninitialized object") # nlme/R/pdMat.R: 678 # stop("cannot extract the log of the determinant from an uninitialized object") # nlme/R/pdMat.R: 1210 # stop("cannot extract the log of the determinant from an uninitialized object") # nlme/R/pdMat.R: 1360 # stop("cannot extract the log of the determinant from an uninitialized object") msgid "cannot extract the log of the determinant from an uninitialized object" msgstr "" "nie można wyodrębnić logarytmu macierzy z niezainicjalizowanego obiektu" # nlme/R/pdMat.R: 301 # stop("cannot change dimensions on an initialized \"pdMat\" object") msgid "cannot change dimensions on an initialized \"pdMat\" object" msgstr "nie można zmienić wymiarów zainicjalizowanego obiektu klasy \"pdMat\"" # nlme/R/pdMat.R: 323 # stop(gettextf("Length of names should be %d", aux), domain = "R-nlme") # nlme/R/pdMat.R: 330 # stop(gettextf("Length of names should be %d", length(dn)), domain = "R-nlme") msgid "Length of names should be %d" msgstr "Długość nazw powinna wynosić %d" # nlme/R/pdMat.R: 368 # stop("names being assigned do not correspond to a permutation of previous names") msgid "" "names being assigned do not correspond to a permutation of previous names" msgstr "przypisane nazwy nie odpowiadają permutacji poprzednich nazw" # nlme/R/pdMat.R: 419 # stop("x-y data passed to 'splom()' function got botched somehow") msgid "x-y data to splom got botched somehow" msgstr "dane x-y przekazywane do funkcji 'splom()' zostały jakoś uszkodzone" # nlme/R/pdMat.R: 526 # stop("cannot get the inverse of an uninitialized object") # nlme/R/pdMat.R: 759 # stop("cannot get the inverse of an uninitialized object") # nlme/R/pdMat.R: 843 # stop("cannot get the inverse of an uninitialized object") # nlme/R/pdMat.R: 1220 # stop("cannot get the inverse of an uninitialized object") # nlme/R/pdMat.R: 2084 # stop("cannot get the inverse of an uninitialized object") msgid "cannot get the inverse of an uninitialized object" msgstr "nie można uzyskać odwrotności niezainicjalizowanego obiektu" # nlme/R/pdMat.R: 612 # stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = "R-nlme") # nlme/R/pdMat.R: 1142 # stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = "R-nlme") # nlme/R/pdMat.R: 1303 # stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = "R-nlme") # nlme/R/pdMat.R: 1443 # stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = "R-nlme") # nlme/R/pdMat.R: 1593 # stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = "R-nlme") msgid "an object of length %d does not match the required parameter size" msgstr "obiekt o długości %d nie zgadza się z wymaganym rozmiarem parametru" # nlme/R/pdMat.R: 632 # stop("cannot extract matrix from an uninitialized object") # nlme/R/pdMat.R: 1162 # stop("cannot extract matrix from an uninitialized object") msgid "cannot extract matrix from an uninitialized object" msgstr "nie można wyodrębnić macierzy z niezainicjalizowanego obiektu" # nlme/R/pdMat.R: 687 # stop("cannot extract the inverse from an uninitialized object") # nlme/R/pdMat.R: 991 # stop("cannot extract the inverse from an uninitialized object") # nlme/R/pdMat.R: 1369 # stop("cannot extract the inverse from an uninitialized object") # nlme/R/pdMat.R: 1510 # stop("cannot extract the inverse from an uninitialized object") msgid "cannot extract the inverse from an uninitialized object" msgstr "nie można wyodrębnić odwrotności z niezainicjalizowanego obiektu" # nlme/R/pdMat.R: 737 # stop(gettextf("an object of length %d does not match a Cholesky factor", length(val)), domain = "R-nlme") msgid "an object of length %d does not match a Cholesky factor" msgstr "obiekt o długości %d nie zgadza się z czynnikiem Cholesky'ego" # nlme/R/pdMat.R: 1319 # stop("cannot extract the matrix from an uninitialized object") msgid "cannot extract the matrix from an uninitialized object" msgstr "nie można wyodrębnić macierzy z niezainicjalizowanego obiektu" # nlme/R/pdMat.R: 1403 # stop("cannot extract the matrix from an uninitialized \"pdIdent\" object") # nlme/R/pdMat.R: 1464 # stop("cannot extract the matrix from an uninitialized \"pdIdent\" object") msgid "cannot extract the matrix from an uninitialized \"pdIdent\" object" msgstr "" "nie można wyodrębnić macierzy z niezainicjalizowanego obiektu klasy " "\"pdIdent\"" # nlme/R/pdMat.R: 1406 # stop("cannot extract the matrix with uninitialized dimensions") # nlme/R/pdMat.R: 1467 # stop("cannot extract the matrix with uninitialized dimensions") # nlme/R/pdMat.R: 1544 # stop("cannot extract the matrix with uninitialized dimensions") # nlme/R/pdMat.R: 1620 # stop("cannot extract the matrix with uninitialized dimensions") msgid "cannot extract the matrix with uninitialized dimensions" msgstr "nie można wyodrębnić macierzy z niezainicjalizowanymi wymiarami" # nlme/R/pdMat.R: 1446 # stop(gettextf("must give names when initializing %s from parameter without a formula", dQuote("pdIdent"))) # nlme/R/pdMat.R: 1596 # stop(gettextf("must give names when initializing %s from parameter without a formula", dQuote("pdCompSymm"))) msgid "" "must give names when initializing \"pdIdent\" from parameter without a " "formula" msgstr "" "nazwy są wymagane gdy występuje inicjalizowanie obiektu klasy \"pdIdent\" z " "parametru bez formuły" # nlme/R/pdMat.R: 1496 # stop("cannot extract the dimensions") # nlme/R/pdMat.R: 1663 # stop("cannot extract the dimensions") msgid "cannot extract the dimensions" msgstr "nie można wyodrębnić wymiarów" # nlme/R/pdMat.R: 1541 # stop("cannot extract the matrix from an uninitialized \"pdCompSymm\" object") # nlme/R/pdMat.R: 1617 # stop("cannot extract the matrix from an uninitialized \"pdCompSymm\" object") msgid "cannot extract the matrix from an uninitialized \"pdCompSymm\" object" msgstr "" "nie można wyodrębnić macierzy z niezainicjalizowanego obiektu klasy " "\"pdCompSymm\"" # nlme/R/pdMat.R: 1584 # warning("initializing \"pdCompSymm\" object is not positive definite") msgid "initializing \"pdCompSymm\" object is not positive definite" msgstr "inicjalizowany obiekt klasy \"pdCompSymm\" nie jest dodatnio określony" msgid "" "must give names when initializing \"pdCompSymm\" from parameter without a " "formula" msgstr "" "nazwy są wymagane podczas inicjalizowania obiektu klasy \"pdCompSymm\" z " "parametru bez formuły" # nlme/R/pdMat.R: 1647 # stop("cannot obtain constrained coefficients with uninitialized dimensions") msgid "cannot obtain constrained coefficients with uninitialized dimensions" msgstr "" "nie można uzyskać ograniczonych współczynników z niezainicjalizowanych " "wymiarów" # nlme/R/pdMat.R: 1702 # stop("cannot access the matrix of object without names") # nlme/R/pdMat.R: 1941 # stop("cannot access the matrix of object without names") msgid "cannot access the matrix of object without names" msgstr "nie można uzyskać dostępu do macierzy obiektu bez nazw" msgid "'form' must be a list" msgstr "argument 'form' musi być listą" msgid "'nam' must be a list" msgstr "argument 'nam' musi być listą" msgid "'form' and 'nam' have incompatible lengths" msgstr "argumenty 'form' oraz 'nam' mają niezgodne długości" # nlme/R/pdMat.R: 1761 # stop(gettextf("'%s' argument must be a character vector", "pdClass")) msgid "'pdClass' must be a character vector" msgstr "argument 'pdClass' musi być wektorem tekstowym" msgid "'form' and 'pdClass' have incompatible lengths" msgstr "argumenty 'form' oraz 'pdClass' mają niezgodne długości" msgid "'nam' and 'pdClass' have incompatible lengths" msgstr "argumenty 'nam' oraz 'pdClass' mają niezgodne długości" # nlme/R/pdMat.R: 1781 # stop("LNone of the arguments specify more than one block") msgid "LNone of the arguments specify more than one block" msgstr "żaden z argumentów nie określa więcej niż jednego bloku" # nlme/R/pdMat.R: 1787 # stop("'object' must be a list when not missing, not a matrix, and not numeric") msgid "'object' must be a list when not missing, not a matrix, and not numeric" msgstr "" "argument 'object' musi być listą, gdy nie jest brakujący, nie jest macierzą, " "ani też liczbą" # nlme/R/pdMat.R: 1791 # stop("arguments imply different number of blocks") msgid "arguments imply different number of blocks" msgstr "argumenty sugerują różną liczbę bloków" # nlme/R/pdMat.R: 1863 # stop("all elements in the argument must generate \"pdMat\" objects") msgid "all elements in the argument must generate \"pdMat\" objects" msgstr "wszystkie elementy w argumencie muszą tworzyć obiekty klasy \"pdMat\"" # nlme/R/pdMat.R: 1886 # stop("cannot have duplicated column names in a \"pdMat\" object") # nlme/R/pdMat.R: 1905 # stop("cannot have duplicated column names in a \"pdMat\" object") msgid "cannot have duplicated column names in a \"pdMat\" object" msgstr "nie można mieć powtórzonych nazw kolumn w obiekcie klasy \"pdMat\"" # nlme/R/pdMat.R: 1892 # stop("must have formula when no names are given") msgid "must have formula when no names are given" msgstr "formuła jest wymagana, gdy nie podano nazw" # nlme/R/pdMat.R: 1895 # stop("must give names when initializing from matrix or parameter") msgid "must give names when initializing from matrix or parameter" msgstr "nazwy są wymagane, gdy następuje inicjowanie z macierzy lub parametru" # nlme/R/pdMat.R: 1900 # stop("all elements must have names when any has names") msgid "all elements must have names when any has names" msgstr "wszystkie elementy muszą mieć nazwy, gdy którykolwiek posiada" # nlme/R/pdMat.R: 1917 # stop("all elements must have a non-zero size") msgid "all elements must have a non-zero size" msgstr "wszystkie elementy muszą mieć niezerowy rozmiar" # nlme/R/reStruct.R: 188 # stop("cannot change the parameter when length of parameters is undefined") # nlme/R/pdMat.R: 1970 # stop("cannot change the parameter when length of parameters is undefined") msgid "cannot change the parameter when length of parameters is undefined" msgstr "nie można zmienić parametru gdy długość parametru jest nieokreślona" msgid "cannot change parameter length of initialized \"pdMat\" object" msgstr "" "nie można zmienić długości parametru zainicjowanego obiektu klasy \"pdMat\"" # nlme/R/pdMat.R: 1990 # stop("all elements must have formulas when any has a formula") msgid "all elements must have formulas when any has a formula" msgstr "wszystkie elementy muszą mieć formułę, gdy którykolwiek posiada" # nlme/R/pdMat.R: 2008 # stop("all elements of formula must be list of two-sided formulae or two-sided formulae") msgid "" "all elements of formula must be list of two-sided formulae or two-sided " "formulae" msgstr "" "wszystkie elementy formuły muszą być listą dwustronnych formuł lub " "dwustronnymi formułami" # nlme/R/pdMat.R: 2040 # stop("cannot change the number of columns on an initialized object") msgid "cannot change the number of columns on an initialized object" msgstr "nie można zmienić liczby kolumn zainicjowanego obiektu" # nlme/R/pdMat.R: 2047 # stop("names of object and value must match") msgid "names of object and value must match" msgstr "nazwy obiektu oraz wartości muszą się zgadzać" msgid "\"pdMat\" element must have a formula" msgstr "element \"pdMat\" musi posiadać formułę" msgid "'object' must be a list or a formula" msgstr "argument 'object' musi być listą lub formułą" msgid "\"pdMat\" elements must have a formula" msgstr "elementy \"pdMat\" muszą posiadać formułę" # nlme/R/reStruct.R: 101 # stop("elements in 'object' argument must be formulae or objects of class \"pdMat\"") msgid "elements in 'object' must be formulas or \"pdMat\" objects" msgstr "" "elementy w argumencie 'object' muszą być formułami lub obiektami klasy " "\"pdMat\"" msgid "cannot change parameter length of initialized objects" msgstr "nie można zmienić długości parametru zainicjowanych obiektów" # nlme/R/reStruct.R: 211 # stop("cannot extract groups formula without a formula") msgid "cannot extract groups formula without a formula" msgstr "nie można wyodrębnić formuł grup bez formuły" # nlme/R/reStruct.R: 252 # stop("all elements of an object of class \"reStruct\" must have a non-zero size") msgid "all elements of a \"reStruct\" object must have a non-zero size" msgstr "" "wszystkie elementy obiektu klasy \"reStruct\" muszą mieć niezerowy rozmiar" # nlme/R/reStruct.R: 302 # stop("cannot change the length of 'object' argument") msgid "cannot change the length of 'object'" msgstr "nie można zmienić długości argumentu 'object'" # nlme/R/reStruct.R: 315 # stop("cannot extract model matrix without formula") msgid "cannot extract model matrix without formula" msgstr "nie można wyodrębnić macierzy modelu bez formuły" # nlme/R/reStruct.R: 373 # stop("incompatible lengths for object names") msgid "incompatible lengths for object names" msgstr "niezgodne długości dla nazw obiektu" # nlme/R/simulate.R: 51 # stop("'data' must inherit from \"groupedData\" class if 'random' does not define groups") msgid "" "'data' must inherit from \"groupedData\" class if 'random' does not define " "groups" msgstr "" "argument 'data' musi być obiektem klasy \"groupedData\" jeśli argument " "'random' nie określa grup" # nlme/R/simulate.R: 162 # stop("models with \"corStruct\" and/or \"varFunc\" objects not allowed") # nlme/R/simulate.R: 227 # stop("models with \"corStruct\" and/or \"varFunc\" objects not allowed") msgid "models with \"corStruct\" and/or \"varFunc\" objects not allowed" msgstr "" "modele z obiektami klasy \"corStruct\" oraz/lub \"varFunc\" nie są dozwolone" # nlme/R/simulate.R: 367 # stop("no degrees of freedom specified") msgid "no degrees of freedom specified" msgstr "nie określono stopni swobody" # nlme/R/simulate.R: 356 # stop("plot method only implemented for comparing models") # nlme/R/simulate.R: 362 # stop("plot method only implemented for comparing models") msgid "plot method only implemented for comparing models" msgstr "" "metoda rysująca wykres została zaimplementowana jedynie do porównywania " "modeli" # nlme/R/simulate.R: 375 # stop("degrees of freedom and weights must have the same length") msgid "degrees of freedom and weights must have the same length" msgstr "stopnie swobody oraz wagi muszą mieć tę samą długość" # nlme/R/simulate.R: 383 # stop("negative degrees of freedom not allowed") msgid "negative degrees of freedom not allowed" msgstr "ujemne stopnie swobody nie są dozwolone" # nlme/R/simulate.R: 386 # stop("more than one degree of freedom is needed when one them is zero.") msgid "more than one degree of freedom is needed when one them is zero." msgstr "" "więcej niż jeden stopień swobody jest potrzebny jeśli jeden człon wynosi " "zero." # nlme/R/varFunc.R: 46 # stop("can only construct \"varFunc\" object from another \"varFunc\" object, a formula, or a character string") msgid "" "can only construct \"varFunc\" object from another \"varFunc\" object, a " "formula, or a character string" msgstr "" "można stworzyć jedynie obiekt klasy \"varFunc\" z innego obiektu klasy " "\"varFunc\", formuły lub łańcucha tekstowego" # nlme/R/varFunc.R: 64 # stop("cannot extract parameters of uninitialized object") msgid "cannot extract parameters of uninitialized object" msgstr "nie można wyodrębnić parametrów niezainicjowanego obiektu" # nlme/R/varFunc.R: 80 # stop(gettextf("do not know how to get coefficients for %s object", dQuote(class(object)[1])), domain = "R-nlme") msgid "do not know how to get coefficients for %s object" msgstr "nie wiadomo jak uzyskać współczynniki dla obiektu %s" # nlme/R/varFunc.R: 90 # stop("cannot change the length of covariate in \"varFunc\" object") msgid "cannot change the length of covariate in \"varFunc\" object" msgstr "" "nie można zmienić długości zmiennej niezależnej w obiekcie klasy \"varFunc\"" msgid "'value' must be a one sided formula" msgstr "argument 'value' musi być jednostronną formułą" # nlme/R/varFunc.R: 463 # stop("'form' must have a covariate") # nlme/R/varFunc.R: 676 # stop("'form' must have a covariate") # nlme/R/varFunc.R: 929 # stop("'form' must have a covariate") msgid "'form' must have a covariate" msgstr "argument 'form' musi posiadać zmienną niezależną" # nlme/R/varFunc.R: 206 # warning("ignoring 'group' in \"varFixed\" formula") msgid "ignoring 'group' in \"varFixed\" formula" msgstr "Ignorowanie 'group' w formule klasy \"varFixed\"" # nlme/R/varFunc.R: 228 # stop("all variables used in 'formula' must be in 'data'") msgid "all variables used in 'formula' must be in 'data'" msgstr "wszystkie zmienne użyte w 'formula' muszą być w 'data'" # nlme/R/groupedData.R: 219 # warning("'subset' ignored with single grouping factor") #, fuzzy msgid "ignoring initial values (no grouping factor)" msgstr "argument 'subset' został zignorowany z jednym czynnikem grupującym" # nlme/R/varFunc.R: 266 # stop("initial values must have group names in 'varIdent'") msgid "initial values must have group names in 'varIdent'" msgstr "początkowe wartości muszą posiadać nazwy grupy w 'varIdent'" # nlme/R/varFunc.R: 270 # stop("initial values for 'varIdent' must be > 0") msgid "initial values for 'varIdent' must be > 0" msgstr "początkowe wartości dla 'varIdent' muszą być > 0" # nlme/R/varFunc.R: 278 # stop("fixed parameters must have names in 'varIdent'") msgid "fixed parameters must have names in 'varIdent'" msgstr "ustalone parametry muszą posiadać nazwy w 'varIdent'" msgid "" "cannot change the length of the \"varIdent\" parameter after initialization" msgstr "" "nie można zmienić długości parametru \"varIdent\" po jego zainicjowaniu" # nlme/R/varFunc.R: 364 # stop("fixed parameter names in 'varIdent' must be a subset of group names") msgid "fixed parameter names in 'varIdent' must be a subset of group names" msgstr "ustalone nazwy parametrów w 'varIdent' muszą być podzbiorem nazw grup" # nlme/R/varFunc.R: 372 # stop("cannot fix variances in all groups") msgid "cannot fix variances in all groups" msgstr "nie można ustalić wariancji we wszystkich grupach" msgid "initial value for \"varIdent\" should be of length %d" msgstr "początkowa wartość dla \"varIdent\" powinna być długości %d" # nlme/R/varFunc.R: 392 # stop("names of starting value for \"varIdent\" object must contain all but one of the stratum levels") msgid "" "names of starting value for \"varIdent\" object must contain all but one of " "the stratum levels" msgstr "" "nazwy wartości początkowych dla obiektu klasy \"varIdent\" muszą zawierać " "wszystkie oprócz jednego z poziomów warstwy" msgid "nonexistent group names for initial values in 'varIdent'" msgstr "nieistniejące nazwy grup dla początkowych wartości w 'varIdent'" # nlme/R/varFunc.R: 467 # stop("initial values must have group names in 'varPower'") msgid "initial values must have group names in 'varPower'" msgstr "początkowe wartości muszą posiadać nazwy grup w 'varPower'" msgid "fixed parameters must have group names in 'varPower'" msgstr "ustalone parametry muszą posiadać nazwy grup w 'varPower'" msgid "" "cannot change the length of the \"varStruct\" parameter after initialization" msgstr "" "nie można zmienić długości parametru \"varStruct\" po jego zainicjowaniu" # nlme/R/varFunc.R: 530 # stop("cannot change coefficients before initialization or when all parameters are fixed") # nlme/R/varFunc.R: 740 # stop("cannot change coefficients before initialization or when all parameters are fixed") # nlme/R/varFunc.R: 1015 # stop("cannot change coefficients before initialization or when all parameters are fixed") msgid "" "cannot change coefficients before initialization or when all parameters are " "fixed" msgstr "" "nie można zmienić współczynników przed zainicjowaniem lub gdy wszystkie " "parametry są ustalone" msgid "fixed parameters must have group names" msgstr "ustalone parametry muszą posiadać nazwy grup" # nlme/R/varFunc.R: 559 # stop("mismatch between group names and fixed values names") # nlme/R/varFunc.R: 769 # stop("mismatch between group names and fixed values names") # nlme/R/varFunc.R: 1048 # stop("mismatch between group names and fixed values names") msgid "mismatch between group names and fixed values names" msgstr "niezgodność pomiędzy nazwami grup oraz nazwami ustalonych wartości" msgid "initial value for \"varPower\" should be of length %d" msgstr "początkowa wartość dla \"varPower\" powinna być długości %d" msgid "nonexistent group names for initial values in \"varPower\"" msgstr "nieistniejące nazwy grup dla początkowych wartości w \"varPower\"" msgid "initial value for \"varPower\" should be of length 1" msgstr "początkowa wartość dla \"varPower\" powinna być długości 1" # nlme/R/varFunc.R: 680 # stop("initial values must have group names in 'varExp'") msgid "initial values must have group names in 'varExp'" msgstr "początkowe wartości muszą posiadać nazwy grupy w 'varExp'" msgid "fixed parameters must have group names in 'varExp'" msgstr "ustalone parametry muszą posiadać nazwy grup w 'varExp'" msgid "" "cannot change the length of the \"varExp\" parameter after initialization" msgstr "nie można zmienić długości parametru \"varExp\" po jego zainicjowaniu" msgid "initial value for \"varExp\" should be of length %d" msgstr "początkowa wartość dla \"varExp\" powinna być długości %d" msgid "nonexistent group names for initial values in \"varExp\"" msgstr "nieistniejące nazwy grup dla początkowych wartości w \"varExp\"" msgid "initial value for \"varExp\" should be of length 1" msgstr "początkowa wartość dla \"varExp\" powinna być długości 1" # nlme/R/varFunc.R: 889 # stop(gettextf("%s can have at most two components", nam), domain = "R-nlme") msgid "%s can have at most two components" msgstr "%s może posiadać najwyżej dwa komponenty" # nlme/R/varFunc.R: 895 # stop(gettextf("%s can only have names \"const\" and \"power\"", nam), domain = "R-nlme") msgid "%s can only have names \"const\" and \"power\"" msgstr "%s może posiadać jedynie nazwy \"const\" oraz \"power\"" # nlme/R/varFunc.R: 904 # stop(gettextf("%s can only be a list or numeric", nam), domain = "R-nlme") msgid "%s can only be a list or numeric" msgstr "%s może być jedynie listą lub liczbą" # nlme/R/varFunc.R: 914 # stop(gettextf("%s must have group names in 'varConstPower'", nam), domain = "R-nlme") msgid "%s must have group names in 'varConstPower'" msgstr "%s musi posiadać nazwy grup w 'varConstPower'" # nlme/R/varFunc.R: 920 # stop("constant in \"varConstPower\" structure must be > 0") #, fuzzy msgid "constant in \"varConstProp\" structure must be > 0" msgstr "stała w strukturze \"varConstPower\" musi być > 0" # nlme/R/varFunc.R: 1070 # stop(gettext("initial value should be of length %d", nStratVar), domain = "R-nlme") # nlme/R/varFunc.R: 1118 # stop(gettext("initial value should be of length %d", aux), domain = "R-nlme") msgid "initial value should be of length %d" msgstr "początkowa wartość powinna być długości %d" # nlme/R/varFunc.R: 1075 # stop("nonexistent group names for initial values") msgid "nonexistent group names for initial values" msgstr "nieistniejące nazwy grup dla początkowych wartości" # nlme/R/varFunc.R: 895 # stop(gettextf("%s can only have names \"const\" and \"power\"", nam), domain = "R-nlme") #, fuzzy msgid "%s can only have names \"const\" and \"prop\"" msgstr "%s może posiadać jedynie nazwy \"const\" oraz \"power\"" # nlme/R/varFunc.R: 914 # stop(gettextf("%s must have group names in 'varConstPower'", nam), domain = "R-nlme") #, fuzzy msgid "%s must have group names in 'varConstProp'" msgstr "%s musi posiadać nazwy grup w 'varConstPower'" # nlme/R/varFunc.R: 1159 # stop("all arguments to 'varComb' must be of class \"varFunc\".") msgid "all arguments to 'varComb' must be of class \"varFunc\"." msgstr "" "wszystkie argumenty przekazywane do funkcji 'varComb()' muszą być obiektami " "klasy \"varFunc\"" msgid "cannot change parameter length of initialized \"varComb\" object" msgstr "" "nie można zmienić długości parametru zainicjalizowanego obiektu \"varComb\"" msgid "deviance undefined for REML fit" msgstr "" msgid "AIC undefined for REML fit" msgstr "" msgid "" "not (yet) implemented. Contributions are welcome; use intervals() instead " "(for now)" msgstr "" # nlme/R/gls.R: 459 # stop(sprintf(ngettext(sum(noMatch), # "term %s was not matched", # "terms %s were not matched", domain = "R-nlme"), # paste(Terms[noMatch], collapse = ", ")), # domain = NA) # nlme/R/lme.R: 895 # stop(sprintf(ngettext(sum(noMatch), # "term %s was not matched", # "terms %s were not matched", domain = "R-nlme"), # paste(Terms[noMatch], collapse = ", ")), # domain = NA) msgid "term %s not matched" msgid_plural "terms %s not matched" msgstr[0] "człon %s nie został dopasowany" msgstr[1] "człony %s nie zostały dopasowane" msgstr[2] "człony %s nie zostały dopasowane" # nlme/R/gls.R: 478 # stop(sprintf(ngettext(ncol(L), # "'L' must have at most %d column", # "'L' must have at most %d columns", domain = "R-nlme"), # ncol(L)), domain = NA) # nlme/R/lme.R: 918 # stop(sprintf(ngettext(nX, # "'L' must have at most %d column", # "'L' must have at most %d columns", domain = "R-nlme"), # nX), domain = NA) msgid "'L' must have at most %d column" msgid_plural "'L' must have at most %d columns" msgstr[0] "'L' musi mieć co najwyzej %d kolumnę" msgstr[1] "'L' musi mieć co najwyzej %d kolumny" msgstr[2] "'L' musi mieć co najwyzej %d kolumn" # nlme/R/gls.R: 490 # stop(sprintf(ngettext(sum(noMatch), # "effect %s was not matched", # "effects %s were not matched", domain = "R-nlme"), # paste(dmsL2[noMatch], collapse = ", ")), domain = NA) # nlme/R/lme.R: 930 # stop(sprintf(ngettext(sum(noMatch), # "effect %s was not matched", # "effects %s were not matched", domain = "R-nlme"), # paste(dmsL2[noMatch],collapse = ", ")), # domain = NA) msgid "effect %s not matched" msgid_plural "effects %s not matched" msgstr[0] "efekt %s nie został dopasowany" msgstr[1] "efekty %s nie zostały dopasowane" msgstr[2] "efekty %s nie zostały dopasowane" msgid "supplied %d starting value, need %d" msgid_plural "supplied %d starting values, need %d" msgstr[0] "" msgstr[1] "" msgstr[2] "" msgid "%s not found in data" msgid_plural "%s not found in data" msgstr[0] "%s nie został znaleziony w danych" msgstr[1] "%s nie zostały znalezione w danych" msgstr[2] "%s nie zostały znalezione w danych" # nlme/R/lme.R: 1222 # stop(sprintf(ngettext(sum(aux), # "nonexistent level %s", # "nonexistent levels %s", domain = "R-nlme"), # level[aux]), domain = NA) # nlme/R/lme.R: 2531 # stop(sprintf(ngettext(sum(aux), # "nonexistent level %s", # "nonexistent levels %s", domain = "R-nlme"), # level[aux]), domain = NA) msgid "nonexistent level %s" msgid_plural "nonexistent levels %s" msgstr[0] "nieistniejący poziom %s" msgstr[1] "nieistniejące poziomy %s" msgstr[2] "nieistniejące poziomy %s" # nlme/R/lme.R: 1688 # stop(sprintf(ngettext(sum(whichNA), # "%s is not available for plotting", # "%s are not available for plotting", domain = "R-nlme"), # onames[whichNA], collapse = ", "), domain = NA) # nlme/R/lme.R: 1745 # stop(sprintf(ngettext(sum(whichNA), # "%s is not available for plotting", # "%s are not available for plotting", domain = "R-nlme"), # onames[whichNA], collapse = ", "), domain = NA) msgid "%s not available for plotting" msgid_plural "%s not available for plotting" msgstr[0] "%s nie jest dostępne do rysowania" msgstr[1] "%s nie są dostępne do rysowania" msgstr[2] "%s nie są dostępne do rysowania" # nlme/R/gls.R: 459 # stop(sprintf(ngettext(sum(noMatch), # "term %s was not matched", # "terms %s were not matched", domain = "R-nlme"), # paste(Terms[noMatch], collapse = ", ")), # domain = NA) # nlme/R/lme.R: 895 # stop(sprintf(ngettext(sum(noMatch), # "term %s was not matched", # "terms %s were not matched", domain = "R-nlme"), # paste(Terms[noMatch], collapse = ", ")), # domain = NA) msgid "%s not matched" msgid_plural "%s not matched" msgstr[0] "człon %s nie został dopasowany" msgstr[1] "człony %s nie zostały dopasowane" msgstr[2] "człony %s nie zostały dopasowane" # nlme/R/nlme.R: 581 # stop(sprintf(ngettext(sum(noMatch), # "group name not matched in starting values for random effects: %s", # "group names not matched in starting values for random effects: %s", domain = "R-nlme"), # paste(namSran[noMatch], collapse = ", ")), domain = NA) msgid "group name not matched in starting values for random effects: %s" msgid_plural "" "group names not matched in starting values for random effects: %s" msgstr[0] "" "nazwa grupy nie zgadza się z początkowymi wartościami dla efektów losowych: " "%s" msgstr[1] "" "nazwy grup nie zgadzają się z początkowymi wartościami dla efektów losowych: " "%s" msgstr[2] "" "nazwy grup nie zgadzają się z początkowymi wartościami dla efektów losowych: " "%s" # nlme/R/gnls.R: 483 # stop("approximate covariance matrix for parameter estimates not of full rank") #~ msgid "" #~ "approximate covariance matrix for parameter estimates not of full rank" #~ msgstr "" #~ "przybliżona macierz kowariancji dla szacunkowych parametrów nie jest " #~ "pełnej rangi" # nlme/R/VarCov.R: 26 # stop("'getVarCov.lme()' is not implemented for objects of class \"nlme\"") #~ msgid "'getVarCov.lme()' is not implemented for objects of class \"nlme\"" #~ msgstr "" #~ "funkcja 'getVarCov.lme()' nie jest zaimplementowana dla obiektów klasy " #~ "\"nlme\"" # nlme/R/VarCov.R: 105 # gettext("correlation matrix", domain = "R-nlme") #~ msgid "correlation matrix" #~ msgstr "macierz korelacji" # nlme/R/VarCov.R: 111 # gettext("variance covariance matrix", domain = "R-nlme") #~ msgid "variance covariance matrix" #~ msgstr "macierz wariancji-kowariancji" # nlme/R/VarCov.R: 116 # gettext(" Standard Deviations: ", domain = "R-nlme") #~ msgid "Standard Deviations:" #~ msgstr "Standardowe odchylenia:" # nlme/R/corStruct.R: 125 # stop(gettextf("cannot change the length of the parameter of an object of class %s", dQuote("corStruct"))) # nlme/R/corStruct.R: 418 # stop(gettextf("cannot change the length of the parameter of an object of class %s", dQuote("corSymm"))) # nlme/R/corStruct.R: 658 # stop(gettextf("cannot change the length of the parameter of an object of class %s", dQuote("corNatural"))) # nlme/R/corStruct.R: 946 # stop(gettextf("cannot change the length of the parameter of an object of class %s", dQuote("corAR1"))) # nlme/R/corStruct.R: 1112 # stop(gettextf("cannot change the length of the parameter of an object of class %s", dQuote("corCAR1"))) # nlme/R/corStruct.R: 1313 # stop(gettextf("cannot change the length of the parameter of an object of class %s", dQuote("corARMA"))) # nlme/R/corStruct.R: 1489 # stop(gettextf("cannot change the length of the parameter of an object of class %s", dQuote("corCompSymm"))) #~ msgid "cannot change the length of the parameter of an object of class %s" #~ msgstr "nie można zmienić długości parametru obiektu klasy %s" # nlme/R/corStruct.R: 164 # stop("'data' argument is required in order to calculate covariate of \"corStruct\" object") #~ msgid "" #~ "'%s' argument is required in order to calculate covariate of an object of " #~ "class %s" #~ msgstr "" #~ "wymagany jest argument '%s' w celu obliczenia zmiennej wyjaśniającej " #~ "obiektu klasy %s" # nlme/R/corStruct.R: 268 # gettextf("Correlation structure of class %s representing", dQuote(class(x)[1]), domain = "R-nlme") # nlme/R/corStruct.R: 504 # gettextf("Correlation structure of class %s representing", dQuote("corSymm"), domain = "R-nlme") # nlme/R/corStruct.R: 738 # gettextf("Correlation structure of class %s representing", dQuote("corNatural"), domain = "R-nlme") #~ msgid "Correlation structure of class %s representing" #~ msgstr "Struktura korelacji klasy reprezentującej %s" # nlme/R/corStruct.R: 271 # gettextf("Uninitialized correlation structure of class %s", dQuote(class(x)[1]), domain = "R-nlme") #~ msgid "Uninitialized correlation structure of class %s" #~ msgstr "Niezainicjalizowana struktura korelacji klasy %s" # nlme/R/corStruct.R: 280 # gettext("Correlation Structure: ", domain = "R-nlme") #~ msgid "Correlation Structure:" #~ msgstr "Struktura korelacji:" # nlme/R/corStruct.R: 281 # gettext(" Formula: ", domain = "R-nlme") # nlme/R/corStruct.R: 517 # gettext(" Formula: ", domain = "R-nlme") # nlme/R/corStruct.R: 751 # gettext(" Formula: ", domain = "R-nlme") # nlme/R/varFunc.R: 136 # gettext(" Formula: ", domain = "R-nlme") # nlme/R/varFunc.R: 242 # gettext(" Formula: ", domain = "R-nlme") # nlme/R/pdMat.R: 450 # gettext(" Formula: ", domain = "R-nlme") #~ msgid "Formula:" #~ msgstr "Formuła:" # nlme/R/corStruct.R: 282 # gettext(" Parameter estimates:", domain = "R-nlme") # nlme/R/corStruct.R: 518 # gettext(" Parameter estimates:", domain = "R-nlme") # nlme/R/corStruct.R: 752 # gettext(" Parameter estimates:", domain = "R-nlme") # nlme/R/varFunc.R: 137 # gettext(" Parameter estimates:", domain = "R-nlme") #~ msgid "Parameter estimates:" #~ msgstr "Oszacowania parametrów:" # nlme/R/corStruct.R: 448 # stop(gettextf("covariate must have unique values within groups for objects of class %s", dQuote("corSymm"))) # nlme/R/corStruct.R: 688 # stop(gettextf("covariate must have unique values within groups for objects of class %s", dQuote("corNatural"))) # nlme/R/corStruct.R: 971 # stop(gettextf("covariate must have unique values within groups for objects of class %s", dQuote("corAR1"))) # nlme/R/corStruct.R: 1139 # stop(gettextf("covariate must have unique values within groups for objects of class %s", dQuote("corCAR1"))) # nlme/R/corStruct.R: 1344 # stop(gettextf("covariate must have unique values within groups for objects of class %s", dQuote("corARMA"))) #~ msgid "" #~ "covariate must have unique values within groups for objects of class %s" #~ msgstr "" #~ "zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla " #~ "obiektów klasy %s" # nlme/R/corStruct.R: 453 # stop(gettextf("unique values of the covariate for objects of class %s must be a sequence of consecutive integers", dQuote("corSymm"))) # nlme/R/corStruct.R: 693 # stop(gettextf("unique values of the covariate for objects of class %s must be a sequence of consecutive integers", dQuote("corNatural"))) #~ msgid "" #~ "unique values of the covariate for objects of class %s must be a " #~ "sequence of consecutive integers" #~ msgstr "" #~ "unikalne wartości zmiennej wyjaśniającej dla obiektów klasy %s muszą być " #~ "ciągiem kolejnych liczb całkowitych" # nlme/R/corStruct.R: 468 # stop(gettextf("initial values for %d must be between %d and %d", dQuote("corSymm"), -1, 1)) # nlme/R/corStruct.R: 708 # stop(gettextf("initial values for %d must be between %d and %d", dQuote("corNatural"), -1, 1)) #~ msgid "initial values for %s must be between %d and %d" #~ msgstr "początkowe wartości dla %s muszą być pomiędzy %d a %d" # nlme/R/corStruct.R: 507 # gettextf("Unitialized correlation structure of class %s", dQuote("corSymm"), domain = "R-nlme") # nlme/R/corStruct.R: 524 # gettextf("Unitialized correlation structure of class %s", dQuote("corSymm"), domain = "R-nlme") # nlme/R/corStruct.R: 741 # gettextf("Unitialized correlation structure of class %s", dQuote("corNatural"), domain = "R-nlme") # nlme/R/corStruct.R: 759 # gettextf("Unitialized correlation structure of class %s", dQuote("corNatural"), domain = "R-nlme") #~ msgid "Unitialized correlation structure of class %s" #~ msgstr "Niezainicjalizowana struktura korelacji klasy %s" # nlme/R/corStruct.R: 516 # gettext("Correlation Structure: General", domain = "R-nlme") # nlme/R/corStruct.R: 750 # gettext("Correlation Structure: General", domain = "R-nlme") #~ msgid "Correlation Structure: General" #~ msgstr "Struktura korelacji: Ogólna" # nlme/R/corStruct.R: 546 # gettext("General correlation", domain = "R-nlme") #~ msgid "General correlation" #~ msgstr "Ogólna korelacja" # nlme/R/corStruct.R: 782 # gettext("General correlation, with natural parametrization", domain = "R-nlme") #~ msgid "General correlation, with natural parametrization" #~ msgstr "Ogólna korelacja z naturalną parametryzacją" # nlme/R/corStruct.R: 842 # gettext("Independent", domain = "R-nlme") #~ msgid "Independent" #~ msgstr "Niezależna" # nlme/R/corStruct.R: 856 # stop(gettextf("parameter in %s structure must be between %d and %d", "AR(1)", -1, 1)) # nlme/R/corStruct.R: 1018 # stop(gettextf("parameter in %s structure must be between %d and %d", "CAR(1)", 0, 1)) # nlme/R/corStruct.R: 1397 # stop(gettextf("parameter in %s structure must be between %d and %d", dQuote("corCompSymm"), -1, 1)) #~ msgid "parameter in %s structure must be between %d and %d" #~ msgstr "parametr w strukturze %s musi być pomiędzy %d a %d" # nlme/R/corStruct.R: 1163 # gettext("Continuous AR(1)", domain = "R-nlme") #~ msgid "Continuous AR(1)" #~ msgstr "Ciągła AR(1)" # nlme/R/corStruct.R: 1189 # stop(gettextf("parameters in %s structure must be between %d and %d", "ARMA", -1, 1)) #~ msgid "parameters in %s structure must be between %d and %d" #~ msgstr "parametry w strukturze %s muszą być pomiędzy %d a %d" # nlme/R/corStruct.R: 1541 # gettext("Compound symmetry", domain = "R-nlme") #~ msgid "Compound symmetry" #~ msgstr "Złożona symetria" # nlme/R/corStruct.R: 2118 # stop("'range' must be > 0 in \"corLin\" initial value") #~ msgid "'%s' argument must be > 0 in %s initial value" #~ msgstr "argument '%s' musi być > 0 w początkowej wartości %s" # nlme/R/corStruct.R: 2038 # gettext("Exponential spatial correlation", domain = "R-nlme") #~ msgid "Exponential spatial correlation" #~ msgstr "Wykładnicza korelacja przestrzenna" # nlme/R/corStruct.R: 2068 # gettext("Gaussian spatial correlation", domain = "R-nlme") #~ msgid "Gaussian spatial correlation" #~ msgstr "Gaussowska korelacja przestrzenna" # nlme/R/corStruct.R: 2156 # gettext("Linear spatial correlation", domain = "R-nlme") #~ msgid "Linear spatial correlation" #~ msgstr "Liniowa korelacja przestrzenna" # nlme/R/corStruct.R: 2186 # gettext("Rational quadratic spatial correlation", domain = "R-nlme") #~ msgid "Rational quadratic spatial correlation" #~ msgstr "Wymierna kwadratowa korelacja przestrzenna" # nlme/R/corStruct.R: 2277 # gettext("Spherical spatial correlation", domain = "R-nlme") #~ msgid "Spherical spatial correlation" #~ msgstr "Sferyczna korelacja przestrzenna" # nlme/R/gls.R: 38 # warning("negative 'control$nlmStepMax' - using default value") # nlme/R/gnls.R: 62 # warning("negative 'control$nlmStepMax' - using default value") # nlme/R/nlme.R: 177 # warning("negative 'control$nlmStepMax' - using default value") # nlme/R/lme.R: 145 # warning("negative 'control$nlmStepMax' - using default value") #~ msgid "negative 'control$nlmStepMax' - using default value" #~ msgstr "ujemna wartość 'control$nlmStepMax' - używanie wartości domyślnej" # nlme/R/gls.R: 163 # gettext("Iteration: ", domain = "R-nlme") #~ msgid "Iteration:" #~ msgstr "Iteracja:" # nlme/R/gls.R: 164 # gettext("Objective: ", domain = "R-nlme") #~ msgid "Objective:" #~ msgstr "Funkcja celu:" # nlme/R/gls.R: 166 # gettext("Convergence:", domain = "R-nlme") # nlme/R/gnls.R: 454 # gettext("Convergence:", domain = "R-nlme") # nlme/R/nlme.R: 936 # gettext("Convergence:", domain = "R-nlme") #~ msgid "Convergence:" #~ msgstr "Zbieżność:" # nlme/R/gls.R: 206 # gettext("Approximate variance-covariance matrix not available", domain = "R-nlme") # nlme/R/gnls.R: 512 # gettext("Approximate variance-covariance matrix not available", domain = "R-nlme") # nlme/R/lme.R: 411 # gettext("Approximate variance-covariance matrix not available", domain = "R-nlme") #~ msgid "Approximate variance-covariance matrix not available" #~ msgstr "Przybliżona macierz wariancji-kowiariancji nie jest dostępna" # nlme/R/gls.R: 294 # gettext("Non-positive definite approximate variance-covariance", domain = "R-nlme") # nlme/R/gnls.R: 593 # gettext("Non-positive definite approximate variance-covariance", domain = "R-nlme") # nlme/R/lme.R: 617 # gettext("Non-positive definite approximate variance-covariance", domain = "R-nlme") #~ msgid "Non-positive definite approximate variance-covariance" #~ msgstr "Niedodatnio określona przybliżona macierz wariancji-kowariancji" # nlme/R/newMethods.R: 15 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/newMethods.R: 134 # stop(gettextf("'%s' argument is not an object of class %s", "object", dQuote("formula"))) # nlme/R/newMethods.R: 273 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/newMethods.R: 693 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/gls.R: 410 # stop(gettextf("'%s' argument is not an object of class %s", "object", dQuote("gls"))) # nlme/R/gnls.R: 71 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/varFunc.R: 198 # stop(gettextf("'%s' argument is not an object of class %s", "value", dQuote("formula"))) # nlme/R/nlme.R: 186 # stop(gettextf("'%s' argument is not an object of class %s", "model", dQuote("formula"))) # nlme/R/lme.R: 853 # stop(gettextf("'%s' argument is not an object of class %s", "object", dQuote("lme"))) # nlme/R/lme.R: 1427 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/lme.R: 2237 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/lmList.R: 387 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/lmList.R: 649 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/lmList.R: 1031 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/newFunc.R: 135 # stop(gettextf("'%s' argument is not an object of class %s", "object", dQuote("data.frame"))) # nlme/R/newFunc.R: 140 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("formula"))) # nlme/R/newFunc.R: 186 # stop(gettextf("'%s' argument is not an object of class %s", "object", dQuote("formula"))) # nlme/R/newFunc.R: 216 # stop(gettextf("'%s' argument is not an object of class %s", "object", dQuote("data.frame"))) # nlme/R/newFunc.R: 220 # stop(gettextf("'%s' argument is not an object of class %s", "form", dQuote("fomrula"))) # nlme/R/newFunc.R: 301 # stop(gettextf("'%s' argument is not an object of class %s", "object", dQuote("lmList"))) #~ msgid "'%s' argument is not an object of class %s" #~ msgstr "argument '%s' nie jest obiektem klasy %s" # nlme/R/gls.R: 428 # gettext("Denom. DF: ", domain = "R-nlme") #~ msgid "Denom. DF:" #~ msgstr "Stopnie swobody mianownika:" # nlme/R/newMethods.R: 370 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/newMethods.R: 746 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/gls.R: 454 # stop(gettextf("'%s' argument must be between %d and %d", "Terms", 1, nTerms), domain = "R-nlme") # nlme/R/lme.R: 890 # stop(gettextf("'%s' argument must be between %d and %d", "Terms", 1, nTerms), domain = "R-nlme") # nlme/R/lme.R: 1516 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/lme.R: 2297 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/lme.R: 2353 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/lmList.R: 473 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/lmList.R: 745 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/lmList.R: 1090 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/lmList.R: 1143 # stop(gettextf("'%s' argument must be between %d and %d", "id", 0, 1)) # nlme/R/newFunc.R: 166 # stop(gettextf("'%s' argument must be between %d and %d", "which", 1, ncol(object)), domain = "R-nlme") #~ msgid "'%s' argument must be between %d and %d" #~ msgstr "argument '%s' musi być pomiędzy %d a %d" # nlme/R/gls.R: 470 # gettext(" F-test for: ", domain = "R-nlme") # nlme/R/lme.R: 910 # gettext("F-test for: ", domain = "R-nlme") #~ msgid "F-test for:" #~ msgstr "Test F dla:" # nlme/R/gls.R: 506 # gettext(" F-test for linear combinations", domain = "R-nlme") # nlme/R/lme.R: 952 # gettext("F-test for linear combinations", domain = "R-nlme") #~ msgid "F-test for linear combinations" #~ msgstr "Test F dla kombinacji liniowej" # nlme/R/gls.R: 705 # gettext("Fitted values", domain = "R-nlme") # nlme/R/lme.R: 1242 # gettext("Fitted values", domain = "R-nlme") # nlme/R/lmList.R: 262 # gettext("Fitted values", domain = "R-nlme") #~ msgid "Fitted values" #~ msgstr "Dopasowanie wartości" # nlme/R/gls.R: 754 # gettext("Coefficients:", domain = "R-nlme") # nlme/R/gls.R: 955 # gettext("Coefficients:", domain = "R-nlme") # nlme/R/gls.R: 992 # gettext("Coefficients:", domain = "R-nlme") # nlme/R/lmList.R: 986 # gettext("Coefficients:", domain = "R-nlme") # nlme/R/lmList.R: 1011 # gettext("Coefficients:", domain = "R-nlme") #~ msgid "Coefficients:" #~ msgstr "Współczynniki:" # nlme/R/gls.R: 769 # gettext("Residual standard error:", domain = "R-nlme") # nlme/R/gls.R: 800 # gettext("Residual standard error:", domain = "R-nlme") # nlme/R/gls.R: 962 # gettext("Residual standard error: ", domain = "R-nlme") # nlme/R/gls.R: 1013 # gettext("Residual standard error: ", domain = "R-nlme") # nlme/R/lmList.R: 994 # gettext("Residual standard error: ", domain = "R-nlme") #~ msgid "Residual standard error:" #~ msgstr "Standardowy błąd reszt:" # nlme/R/gls.R: 814 # gettext("Correlation structure:", domain = "R-nlme") # nlme/R/lme.R: 1383 # gettext("Correlation structure:", domain = "R-nlme") #~ msgid "Correlation structure:" #~ msgstr "Struktura korelacji:" # nlme/R/gls.R: 815 # gettext("Variance function:", domain = "R-nlme") # nlme/R/varFunc.R: 134 # gettext("Variance function:", domain = "R-nlme") # nlme/R/varFunc.R: 240 # gettext("Variance function:", domain = "R-nlme") # nlme/R/lme.R: 1384 # gettext("Variance function:", domain = "R-nlme") #~ msgid "Variance function:" #~ msgstr "Funkcja wariancji:" # nlme/R/gls.R: 906 # gettext("Predicted values", domain = "R-nlme") # nlme/R/gnls.R: 754 # gettext("Predicted values", domain = "R-nlme") # nlme/R/nlme.R: 1315 # gettext("Predicted values", domain = "R-nlme") # nlme/R/lme.R: 1967 # gettext("Predicted values", domain = "R-nlme") # nlme/R/lme.R: 2009 # gettext("Predicted values", domain = "R-nlme") # nlme/R/lmList.R: 956 # gettext("Predicted values", domain = "R-nlme") #~ msgid "Predicted values" #~ msgstr "Wyznaczone wartości" # nlme/R/gls.R: 916 # gettextf("Approximate %s %% confidence intervals", attr(x, "level") * 100, domain = "R-nlme") # nlme/R/lme.R: 2072 # gettextf("Approximate %s %% confidence intervals", attr(x, "level") * 100, domain = "R-nlme") #~ msgid "Approximate %s %% confidence intervals" #~ msgstr "Przybliżone %s %% przedziały ufności" # nlme/R/gls.R: 933 # gettext("Generalized nonlinear least squares fit", domain = "R-nlme") # nlme/R/gls.R: 973 # gettext("Generalized nonlinear least squares fit", domain = "R-nlme") #~ msgid "Generalized nonlinear least squares fit" #~ msgstr "Uogólnione nieliniowe dopasowanie metodą najmniejszych kwadratów" # nlme/R/gls.R: 936 # gettext("Generalized least squares fit by REML", domain = "R-nlme") # nlme/R/gls.R: 976 # gettext("Generalized least squares fit by REML", domain = "R-nlme") #~ msgid "Generalized least squares fit by REML" #~ msgstr "" #~ "Uogólnione dopasowanie metodą najmniejszych kwadratów ze względu na REML" # nlme/R/gls.R: 938 # gettext("Generalized least squares fit by maximum likelihood", domain = "R-nlme") # nlme/R/gls.R: 978 # gettext("Generalized least squares fit by maximum likelihood", domain = "R-nlme") #~ msgid "Generalized least squares fit by maximum likelihood" #~ msgstr "" #~ "Uogólnione dopasowanie metodą najmniejszych kwadratów ze względu na " #~ "maksimum funkcji wiarygodności" # nlme/R/gls.R: 941 # gettext(" Model: ", domain = "R-nlme") # nlme/R/gls.R: 981 # gettext(" Model: ", domain = "R-nlme") # nlme/R/lme.R: 2099 # gettext(" Model: ", domain = "R-nlme") # nlme/R/lme.R: 2168 # gettext(" Model: ", domain = "R-nlme") # nlme/R/lmList.R: 981 # gettext(" Model: ", domain = "R-nlme") # nlme/R/lmList.R: 1005 # gettext(" Model: ", domain = "R-nlme") #~ msgid "Model:" #~ msgstr "Model:" # nlme/R/gls.R: 942 # gettext(" Data: ", domain = "R-nlme") # nlme/R/gls.R: 982 # gettext(" Data: ", domain = "R-nlme") # nlme/R/lme.R: 2107 # gettext(" Data: ", domain = "R-nlme") # nlme/R/lme.R: 2177 # gettext(" Data: ", domain = "R-nlme") # nlme/R/lmList.R: 985 # gettext(" Data: ", domain = "R-nlme") # nlme/R/lmList.R: 1010 # gettext(" Data: ", domain = "R-nlme") #~ msgid "Data:" #~ msgstr "Dane:" # nlme/R/gls.R: 944 # gettext(" Subset: ", domain = "R-nlme") # nlme/R/gls.R: 984 # gettext(" Subset: ", domain = "R-nlme") # nlme/R/lme.R: 2109 # gettext(" Subset: ", domain = "R-nlme") # nlme/R/lme.R: 2179 # gettext(" Subset: ", domain = "R-nlme") #~ msgid "Subset:" #~ msgstr "Podzbiór:" # nlme/R/gls.R: 947 # gettext(" Log-likelihood: ", domain = "R-nlme") # nlme/R/gls.R: 952 # gettext(" Log-likelihood: ", domain = "R-nlme") # nlme/R/lme.R: 2114 # gettext(" Log-likelihood: ", domain = "R-nlme") #~ msgid "Log-likelihood:" #~ msgstr "logarytm funkcji wiarygodności:" # nlme/R/gls.R: 950 # gettext(" Log-restricted-likelihood: ", domain = "R-nlme") # nlme/R/lme.R: 2112 # gettext(" Log-restricted-likelihood: ", domain = "R-nlme") #~ msgid "Log-restricted-likelihood:" #~ msgstr "Logarytm ograniczonej funkcji wiarygodności:" # nlme/R/gls.R: 961 # gettextf("Degrees of freedom: %s total; %s residual", dd[["N"]], dd[["N"]] - dd[["p"]], domain = "R-nlme") # nlme/R/gls.R: 1014 # gettextf("Degrees of freedom: %s total; %s residual", dd[["N"]], dd[["N"]] - dd[["p"]], domain = "R-nlme") # nlme/R/lmList.R: 993 # gettextf("Degrees of freedom: %s total; %s residual", length(unlist(lapply(x, fitted))), dfRes, domain = "R-nlme") #~ msgid "Degrees of freedom: %s total; %s residual" #~ msgstr "Stopnie swobody: całość %s, %s reszt" # nlme/R/gls.R: 987 # gettext("Convergence at iteration: ", domain = "R-nlme") # nlme/R/lme.R: 2182 # gettext("Convergence at iteration: ", domain = "R-nlme") #~ msgid "Convergence at iteration:" #~ msgstr "Zbieżność w iteracji:" # nlme/R/newMethods.R: 668 # gettext(" Correlation:", domain = "R-nlme") # nlme/R/gls.R: 1008 # gettext("Correlation:", domain = "R-nlme") # nlme/R/lme.R: 2209 # gettext(" Correlation:", domain = "R-nlme") #~ msgid "Correlation:" #~ msgstr "Korelacja:" # nlme/R/gls.R: 1010 # gettext("Standardized residuals:", domain = "R-nlme") #~ msgid "Standardized residuals:" #~ msgstr "Standaryzowane reszty:" # nlme/R/newMethods.R: 726 # gettext("Standardized residuals", domain = "R-nlme") # nlme/R/gls.R: 1025 # gettext("Standardized residuals", domain = "R-nlme") # nlme/R/lme.R: 2273 # gettext("Standardized residuals", domain = "R-nlme") # nlme/R/lme.R: 2572 # gettext("Standardized residuals", domain = "R-nlme") # nlme/R/lmList.R: 1067 # gettext("Standardized residuals", domain = "R-nlme") # nlme/R/lmList.R: 1319 # gettext("Standardized residuals", domain = "R-nlme") #~ msgid "Standardized residuals" #~ msgstr "Standaryzowane reszty" # nlme/R/newMethods.R: 727 # gettext("Normalized residuals", domain = "R-nlme") # nlme/R/newMethods.R: 748 # gettext("Normalized residuals", domain = "R-nlme") # nlme/R/gls.R: 1030 # gettext("Normalized residuals", domain = "R-nlme") # nlme/R/lme.R: 2274 # gettext("Normalized residuals", domain = "R-nlme") # nlme/R/lme.R: 2299 # gettext("Normalized residuals", domain = "R-nlme") # nlme/R/lme.R: 2573 # gettext("Normalized residuals", domain = "R-nlme") #~ msgid "Normalized residuals" #~ msgstr "Znormalizowane reszty" # nlme/R/newMethods.R: 729 # gettext("Residuals", domain = "R-nlme") # nlme/R/gls.R: 1034 # gettext("Residuals", domain = "R-nlme") # nlme/R/lme.R: 2276 # gettext("Residuals", domain = "R-nlme") # nlme/R/lme.R: 2566 # gettext("Residuals", domain = "R-nlme") # nlme/R/lmList.R: 1069 # gettext("Residuals", domain = "R-nlme") # nlme/R/lmList.R: 1315 # gettext("Residuals", domain = "R-nlme") #~ msgid "Residuals" #~ msgstr "Reszty" # nlme/R/gls.R: 1093 # stop("an object with 'call' component is required") # nlme/R/gnls.R: 768 # stop("an object with 'call' component is required") # nlme/R/nlme.R: 1332 # stop("an object with 'call' component is required") # nlme/R/lme.R: 2625 # stop("an object with 'call' component is required") #~ msgid "an object with 'call' component is required" #~ msgstr "wymagany jest obiekt z komponentem 'call'" # nlme/R/gnls.R: 126 # stop(gettextf("'%s' must be a formula or list of formulae", "params")) # nlme/R/nlme.R: 275 # stop(gettextf("'%s' must be a formula or list of formulae", "fixed")) # nlme/R/nlme.R: 294 # stop(gettextf("'%s' must be a formula or list of formulae", "random")) #~ msgid "'%s' argument must be a formula or list of formulae" #~ msgstr "argument '%s' musi być formułą lub listą formuł" # nlme/R/gnls.R: 128 # stop(gettextf("formulae in '%s' must be of the form \"parameter ~ expr\"", "params")) # nlme/R/gnls.R: 130 # stop(gettextf("formulae in '%s' must be of the form \"parameter ~ expr\"", "params")) # nlme/R/nlme.R: 277 # stop(gettextf("formulae in '%s' must be of the form \"parameter ~ expr\"", "fixed")) # nlme/R/nlme.R: 279 # stop(gettextf("formulae in '%s' must be of the form \"parameter ~ expr\"", "fixed")) # nlme/R/nlme.R: 296 # stop(gettextf("formulae in '%s' must be of the form \"parameter ~ expr\"", "random")) # nlme/R/nlme.R: 298 # stop(gettextf("formulae in '%s' must be of the form \"parameter ~ expr\"", "random")) #~ msgid "formulae in '%s' must be of the form \"parameter ~ expr\"" #~ msgstr "formuły w '%s' muszą mieć formę \"parametr ~ wyrażenie\"" # nlme/R/gnls.R: 382 # gettextf("Iteration %d", numIter, domain = "R-nlme") # nlme/R/nlme.R: 841 # gettextf("Iteration %d", numIter, domain = "R-nlme") #~ msgid "Iteration %d" #~ msgstr "Iteracja %d" # nlme/R/gnls.R: 384 # gettext("GLS step: Objective: ", domain = "R-nlme") #~ msgid "GLS step: Objective:" #~ msgstr "krok GLS: Funkcja celu:" #~ msgid "NLS step: RSS = %s" #~ msgstr "krok NLS: RSS = %s" # nlme/R/gnls.R: 433 # gettext("model parameters:", domain = "R-nlme") #~ msgid "model parameters:" #~ msgstr "parametry modelu:" # nlme/R/gnls.R: 435 # gettext("iterations: ", domain = "R-nlme") # nlme/R/nlme.R: 901 # gettext("iterations: ", domain = "R-nlme") #~ msgid "iterations:" #~ msgstr "iteracje:" # nlme/R/groupedData.R: 31 # stop(gettextf("first argument passed to %s function must be a two-sided formula", sQuote("GroupedData()"))) # nlme/R/groupedData.R: 50 # stop(gettextf("first argument passed to %s function must be a two-sided formula", sQuote("nfGroupedData()"))) # nlme/R/groupedData.R: 150 # stop(gettextf("first argument passed to %s function must be a two-sided formula", sQuote("nmGroupedData()"))) #~ msgid "first argument passed to %s function must be a two-sided formula" #~ msgstr "" #~ "pierwszy argument przekazywany do funkcji %s musi być dwustronną formułą" # nlme/R/pdMat.R: 1740 # stop(gettextf("'%s' argument must be a list", "form")) # nlme/R/pdMat.R: 1749 # stop(gettextf("'%s' argument must be a list", "nam")) # nlme/R/groupedData.R: 227 # stop(gettextf("'%s' argument must be a list", "subset")) #~ msgid "'%s' argument must be a list" #~ msgstr "argument '%s' musi być listą" # nlme/R/newMethods.R: 121 # stop(gettextf("'%s' argument must be a two-sided formula", "form")) # nlme/R/newFunc.R: 201 # stop(gettextf("'%s' argument must be a two-sided formula", "form")) # nlme/R/groupedData.R: 293 # stop(gettextf("'%s' argument must be a two-sided formula", "preserve")) #~ msgid "'%s' argument must be a two-sided formula" #~ msgstr "argument '%s' musi być dwustronną formułą" # nlme/R/groupedData.R: 560 # gettext("Grouped Data: ", domain = "R-nlme") #~ msgid "Grouped Data:" #~ msgstr "Zgrupowane dane:" # nlme/R/lme.R: 1206 # gettext("Coefficients", domain = "R-nlme") # nlme/R/lmList.R: 216 # gettext("Coefficients", domain = "R-nlme") #~ msgid "Coefficients" #~ msgstr "Współczynniki" # nlme/R/lme.R: 1430 # stop(gettextf("'%s' argument must be a one-sided formula", "form")) # nlme/R/lmList.R: 390 # stop(gettextf("'%s' argument must be a one-sided formula", "form")) #~ msgid "'%s' argument must be a one-sided formula" #~ msgstr "argument '%s' musi być jednostronną formułą" # nlme/R/newMethods.R: 376 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/newMethods.R: 757 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/lme.R: 1528 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/lme.R: 2306 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/lme.R: 2359 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/lmList.R: 482 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/lmList.R: 750 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/lmList.R: 1096 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) # nlme/R/lmList.R: 1149 # stop(gettextf("'%s' argument can only be a formula or numeric", "id")) #~ msgid "'%s' argument can only be a formula or numeric" #~ msgstr "argument '%s' może być jedynie formułą lub liczbą" # nlme/R/newMethods.R: 388 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/newMethods.R: 769 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/lme.R: 1546 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/lme.R: 2318 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/lme.R: 2374 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/lmList.R: 497 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/lmList.R: 762 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/lmList.R: 1108 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) # nlme/R/lmList.R: 1164 # stop(gettextf("'%s' argument is of incorrect length", "idLabels")) #~ msgid "'%s' argument is of incorrect length" #~ msgstr "argument '%s' ma niepoprawną długość" # nlme/R/newMethods.R: 392 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/newMethods.R: 773 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/lme.R: 1550 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/lme.R: 2322 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/lme.R: 2378 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/lmList.R: 501 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/lmList.R: 766 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/lmList.R: 1112 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) # nlme/R/lmList.R: 1168 # stop(gettextf("'%s' argument can only be a formula or a vector", "idLabels")) #~ msgid "'%s' argument can only be a formula or a vector" #~ msgstr "argument '%s' może być jedynie formułą lub wektorem" # nlme/R/lme.R: 2036 # gettext("Call:", domain = "R-nlme") # nlme/R/lmList.R: 979 # gettext("Call:", domain = "R-nlme") # nlme/R/lmList.R: 1003 # gettext("Call:", domain = "R-nlme") #~ msgid "Call:" #~ msgstr "Wywołanie:" # nlme/R/lme.R: 2078 # gettext(" Level: ", domain = "R-nlme") # nlme/R/lme.R: 2149 # gettext("Level: ", domain = "R-nlme") # nlme/R/pdMat.R: 461 # gettext("Level: ", domain = "R-nlme") # nlme/R/lmList.R: 983 # gettext(" Level: ", domain = "R-nlme") # nlme/R/lmList.R: 1008 # gettext(" Level: ", domain = "R-nlme") #~ msgid "Level:" #~ msgstr "Poziom:" # nlme/R/lmList.R: 1018 # gettextf("Residual standard error: %s on %s degrees of freedom", format(x$RSE), x$df.residual, domain = "R-nlme") #~ msgid "Residual standard error: %s on %s degrees of freedom" #~ msgstr "Standardowy błąd reszt: %s dla %s stopni swobody" # nlme/R/newMethods.R: 733 # gettext("Quantiles of standard normal", domain = "R-nlme") # nlme/R/lme.R: 2283 # gettext("Quantiles of standard normal", domain = "R-nlme") # nlme/R/lmList.R: 1076 # gettext("Quantiles of standard normal", domain = "R-nlme") #~ msgid "Quantiles of standard normal" #~ msgstr "Kwantyle rozkładu normalnego" # nlme/R/lme.R: 2509 # gettext("Standardized random effects", domain = "R-nlme") # nlme/R/lmList.R: 1243 # gettext("Standardized random effects", domain = "R-nlme") #~ msgid "Standardized random effects" #~ msgstr "Ustandaryzowane efekty losowe" # nlme/R/lme.R: 2511 # gettext("Random effects", domain = "R-nlme") # nlme/R/lmList.R: 1245 # gettext("Random effects", domain = "R-nlme") #~ msgid "Random effects" #~ msgstr "Efekty losowe" # nlme/R/lme.R: 67 # stop("can only fit \"lmList\" objects with single grouping variable") # nlme/R/lme.R: 107 # stop("can only fit \"lmList\" objects with single grouping variable") #~ msgid "can only fit objects of class %s with single grouping variable" #~ msgstr "" #~ "można dopasować jedynie obiekty klasy %s z pojedynczą zmienną grupującą" # nlme/R/lme.R: 981 # stop(gettextf("objects must inherit from at least one of the following classes: %s", paste(dQuote(valid.classes), collapse = ", "))) #~ msgid "objects must inherit from at least one of the following classes: %s" #~ msgstr "" #~ "obiekty muszą dziedziczyć z co najmniej jednej z następujących klas: %s" # nlme/R/nlme.R: 899 # gettext("Fixed effects:", domain = "R-nlme") # nlme/R/lme.R: 1297 # gettext("Fixed effects:", domain = "R-nlme") # nlme/R/lme.R: 2186 # gettext("Fixed effects: ", domain = "R-nlme") #~ msgid "Fixed effects:" #~ msgstr "Ustalone efekty:" # nlme/R/lme.R: 1333 # gettext("Within-group standard error:", domain = "R-nlme") #~ msgid "Within-group standard error:" #~ msgstr "Standardowy błąd w obrębie grup:" # nlme/R/reStruct.R: 396 # gettext("Random effects:", domain = "R-nlme") # nlme/R/lme.R: 1382 # gettext("Random effects:", domain = "R-nlme") #~ msgid "Random effects:" #~ msgstr "Efekty losowe:" # nlme/R/lme.R: 1533 # stop(gettextf("covariate must have a level attribute when '%s' argument is a formula", "id")) # nlme/R/lme.R: 1556 # stop(gettextf("covariate must have a level attribute when '%s' argument is a formula", "idLabels")) #~ msgid "" #~ "covariate must have a level attribute when '%s' argument is a formula" #~ msgstr "" #~ "zmienna niezależna musi mieć atrybut poziomu, gdy argument '%s' jest " #~ "formułą" # nlme/R/lme.R: 2095 # gettext("Nonlinear mixed-effects model fit by REML", domain = "R-nlme") # nlme/R/lme.R: 2164 # gettext("Nonlinear mixed-effects model fit by REML", domain = "R-nlme") #~ msgid "Nonlinear mixed-effects model fit by REML" #~ msgstr "Nieliniowe dopasowanie modelu mieszanych efektów ze względu na REML" # nlme/R/lme.R: 2097 # gettext("Nonlinear mixed-effects model fit by maximum likelihood", domain = "R-nlme") # nlme/R/lme.R: 2166 # gettext("Nonlinear mixed-effects model fit by maximum likelihood", domain = "R-nlme") #~ msgid "Nonlinear mixed-effects model fit by maximum likelihood" #~ msgstr "" #~ "Nieliniowe dopasowanie modelu mieszanych efektów ze względu na maksimum " #~ "funkcji wiarygodności" # nlme/R/lme.R: 2102 # gettext("Linear mixed-effects model fit by REML", domain = "R-nlme") # nlme/R/lme.R: 2171 # gettext("Linear mixed-effects model fit by REML", domain = "R-nlme") #~ msgid "Linear mixed-effects model fit by REML" #~ msgstr "Liniowe dopasowanie modelu mieszanych efektów ze względnu na REML" # nlme/R/lme.R: 2104 # gettext("Linear mixed-effects model fit by maximum likelihood", domain = "R-nlme") # nlme/R/lme.R: 2173 # gettext("Linear mixed-effects model fit by maximum likelihood", domain = "R-nlme") #~ msgid "Linear mixed-effects model fit by maximum likelihood" #~ msgstr "" #~ "Liniowe dopasowanie model mieszanych efektów ze względu na maksimum " #~ "funkcji wiarygodności" # nlme/R/lme.R: 2118 # gettext(" Fixed: ", domain = "R-nlme") #~ msgid "Fixed:" #~ msgstr "Ustalone:" # nlme/R/lme.R: 2125 # gettext("Number of Observations: ", domain = "R-nlme") # nlme/R/lme.R: 2213 # gettext("Number of Observations: ", domain = "R-nlme") #~ msgid "Number of Observations:" #~ msgstr "Liczba obserwacji:" # nlme/R/lme.R: 2126 # gettext("Number of Groups: ", domain = "R-nlme") # nlme/R/lme.R: 2214 # gettext("Number of Groups: ", domain = "R-nlme") #~ msgid "Number of Groups:" #~ msgstr "Liczba brup:" # nlme/R/lme.R: 2211 # gettext("Standardized Within-Group Residuals:", domain = "R-nlme") #~ msgid "Standardized Within-Group Residuals:" #~ msgstr "Ustandaryzowane reszty wewnątrz grupy:" # nlme/R/modelStruct.R: 62 # gettextf("%s parameters:", i, domain = "R-nlme") #~ msgid "%s parameters:" #~ msgstr "parametry %s:" # nlme/R/newFunc.R: 148 # stop(gettextf("only one level allowed in %s function", sQuote("gapply"))) # nlme/R/newFunc.R: 228 # stop(gettextf("only one level allowed in %s function", sQuote("gsummary"))) #~ msgid "only one level allowed in %s function" #~ msgstr "tylko jeden poziom jest dozwolony w funkcji %s" # nlme/R/newFunc.R: 169 # stop(gettextf("'%s' argument can only be character or integer", "which")) #~ msgid "'%s' argument can only be character or integer" #~ msgstr "argument '%s' może być jedynie znakiem lub liczbą całkowitą" # nlme/R/newMethods.R: 74 # stop(gettextf("'%s' argument can only be a formula or a list of formulae", "form")) # nlme/R/pdMat.R: 170 # stop(gettextf("'%s' argument can only be a formula or a list of formulae", "form")) #~ msgid "'%s' argument can only be a formula or a list of formulae" #~ msgstr "argument '%s' może być jedynie formułą lub listą formuł" # nlme/R/newMethods.R: 475 # gettext("Lag", domain = "R-nlme") #~ msgid "Lag" #~ msgstr "Opóźnienie" #~ msgid "Autocorrelation" #~ msgstr "Autokorelacja" # nlme/R/newMethods.R: 603 # gettext("Distance", domain = "R-nlme") #~ msgid "Distance" #~ msgstr "Odległość" #~ msgid "Semivariogram" #~ msgstr "Semiwariogram" # nlme/R/newMethods.R: 815 # stop(gettextf("'%s' and '%s' arguments have incompatible lengths", "distance", "object")) # nlme/R/pdMat.R: 1753 # stop(gettextf("'%s' and '%s' arguments have incompatible lengths", "form", "nam")) # nlme/R/pdMat.R: 1766 # stop(gettextf("'%s' and '%s' arguments have incompatible lengths", "form", "pdClass")) # nlme/R/pdMat.R: 1769 # stop(gettextf("'%s' and '%s' arguments have incompatible lengths", "nam", "pdClass")) #~ msgid "'%s' and '%s' arguments have incompatible lengths" #~ msgstr "argumenty '%s' oraz '%s' mają niezgodne długości" # nlme/R/nlme.R: 843 # gettextf("LME step: Loglik: %s, nlm iterations: %d", format(nlmeFit$logLik), convIter, domain = "R-nlme") #~ msgid "LME step: Loglik: %s, nlm iterations: %d" #~ msgstr "krok LME: Logarytm funkcji wiarygodności: %s, iteracje nlm: %d" #~ msgid "PNLS step: RSS = %s" #~ msgstr "krok PNLS: RSS = %s" # nlme/R/pdMat.R: 90 # warning(gettextf("ignoring argument '%s'", "form")) # nlme/R/pdMat.R: 98 # warning(gettextf("ignoring argument '%s'", "nam")) # nlme/R/pdMat.R: 133 # warning(gettextf("ignoring argument '%s'", "form")) #~ msgid "ignoring argument '%s'" #~ msgstr "ignorowanie argumentu '%s'" # nlme/R/pdMat.R: 436 # gettextf("Positive definite matrix structure of class %s representing", dQuote(class(x)[1]), domain = "R-nlme") #~ msgid "Positive definite matrix structure of class %s representing" #~ msgstr "Struktura dodatnio określonej macierzy klasy reprezentującej %s" # nlme/R/pdMat.R: 439 # gettextf("Uninitialized positive definite matrix structure of class %s.", dQuote(class(x)[1]), domain = "R-nlme") #~ msgid "Uninitialized positive definite matrix structure of class %s." #~ msgstr "" #~ "Niezainicjalizowana struktura dodatnio określonej macierzy klasy %s" # nlme/R/varFunc.R: 135 # gettext(" Structure: ", domain = "R-nlme") # nlme/R/pdMat.R: 476 # gettext(" Structure: ", domain = "R-nlme") #~ msgid "Structure:" #~ msgstr "Struktura:" # nlme/R/pdMat.R: 510 # gettext(" Composite Structure: ", domain = "R-nlme") #~ msgid "Composite Structure:" #~ msgstr "Struktura złożona:" # nlme/R/pdMat.R: 1319 # stop("cannot extract the matrix from an uninitialized object") #~ msgid "cannot extract the matrix from an uninitialized object of class %s" #~ msgstr "" #~ "nie można wyodrębnić macierzy z niezainicjalizowanego obiektu klasy %s" # nlme/R/reStruct.R: 191 # stop(gettextf("cannot change parameter length of initialized object of class %s", dQuote("reStruct"))) # nlme/R/varFunc.R: 1191 # stop(gettextf("cannot change parameter length of initialized object of class %s", dQuote("varComb"))) # nlme/R/pdMat.R: 1973 # stop(gettextf("cannot change parameter length of initialized object of class %s", dQuote("pdMat"))) #~ msgid "cannot change parameter length of initialized object of class %s" #~ msgstr "" #~ "nie można zmienić długości parametru zainicjowanych obiektów klasy %s" # nlme/R/reStruct.R: 71 # stop(gettextf("'%s' argument must be a list or a formula", "object")) #~ msgid "'%s' argument must be a list or a formula" #~ msgstr "argument '%s' musi być listą lub formułą" # nlme/R/reStruct.R: 401 # gettext("Random effects estimates:", domain = "R-nlme") #~ msgid "Random effects estimates:" #~ msgstr "Oszacowania efektów losowych:" # nlme/R/reStruct.R: 407 # gettext("Uninitialized random effects structure", domain = "R-nlme") #~ msgid "Uninitialized random effects structure" #~ msgstr "Niezainicjalizowana struktura efektów losowych" # nlme/R/simulate.R: 115 # stop("order of arguments in 'simulate.lme' has changed to conform with generic in R-2.2.0", domain = "R-nlme") #~ msgid "" #~ "order of arguments in 'simulate.lme' has changed to conform with generic " #~ "in R-2.2.0" #~ msgstr "" #~ "kolejność argumentów w 'simulate.lme()' zmieniła się aby pasowała z " #~ "funkcjami ogólnymi w R-2.2.0" # nlme/R/varFunc.R: 144 # gettextf("Variance function structure of class %s with no parameters, or uninitialized", dQuote(class(x)[1]), domain = "R-nlme") # nlme/R/varFunc.R: 156 # gettextf("Variance function structure of class %s with no parameters, or uninitialized", dQuote(class(x)[1]), domain = "R-nlme") #~ msgid "" #~ "Variance function structure of class %s with no parameters, or " #~ "uninitialized" #~ msgstr "" #~ "Struktura funkcji wariancji klasy %s bez parametrów lub " #~ "niezainicjalizowana" # nlme/R/varFunc.R: 153 # gettextf("Variance function structure of class %s representing", dQuote(class(x)[1]), domain = "R-nlme") #~ msgid "Variance function structure of class %s representing" #~ msgstr "Struktura funkcji wariancji klasy reprezentującej %s" # nlme/R/varFunc.R: 202 # stop("'form' argument must have a covariate") #~ msgid "'%s' argument must have a covariate" #~ msgstr "argument '%s' musi posiadać zmienną niezależną" # nlme/R/varFunc.R: 241 # gettext(" Structure: fixed weights", domain = "R-nlme") #~ msgid "Structure: fixed weights" #~ msgstr "Struktura: ustalone wagi" # nlme/R/varFunc.R: 335 # stop(gettextf("cannot change the length of the %s parameter after initialization", dQuote("varIdent"))) # nlme/R/varFunc.R: 518 # stop(gettextf("cannot change the length of the %s parameter after initialization", dQuote("varStruct"))) # nlme/R/varFunc.R: 730 # stop(gettextf("cannot change the length of the %s parameter after initialization", dQuote("varExp"))) #~ msgid "cannot change the length of the %s parameter after initialization" #~ msgstr "nie można zmienić długości parametru %s po jego zainicjowaniu" # nlme/R/varFunc.R: 387 # stop(gettextf("initial value for %s should be of length %d", dQuote("varIdent"), len), domain = "R-nlme") # nlme/R/varFunc.R: 582 # stop(gettextf("initial value for %s should be of length %d", dQuote("varPower"), nStratVar), domain = "R-nlme") # nlme/R/varFunc.R: 624 # stop(gettextf("initial value for %s should be of length %d", dQuote("varPower"), 1), domain = "R-nlme") # nlme/R/varFunc.R: 792 # stop(gettextf("initial value for %s should be of length %d", dQuote("varExp"), nStratVar), domain = "R-nlme") # nlme/R/varFunc.R: 834 # stop(gettextf("initial value for %s should be of length %d", dQuote("varExp"), 1), domain = "R-nlme") #~ msgid "initial value for %s should be of length %d" #~ msgstr "początkowa wartość dla %s powinna być długości %d" # nlme/R/varFunc.R: 397 # stop(gettextf("nonexistent group names for initial values in %s", dQuote("varIdent"))) # nlme/R/varFunc.R: 587 # stop(gettextf("nonexistent group names for initial values in %s", dQuote("varPower"))) # nlme/R/varFunc.R: 797 # stop(gettextf("nonexistent group names for initial values in %s", dQuote("varExp"))) #~ msgid "nonexistent group names for initial values in %s" #~ msgstr "nieistniejące nazwy grup dla początkowych wartości w %s" # nlme/R/varFunc.R: 471 # stop(gettextf("fixed parameters must have group names in %s function", sQuote("varPower()"))) # nlme/R/varFunc.R: 556 # stop(gettextf("fixed parameters must have group names in %s function", sQuote("Initialize.varPower()"))) # nlme/R/varFunc.R: 684 # stop(gettextf("fixed parameters must have group names in %s function", sQuote("varExp()"))) # nlme/R/varFunc.R: 766 # stop(gettextf("fixed parameters must have group names in %s function", sQuote("Initialize.varExp()"))) # nlme/R/varFunc.R: 1045 # stop(gettextf("fixed parameters must have group names in %s function", sQuote("Initialize.varConstPower()"))) #~ msgid "fixed parameters must have group names in %s function" #~ msgstr "ustalone parametry muszą posiadać nazwy grup w funkcji %s" # nlme/R/varFunc.R: 1124 # gettext("Constant plus power of variance covariate") #~ msgid "Constant plus power of variance covariate" #~ msgstr "Stała plus potęga zmiennej niezależnej wariancji" # nlme/R/varFunc.R: 1232 # gettext("Combination of:", domain = "R-nlme") #~ msgid "Combination of:" #~ msgstr "Kombinacje:" # nlme/R/varFunc.R: 1246 # gettext("Combination of variance functions:", domain = "R-nlme") #~ msgid "Combination of variance functions:" #~ msgstr "Kombinacja funkcji wariancji:" # nlme/R/gls.R: 882 # stop(sprintf(ngettext(sum(wch), # "level %s is not allowed for %s", # "levels %s are not allowed for %s", domain = "R-nlme"), # paste(levs[wch], collapse = ", ")), domain = NA) # nlme/R/gnls.R: 694 # stop(sprintf(ngettext(sum(wch), # "level %s is not allowed for %s", # "levels %s are not allowed for %s", domain = "R-nlme"), # paste(levs[wch], collapse = ", ")), domain = NA) # nlme/R/nlme.R: 1178 # stop(sprintf(ngettext(sum(wch), # "level %s is not allowed for %s", # "levels %s ares not allowed for %s", domain = "R-nlme"), # paste(levs[wch], collapse = ", ")), domain = NA) # nlme/R/lme.R: 1934 # stop(sprintf(ngettext(sum(wch), # "level %s is not allowed for %s", # "levels %s are not allowed for %s", domain = "R-nlme"), # paste(levs[wch], collapse = ", ")), # domain = NA) #~ msgid "level %s is not allowed for %s" #~ msgid_plural "levels %s are not allowed for %s" #~ msgstr[0] "poziom %s nie jest dozwolony dla %s" #~ msgstr[1] "poziomy %s nie są dozwolone dla %s" #~ msgstr[2] "poziomy %s nie są dozwolone dla %s" # nlme/R/newMethods.R: 288 # stop(sprintf(ngettext(sum(naV), # "%s was not found in data", # "%s were not found in data", domain = "R-nlme"), # allV[naV]), domain = NA) # nlme/R/newMethods.R: 708 # stop(sprintf(ngettext(sum(naV), # "%s was not found in data", # "%s were not found in data", domain = "R-nlme"), # allV[naV]), domain = NA) # nlme/R/lme.R: 1445 # stop(sprintf(ngettext(sum(naV), # "%s was not found in data", # "%s were not found in data", domain = "R-nlme"), # allV[naV]), domain = NA) # nlme/R/lme.R: 2252 # stop(sprintf(ngettext(sum(naV), # "%s was not found in data", # "%s were not found in data", domain = "R-nlme"), # allV[naV]), domain = NA) # nlme/R/lmList.R: 405 # stop(sprintf(ngettext(sum(naV), # "%s was not found in data", # "%s were not found in data", domain = "R-nlme"), # allV[naV]), domain = NA) # nlme/R/lmList.R: 665 # stop(sprintf(ngettext(sum(naV), # "%s was not found in data", # "%s were not found in data", domain = "R-nlme"), # allV[naV]), domain = NA) # nlme/R/lmList.R: 1046 # stop(sprintf(ngettext(sum(naV), # "%s was not found in data", # "%s were not found in data", domain = "R-nlme"), # allV[naV]), domain = NA) #~ msgid "%s was not found in data" #~ msgid_plural "%s were not found in data" #~ msgstr[0] "%s nie został znaleziony w danych" #~ msgstr[1] "%s nie zostały znalezione w danych" #~ msgstr[2] "%s nie zostały znalezione w danych" # nlme/R/newFunc.R: 157 # stop(sprintf(ngettext(sum(wchNot), # "%s value was not matched", # "%s values were not matched", domain = "R-nlme"), # paste(which[wchNot], collapse = ", ")), # domain = NA) #~ msgid "%s value was not matched" #~ msgid_plural "%s values were not matched" #~ msgstr[0] "wartość %s nie została dopasowana" #~ msgstr[1] "wartości %s nie zostały dopasowane" #~ msgstr[2] "wartości %s nie zostały dopasowane" # nlme/R/corStruct.R: 1888 # stop("'data' argument is required in order to calculate covariate") #~ msgid "'data' argument is required in order to calculate covariate" #~ msgstr "" #~ "wymagany jest argument 'data' w celu obliczenia zmiennej wyjaśniającej " #~ "obiektu klasy \"corStruct\"" #~ msgid "'%d' argument must be between %d and %d" #~ msgstr "argument '%s' musi być pomiędzy %d a %d" #~ msgid "Random Effects:" #~ msgstr "Efekty losowe:" #, fuzzy #~ msgid "'%s' is of incorrect length" #~ msgstr "argument '%s' ma niepoprawną długość" #~ msgid "'%s' argument must be between 1 and %d" #~ msgstr "argument '%s' musi być pomiędzy 1 a %d" #, fuzzy #~ msgid "'%s' argument must be between 0 and 1" #~ msgstr "argument 'id' musi być pomiędzy 0 a 1" #~ msgid "Parameter estimate(s):" #~ msgstr "Oszacowania parametrów:" #, fuzzy #~ msgid "'which' argument must be between 1 and %d" #~ msgstr "argument 'Terms' musi być pomiędzy 1 a %d" #, fuzzy #~ msgid "Correlation structure of class \"corSymm\" representing" #~ msgstr "Struktura korelacji klasy %s reprezentującej" #, fuzzy #~ msgid "Unitialized correlation structure of class \"corSymm\"" #~ msgstr "Niezainicjalizowana struktura korelacji klasy %s" #, fuzzy #~ msgid "Correlation structure of class \"corNatural\" representing" #~ msgstr "Struktura korelacji klasy %s reprezentującej" #, fuzzy #~ msgid "Unitialized correlation structure of class \"corNatural\"" #~ msgstr "Niezainicjalizowana struktura korelacji klasy %s" #~ msgid "'object' argument is not an object of class \"gls\"" #~ msgstr "argument 'object' nie jest obiektem klasy \"gls\"" #~ msgid "'form' argument is not an object of class \"formula\"" #~ msgstr "argument 'form' nie jest obiektem klasy \"fomula\"" #~ msgid "'object' argument is not an object of class \"data.frame\"" #~ msgstr "argument 'object' nie jest obiektem klasy \"data.frame\"" #~ msgid "'value' argument is not an object of class \"formula\"" #~ msgstr "argument 'value' nie jest obiektem klasy \"formula\"" #, fuzzy #~ msgid "'object' argument is not an object of class \"formula\"" #~ msgstr "argument 'form' nie jest obiektem klasy \"fomula\"" #, fuzzy #~ msgid "Unitialized correlation structure of class corSymm" #~ msgstr "Niezainicjalizowana struktura korelacji klasy %s" nlme/po/fr.po0000644000176000001440000000516414632316272012636 0ustar ripleyusers# Translation of nlme.pot to French # Copyright (C) 2005 The R Foundation # This file is distributed under the same license as the nlme R package. # Philippe Grosjean , 2005. # msgid "" msgstr "" "Project-Id-Version: nlme 3.1-65\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-06-06 12:49+0200\n" "PO-Revision-Date: 2021-02-06 16:27+0100\n" "Last-Translator: Philippe Grosjean \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 2.4.2\n" #: corStruct.c:424 msgid "All parameters must be less than 1 in absolute value" msgstr "Tous les paramètres doivent être inférieurs à 1 en valeur absolue" #: corStruct.c:535 msgid "Coefficient matrix not invertible" msgstr "Matrice de coefficient non inversible" #: corStruct.c:872 corStruct.c:927 corStruct.c:987 corStruct.c:1029 msgid "Unknown spatial correlation class" msgstr "Classes de corrélation spatiale inconnues" #: nlme.c:468 msgid "First observation on an individual must have a dose" msgstr "La première observation sur un individu doit avoir une dose" #: nlmefit.c:426 #, c-format msgid "Singularity in backsolve at level %ld, block %ld" msgstr "Singularité rencontrée en résolution inverse au niveau %ld, bloc %ld" #: nlmefit.c:464 #, c-format msgid "" "Too many parameters for finite-difference Hessian; npar = %d, nTot = %g." msgstr "" "Trop de paramètres pour un Hessien de différences finies : par = %d, not = " "%g." #: nlmefit.c:575 nlmefit.c:756 msgid "Overfitted model!" msgstr "Modèle surajusté !" #: nlmefit.c:601 msgid "analytic gradient is not available with matrix logarithm" msgstr "" "un gradient analytique n'est pas disponible avec une matrice logarithmique" #: nlmefit.c:624 msgid "analytic gradient is not available with compound symmetry" msgstr "un gradient analytique n'est pas disponible avec une symétrie composée" #: nlmefit.c:917 #, c-format msgid "Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]" msgstr "" "Incapable de former la décomposition valeurs propres - vecteurs propres " "[RS(.) ierr = %d]" #: nlmefit.c:949 #, c-format msgid "" "Unable to form Cholesky decomposition: the leading minor of order %d is not " "pos.def." msgstr "" "Incapable de former la décomposition de Cholesky : le premier mineur d’ordre " "%d n’est pas pos.def." #: nlmefit.c:981 msgid "Haven't written the compound symmetry case for this yet" msgstr "Les cas de symétrie composée n'ont pas encore été écrits" nlme/po/R-nlme.pot0000644000176000001440000006037514772467244013565 0ustar ripleyusersmsgid "" msgstr "" "Project-Id-Version: nlme 3.1-167\n" "POT-Creation-Date: 2025-03-31 10:29\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" msgid "not implemented for \"nlme\" objects" msgstr "" msgid "not implemented for multiple levels of nesting" msgstr "" msgid "individual %s was not used in the fit" msgstr "" msgid "not implemented for uncorrelated errors" msgstr "" msgid "not implemented for correlation structures without a grouping factor" msgstr "" msgid "do not know how to calculate correlation matrix of %s object" msgstr "" msgid "\"corStruct\" object must have a \"fixed\" attribute" msgstr "" msgid "do not know how to obtain parameters of %s object" msgstr "" msgid "cannot change the length of the parameter of a \"corStruct\" object" msgstr "" msgid "'sumLenSq := sum(table(groups)^2)' = %g is too large.\n Too large or no groups in your correlation structure?" msgstr "" msgid "cannot change 'form'" msgstr "" msgid "need data to calculate covariate of \"corStruct\" object" msgstr "" msgid "cannot change the length of the parameter of a \"corSymm\" object" msgstr "" msgid "covariate must have unique values within groups for \"corSymm\" objects" msgstr "" msgid "unique values of the covariate for \"corSymm\" objects must be a sequence of consecutive integers" msgstr "" msgid "initial value for \"corSymm\" parameters of wrong dimension" msgstr "" msgid "initial values for \"corSymm\" must be between -1 and 1" msgstr "" msgid "initial values for \"corSymm\" do not define a positive-definite correlation structure" msgstr "" msgid "cannot change the length of the parameter of a \"corNatural\" object" msgstr "" msgid "covariate must have unique values within groups for \"corNatural\" objects" msgstr "" msgid "unique values of the covariate for \"corNatural\" objects must be a sequence of consecutive integers" msgstr "" msgid "initial value for \"corNatural\" parameters of wrong dimension" msgstr "" msgid "initial values for \"corNatural\" must be between -1 and 1" msgstr "" msgid "initial values for \"corNatural\" do not define a positive-definite correlation structure" msgstr "" msgid "parameter in AR(1) structure must be between -1 and 1" msgstr "" msgid "'sumLenSq' = %g is too large (larger than maximal integer)" msgstr "" msgid "cannot change the length of the parameter of a \"corAR1\" object" msgstr "" msgid "covariate must have unique values within groups for \"corAR1\" objects" msgstr "" msgid "parameter in CAR(1) structure must be between 0 and 1" msgstr "" msgid "cannot change the length of the parameter of a \"corCAR1\" object" msgstr "" msgid "covariate must have unique values within groups for \"corCAR1\" objects" msgstr "" msgid "autoregressive order must be a non-negative integer" msgstr "" msgid "moving average order must be a non-negative integer" msgstr "" msgid "at least one of 'p' and 'q' must be > 0" msgstr "" msgid "initial value for parameter of wrong length" msgstr "" msgid "parameters in ARMA structure must be < 1 in absolute value" msgstr "" msgid "'object' has not been Initialize()d" msgstr "" msgid "cannot change the length of the parameter of a \"corARMA\" object" msgstr "" msgid "covariate must have unique integer values within groups for \"corARMA\" objects" msgstr "" msgid "\"corARMA\" order (%g, %g) exceeds maximum lag in data (%g)" msgstr "" msgid "parameter in \"corCompSymm\" structure must be < 1 in absolute value" msgstr "" msgid "cannot change the length of the parameter of a \"corCompSymm\" object" msgstr "" msgid "initial value in \"corCompSymm\" must be greater than %s" msgstr "" msgid "cannot change the length of the parameter after initialization" msgstr "" msgid "need data to calculate covariate" msgstr "" msgid "cannot have zero distances in \"corSpatial\"" msgstr "" msgid "'range' must be > 0 in \"corSpatial\" initial value" msgstr "" msgid "initial value for \"corSpatial\" parameters of wrong dimension" msgstr "" msgid "initial value of nugget ratio must be between 0 and 1" msgstr "" msgid "'range' must be > 0 in \"corLin\" initial value" msgstr "" msgid "initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)" msgstr "" msgid "initial value for \"corLin\" parameters of wrong dimension" msgstr "" msgid "range must be > 0 in \"corSpher\" initial value" msgstr "" msgid "initial value for \"corSpher\" parameters of wrong dimension" msgstr "" msgid "model must be a formula of the form \"resp ~ pred\"" msgstr "" msgid "offset() terms are not supported" msgstr "" msgid "no coefficients to fit" msgstr "" msgid "maximum number of iterations reached without convergence" msgstr "" msgid "computed \"gls\" fit is singular, rank %s" msgstr "" msgid "object must inherit from class %s" msgstr "" msgid "'Terms' must be between 1 and %d" msgstr "" msgid "terms can only be integers or characters" msgstr "" msgid "data in %s call must evaluate to a data frame" msgstr "" msgid "%s without \"primary\" can only be used with fits of \"groupedData\" objects" msgstr "" msgid "only one level allowed for predictions" msgstr "" msgid "%s and %s must have the same group levels" msgstr "" msgid "wrong group levels" msgstr "" msgid "cannot get confidence intervals on var-cov components: %s" msgstr "" msgid "need an object with call component" msgstr "" msgid "'nint' is not consistent with 'breaks'" msgstr "" msgid "Within-group std. dev. must be a positive numeric value" msgstr "" msgid "'object' must be a formula" msgstr "" msgid "object formula must be of the form \"resp ~ pred\"" msgstr "" msgid "'data' must be given explicitly to use 'nls' to get initial estimates" msgstr "" msgid "no initial values for model parameters" msgstr "" msgid "starting estimates must have names when 'params' is missing" msgstr "" msgid "'params' must be a formula or list of formulae" msgstr "" msgid "formulae in 'params' must be of the form \"parameter ~ expr\"" msgstr "" msgid "step halving factor reduced below minimum in NLS step" msgstr "" msgid "cannot calculate REML log-likelihood for \"gnls\" objects" msgstr "" msgid "first argument to 'groupedData' must be a two-sided formula" msgstr "" msgid "right-hand side of first argument must be a conditional expression" msgstr "" msgid "first argument to 'nfGroupedData' must be a two-sided formula" msgstr "" msgid "only one level of grouping allowed" msgstr "" msgid "second argument to 'groupedData' must inherit from data.frame" msgstr "" msgid "first argument to 'nmGroupedData' must be a two-sided formula" msgstr "" msgid "single group not supported -- use groupedData()" msgstr "" msgid "'subset' ignored with single grouping factor" msgstr "" msgid "'subset' must be a list" msgstr "" msgid "undefined group declared in 'subset'" msgstr "" msgid "only one display level allowed" msgstr "" msgid "undefined display level %s for %s" msgstr "" msgid "undefined collapsing level %s for %s" msgstr "" msgid "collapsing level cannot be smaller than display level; setting it to the display level" msgstr "" msgid "'preserve' must be a two-sided formula" msgstr "" msgid "'asTable' cannot be used with multilevel grouped data" msgstr "" msgid "'asTable' can only be used with balanced 'groupedData' objects" msgstr "" msgid "'data' argument not used, but taken from groupedData object" msgstr "" msgid "multiple levels not allowed" msgstr "" msgid "'data' must be a \"groupedData\" object if 'groups' argument is missing" msgstr "" msgid "'data' in %s call must evaluate to a data frame" msgstr "" msgid "nonexistent groups requested in 'subset'" msgstr "" msgid "'subset' can only be character or integer" msgstr "" msgid "log-likelihood not available with NULL fits" msgstr "" msgid "'form' must be a formula" msgstr "" msgid "'form' must be a one-sided formula" msgstr "" msgid "covariate must be a data frame" msgstr "" msgid "cannot do pairs of just one variable" msgstr "" msgid "'id' must be between 0 and 1" msgstr "" msgid "'id' can only be a formula or numeric" msgstr "" msgid "'idLabels' of incorrect length" msgstr "" msgid "'idLabels' can only be a formula or a vector" msgstr "" msgid "covariate must be numeric" msgstr "" msgid "nonexistent group in 'newdata'" msgstr "" msgid "nonexistent group requested in 'subset'" msgstr "" msgid "only residuals and random effects allowed" msgstr "" msgid "can only fit \"lmList\" objects with single grouping variable" msgstr "" msgid "'lme.lmList' will redefine 'data'" msgstr "" msgid "initial value for \"reStruct\" overwritten in 'lme.lmList'" msgstr "" msgid "fixed-effects model must be a formula of the form \"resp ~ pred\"" msgstr "" msgid "incompatible lengths for 'random' and grouping factors" msgstr "" msgid "incompatible formulas for groups in 'random' and 'correlation'" msgstr "" msgid "cannot use smaller level of grouping for 'correlation' than for 'random'. Replacing the former with the latter." msgstr "" msgid "fewer observations than random effects in all level %s groups" msgstr "" msgid "%s problem, convergence error code = %s\n message = %s" msgstr "" msgid "maximum number of iterations (lmeControl(maxIter)) reached without convergence" msgstr "" msgid "terms must all have the same denominator DF" msgstr "" msgid "L may only involve fixed effects with the same denominator DF" msgstr "" msgid "objects must inherit from classes %s, or %s" msgstr "" msgid "some fitted objects deleted because response differs from the first model" msgstr "" msgid "first model has a different response from the rest" msgstr "" msgid "all fitted objects must have the same estimation method" msgstr "" msgid "fitted objects with different fixed effects. REML comparisons are not meaningful." msgstr "" msgid "objects must have a \"call\" component or attribute" msgstr "" msgid "all fitted objects must use the same number of observations" msgstr "" msgid "only single level allowed" msgstr "" msgid "cannot get confidence intervals on var-cov components: %s\n Consider '%s'" msgstr "" msgid "covariate must have a level attribute when groups are present" msgstr "" msgid "covariate must have a level attribute when 'id' is a formula" msgstr "" msgid "covariate must have a level attribute when 'idLabels' is a formula" msgstr "" msgid "'form' must be a formula when not NULL" msgstr "" msgid "only single effects allowed in left side of 'form'" msgstr "" msgid "%s is not a valid effect name" msgstr "" msgid "no effects allowed in right side of formula" msgstr "" msgid "cannot evaluate groups for desired levels on 'newdata'" msgstr "" msgid "'Id' must be between 0 and 1" msgstr "" msgid "augmentation of random effects only available for single level" msgstr "" msgid "no condensed linear model" msgstr "" msgid "no fitted \"lme\" object" msgstr "" msgid "objects must have coefficients with same row names" msgstr "" msgid "only one level allowed in 'gapply'" msgstr "" msgid "'which' must be between 1 and %d" msgstr "" msgid "'which' can only be character or integer" msgstr "" msgid "formula(object) must return a formula" msgstr "" msgid "'form' must be a two-sided formula" msgstr "" msgid "only one level allowed in 'gsummary'" msgstr "" msgid "'FUN' can only be a function or a list of functions" msgstr "" msgid "cannot omit grouping factor without 'form'" msgstr "" msgid "no degrees of freedom for estimating std. dev." msgstr "" msgid "data argument to \"data.frame\" method for 'getGroups' does not make sense" msgstr "" msgid "invalid formula for groups" msgstr "" msgid "'form' must have all components as formulas" msgstr "" msgid "'form' can only be a formula, or a list of formulas" msgstr "" msgid "level of %s does not match formula %s" msgstr "" msgid "'form' argument must be a formula" msgstr "" msgid "at least two coefficients are needed" msgstr "" msgid "no model variogram available with 'showModel = TRUE'" msgstr "" msgid "only residuals allowed" msgstr "" msgid "'distance' and 'object' have incompatible lengths" msgstr "" msgid "'nlme.nlsList' will redefine 'fixed', 'data', and 'start'" msgstr "" msgid "can only fit \"nlsList\" objects with single grouping variable" msgstr "" msgid "initial value for 'reStruct' overwritten in 'nlme.nlsList'" msgstr "" msgid "'model' must be a formula" msgstr "" msgid "model formula must be of the form \"resp ~ pred\"" msgstr "" msgid "'data' must be given explicitly to use 'nlsList'" msgstr "" msgid "'fixed' must be a formula or list of formulae" msgstr "" msgid "formulae in 'fixed' must be of the form \"parameter ~ expr\"" msgstr "" msgid "'random' must be a formula or list of formulae" msgstr "" msgid "formulae in 'random' must be of the form \"parameter ~ expr\"" msgstr "" msgid "incompatible formulas for groups in \"random\" and \"correlation\"" msgstr "" msgid "cannot use smaller level of grouping for \"correlation\" than for \"random\". Replacing the former with the latter." msgstr "" msgid "'start' must have a component called 'fixed'" msgstr "" msgid "starting values for the 'fixed' component are not the correct length" msgstr "" msgid "starting values for random effects should be a list, or a matrix" msgstr "" msgid "list with starting values for random effects must have names or be of length %d" msgstr "" msgid "starting values for the random components should be a list of matrices" msgstr "" msgid "number of rows in starting values for random component at level %s should be %d" msgstr "" msgid "number of columns in starting values for random component at level %s should be %d" msgstr "" msgid "starting values for random effects must include group levels" msgstr "" msgid "groups levels mismatch in 'random' and starting values for 'random' at level %s" msgstr "" msgid "names mismatch in 'random' and starting values for 'random' at level %s" msgstr "" msgid "Iteration %d, LME step: nlminb() did not converge (code = %d)." msgstr "" msgid "Do increase 'msMaxIter'!" msgstr "" msgid "PORT message:" msgstr "" msgid "Iteration %d, LME step: nlm() did not converge (code = %d)." msgstr "" msgid "step halving factor reduced below minimum in PNLS step" msgstr "" msgid "maximum number of iterations (maxIter = %d) reached without convergence" msgstr "" msgid "second argument must be a groupedData object" msgstr "" msgid "cannot use an anonymous function for the model" msgstr "" msgid "'data' must be a \"groupedData\" object if 'formula' does not include groups" msgstr "" msgid "old-style self-starting model functions\nare no longer supported.\nNew selfStart functions are available.\nUse\n SSfpl instead of fpl,\n SSfol instead of first.order.log,\n SSbiexp instead of biexp,\n SSlogis instead of logistic.\nIf writing your own selfStart model, see\n \"help(selfStart)\"\nfor the new form of the \"initial\" attribute." msgstr "" msgid "missing call attribute in \"nlsList\" object" msgstr "" msgid "cannot access the matrix of uninitialized objects" msgstr "" msgid "ignoring argument 'form'" msgstr "" msgid "ignoring argument 'nam'" msgstr "" msgid "'value' must be a square matrix" msgstr "" msgid "dimnames of 'value' must match or be NULL" msgstr "" msgid "names of 'value' are not consistent with 'nam' argument" msgstr "" msgid "%s is not a valid object for \"pdMat\"" msgstr "" msgid "all elements of 'form' list must be two-sided formulas" msgstr "" msgid "'form' can only be a formula or a list of formulae" msgstr "" msgid "'form' not consistent with 'nam'" msgstr "" msgid "length of 'nam' not consistent with dimensions of initial value" msgstr "" msgid "no default method for extracting the square root of a \"pdMat\" object" msgstr "" msgid "do not know how to obtain constrained coefficients" msgstr "" msgid "cannot access the number of columns of uninitialized objects without names" msgstr "" msgid "cannot extract the log of the determinant from an uninitialized object" msgstr "" msgid "cannot change dimensions on an initialized \"pdMat\" object" msgstr "" msgid "Length of names should be %d" msgstr "" msgid "names being assigned do not correspond to a permutation of previous names" msgstr "" msgid "x-y data to splom got botched somehow" msgstr "" msgid "cannot get the inverse of an uninitialized object" msgstr "" msgid "an object of length %d does not match the required parameter size" msgstr "" msgid "cannot extract matrix from an uninitialized object" msgstr "" msgid "cannot extract the inverse from an uninitialized object" msgstr "" msgid "an object of length %d does not match a Cholesky factor" msgstr "" msgid "cannot extract the matrix from an uninitialized object" msgstr "" msgid "cannot extract the matrix from an uninitialized \"pdIdent\" object" msgstr "" msgid "cannot extract the matrix with uninitialized dimensions" msgstr "" msgid "must give names when initializing \"pdIdent\" from parameter without a formula" msgstr "" msgid "cannot extract the dimensions" msgstr "" msgid "cannot extract the matrix from an uninitialized \"pdCompSymm\" object" msgstr "" msgid "initializing \"pdCompSymm\" object is not positive definite" msgstr "" msgid "must give names when initializing \"pdCompSymm\" from parameter without a formula" msgstr "" msgid "cannot obtain constrained coefficients with uninitialized dimensions" msgstr "" msgid "cannot access the matrix of object without names" msgstr "" msgid "'form' must be a list" msgstr "" msgid "'nam' must be a list" msgstr "" msgid "'form' and 'nam' have incompatible lengths" msgstr "" msgid "'pdClass' must be a character vector" msgstr "" msgid "'form' and 'pdClass' have incompatible lengths" msgstr "" msgid "'nam' and 'pdClass' have incompatible lengths" msgstr "" msgid "LNone of the arguments specify more than one block" msgstr "" msgid "'object' must be a list when not missing, not a matrix, and not numeric" msgstr "" msgid "arguments imply different number of blocks" msgstr "" msgid "all elements in the argument must generate \"pdMat\" objects" msgstr "" msgid "cannot have duplicated column names in a \"pdMat\" object" msgstr "" msgid "must have formula when no names are given" msgstr "" msgid "must give names when initializing from matrix or parameter" msgstr "" msgid "all elements must have names when any has names" msgstr "" msgid "all elements must have a non-zero size" msgstr "" msgid "cannot change the parameter when length of parameters is undefined" msgstr "" msgid "cannot change parameter length of initialized \"pdMat\" object" msgstr "" msgid "all elements must have formulas when any has a formula" msgstr "" msgid "all elements of formula must be list of two-sided formulae or two-sided formulae" msgstr "" msgid "cannot change the number of columns on an initialized object" msgstr "" msgid "names of object and value must match" msgstr "" msgid "\"pdMat\" element must have a formula" msgstr "" msgid "'object' must be a list or a formula" msgstr "" msgid "\"pdMat\" elements must have a formula" msgstr "" msgid "elements in 'object' must be formulas or \"pdMat\" objects" msgstr "" msgid "cannot change parameter length of initialized objects" msgstr "" msgid "cannot extract groups formula without a formula" msgstr "" msgid "all elements of a \"reStruct\" object must have a non-zero size" msgstr "" msgid "cannot change the length of 'object'" msgstr "" msgid "cannot extract model matrix without formula" msgstr "" msgid "incompatible lengths for object names" msgstr "" msgid "'data' must inherit from \"groupedData\" class if 'random' does not define groups" msgstr "" msgid "models with \"corStruct\" and/or \"varFunc\" objects not allowed" msgstr "" msgid "no degrees of freedom specified" msgstr "" msgid "plot method only implemented for comparing models" msgstr "" msgid "degrees of freedom and weights must have the same length" msgstr "" msgid "negative degrees of freedom not allowed" msgstr "" msgid "more than one degree of freedom is needed when one them is zero." msgstr "" msgid "can only construct \"varFunc\" object from another \"varFunc\" object, a formula, or a character string" msgstr "" msgid "cannot extract parameters of uninitialized object" msgstr "" msgid "do not know how to get coefficients for %s object" msgstr "" msgid "cannot change the length of covariate in \"varFunc\" object" msgstr "" msgid "'value' must be a one sided formula" msgstr "" msgid "'form' must have a covariate" msgstr "" msgid "ignoring 'group' in \"varFixed\" formula" msgstr "" msgid "all variables used in 'formula' must be in 'data'" msgstr "" msgid "ignoring initial values (no grouping factor)" msgstr "" msgid "initial values must have group names in 'varIdent'" msgstr "" msgid "initial values for 'varIdent' must be > 0" msgstr "" msgid "fixed parameters must have names in 'varIdent'" msgstr "" msgid "cannot change the length of the \"varIdent\" parameter after initialization" msgstr "" msgid "fixed parameter names in 'varIdent' must be a subset of group names" msgstr "" msgid "cannot fix variances in all groups" msgstr "" msgid "initial value for \"varIdent\" should be of length %d" msgstr "" msgid "names of starting value for \"varIdent\" object must contain all but one of the stratum levels" msgstr "" msgid "nonexistent group names for initial values in 'varIdent'" msgstr "" msgid "initial values must have group names in 'varPower'" msgstr "" msgid "fixed parameters must have group names in 'varPower'" msgstr "" msgid "cannot change the length of the \"varStruct\" parameter after initialization" msgstr "" msgid "cannot change coefficients before initialization or when all parameters are fixed" msgstr "" msgid "fixed parameters must have group names" msgstr "" msgid "mismatch between group names and fixed values names" msgstr "" msgid "initial value for \"varPower\" should be of length %d" msgstr "" msgid "nonexistent group names for initial values in \"varPower\"" msgstr "" msgid "initial value for \"varPower\" should be of length 1" msgstr "" msgid "initial values must have group names in 'varExp'" msgstr "" msgid "fixed parameters must have group names in 'varExp'" msgstr "" msgid "cannot change the length of the \"varExp\" parameter after initialization" msgstr "" msgid "initial value for \"varExp\" should be of length %d" msgstr "" msgid "nonexistent group names for initial values in \"varExp\"" msgstr "" msgid "initial value for \"varExp\" should be of length 1" msgstr "" msgid "%s can have at most two components" msgstr "" msgid "%s can only have names \"const\" and \"power\"" msgstr "" msgid "%s can only be a list or numeric" msgstr "" msgid "%s must have group names in 'varConstPower'" msgstr "" msgid "constant in \"varConstProp\" structure must be > 0" msgstr "" msgid "initial value should be of length %d" msgstr "" msgid "nonexistent group names for initial values" msgstr "" msgid "%s can only have names \"const\" and \"prop\"" msgstr "" msgid "%s must have group names in 'varConstProp'" msgstr "" msgid "all arguments to 'varComb' must be of class \"varFunc\"." msgstr "" msgid "cannot change parameter length of initialized \"varComb\" object" msgstr "" msgid "deviance undefined for REML fit" msgstr "" msgid "AIC undefined for REML fit" msgstr "" msgid "not (yet) implemented. Contributions are welcome; use intervals() instead (for now)" msgstr "" msgid "term %s not matched" msgid_plural "terms %s not matched" msgstr[0] "" msgstr[1] "" msgid "'L' must have at most %d column" msgid_plural "'L' must have at most %d columns" msgstr[0] "" msgstr[1] "" msgid "effect %s not matched" msgid_plural "effects %s not matched" msgstr[0] "" msgstr[1] "" msgid "supplied %d starting value, need %d" msgid_plural "supplied %d starting values, need %d" msgstr[0] "" msgstr[1] "" msgid "%s not found in data" msgid_plural "%s not found in data" msgstr[0] "" msgstr[1] "" msgid "nonexistent level %s" msgid_plural "nonexistent levels %s" msgstr[0] "" msgstr[1] "" msgid "%s not available for plotting" msgid_plural "%s not available for plotting" msgstr[0] "" msgstr[1] "" msgid "%s not matched" msgid_plural "%s not matched" msgstr[0] "" msgstr[1] "" msgid "group name not matched in starting values for random effects: %s" msgid_plural "group names not matched in starting values for random effects: %s" msgstr[0] "" msgstr[1] "" nlme/po/R-de.po0000644000176000001440000013307214772467244013031 0ustar ripleyusers# Translation of R-nlme.pot to German # Copyright (C) 2007-2025 The R Foundation # This file is distributed under the same license as the nlme package. msgid "" msgstr "" "Project-Id-Version: R 4.5.0\n" "Report-Msgid-Bugs-To: bugs@r-project.org\n" "POT-Creation-Date: 2025-03-31 10:29\n" "PO-Revision-Date: 2025-03-18 11:20+0100\n" "Last-Translator: Detlef Steuer \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "not implemented for \"nlme\" objects" msgstr "nicht für \"nlme\"-Objekte implementiert" msgid "not implemented for multiple levels of nesting" msgstr "nicht für mehrstufige Schachtelung implementiert" msgid "individual %s was not used in the fit" msgstr "Individuum %s wurde in der Anpassung nicht benutzt." msgid "not implemented for uncorrelated errors" msgstr "für unkorrelierte Fehler nicht implementiert" msgid "not implemented for correlation structures without a grouping factor" msgstr "für Korrelationsstruktur ohne Gruppierungsfaktor nicht implementiert" # R/corStruct.R msgid "do not know how to calculate correlation matrix of %s object" msgstr "" "Es ist nicht bekannt, wie die Korrelationsmatrix des Objekts %s berechnet " "wird." msgid "\"corStruct\" object must have a \"fixed\" attribute" msgstr "\"corStruct\"-Objekt muss ein \"fixed\"-Attribut haben." msgid "do not know how to obtain parameters of %s object" msgstr "Es ist nicht bekannt, wie Parameter des Objekts %s abgefragt werden." msgid "cannot change the length of the parameter of a \"corStruct\" object" msgstr "" "Die Länge des Parameters eines \"corStruct\"-Objekts kann nicht geändert " "werden." msgid "" "'sumLenSq := sum(table(groups)^2)' = %g is too large.\n" " Too large or no groups in your correlation structure?" msgstr "" "'sumLenSq := sum(table(groups)^2)' = %g ist zu groß.\n" " Zu große oder keine Gruppen in der Korrelationsstrujtur? " msgid "cannot change 'form'" msgstr "'form' kann nicht geändert werden." msgid "need data to calculate covariate of \"corStruct\" object" msgstr "" "Zur Berechnung der Kovariate des \"corStruct\"-Objekts werden Daten benötigt." msgid "cannot change the length of the parameter of a \"corSymm\" object" msgstr "" "Die Länge des Parameters eines \"corSymm\"-Objekts kann nicht geändert " "werden." # http://www.sozpsy.uni-hannover.de/marienthal/glossar/html/k37.htm msgid "covariate must have unique values within groups for \"corSymm\" objects" msgstr "" "Kovariate muss eindeutige Werte innerhalb der Gruppen für \"corSymm\"-" "Objekte haben." msgid "" "unique values of the covariate for \"corSymm\" objects must be a sequence " "of consecutive integers" msgstr "" "Eindeutige Werte der Kovariate für \"corSymm\"-Objekte müssen eine\n" "Sequenz von aufeinander folgenden ganzen Zahlen sein." msgid "initial value for \"corSymm\" parameters of wrong dimension" msgstr "Anfangswert für \"corSymm\"-Parameter hat falsche Dimension" msgid "initial values for \"corSymm\" must be between -1 and 1" msgstr "Anfangswerte für \"corSymm\" müssen zwischen -1 und 1 liegen." msgid "" "initial values for \"corSymm\" do not define a positive-definite correlation " "structure" msgstr "" "Anfangswerte für \"corSymm\" definieren keine positiv-definite " "Korrelationsstruktur." msgid "cannot change the length of the parameter of a \"corNatural\" object" msgstr "" "Die Länge des Parameters eines \"corNatural\"-Objekts kann nicht geändert " "werden." msgid "" "covariate must have unique values within groups for \"corNatural\" objects" msgstr "" "Kovariate muss eindeutige Werte innerhalb der Gruppen für \"corNatural-" "Objekte\" haben." msgid "" "unique values of the covariate for \"corNatural\" objects must be a sequence " "of consecutive integers" msgstr "" "Eindeutige Werte der Kovariate für \"corNatural\"-Objekte müssen eine\n" "Sequenz von aufeinanderfolgenden ganzen Zahlen sein" msgid "initial value for \"corNatural\" parameters of wrong dimension" msgstr "Anfangswert für \"corNatural\"-Parameter hat falsche Dimension" msgid "initial values for \"corNatural\" must be between -1 and 1" msgstr "Anfangswerte für \"corNatural\" müssen zwischen -1 und 1 liegen." msgid "" "initial values for \"corNatural\" do not define a positive-definite " "correlation structure" msgstr "" "Anfangswerte für \"corNatural\" definieren keine positiv-definite " "Korrelationsstruktur." msgid "parameter in AR(1) structure must be between -1 and 1" msgstr "Parameter in AR(1)-Struktur muss zwischen -1 und 1 liegen" msgid "'sumLenSq' = %g is too large (larger than maximal integer)" msgstr "'sumLenSq' = %g ist zu groß (größer als maximale Integerzahl)" msgid "cannot change the length of the parameter of a \"corAR1\" object" msgstr "" "Die Länge des Parameters eines \"corAR1\"-Objekts kann nicht geändert werden." # http://www.sozpsy.uni-hannover.de/marienthal/glossar/html/k37.htm msgid "covariate must have unique values within groups for \"corAR1\" objects" msgstr "" "Kovariate muss eindeutige Werte innerhalb der Gruppen für \"corAR1-Objekte\" " "haben." msgid "parameter in CAR(1) structure must be between 0 and 1" msgstr "Parameter in CAR(1)-Struktur muss zwischen 0 und 1 liegen." msgid "cannot change the length of the parameter of a \"corCAR1\" object" msgstr "" "Die Länge des Parameters eines \"corCAR1\"-Objekts kann nicht geändert " "werden." # http://www.sozpsy.uni-hannover.de/marienthal/glossar/html/k37.htm msgid "covariate must have unique values within groups for \"corCAR1\" objects" msgstr "" "Kovariate muss eindeutige Werte innerhalb der Gruppen für \"corCAR1-" "Objekte\" haben." msgid "autoregressive order must be a non-negative integer" msgstr "Autoregressive Ordnung muss eine nicht-negative Ganzzahl sein." msgid "moving average order must be a non-negative integer" msgstr "" "Ordnung des gleitenden Durchschnitts muss eine nicht-negative Ganzzahl sein." msgid "at least one of 'p' and 'q' must be > 0" msgstr "'p' oder 'q' muss > 0 sein" msgid "initial value for parameter of wrong length" msgstr "Anfangswerte für Parameter hat falsche Länge" msgid "parameters in ARMA structure must be < 1 in absolute value" msgstr "Parameter in ARMA-Struktur müssen vom Betrag < 1 sein." msgid "'object' has not been Initialize()d" msgstr "Initialize() wurde nicht für »object« ausgeführt" msgid "cannot change the length of the parameter of a \"corARMA\" object" msgstr "" "Die Länge des Parameters eines \"corARMA\"-Objekts kann nicht geändert " "werden." # http://www.sozpsy.uni-hannover.de/marienthal/glossar/html/k37.htm msgid "" "covariate must have unique integer values within groups for \"corARMA\" " "objects" msgstr "" "Kovariate muss eindeutige ganzzahlige Werte innerhalb der Gruppen für \"corARMA-" "Objekte\" haben." msgid "\"corARMA\" order (%g, %g) exceeds maximum lag in data (%g)" msgstr "" msgid "parameter in \"corCompSymm\" structure must be < 1 in absolute value" msgstr "Parameter in \"corCompSymm\"-Struktur muss vom Betrag < 1 sein." msgid "cannot change the length of the parameter of a \"corCompSymm\" object" msgstr "" "Die Länge des Parameters eines \"corCompSymm\"-Objekts kann nicht geändert " "werden." msgid "initial value in \"corCompSymm\" must be greater than %s" msgstr "Anfangswert in \"corCompSymm\" muss größer als %s sein." msgid "cannot change the length of the parameter after initialization" msgstr "" "Länge des Parameters kann nach der Initialisierung nicht geändert werden." msgid "need data to calculate covariate" msgstr "Um Kovariate zu berechnen, werden Daten benötigt." msgid "cannot have zero distances in \"corSpatial\"" msgstr "Es darf keine Null-Distanzen in \"corSpatial\" geben" msgid "'range' must be > 0 in \"corSpatial\" initial value" msgstr "'range' muss im \"corSpatial\"-Anfangswert > 0 sein." msgid "initial value for \"corSpatial\" parameters of wrong dimension" msgstr "Anfangswert des Parameters \"corSpatial\" hat falsche Dimension" msgid "initial value of nugget ratio must be between 0 and 1" msgstr "Anfangswert des Nugget-Anteils muss zwischen 0 und 1 liegen" msgid "'range' must be > 0 in \"corLin\" initial value" msgstr "'range' im \"corLin\"-Anfangswert muss > 0 sein" msgid "" "initial value for 'range' less than minimum distance. Setting it to 1.1 * " "min(distance)" msgstr "" "Anfangswert für 'range' kleiner als minimale Distanz. Er wird auf 1.1 * min " "(distance) gesetzt." msgid "initial value for \"corLin\" parameters of wrong dimension" msgstr "Anfangswert für Parameter \"corLin\" hat falsche Dimension." msgid "range must be > 0 in \"corSpher\" initial value" msgstr "Spannweite im \"corSpher\"-Anfangswert muss > 0 sein." msgid "initial value for \"corSpher\" parameters of wrong dimension" msgstr "Anfangswert für Parameter \"corSpher\" hat falsche Dimension" msgid "model must be a formula of the form \"resp ~ pred\"" msgstr "Modell muss eine Formel der Form \"resp ~ pred\" sein." msgid "offset() terms are not supported" msgstr "offset() Terme sind nicht unterstützt" msgid "no coefficients to fit" msgstr "keine Koeffizienten anzupassen" msgid "maximum number of iterations reached without convergence" msgstr "maximale Anzahl der Iterationen ohne Konvergenz erreicht" msgid "computed \"gls\" fit is singular, rank %s" msgstr "errechneter \"gls\"-Fit ist singulär, Rang %s" msgid "object must inherit from class %s" msgstr "Objekt muss von der Klasse %s erben" msgid "'Terms' must be between 1 and %d" msgstr "'Terms' müssen zwischen 1 und %d liegen." msgid "terms can only be integers or characters" msgstr "Terme können nur Ganzzahlen oder Zeichen sein" msgid "data in %s call must evaluate to a data frame" msgstr "Daten im %s-Aufruf müssen einen Dataframe ergeben" msgid "" "%s without \"primary\" can only be used with fits of \"groupedData\" objects" msgstr "" "%s ohne \"primary\" kann nur für Anpassungen von \"groupedData\"-Objekten " "genutzt werden." msgid "only one level allowed for predictions" msgstr "nur eine Stufe für Vorhersagen erlaubt" msgid "%s and %s must have the same group levels" msgstr "%s und %s müssen die gleichen Gruppenstufen haben" msgid "wrong group levels" msgstr "falsche Gruppenstufen" msgid "cannot get confidence intervals on var-cov components: %s" msgstr "" "Konfidenzintervalle für var-cov-Komponenten können nicht bestimmt werden: %s" msgid "need an object with call component" msgstr "ein Objekt mit Aufruf-Komponenten wird benötigt" msgid "'nint' is not consistent with 'breaks'" msgstr "'nint' ist nicht konsistent mit 'breaks'" msgid "Within-group std. dev. must be a positive numeric value" msgstr "SD innerhalb der Gruppe muss positiver numerischer Wert sein" msgid "'object' must be a formula" msgstr "'object' muss eine Formel sein" msgid "object formula must be of the form \"resp ~ pred\"" msgstr "Objekt-Formel muss von der Form \"resp ~ pred\" sein" msgid "'data' must be given explicitly to use 'nls' to get initial estimates" msgstr "" "'data' muss explizit angegeben werden, um 'nls' zum Gewinnen von " "Initialschätzungen zu nutzen." msgid "no initial values for model parameters" msgstr "keine Anfangswerte für Modellparameter" msgid "starting estimates must have names when 'params' is missing" msgstr "Startschätzung muss Namen haben, wenn 'params' fehlt" msgid "'params' must be a formula or list of formulae" msgstr "'params' müssen eine Formel oder eine Liste von Formeln sein." msgid "formulae in 'params' must be of the form \"parameter ~ expr\"" msgstr "Formeln in 'params' müssen die Form \"parameter ~ expr\" haben." msgid "step halving factor reduced below minimum in NLS step" msgstr "Schrittlängen-Halbierungsfaktor reduziert unter Minimum im NLS-Schritt" msgid "cannot calculate REML log-likelihood for \"gnls\" objects" msgstr "REML Log-likelihood für \"gnls\"-Objekte kann nicht berechnet werden" msgid "first argument to 'groupedData' must be a two-sided formula" msgstr "erstes Argument für 'groupedData' muss eine zweiseitige Formel sein" msgid "right-hand side of first argument must be a conditional expression" msgstr "rechte Seite des ersten Arguments muss ein bedingter Ausdruck sein" msgid "first argument to 'nfGroupedData' must be a two-sided formula" msgstr "erstes Argument für 'nfGroupedData' muss eine zweiseitige Formel sein" msgid "only one level of grouping allowed" msgstr "nur eine Stufe der Gruppierung erlaubt" msgid "second argument to 'groupedData' must inherit from data.frame" msgstr "zweites Argument für 'groupedData' muss von data.frame erben" msgid "first argument to 'nmGroupedData' must be a two-sided formula" msgstr "erstes Argument für 'nmGroupedData' muss eine zweiseitige Formel sein" msgid "single group not supported -- use groupedData()" msgstr "einzelne Gruppe nicht unterstützt -- nutze groupedData()" msgid "'subset' ignored with single grouping factor" msgstr "'subset' mit einzelnem Gruppierungsfaktor ignoriert" msgid "'subset' must be a list" msgstr "'subset' muss eine Liste sein" msgid "undefined group declared in 'subset'" msgstr "undefinierte Gruppe in 'subset' deklariert" msgid "only one display level allowed" msgstr "nur eine Anzeigestufe erlaubt" msgid "undefined display level %s for %s" msgstr "undefinierte Anzeigestufe %s für %s" msgid "undefined collapsing level %s for %s" msgstr "Collapsing-Stufe %s für %s nicht definiert" msgid "" "collapsing level cannot be smaller than display level; setting it to the " "display level" msgstr "" "Die Collapsing-Stufe kann nicht kleiner sein, als die Anzeigestufe; sie wird " "auf die Anzeigestufe gesetzt." msgid "'preserve' must be a two-sided formula" msgstr "'preserve' muss eine zweiseitige Formel sein" msgid "'asTable' cannot be used with multilevel grouped data" msgstr "'asTable' kann nicht mit mehrstufig gruppierten Daten benutzt werden" msgid "'asTable' can only be used with balanced 'groupedData' objects" msgstr "" "'asTable' kann nur mit balancierten 'groupedData'-Objekten benutzt werden" msgid "'data' argument not used, but taken from groupedData object" msgstr "'data' Argument nicht benutzt, aber vom groupedData Objekt genommen" msgid "multiple levels not allowed" msgstr "mehrere Stufen nicht erlaubt" msgid "'data' must be a \"groupedData\" object if 'groups' argument is missing" msgstr "" "'data' muss ein \"groupedData\"-Objekt sein, falls 'groups'-Argument fehlt" msgid "'data' in %s call must evaluate to a data frame" msgstr "'data' in %s muss sich zu einem Dataframe berechnen" msgid "nonexistent groups requested in 'subset'" msgstr "nicht existierende Gruppen in 'subset' angefordert" msgid "'subset' can only be character or integer" msgstr "'subset' kann nur ein Zeichen oder eine ganze Zahl sein" msgid "log-likelihood not available with NULL fits" msgstr "Log-likelihood nicht mit NULL-Fit verfügbar" msgid "'form' must be a formula" msgstr "'form' muss eine Formel sein" msgid "'form' must be a one-sided formula" msgstr "'form' muss eine einseitige Formel sein" msgid "covariate must be a data frame" msgstr "Kovariate muss ein Dataframe sein" msgid "cannot do pairs of just one variable" msgstr "kann pairs nicht mit nur einer Variablen durchführen" msgid "'id' must be between 0 and 1" msgstr "'id' muss zwischen 0 und 1 liegen" msgid "'id' can only be a formula or numeric" msgstr "'id' kann nur eine Formel oder numerisch sein." msgid "'idLabels' of incorrect length" msgstr "'idLabels' hat falsche Länge" msgid "'idLabels' can only be a formula or a vector" msgstr "'idLabels' kann nur eine Formel oder eine Vektor sein." msgid "covariate must be numeric" msgstr "Kovariate muss numerisch sein" msgid "nonexistent group in 'newdata'" msgstr "nicht existierende Gruppe in 'newdata'" msgid "nonexistent group requested in 'subset'" msgstr "nicht existierende Gruppe in 'subset' angefordert." msgid "only residuals and random effects allowed" msgstr "nur Residuen und zufällige Effekte erlaubt" msgid "can only fit \"lmList\" objects with single grouping variable" msgstr "" "Nur \"lmList\"-Objekte mit einzelner Gruppenvariable können angepasst werden." msgid "'lme.lmList' will redefine 'data'" msgstr "'lme.lmList' wird 'data' redefinieren" msgid "initial value for \"reStruct\" overwritten in 'lme.lmList'" msgstr "Anfangswert für \"reStruct\" in 'lme.lmList' überschrieben" msgid "fixed-effects model must be a formula of the form \"resp ~ pred\"" msgstr "Feste-Effekte-Modell muss eine Formel der Form \"resp ~ pred\" sein." msgid "incompatible lengths for 'random' and grouping factors" msgstr "inkompatible Längen für 'random' und Gruppierungsfaktoren" msgid "incompatible formulas for groups in 'random' and 'correlation'" msgstr "inkompatible Formeln für Gruppen in 'random' und 'correlation'" msgid "" "cannot use smaller level of grouping for 'correlation' than for 'random'. " "Replacing the former with the latter." msgstr "" "Für die Gruppierung von 'correlation' kann keine kleinere Stufe als für " "'random' benutzt werden. Ersteres wird durch letzteres ersetzt." msgid "fewer observations than random effects in all level %s groups" msgstr "" "weniger Beobachtungen als zufällige Effekte in allen Gruppen der Stufe %s" msgid "" "%s problem, convergence error code = %s\n" " message = %s" msgstr "" "%s Problem, Konvergenzfehlerkode = %s\n" " Nachricht = %s" msgid "" "maximum number of iterations (lmeControl(maxIter)) reached without " "convergence" msgstr "" "maximale Anzahl der Iterationen (lmeControl(maxIter)) ohne Konvergenz " "erreicht" msgid "terms must all have the same denominator DF" msgstr "Terme müssen alle den gleichen Freiheitsgrad im Nenner haben" msgid "L may only involve fixed effects with the same denominator DF" msgstr "L kann nur feste Effekte mit dem gleichen Nenner DF einschließen" msgid "objects must inherit from classes %s, or %s" msgstr "Objekte müssen von den Klassen %s oder %s erben" msgid "" "some fitted objects deleted because response differs from the first model" msgstr "" "einige gefittete Objekte gelöscht, da Antwort vom ersten Modell abweicht" msgid "first model has a different response from the rest" msgstr "erstes Modell hat eine vom Rest abweichende Antwort" msgid "all fitted objects must have the same estimation method" msgstr "Alle gefitteten Objekte müssen die gleiche Schätzungsmethode haben." msgid "" "fitted objects with different fixed effects. REML comparisons are not " "meaningful." msgstr "" "Gefittete Objekte mit unterschiedlichen festen Effekten. REML\n" "Vergleiche haben keine Bedeutung." msgid "objects must have a \"call\" component or attribute" msgstr "Objekte müssen eine \"call\"-Komponente oder -Attribut haben." msgid "all fitted objects must use the same number of observations" msgstr "" "Alle gefitteten Objekte müssen die gleiche Zahl von Beobachtungen benutzen." msgid "only single level allowed" msgstr "nur einzelne Stufe erlaubt" msgid "" "cannot get confidence intervals on var-cov components: %s\n" " Consider '%s'" msgstr "" "Konfidenzintervalle für var-cov-Komponenten können nicht bestimmt werden: " "%s\n" " Evtl. '%s'" msgid "covariate must have a level attribute when groups are present" msgstr "Kovariate muss ein Stufenattribut haben, wenn Gruppen vorhanden sind" msgid "covariate must have a level attribute when 'id' is a formula" msgstr "Kovariate muss ein Stufenattribut haben, wenn 'id' eine Formel ist" msgid "covariate must have a level attribute when 'idLabels' is a formula" msgstr "" "Kovariate muss ein Stufenattribut haben, wenn 'idLabels' eine Formel ist" msgid "'form' must be a formula when not NULL" msgstr "'form' muss eine Formel sein, wenn nicht NULL" msgid "only single effects allowed in left side of 'form'" msgstr "nur einzelne Effekte auf der linken Seite von 'form' erlaubt" msgid "%s is not a valid effect name" msgstr "%s ist kein gültiger Effektname" msgid "no effects allowed in right side of formula" msgstr "keine Effekte auf der rechten Seite der Formel erlaubt" msgid "cannot evaluate groups for desired levels on 'newdata'" msgstr "" "Gruppen für gewünschte Stufen auf 'newdata' können nicht ausgewertet werden" msgid "'Id' must be between 0 and 1" msgstr "'Id' muss zwischen 0 und 1 liegen" # CHECKME: augmentation? msgid "augmentation of random effects only available for single level" msgstr "" "Augmentation von zufälligen Effekten ist nur für einzelne Stufe verfügbar" msgid "no condensed linear model" msgstr "kein zusammengefasstes lineares Modell" msgid "no fitted \"lme\" object" msgstr "kein angepasstes \"lme\"-Objekt" msgid "objects must have coefficients with same row names" msgstr "Objekte müssen Koeffizienten mit gleichen Zeilennamen haben." msgid "only one level allowed in 'gapply'" msgstr "nur eine Stufe in 'gapply' erlaubt" msgid "'which' must be between 1 and %d" msgstr "'which' muss zwischen 1 und %d liegen." msgid "'which' can only be character or integer" msgstr "'which' kann nur ein Buchstabe oder eine Ganzzahl sein." msgid "formula(object) must return a formula" msgstr "Formel(Objekt) muss eine Formel zurückgeben." msgid "'form' must be a two-sided formula" msgstr "'form' muss eine zweiseitige Formel sein." msgid "only one level allowed in 'gsummary'" msgstr "nur eine Stufe in 'gsummary' erlaubt" msgid "'FUN' can only be a function or a list of functions" msgstr "'FUN' kann nur eine Funktion oder eine Liste von Funktionen sein." msgid "cannot omit grouping factor without 'form'" msgstr "Gruppierungsfaktor ohne 'form' kann nicht weggelassen werden." msgid "no degrees of freedom for estimating std. dev." msgstr "keine Freiheitsgrade für Schätzung von Standardabweichung" msgid "" "data argument to \"data.frame\" method for 'getGroups' does not make sense" msgstr "" "Datenargument für \"data.frame\"-Methode für 'getGroups' nicht sinnvoll" msgid "invalid formula for groups" msgstr "ungültige Formel für Gruppen" msgid "'form' must have all components as formulas" msgstr "'form' muss alle Komponenten als Formeln enthalten." msgid "'form' can only be a formula, or a list of formulas" msgstr "'form' kann nur eine Formel oder eine Liste von Formeln sein." # R/newMethods.R msgid "level of %s does not match formula %s" msgstr "Stufe von %s passt nicht zu Formel %s" msgid "'form' argument must be a formula" msgstr "'form'-Argument muss eine Formel sein" msgid "at least two coefficients are needed" msgstr "mindestens zwei Koeffizienten werden benötigt" msgid "no model variogram available with 'showModel = TRUE'" msgstr "kein Modell-Variogramm mit 'showModel = TRUE' verfügbar" msgid "only residuals allowed" msgstr "nur Residuen erlaubt" msgid "'distance' and 'object' have incompatible lengths" msgstr "'distance' und 'object' haben inkompatible Längen" msgid "'nlme.nlsList' will redefine 'fixed', 'data', and 'start'" msgstr "'nlme.nlsList' wird 'fixed', 'data' und 'start' neu definieren" msgid "can only fit \"nlsList\" objects with single grouping variable" msgstr "" "nur \"lmList\"-Objekte mit einzelner Gruppenvariable können angepasst werden." msgid "initial value for 'reStruct' overwritten in 'nlme.nlsList'" msgstr "Anfangswert für 'reStruct' in 'nlme.nlsList' überschrieben" msgid "'model' must be a formula" msgstr "'model' muss eine Formel sein." msgid "model formula must be of the form \"resp ~ pred\"" msgstr "Modell-Formel muss die Form \"resp ~ pred\" haben." msgid "'data' must be given explicitly to use 'nlsList'" msgstr "'data' muss explizit angegeben werden, um 'nlsList' zu benutzen." # R/nlme.R msgid "'fixed' must be a formula or list of formulae" msgstr "'fixed' muss eine Formel oder eine Liste von Formeln sein." msgid "formulae in 'fixed' must be of the form \"parameter ~ expr\"" msgstr "Formeln in 'fixed' müssen die Form \"parameter ~ expr\" haben." msgid "'random' must be a formula or list of formulae" msgstr "'random' muss eine Formel oder eine Liste von Formeln sein." msgid "formulae in 'random' must be of the form \"parameter ~ expr\"" msgstr "Formeln in 'random' müssen die Form \"parameter ~ expr\" haben." msgid "incompatible formulas for groups in \"random\" and \"correlation\"" msgstr "inkompatible Formeln für Gruppen in \"random\" und \"correlation\"" msgid "" "cannot use smaller level of grouping for \"correlation\" than for " "\"random\". Replacing the former with the latter." msgstr "" "Zur Gruppierung in \"correlation\" kann keine kleinere Stufe als für " "\"random\" benutzt werden. Ersteres wird durch letzteres ersetzt." msgid "'start' must have a component called 'fixed'" msgstr "'start' muss eine Komponente mit Namen 'fixed' haben." msgid "starting values for the 'fixed' component are not the correct length" msgstr "Startwerte für die Komponente 'fixed' haben nicht die richtige Länge." msgid "starting values for random effects should be a list, or a matrix" msgstr "" "Startwerte für Zufallseffekte sollten eine Liste oder eine Matrix sein." msgid "" "list with starting values for random effects must have names or be of length " "%d" msgstr "" "Liste mit Startwerten für Zufallseffekte muss Namen haben oder %d lang sein." msgid "starting values for the random components should be a list of matrices" msgstr "" "Startwerte für Zufallskomponenten sollten eine Liste von Matrizen sein." msgid "" "number of rows in starting values for random component at level %s should be " "%d" msgstr "" "Anzahl der Zeilen in Startwerten für Zufallskomponente auf Stufe %s sollte " "%d sein." msgid "" "number of columns in starting values for random component at level %s should " "be %d" msgstr "" "Anzahl der Spalten in Startwerten für Zufallskomponente auf Stufe %s sollte " "%d sein." msgid "starting values for random effects must include group levels" msgstr "Startwerte für Zufallseffekte müssen Gruppenstufen enthalten." msgid "" "groups levels mismatch in 'random' and starting values for 'random' at level " "%s" msgstr "" "Gruppenstufen stimmen in 'random' und in den Startwerten für 'random' auf " "Stufe %s nicht überein." msgid "" "names mismatch in 'random' and starting values for 'random' at level %s" msgstr "" "Namen in 'random' und in den Startwerten für 'random' auf Stufe %s passen " "nicht " msgid "Iteration %d, LME step: nlminb() did not converge (code = %d)." msgstr "Iteration %d, LME Schritt: nlminb() hat nicht konvergiert (Kode = %d)." msgid "Do increase 'msMaxIter'!" msgstr "Bitte 'msMaxIter' erhöhen!" msgid "PORT message:" msgstr "PORT Nachricht:" msgid "Iteration %d, LME step: nlm() did not converge (code = %d)." msgstr "Iteration %d, LME Schritt: nlm() hat nicht konvergiert (Kode = %d)." msgid "step halving factor reduced below minimum in PNLS step" msgstr "" "Schrittlängenhalbierungsfaktor unter das Minimum in PNLS-Schritt vermindert" msgid "maximum number of iterations (maxIter = %d) reached without convergence" msgstr "" "maximale Anzahl der Iterationen (maxIter = %d) ohne Konvergenz erreicht" msgid "second argument must be a groupedData object" msgstr "zweites Argument muss ein groupedData-Objekt sein" msgid "cannot use an anonymous function for the model" msgstr "eine anonyme Funktion kann für das Modell nicht benutzt werden" msgid "" "'data' must be a \"groupedData\" object if 'formula' does not include groups" msgstr "" "'data' muss ein \"groupedData\"-Objekt sein, wenn 'formula' keine Gruppen " "enthält." msgid "" "old-style self-starting model functions\n" "are no longer supported.\n" "New selfStart functions are available.\n" "Use\n" " SSfpl instead of fpl,\n" " SSfol instead of first.order.log,\n" " SSbiexp instead of biexp,\n" " SSlogis instead of logistic.\n" "If writing your own selfStart model, see\n" " \"help(selfStart)\"\n" "for the new form of the \"initial\" attribute." msgstr "" "Selbst-startende Model Funktionen im alten Stil\n" "werden nicht mehr unterstützt.\n" "Neue selbst-startende Funktionen sind verfügbar.\n" "Nutzen Sie\n" " SSfpl statt fpl,\n" " SSfol statt first.order.lag,\n" " SSbiexp statt biexp,\n" " SSlogis statt logistic.\n" "Um eigene selbst-startende Modelle zu implementieren,\n" "sehen Sie unter \"help(selfStart)\" die neue Form\n" "der \"initial\" Attribute nach." msgid "missing call attribute in \"nlsList\" object" msgstr "fehlendes Aufrufattribut in \"nlsList\"-Objekt" msgid "cannot access the matrix of uninitialized objects" msgstr "" "Auf die Matrix der nicht initialisierten Objekten kann nicht zugegriffen " "werden." msgid "ignoring argument 'form'" msgstr "Argument 'form' wird ignoriert" msgid "ignoring argument 'nam'" msgstr "Argument 'nam' wird ignoriert" msgid "'value' must be a square matrix" msgstr "'value' muss eine quadratische Matrix sein" msgid "dimnames of 'value' must match or be NULL" msgstr "dimnames von 'value' müssen übereinstimmen oder NULL sein" msgid "names of 'value' are not consistent with 'nam' argument" msgstr "Namen von 'value' sind nicht mit dem Argument 'nam' konsistent" msgid "%s is not a valid object for \"pdMat\"" msgstr "%s ist kein gültiges Objekt für \"pdMat\"." msgid "all elements of 'form' list must be two-sided formulas" msgstr "Alle Elemente der 'form'-Liste müssen zweiseitige Formeln sein." msgid "'form' can only be a formula or a list of formulae" msgstr "'form' kann nur eine Formel oder eine Liste von Formeln sein." msgid "'form' not consistent with 'nam'" msgstr "'form' nicht konsistent mit 'nam'" msgid "length of 'nam' not consistent with dimensions of initial value" msgstr "Länge von 'nam' nicht konsistent mit Dimensionen des Startwerts" msgid "no default method for extracting the square root of a \"pdMat\" object" msgstr "" "keine Standardmethode, um die Quadratwurzel eines \"pdMat\"-Objekts zu " "extrahieren" msgid "do not know how to obtain constrained coefficients" msgstr "" "Es ist nicht bekannt, wie eingeschränkte Koeffizienten bestimmt werden " "können." msgid "" "cannot access the number of columns of uninitialized objects without names" msgstr "" "Auf die Spaltenanzahl nicht initialisierter Objekte kann ohne Namen nicht " "zugegriffen werden." msgid "cannot extract the log of the determinant from an uninitialized object" msgstr "" "Der Logarithmus der Determinante eines nicht initialisierten Objekts kann " "nicht extrahiert werden." msgid "cannot change dimensions on an initialized \"pdMat\" object" msgstr "" "Die Dimensionen eines initialisierten \"pdMat\"-Objekts können nicht " "geändert werden." msgid "Length of names should be %d" msgstr "Länge von names sollte %d sein" msgid "" "names being assigned do not correspond to a permutation of previous names" msgstr "Zugeordnete Namen entsprechen keiner Permutation vorheriger Namen." msgid "x-y data to splom got botched somehow" msgstr "x-y-Daten an splom wurden irgendwie verpfuscht." msgid "cannot get the inverse of an uninitialized object" msgstr "Inverse eines nicht initialisierten Objekts kann nicht bestimmt werden" msgid "an object of length %d does not match the required parameter size" msgstr "" "Ein Objekt der Länge %d entspricht nicht der benötigten Parametergröße." msgid "cannot extract matrix from an uninitialized object" msgstr "" "Matrix kann nicht von einem nicht initialisierten Objekt extrahiert werden." msgid "cannot extract the inverse from an uninitialized object" msgstr "" "Inverse eines nicht initialisierten Objekts kann nicht extrahiert werden." msgid "an object of length %d does not match a Cholesky factor" msgstr "Ein Objekt der Länge %d entspricht keinem Cholesky-Faktor" msgid "cannot extract the matrix from an uninitialized object" msgstr "" "Matrix eines nicht initialisierten Objekts kann nicht extrahiert werden." msgid "cannot extract the matrix from an uninitialized \"pdIdent\" object" msgstr "" "Matrix eines nicht initialisierten \"pdIdent\"-Objekts kann nicht extrahiert " "werden." msgid "cannot extract the matrix with uninitialized dimensions" msgstr "" "Matrix mit nicht initialisierten Dimensionen kann nicht extrahiert werden." msgid "" "must give names when initializing \"pdIdent\" from parameter without a " "formula" msgstr "" "Wenn \"pdIdent\" über Parameter ohne eine Formel initialisiert wird, müssen " "Namen gegeben werden." msgid "cannot extract the dimensions" msgstr "Dimensionen können nicht extrahiert werden." msgid "cannot extract the matrix from an uninitialized \"pdCompSymm\" object" msgstr "" "Matrix eines nicht initialisierten \"pdCompSymm\"-Objekts kann nicht " "extrahiert werden" msgid "initializing \"pdCompSymm\" object is not positive definite" msgstr "Initialisierendes \"pdCompSymm\"-Objekt ist nicht positiv-definit" msgid "" "must give names when initializing \"pdCompSymm\" from parameter without a " "formula" msgstr "" "Wenn \"pdCompSymm\" über Parameter ohne eine Formel initialisiert wird, " "müssen Namen vergeben werden." msgid "cannot obtain constrained coefficients with uninitialized dimensions" msgstr "" "Eingeschränkte Koeffizienten können nicht mit nicht initialisierten " "Dimensionen nicht erlangt werden." msgid "cannot access the matrix of object without names" msgstr "Auf die Matrix des Objekts kann ohne Namen nicht zugegriffen werden." msgid "'form' must be a list" msgstr "'form' muss eine Liste sein" msgid "'nam' must be a list" msgstr "'nam' muss eine Liste sein" msgid "'form' and 'nam' have incompatible lengths" msgstr "'form' und 'nam' haben inkompatible Längen" # http://einstein.informatik.uni-oldenburg.de/rechnernetze/neue_verfahren.htm msgid "'pdClass' must be a character vector" msgstr "'pdClass' muss ein Zeichenvektor sein" msgid "'form' and 'pdClass' have incompatible lengths" msgstr "'form' und 'pdClass' haben inkompatible Längen" msgid "'nam' and 'pdClass' have incompatible lengths" msgstr "'nam' und 'pdClass' haben inkompatible Längen" # FIXME s/LNone/None/ specifies? msgid "LNone of the arguments specify more than one block" msgstr "Keines der Argumente gibt mehr als einen Block an" # R/pdMat.R msgid "'object' must be a list when not missing, not a matrix, and not numeric" msgstr "" "'object' muss eine Liste sein, wenn es nicht fehlt, keine Matrix und nicht " "numerisch." msgid "arguments imply different number of blocks" msgstr "Argumente implizieren eine unterschiedliche Zahl von Blöcken" msgid "all elements in the argument must generate \"pdMat\" objects" msgstr "Alle Elemente des Arguments müssen \"pdMat\"-Objekte generieren." msgid "cannot have duplicated column names in a \"pdMat\" object" msgstr "In \"pdMat\"-Objekten darf es keine doppelten Spaltennamen geben." msgid "must have formula when no names are given" msgstr "muss Formel haben, wenn keine Namen gegeben sind" msgid "must give names when initializing from matrix or parameter" msgstr "" "Namen müssen vergeben werden, wenn von Matrix oder Parameter initialisiert " "wird" msgid "all elements must have names when any has names" msgstr "Alle Elemente müssen Namen habe, wenn irgendeins einen Namen hat." msgid "all elements must have a non-zero size" msgstr "Alle Elemente müssen eine Größe ungleich Null haben." msgid "cannot change the parameter when length of parameters is undefined" msgstr "" "Der Parameter kann nicht geändert werden, wenn die Länge der Parameter " "undefiniert ist." msgid "cannot change parameter length of initialized \"pdMat\" object" msgstr "" "Länge des initialisierten \"pdMat\"-Objekts kann nicht geändert werden." msgid "all elements must have formulas when any has a formula" msgstr "Alle Elemente müssen Formeln habe, wenn irgendeins eine Formel hat." msgid "" "all elements of formula must be list of two-sided formulae or two-sided " "formulae" msgstr "" "Alle Elemente der Formel müssen eine Liste zweiseitiger Formeln oder " "zweiseitige Formeln sein." msgid "cannot change the number of columns on an initialized object" msgstr "" "Die Anzahl der Spalten eines initialisierten Objekts kann nicht geändert " "werden." msgid "names of object and value must match" msgstr "Namen von Objekt und Wert müssen übereinstimmen." msgid "\"pdMat\" element must have a formula" msgstr "\"pdMat\"-Element muss eine Formel haben." msgid "'object' must be a list or a formula" msgstr "'object' muss eine Liste oder Formel sein" msgid "\"pdMat\" elements must have a formula" msgstr "\"pdMat\"-Elemente müssen eine Formel haben" msgid "elements in 'object' must be formulas or \"pdMat\" objects" msgstr "Elemente in 'object' müssen Formeln oder \"pdMat\"-Objekte sein." msgid "cannot change parameter length of initialized objects" msgstr "" "Parameterlänge von initialisierten Objekten kann nicht geändert werden." msgid "cannot extract groups formula without a formula" msgstr "Gruppenformel ohne eine Formel kann nicht extrahiert werden." msgid "all elements of a \"reStruct\" object must have a non-zero size" msgstr "" "Alle Elemente eines \"reStruct\"-Objekts müssen eine Größe ungleich Null " "haben." msgid "cannot change the length of 'object'" msgstr "Länge von 'object' kann nicht geändert werden." msgid "cannot extract model matrix without formula" msgstr "Modellmatrix kann ohne Formel nicht extrahiert werden." msgid "incompatible lengths for object names" msgstr "inkompatible Länge für Objektnamen" msgid "" "'data' must inherit from \"groupedData\" class if 'random' does not define " "groups" msgstr "" "'data' muss von der Klasse \"groupedData\" erben, falls 'random' keine " "Gruppen definiert." msgid "models with \"corStruct\" and/or \"varFunc\" objects not allowed" msgstr "Modelle mit \"corStruct\"- und/oder \"varFunc\"-Objekten nicht erlaubt" msgid "no degrees of freedom specified" msgstr "keine Freiheitsgrade angegeben" msgid "plot method only implemented for comparing models" msgstr "Plotmehtode nur für Modellvergleiche implementiert" msgid "degrees of freedom and weights must have the same length" msgstr "Freiheitsgrade und Gewichte müssen die gleiche Länge haben." msgid "negative degrees of freedom not allowed" msgstr "negative Freiheitsgrade nicht erlaubt" msgid "more than one degree of freedom is needed when one them is zero." msgstr "" "Mehr als ein Freiheitsgrad wird benötigt, wenn einer von ihnen Null ist." msgid "" "can only construct \"varFunc\" object from another \"varFunc\" object, a " "formula, or a character string" msgstr "" "\"varFunc\"-Objekt kann nur aus anderem \"varFunc\", einer Formel oder einer " "Zeichenkette erstellt werden." msgid "cannot extract parameters of uninitialized object" msgstr "" "Parameter eines nicht initialisierten Objekts können nicht extrahiert werden." msgid "do not know how to get coefficients for %s object" msgstr "nicht bekannt, wie Koeffizienten erlangt werden für %s-Objekt" msgid "cannot change the length of covariate in \"varFunc\" object" msgstr "" "Die Länge der Kovariate im \"varFunc\"-Objekt kann nicht geändert werden." msgid "'value' must be a one sided formula" msgstr "'value' muss eine einseitige Formel sein." msgid "'form' must have a covariate" msgstr "'form' muss eine Kovariate haben." msgid "ignoring 'group' in \"varFixed\" formula" msgstr "'group' in \"varFixed\"-Formel wird ignoriert." msgid "all variables used in 'formula' must be in 'data'" msgstr "Alle in 'formula' benutzten Variablen müssen in 'data' enthalten sein." msgid "ignoring initial values (no grouping factor)" msgstr "Startwerte werden ignoriert (kein Gruppierungsfaktor)" msgid "initial values must have group names in 'varIdent'" msgstr "Startwerte müssen Gruppennamen in 'varIdent' haben." msgid "initial values for 'varIdent' must be > 0" msgstr "Startwerte für 'varIdent' müssen > 0 sein." msgid "fixed parameters must have names in 'varIdent'" msgstr "Feste Parameter müssen in 'varIdent' Namen haben." msgid "" "cannot change the length of the \"varIdent\" parameter after initialization" msgstr "" "Länge des Parameters \"varIdent\" kann nach der Initialisierung nicht mehr " "geändert werden." msgid "fixed parameter names in 'varIdent' must be a subset of group names" msgstr "" "Feste Parameternamen in 'varIdent' müssen eine Teilmenge von Gruppennamen " "sein." msgid "cannot fix variances in all groups" msgstr "Varianzen können nicht in allen Gruppen festgehalten werden." msgid "initial value for \"varIdent\" should be of length %d" msgstr "Startwert von \"varIndent\" sollte die Länge %d haben." msgid "" "names of starting value for \"varIdent\" object must contain all but one of " "the stratum levels" msgstr "" "Die Namen des Startwerts für ein \"varIdent\"-Objekt müssen alles außer " "einer Schichtstufe enthalten." msgid "nonexistent group names for initial values in 'varIdent'" msgstr "nicht existente Gruppennamen für Startwerte in 'varIdent'" msgid "initial values must have group names in 'varPower'" msgstr "Anfangswerte müssen Gruppennamen in 'varPower' haben." msgid "fixed parameters must have group names in 'varPower'" msgstr "Feste Parameter müssen Gruppennamen in 'varPower' haben." msgid "" "cannot change the length of the \"varStruct\" parameter after initialization" msgstr "" "Länge des Parameters \"varStruct\" kann nach der Initialisierung nicht " "geändert werden." msgid "" "cannot change coefficients before initialization or when all parameters are " "fixed" msgstr "" "Koeffizienten können nicht vor der Initialisierung oder wenn alle Parameter " "fest sind geändert werden." msgid "fixed parameters must have group names" msgstr "Feste Parameter müssen Gruppennamen haben." msgid "mismatch between group names and fixed values names" msgstr "keine Übereinstimmung zwischen Gruppennamen und festen Wertnamen" msgid "initial value for \"varPower\" should be of length %d" msgstr "Startwert von \"varPower\" sollte Länge %d haben." msgid "nonexistent group names for initial values in \"varPower\"" msgstr "nicht existierende Gruppennamen für Anfangswerte in \"varPower\"" msgid "initial value for \"varPower\" should be of length 1" msgstr "Anfangswert für \"varPower\" sollte die Länge 1 haben." msgid "initial values must have group names in 'varExp'" msgstr "Anfangswerte müssen Gruppennamen in 'varExp' haben." msgid "fixed parameters must have group names in 'varExp'" msgstr "Feste Parameter müssen Gruppennamen in 'varExp' haben." msgid "" "cannot change the length of the \"varExp\" parameter after initialization" msgstr "" "Länge des Parameters \"varExp\" kann nach der Initialisierung nicht geändert " "werden." msgid "initial value for \"varExp\" should be of length %d" msgstr "Startwert von \"varExp\" sollte Länge %d haben." msgid "nonexistent group names for initial values in \"varExp\"" msgstr "nicht existente Gruppennamen für Anfangswerte in \"varExp\"" msgid "initial value for \"varExp\" should be of length 1" msgstr "Anfangswert für \"varExp\" sollte die Länge 1 haben." msgid "%s can have at most two components" msgstr "%s kann höchstens zwei Komponenten haben." msgid "%s can only have names \"const\" and \"power\"" msgstr "%s kann nur die Namen \"const\" und \"power\" haben." msgid "%s can only be a list or numeric" msgstr "%s kann nur eine Liste oder numerisch sein." msgid "%s must have group names in 'varConstPower'" msgstr "%s muss Gruppennamen in 'varConstPower' haben." msgid "constant in \"varConstProp\" structure must be > 0" msgstr "Konstante in \"varConstPower\"-Struktur muss > 0 sein." msgid "initial value should be of length %d" msgstr "Startwert sollte Länge %d haben." msgid "nonexistent group names for initial values" msgstr "Nicht existierende Gruppenamen für Startwerte" msgid "%s can only have names \"const\" and \"prop\"" msgstr "%s kann nur die Namen \"const\" und \"power\" haben." msgid "%s must have group names in 'varConstProp'" msgstr "%s muss Gruppennamen in 'varConstPower' haben." msgid "all arguments to 'varComb' must be of class \"varFunc\"." msgstr "Alle Argumente für 'varComb' müssen von der Klasse \"varFunc\" sein." msgid "cannot change parameter length of initialized \"varComb\" object" msgstr "" "Parameterlänge eines initialisierten \"varComb\"-Objekts kann nicht geändert " "werden" msgid "deviance undefined for REML fit" msgstr "Devianz für REML Anpassung nicht definiert" msgid "AIC undefined for REML fit" msgstr "AIC für REML Anpassung nicht definiert" msgid "" "not (yet) implemented. Contributions are welcome; use intervals() instead " "(for now)" msgstr "" "(nocht) nicht implementiert. Beiträge sind willkommen; Für den Moment " "stattdessen intervals() nutzen" msgid "term %s not matched" msgid_plural "terms %s not matched" msgstr[0] "Term %s nicht übereinstimmend" msgstr[1] "Terme %s nicht übereinstimmend" msgid "'L' must have at most %d column" msgid_plural "'L' must have at most %d columns" msgstr[0] "'L' muss zumindest %d Spalte haben:" msgstr[1] "'L' muss zumindest %d Spalten haben:" msgid "effect %s not matched" msgid_plural "effects %s not matched" msgstr[0] "Effekt %s nicht übereinstimmend" msgstr[1] "Effekte %s nicht übereinstimmend" msgid "supplied %d starting value, need %d" msgid_plural "supplied %d starting values, need %d" msgstr[0] "%d Startwert angegeben, brauche %d" msgstr[1] "%d Startwerte angegeben, brauche %d" msgid "%s not found in data" msgid_plural "%s not found in data" msgstr[0] "%s nicht in Daten gefunden" msgstr[1] "%s nicht in Daten gefunden" msgid "nonexistent level %s" msgid_plural "nonexistent levels %s" msgstr[0] "nicht existierende Stufe %s" msgstr[1] "nicht existierende Stufen %s" msgid "%s not available for plotting" msgid_plural "%s not available for plotting" msgstr[0] "%s nicht verfügbar für grafische Darstellung" msgstr[1] "%s nicht verfügbar für grafische Darstellung" msgid "%s not matched" msgid_plural "%s not matched" msgstr[0] "%s nicht übereinstimmend" msgstr[1] "%s nicht übereinstimmend" msgid "group name not matched in starting values for random effects: %s" msgid_plural "" "group names not matched in starting values for random effects: %s" msgstr[0] "Gruppenname nicht zu Startwerten für Zufallseffekte passend: %s" msgstr[1] "Gruppennamen nicht zu Startwerten für Zufallseffekte passend: %s" #~ msgid "" #~ "approximate covariance matrix for parameter estimates not of full rank" #~ msgstr "" #~ "Approximiert Kovarianzmatrix für Parameterschätzungen haben keinen " #~ "vollständigen Rang." nlme/po/R-ko.po0000644000176000001440000006654214772467244013061 0ustar ripleyusers# Korean translation for R nlme package # Recommended/nlme/po/R-ko.po # Maintainer: R Core Team # Sent to Brian Ripley # Copyright (C) 1995-2013 The R Core Team # This file is distributed under the same license as the R nlme package. # R Development Translation Team - Korean # Chel Hee Lee , 2013. # Chel Hee Lee , 2013. # msgid "" msgstr "" "Project-Id-Version: nlme 3.1-105\n" "POT-Creation-Date: 2025-03-31 10:29\n" "PO-Revision-Date: 2013-08-16 18:52-0600\n" "Last-Translator: Chel Hee Lee \n" "Language-Team: R Development Translation Teams (Korean) \n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Poedit-SourceCharset: utf-8\n" "X-Generator: Poedit 1.5.4\n" msgid "not implemented for \"nlme\" objects" msgstr "\"nlme\" 객체들에 대하여 구현되지 않았습니다" msgid "not implemented for multiple levels of nesting" msgstr "" msgid "individual %s was not used in the fit" msgstr "" #, fuzzy msgid "not implemented for uncorrelated errors" msgstr "\"nlme\" 객체들에 대하여 구현되지 않았습니다" msgid "not implemented for correlation structures without a grouping factor" msgstr "" msgid "do not know how to calculate correlation matrix of %s object" msgstr "%s 객체의 상관행렬을 어떻게 계산해야 할 지 알 수 없습니다" msgid "\"corStruct\" object must have a \"fixed\" attribute" msgstr "\"corStruct\" 객체는 반드시 \"fixed\" 속성을 가지고 있어야 합니다" msgid "do not know how to obtain parameters of %s object" msgstr "%s 객체의 파라미터들을 어떻게 얻어야 할지 알 수 없습니다" msgid "cannot change the length of the parameter of a \"corStruct\" object" msgstr "\"corStruct\" 객체의 파라미터의 길이를 변경할 수 없습니다" msgid "" "'sumLenSq := sum(table(groups)^2)' = %g is too large.\n" " Too large or no groups in your correlation structure?" msgstr "" msgid "cannot change 'form'" msgstr "'form'를 변경할 수 없습니다" msgid "need data to calculate covariate of \"corStruct\" object" msgstr "\"corStruct\" 객체의 공변량을 계산하기 위한 데이터가 필요합니다" msgid "cannot change the length of the parameter of a \"corSymm\" object" msgstr "\"corSymm\" 객체의 파라미터의 길이를 변경할 수 없습니다" msgid "covariate must have unique values within groups for \"corSymm\" objects" msgstr "" msgid "" "unique values of the covariate for \"corSymm\" objects must be a sequence " "of consecutive integers" msgstr "" msgid "initial value for \"corSymm\" parameters of wrong dimension" msgstr "" msgid "initial values for \"corSymm\" must be between -1 and 1" msgstr "" msgid "" "initial values for \"corSymm\" do not define a positive-definite correlation " "structure" msgstr "" msgid "cannot change the length of the parameter of a \"corNatural\" object" msgstr "\"corNatural\" 객체의 파라미터의 길이를 변경할 수 없습니다" msgid "" "covariate must have unique values within groups for \"corNatural\" objects" msgstr "" msgid "" "unique values of the covariate for \"corNatural\" objects must be a sequence " "of consecutive integers" msgstr "" msgid "initial value for \"corNatural\" parameters of wrong dimension" msgstr "" msgid "initial values for \"corNatural\" must be between -1 and 1" msgstr "" msgid "" "initial values for \"corNatural\" do not define a positive-definite " "correlation structure" msgstr "" msgid "parameter in AR(1) structure must be between -1 and 1" msgstr "" msgid "'sumLenSq' = %g is too large (larger than maximal integer)" msgstr "" msgid "cannot change the length of the parameter of a \"corAR1\" object" msgstr "\"corAR1\" 객체의 파라미터의 길이를 변경할 수 없습니다" msgid "covariate must have unique values within groups for \"corAR1\" objects" msgstr "" msgid "parameter in CAR(1) structure must be between 0 and 1" msgstr "" msgid "cannot change the length of the parameter of a \"corCAR1\" object" msgstr "" msgid "covariate must have unique values within groups for \"corCAR1\" objects" msgstr "" msgid "autoregressive order must be a non-negative integer" msgstr "" msgid "moving average order must be a non-negative integer" msgstr "" msgid "at least one of 'p' and 'q' must be > 0" msgstr "" msgid "initial value for parameter of wrong length" msgstr "" msgid "parameters in ARMA structure must be < 1 in absolute value" msgstr "" msgid "'object' has not been Initialize()d" msgstr "'object'가 초기화 되지 않았습니다" msgid "cannot change the length of the parameter of a \"corARMA\" object" msgstr "" msgid "" "covariate must have unique integer values within groups for \"corARMA\" " "objects" msgstr "" msgid "\"corARMA\" order (%g, %g) exceeds maximum lag in data (%g)" msgstr "" msgid "parameter in \"corCompSymm\" structure must be < 1 in absolute value" msgstr "" msgid "cannot change the length of the parameter of a \"corCompSymm\" object" msgstr "\"corCompSymm\" 객체의 파라미터의 길이를 변경할 수 없습니다" msgid "initial value in \"corCompSymm\" must be greater than %s" msgstr "\"corCompSymm\" 내의 초기값은 반드시 %s 보다 커야 합니다" msgid "cannot change the length of the parameter after initialization" msgstr "초기화 이후에는 파라미터의 길이를 변경할 수 없습니다" msgid "need data to calculate covariate" msgstr "공변량을 계산할 데이터가 필요합니다" msgid "cannot have zero distances in \"corSpatial\"" msgstr "" msgid "'range' must be > 0 in \"corSpatial\" initial value" msgstr "" msgid "initial value for \"corSpatial\" parameters of wrong dimension" msgstr "" msgid "initial value of nugget ratio must be between 0 and 1" msgstr "nugget ratio의 초기값은 반드시 0과 1 사이에 있어야 합니다" msgid "'range' must be > 0 in \"corLin\" initial value" msgstr "" msgid "" "initial value for 'range' less than minimum distance. Setting it to 1.1 * " "min(distance)" msgstr "" msgid "initial value for \"corLin\" parameters of wrong dimension" msgstr "" msgid "range must be > 0 in \"corSpher\" initial value" msgstr "" msgid "initial value for \"corSpher\" parameters of wrong dimension" msgstr "" msgid "model must be a formula of the form \"resp ~ pred\"" msgstr "" msgid "offset() terms are not supported" msgstr "" msgid "no coefficients to fit" msgstr "적합할 계수가 없습니다" msgid "maximum number of iterations reached without convergence" msgstr "수렴하지 않고 지정된 최대 반복수에 도달하였습니다" msgid "computed \"gls\" fit is singular, rank %s" msgstr "" #, fuzzy msgid "object must inherit from class %s" msgstr "'object'는 반드시 formula이어야 합니다" msgid "'Terms' must be between 1 and %d" msgstr "'Terms'는 반드시 1과 %d 사이에 있어야 합니다" msgid "terms can only be integers or characters" msgstr "" msgid "data in %s call must evaluate to a data frame" msgstr "" msgid "" "%s without \"primary\" can only be used with fits of \"groupedData\" objects" msgstr "" msgid "only one level allowed for predictions" msgstr "" msgid "%s and %s must have the same group levels" msgstr "%s와 %s은 반드시 같은 그룹 수준들을 가져야 합니다" msgid "wrong group levels" msgstr "" msgid "cannot get confidence intervals on var-cov components: %s" msgstr "" msgid "need an object with call component" msgstr "" msgid "'nint' is not consistent with 'breaks'" msgstr "" msgid "Within-group std. dev. must be a positive numeric value" msgstr "" msgid "'object' must be a formula" msgstr "'object'는 반드시 formula이어야 합니다" msgid "object formula must be of the form \"resp ~ pred\"" msgstr "" msgid "'data' must be given explicitly to use 'nls' to get initial estimates" msgstr "" msgid "no initial values for model parameters" msgstr "" msgid "starting estimates must have names when 'params' is missing" msgstr "" msgid "'params' must be a formula or list of formulae" msgstr "" msgid "formulae in 'params' must be of the form \"parameter ~ expr\"" msgstr "" msgid "step halving factor reduced below minimum in NLS step" msgstr "" msgid "cannot calculate REML log-likelihood for \"gnls\" objects" msgstr "" msgid "first argument to 'groupedData' must be a two-sided formula" msgstr "" msgid "right-hand side of first argument must be a conditional expression" msgstr "" msgid "first argument to 'nfGroupedData' must be a two-sided formula" msgstr "" msgid "only one level of grouping allowed" msgstr "" msgid "second argument to 'groupedData' must inherit from data.frame" msgstr "" msgid "first argument to 'nmGroupedData' must be a two-sided formula" msgstr "" msgid "single group not supported -- use groupedData()" msgstr "" msgid "'subset' ignored with single grouping factor" msgstr "" msgid "'subset' must be a list" msgstr "'subset'은 반드시 리스트이어야 합니다" msgid "undefined group declared in 'subset'" msgstr "" msgid "only one display level allowed" msgstr "" msgid "undefined display level %s for %s" msgstr "" msgid "undefined collapsing level %s for %s" msgstr "" msgid "" "collapsing level cannot be smaller than display level; setting it to the " "display level" msgstr "" msgid "'preserve' must be a two-sided formula" msgstr "" msgid "'asTable' cannot be used with multilevel grouped data" msgstr "" msgid "'asTable' can only be used with balanced 'groupedData' objects" msgstr "" msgid "'data' argument not used, but taken from groupedData object" msgstr "" msgid "multiple levels not allowed" msgstr "" msgid "'data' must be a \"groupedData\" object if 'groups' argument is missing" msgstr "" msgid "'data' in %s call must evaluate to a data frame" msgstr "" msgid "nonexistent groups requested in 'subset'" msgstr "" msgid "'subset' can only be character or integer" msgstr "" msgid "log-likelihood not available with NULL fits" msgstr "" msgid "'form' must be a formula" msgstr "'form'은 반드시 formula 이어야 합니다" msgid "'form' must be a one-sided formula" msgstr "" msgid "covariate must be a data frame" msgstr "공변량은 반드시 데이터프레임이어야 합니다" msgid "cannot do pairs of just one variable" msgstr "" msgid "'id' must be between 0 and 1" msgstr "'id'는 반드시 0과 1 사이에 있어야 합니다" msgid "'id' can only be a formula or numeric" msgstr "" msgid "'idLabels' of incorrect length" msgstr "" msgid "'idLabels' can only be a formula or a vector" msgstr "" msgid "covariate must be numeric" msgstr "" msgid "nonexistent group in 'newdata'" msgstr "" msgid "nonexistent group requested in 'subset'" msgstr "" msgid "only residuals and random effects allowed" msgstr "" msgid "can only fit \"lmList\" objects with single grouping variable" msgstr "" msgid "'lme.lmList' will redefine 'data'" msgstr "" msgid "initial value for \"reStruct\" overwritten in 'lme.lmList'" msgstr "" msgid "fixed-effects model must be a formula of the form \"resp ~ pred\"" msgstr "" msgid "incompatible lengths for 'random' and grouping factors" msgstr "" msgid "incompatible formulas for groups in 'random' and 'correlation'" msgstr "" msgid "" "cannot use smaller level of grouping for 'correlation' than for 'random'. " "Replacing the former with the latter." msgstr "" msgid "fewer observations than random effects in all level %s groups" msgstr "" msgid "" "%s problem, convergence error code = %s\n" " message = %s" msgstr "" #, fuzzy msgid "" "maximum number of iterations (lmeControl(maxIter)) reached without " "convergence" msgstr "수렴하지 않고 지정된 최대 반복수에 도달하였습니다" msgid "terms must all have the same denominator DF" msgstr "" msgid "L may only involve fixed effects with the same denominator DF" msgstr "" msgid "objects must inherit from classes %s, or %s" msgstr "" msgid "" "some fitted objects deleted because response differs from the first model" msgstr "" msgid "first model has a different response from the rest" msgstr "" msgid "all fitted objects must have the same estimation method" msgstr "모든 객체들이 같은 추정방법을 이용하여 적합되어야 합니다" msgid "" "fitted objects with different fixed effects. REML comparisons are not " "meaningful." msgstr "" msgid "objects must have a \"call\" component or attribute" msgstr "" msgid "all fitted objects must use the same number of observations" msgstr "" msgid "only single level allowed" msgstr "" msgid "" "cannot get confidence intervals on var-cov components: %s\n" " Consider '%s'" msgstr "" msgid "covariate must have a level attribute when groups are present" msgstr "" msgid "covariate must have a level attribute when 'id' is a formula" msgstr "" msgid "covariate must have a level attribute when 'idLabels' is a formula" msgstr "" msgid "'form' must be a formula when not NULL" msgstr "" msgid "only single effects allowed in left side of 'form'" msgstr "" msgid "%s is not a valid effect name" msgstr "" msgid "no effects allowed in right side of formula" msgstr "" msgid "cannot evaluate groups for desired levels on 'newdata'" msgstr "" msgid "'Id' must be between 0 and 1" msgstr "'Id'는 반드시 0과 1 사이에 있어야 합니다" msgid "augmentation of random effects only available for single level" msgstr "" msgid "no condensed linear model" msgstr "" msgid "no fitted \"lme\" object" msgstr "적합된 \"lme\" 객체가 없습니다" msgid "objects must have coefficients with same row names" msgstr "" msgid "only one level allowed in 'gapply'" msgstr "" msgid "'which' must be between 1 and %d" msgstr "'which'는 반드시 1과 %d 사이에 있어야 합니다" msgid "'which' can only be character or integer" msgstr "" msgid "formula(object) must return a formula" msgstr "" msgid "'form' must be a two-sided formula" msgstr "" msgid "only one level allowed in 'gsummary'" msgstr "" msgid "'FUN' can only be a function or a list of functions" msgstr "" msgid "cannot omit grouping factor without 'form'" msgstr "" msgid "no degrees of freedom for estimating std. dev." msgstr "" msgid "" "data argument to \"data.frame\" method for 'getGroups' does not make sense" msgstr "" msgid "invalid formula for groups" msgstr "" msgid "'form' must have all components as formulas" msgstr "" msgid "'form' can only be a formula, or a list of formulas" msgstr "" msgid "level of %s does not match formula %s" msgstr "" msgid "'form' argument must be a formula" msgstr "" msgid "at least two coefficients are needed" msgstr "" msgid "no model variogram available with 'showModel = TRUE'" msgstr "" msgid "only residuals allowed" msgstr "" msgid "'distance' and 'object' have incompatible lengths" msgstr "" msgid "'nlme.nlsList' will redefine 'fixed', 'data', and 'start'" msgstr "" msgid "can only fit \"nlsList\" objects with single grouping variable" msgstr "" msgid "initial value for 'reStruct' overwritten in 'nlme.nlsList'" msgstr "" msgid "'model' must be a formula" msgstr "" msgid "model formula must be of the form \"resp ~ pred\"" msgstr "" msgid "'data' must be given explicitly to use 'nlsList'" msgstr "" msgid "'fixed' must be a formula or list of formulae" msgstr "" msgid "formulae in 'fixed' must be of the form \"parameter ~ expr\"" msgstr "" msgid "'random' must be a formula or list of formulae" msgstr "" msgid "formulae in 'random' must be of the form \"parameter ~ expr\"" msgstr "" msgid "incompatible formulas for groups in \"random\" and \"correlation\"" msgstr "" msgid "" "cannot use smaller level of grouping for \"correlation\" than for " "\"random\". Replacing the former with the latter." msgstr "" msgid "'start' must have a component called 'fixed'" msgstr "" msgid "starting values for the 'fixed' component are not the correct length" msgstr "" msgid "starting values for random effects should be a list, or a matrix" msgstr "" msgid "" "list with starting values for random effects must have names or be of length " "%d" msgstr "" msgid "starting values for the random components should be a list of matrices" msgstr "" msgid "" "number of rows in starting values for random component at level %s should be " "%d" msgstr "" msgid "" "number of columns in starting values for random component at level %s should " "be %d" msgstr "" msgid "starting values for random effects must include group levels" msgstr "" msgid "" "groups levels mismatch in 'random' and starting values for 'random' at level " "%s" msgstr "" msgid "" "names mismatch in 'random' and starting values for 'random' at level %s" msgstr "" msgid "Iteration %d, LME step: nlminb() did not converge (code = %d)." msgstr "" msgid "Do increase 'msMaxIter'!" msgstr "" msgid "PORT message:" msgstr "" msgid "Iteration %d, LME step: nlm() did not converge (code = %d)." msgstr "" msgid "step halving factor reduced below minimum in PNLS step" msgstr "" #, fuzzy msgid "maximum number of iterations (maxIter = %d) reached without convergence" msgstr "수렴하지 않고 지정된 최대 반복수에 도달하였습니다" msgid "second argument must be a groupedData object" msgstr "" msgid "cannot use an anonymous function for the model" msgstr "" msgid "" "'data' must be a \"groupedData\" object if 'formula' does not include groups" msgstr "" msgid "" "old-style self-starting model functions\n" "are no longer supported.\n" "New selfStart functions are available.\n" "Use\n" " SSfpl instead of fpl,\n" " SSfol instead of first.order.log,\n" " SSbiexp instead of biexp,\n" " SSlogis instead of logistic.\n" "If writing your own selfStart model, see\n" " \"help(selfStart)\"\n" "for the new form of the \"initial\" attribute." msgstr "" msgid "missing call attribute in \"nlsList\" object" msgstr "" msgid "cannot access the matrix of uninitialized objects" msgstr "" msgid "ignoring argument 'form'" msgstr "" msgid "ignoring argument 'nam'" msgstr "" msgid "'value' must be a square matrix" msgstr "" msgid "dimnames of 'value' must match or be NULL" msgstr "" msgid "names of 'value' are not consistent with 'nam' argument" msgstr "" msgid "%s is not a valid object for \"pdMat\"" msgstr "" msgid "all elements of 'form' list must be two-sided formulas" msgstr "" msgid "'form' can only be a formula or a list of formulae" msgstr "" msgid "'form' not consistent with 'nam'" msgstr "" msgid "length of 'nam' not consistent with dimensions of initial value" msgstr "" msgid "no default method for extracting the square root of a \"pdMat\" object" msgstr "" msgid "do not know how to obtain constrained coefficients" msgstr "" msgid "" "cannot access the number of columns of uninitialized objects without names" msgstr "" msgid "cannot extract the log of the determinant from an uninitialized object" msgstr "" msgid "cannot change dimensions on an initialized \"pdMat\" object" msgstr "초기화된 \"pdMat\" 객체의 차원정보를 변경할 수 없습니다" msgid "Length of names should be %d" msgstr "" msgid "" "names being assigned do not correspond to a permutation of previous names" msgstr "" msgid "x-y data to splom got botched somehow" msgstr "" msgid "cannot get the inverse of an uninitialized object" msgstr "" msgid "an object of length %d does not match the required parameter size" msgstr "" msgid "cannot extract matrix from an uninitialized object" msgstr "" msgid "cannot extract the inverse from an uninitialized object" msgstr "" msgid "an object of length %d does not match a Cholesky factor" msgstr "" msgid "cannot extract the matrix from an uninitialized object" msgstr "" msgid "cannot extract the matrix from an uninitialized \"pdIdent\" object" msgstr "" msgid "cannot extract the matrix with uninitialized dimensions" msgstr "" msgid "" "must give names when initializing \"pdIdent\" from parameter without a " "formula" msgstr "" msgid "cannot extract the dimensions" msgstr "" msgid "cannot extract the matrix from an uninitialized \"pdCompSymm\" object" msgstr "" msgid "initializing \"pdCompSymm\" object is not positive definite" msgstr "" msgid "" "must give names when initializing \"pdCompSymm\" from parameter without a " "formula" msgstr "" msgid "cannot obtain constrained coefficients with uninitialized dimensions" msgstr "" msgid "cannot access the matrix of object without names" msgstr "" msgid "'form' must be a list" msgstr "'form'은 반드시 리스트이어야 합니다" msgid "'nam' must be a list" msgstr "'nam'은 반드시 리스트이어야 합니다" msgid "'form' and 'nam' have incompatible lengths" msgstr "" msgid "'pdClass' must be a character vector" msgstr "'pdClass'는 반드시 문자형 벡터이어야 합니다" msgid "'form' and 'pdClass' have incompatible lengths" msgstr "" msgid "'nam' and 'pdClass' have incompatible lengths" msgstr "" msgid "LNone of the arguments specify more than one block" msgstr "" msgid "'object' must be a list when not missing, not a matrix, and not numeric" msgstr "" msgid "arguments imply different number of blocks" msgstr "" msgid "all elements in the argument must generate \"pdMat\" objects" msgstr "" msgid "cannot have duplicated column names in a \"pdMat\" object" msgstr "" msgid "must have formula when no names are given" msgstr "" msgid "must give names when initializing from matrix or parameter" msgstr "" msgid "all elements must have names when any has names" msgstr "" msgid "all elements must have a non-zero size" msgstr "" msgid "cannot change the parameter when length of parameters is undefined" msgstr "" msgid "cannot change parameter length of initialized \"pdMat\" object" msgstr "" msgid "all elements must have formulas when any has a formula" msgstr "" msgid "" "all elements of formula must be list of two-sided formulae or two-sided " "formulae" msgstr "" msgid "cannot change the number of columns on an initialized object" msgstr "" msgid "names of object and value must match" msgstr "" msgid "\"pdMat\" element must have a formula" msgstr "" msgid "'object' must be a list or a formula" msgstr "" msgid "\"pdMat\" elements must have a formula" msgstr "" msgid "elements in 'object' must be formulas or \"pdMat\" objects" msgstr "" msgid "cannot change parameter length of initialized objects" msgstr "" msgid "cannot extract groups formula without a formula" msgstr "" msgid "all elements of a \"reStruct\" object must have a non-zero size" msgstr "" msgid "cannot change the length of 'object'" msgstr "" msgid "cannot extract model matrix without formula" msgstr "" msgid "incompatible lengths for object names" msgstr "" msgid "" "'data' must inherit from \"groupedData\" class if 'random' does not define " "groups" msgstr "" msgid "models with \"corStruct\" and/or \"varFunc\" objects not allowed" msgstr "" msgid "no degrees of freedom specified" msgstr "" msgid "plot method only implemented for comparing models" msgstr "" msgid "degrees of freedom and weights must have the same length" msgstr "" msgid "negative degrees of freedom not allowed" msgstr "" msgid "more than one degree of freedom is needed when one them is zero." msgstr "" msgid "" "can only construct \"varFunc\" object from another \"varFunc\" object, a " "formula, or a character string" msgstr "" msgid "cannot extract parameters of uninitialized object" msgstr "" msgid "do not know how to get coefficients for %s object" msgstr "" msgid "cannot change the length of covariate in \"varFunc\" object" msgstr "" msgid "'value' must be a one sided formula" msgstr "" msgid "'form' must have a covariate" msgstr "" msgid "ignoring 'group' in \"varFixed\" formula" msgstr "" msgid "all variables used in 'formula' must be in 'data'" msgstr "" msgid "ignoring initial values (no grouping factor)" msgstr "" msgid "initial values must have group names in 'varIdent'" msgstr "" msgid "initial values for 'varIdent' must be > 0" msgstr "" msgid "fixed parameters must have names in 'varIdent'" msgstr "" msgid "" "cannot change the length of the \"varIdent\" parameter after initialization" msgstr "" msgid "fixed parameter names in 'varIdent' must be a subset of group names" msgstr "" msgid "cannot fix variances in all groups" msgstr "" msgid "initial value for \"varIdent\" should be of length %d" msgstr "" msgid "" "names of starting value for \"varIdent\" object must contain all but one of " "the stratum levels" msgstr "" msgid "nonexistent group names for initial values in 'varIdent'" msgstr "" msgid "initial values must have group names in 'varPower'" msgstr "" msgid "fixed parameters must have group names in 'varPower'" msgstr "" msgid "" "cannot change the length of the \"varStruct\" parameter after initialization" msgstr "" msgid "" "cannot change coefficients before initialization or when all parameters are " "fixed" msgstr "" msgid "fixed parameters must have group names" msgstr "" msgid "mismatch between group names and fixed values names" msgstr "" msgid "initial value for \"varPower\" should be of length %d" msgstr "" msgid "nonexistent group names for initial values in \"varPower\"" msgstr "" msgid "initial value for \"varPower\" should be of length 1" msgstr "" msgid "initial values must have group names in 'varExp'" msgstr "" msgid "fixed parameters must have group names in 'varExp'" msgstr "" msgid "" "cannot change the length of the \"varExp\" parameter after initialization" msgstr "" msgid "initial value for \"varExp\" should be of length %d" msgstr "" msgid "nonexistent group names for initial values in \"varExp\"" msgstr "" msgid "initial value for \"varExp\" should be of length 1" msgstr "" msgid "%s can have at most two components" msgstr "" msgid "%s can only have names \"const\" and \"power\"" msgstr "" msgid "%s can only be a list or numeric" msgstr "" msgid "%s must have group names in 'varConstPower'" msgstr "" msgid "constant in \"varConstProp\" structure must be > 0" msgstr "" msgid "initial value should be of length %d" msgstr "" msgid "nonexistent group names for initial values" msgstr "" msgid "%s can only have names \"const\" and \"prop\"" msgstr "" msgid "%s must have group names in 'varConstProp'" msgstr "" msgid "all arguments to 'varComb' must be of class \"varFunc\"." msgstr "" msgid "cannot change parameter length of initialized \"varComb\" object" msgstr "" msgid "deviance undefined for REML fit" msgstr "" msgid "AIC undefined for REML fit" msgstr "" msgid "" "not (yet) implemented. Contributions are welcome; use intervals() instead " "(for now)" msgstr "" msgid "term %s not matched" msgid_plural "terms %s not matched" msgstr[0] "" msgstr[1] "" msgid "'L' must have at most %d column" msgid_plural "'L' must have at most %d columns" msgstr[0] "" msgstr[1] "" msgid "effect %s not matched" msgid_plural "effects %s not matched" msgstr[0] "" msgstr[1] "" msgid "supplied %d starting value, need %d" msgid_plural "supplied %d starting values, need %d" msgstr[0] "" msgid "%s not found in data" msgid_plural "%s not found in data" msgstr[0] "데이터로부터 %s를 찾을 수 없습니다" msgid "nonexistent level %s" msgid_plural "nonexistent levels %s" msgstr[0] "" msgstr[1] "" msgid "%s not available for plotting" msgid_plural "%s not available for plotting" msgstr[0] "" msgstr[1] "" msgid "%s not matched" msgid_plural "%s not matched" msgstr[0] "" msgstr[1] "" msgid "group name not matched in starting values for random effects: %s" msgid_plural "" "group names not matched in starting values for random effects: %s" msgstr[0] "" msgstr[1] "" #~ msgid "starting values for parameters are not of the correct length" #~ msgstr "파라미터들에 대한 시작값들에 대한 길이가 올바르지 않습니다" nlme/po/nlme.pot0000644000176000001440000000335214632316272013343 0ustar ripleyusers# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the nlme package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: nlme 3.1-165\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-06-06 12:49+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: corStruct.c:424 msgid "All parameters must be less than 1 in absolute value" msgstr "" #: corStruct.c:535 msgid "Coefficient matrix not invertible" msgstr "" #: corStruct.c:872 corStruct.c:927 corStruct.c:987 corStruct.c:1029 msgid "Unknown spatial correlation class" msgstr "" #: nlme.c:468 msgid "First observation on an individual must have a dose" msgstr "" #: nlmefit.c:426 #, c-format msgid "Singularity in backsolve at level %ld, block %ld" msgstr "" #: nlmefit.c:464 #, c-format msgid "" "Too many parameters for finite-difference Hessian; npar = %d, nTot = %g." msgstr "" #: nlmefit.c:575 nlmefit.c:756 msgid "Overfitted model!" msgstr "" #: nlmefit.c:601 msgid "analytic gradient is not available with matrix logarithm" msgstr "" #: nlmefit.c:624 msgid "analytic gradient is not available with compound symmetry" msgstr "" #: nlmefit.c:917 #, c-format msgid "Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]" msgstr "" #: nlmefit.c:949 #, c-format msgid "" "Unable to form Cholesky decomposition: the leading minor of order %d is not " "pos.def." msgstr "" #: nlmefit.c:981 msgid "Haven't written the compound symmetry case for this yet" msgstr "" nlme/R/0000755000176000001440000000000014662037430011443 5ustar ripleyusersnlme/R/newGenerics.R0000644000176000001440000001220714251721455014042 0ustar ripleyusers### New generics used with corStruct, varFunc, groupedData, and reStruct ### ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # Copyright 2007-2011 The R Core team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # ACF <- ## autocorrelation function - needed not exist if acf were generic function(object, maxLag, ...) UseMethod("ACF") asTable <- ## Return the object in a tabular form function(object) UseMethod("asTable") augPred <- ## Return the data used to fit the model augmented with the predictions function(object, primary = NULL, minimum = min(primary), maximum = max(primary), length.out = 51, ...) UseMethod("augPred") "coef<-" <- "coefficients<-" <- ## Assignment of the unconstrained parameter function(object, ..., value) UseMethod("coef<-") collapse <- ## collapse a data frame according to a factor, or several nested factors function(object, ...) UseMethod("collapse") comparePred <- ## compare predictions from different fitted objects function(object1, object2, primary = NULL, minimum = min(primary), maximum = max(primary), length.out = 51, level = NULL, ...) UseMethod("comparePred") "covariate<-" <- ## Assignment of the primary covariate function(object, value) UseMethod("covariate<-") Dim <- ## Extract dimensions of an object. Not needed if "dims" were generic function(object, ...) UseMethod("Dim") fixed.effects <- ## Generic extractor for estimates of fixed effects function(object, ...) UseMethod("fixef") fixef <- ## Short form for generic extractor for estimates of fixed effects function(object, ...) UseMethod("fixef") getCovariate <- ## Return the primary covariate associated with object according to form function(object, form = formula(object), data) UseMethod("getCovariate") getData <- ## Return the data.frame used to fit an object, if any was given in ## the call that produced it function(object) UseMethod("getData") getGroups <- ## Return the groups associated with object according to form. function(object, form = formula(object), level, data, sep = "/") UseMethod("getGroups") getGroupsFormula <- ## Return the formula(s) for the groups associated with object. ## The result is a one-sided formula unless asList is TRUE in which case ## it is a list of formulas, one for each level. function(object, asList = FALSE, sep = "/") UseMethod("getGroupsFormula") getResponse <- ## Return the response associated with object according to form. function(object, form = formula(object)) UseMethod("getResponse") isBalanced <- ## Check for balance, especially in a groupedData object function(object, countOnly = FALSE, level) UseMethod("isBalanced") isInitialized <- ## Determine if the object has been assigned a value function(object) UseMethod("isInitialized") Initialize <- ## Initialize objects function(object, data, ...) UseMethod("Initialize") intervals <- ## generate confidence intervals for the parameters in object function(object, level = 0.95, ...) UseMethod("intervals") logDet <- ## Returns the negative of the sum of the logarithm of the determinant function(object, ...) UseMethod("logDet") "matrix<-" <- ## Assignment of the matrix in an object representing special types of matrices function(object, value) UseMethod("matrix<-") Names <- ## Extract names of an object. Not needed if "names" were generic function(object, ...) UseMethod("Names") "Names<-" <- ## Assignment of names. Not needed if "names<-" were generic function(object, ..., value) UseMethod("Names<-") needUpdate <- ## Checks if model plug-in needs to be updated after an estimation cycle function(object) UseMethod("needUpdate") #pruneLevels <- # ## Returns the factor with the levels attribute truncated to only those # ## levels occuring in the factor # function(object) UseMethod("pruneLevels") random.effects <- ## Generic function for extracting the random effects ## If aug.frame is true, the returned data frame is augmented with ## values from the original data object, if available. The variables ## in the original data are collapsed over the groups variable by the ## function fun. function(object, ...) UseMethod("ranef") ranef <- ## Short form for generic function for extracting the random effects function(object, ...) UseMethod("ranef") recalc <- ## Recalculate condensed linear object, according to model plug-in function(object, conLin, ...) UseMethod("recalc") Variogram <- ## calculates variogram of a vector according to a distance matrix function(object, distance, ...) UseMethod("Variogram") nlme/R/pdMat.R0000644000176000001440000016745714630076362012661 0ustar ripleyusers### Classes of positive-definite matrices ### ### Copyright 2006-2022 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # pdConstruct <- ## a virtual constructor for these objects function(object, value, form, nam, data, ...) UseMethod("pdConstruct") pdFactor <- function(object) UseMethod("pdFactor") pdMatrix <- ## extractor for the pd, correlation, or square-root factor matrix function(object, factor = FALSE) UseMethod("pdMatrix") ##*## pdMat - a virtual class of positive definite matrices ###*# constructor for the virtual class pdMat <- function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame(), pdClass = "pdSymm") { if (inherits(value, "pdMat")) { # nothing to construct pdClass <- class(value) } object <- numeric(0) class(object) <- unique(c(pdClass, "pdMat")) pdConstruct(object, value, form, nam, data) } ###*# Methods for local generics corMatrix.pdMat <- function(object, ...) { if (!isInitialized(object)) { stop("cannot access the matrix of uninitialized objects") } Var <- pdMatrix(object) if (length(unlist(dimnames(Var))) == 0) { aux <- paste("V", 1:(Dim(Var)[2]), sep = "") dimnames(Var) <- list(aux, aux) } dd <- dim(Var) dn <- dimnames(Var) stdDev <- sqrt(diag(Var)) names(stdDev) <- colnames(Var) value <- array(t(Var/stdDev)/stdDev, dd, dn) attr(value, "stdDev") <- stdDev value } pdConstruct.pdMat <- function(object, value = numeric(0), form = formula(object), nam = Names(object), data = parent.frame(), ...) { if (inherits(value, "pdMat")) { # constructing from another pdMat if (length(form) == 0) { form <- formula(value) } if (length(nam) == 0) { nam <- Names(value) } if (isInitialized(value)) { return(pdConstruct(object, as.matrix(value), form, nam, data)) } else { return(pdConstruct(object, form = form, nam = nam, data = data)) } } if (length(value) > 0) { if (inherits(value, "formula") || is.call(value)) { ## constructing from a formula if (!is.null(form)) { warning("ignoring argument 'form'") } form <- formula(value) if (length(form) == 3) { #two-sided case - nlme form <- list(form) } } else if (is.character(value)) { # constructing from character array if (length(nam) > 0) { warning("ignoring argument 'nam'") } nam <- value } else if (is.matrix(value)) { # constructing from a pd matrix vdim <- dim(value) if (length(vdim) != 2 || diff(vdim) != 0) { stop("'value' must be a square matrix") } if (length(unlist(vnam <- dimnames(value))) > 0) { vnam <- unique(unlist(vnam)) if (length(vnam) != vdim[1]) { stop("dimnames of 'value' must match or be NULL") } dimnames(value) <- list(vnam, vnam) if (length(nam) > 0) { # check consistency if (anyNA(match(nam, vnam)) || anyNA(match(vnam, nam))) { stop("names of 'value' are not consistent with 'nam' argument") } value <- value[nam, nam, drop = FALSE] } else { nam <- vnam } } form <- form # avoid problems with lazy evaluation nam <- nam object <- chol((value + t(value))/2) # ensure it is positive-definite attr(object, "dimnames") <- NULL attr(object, "rank") <- NULL } else if (is.numeric(value)) { # constructing from the parameter value <- as.numeric(value) attributes(value) <- attributes(object) object <- value } else if(is.list(value)) { ## constructing from a list of two-sided formulae - nlme case if (!is.null(form)) { warning("ignoring argument 'form'") } form <- value } else { stop(gettextf("%s is not a valid object for \"pdMat\"", sQuote(deparse(object))), domain = NA) } } if (!is.null(form)) { if (inherits(form, "formula") && length(form) == 3) {#two-sided case - nlme form <- list(form) } if (is.list(form)) { # list of formulae if (any(!unlist(lapply(form, function(el) { inherits(el, "formula") && length(el) == 3 })))) { stop("all elements of 'form' list must be two-sided formulas") } val <- list() for(i in seq_along(form)) { if (is.name(form[[i]][[2]])) { val <- c(val, list(form[[i]])) } else { val <- c(val, eval(parse(text = paste("list(", paste(paste(all.vars(form[[i]][[2]]), deparse(form[[i]][[3]]), sep = "~"), collapse=","),")")))) } } form <- val class(form) <- "listForm" namesForm <- Names(form, data) } else { if (inherits(form, "formula")) { namesForm <- Names(asOneSidedFormula(form), data) ## namesForm1 <- NULL } else { stop("'form' can only be a formula or a list of formulae") } } if (length(namesForm) > 0) { if (length(nam) == 0) { # getting names from formula nam <- namesForm } else { # checking consistency with names if (any(noMatch <- is.na(match(nam, namesForm)))) { err <- TRUE namCopy <- nam indNoMatch <- seq_along(nam)[noMatch] if (any(wch1 <- (nchar(nam, "c") > 12))) { ## possibly names with .(Intercept) in value wch1 <- substring(nam, nchar(nam, "c")-10) == "(Intercept)" if (any(wch1)) { namCopy[indNoMatch[wch1]] <- substring(nam[wch1], 1, nchar(nam[wch1], "c") - 12) noMatch[wch1] <- FALSE indNoMatch <- indNoMatch[!wch1] # possibly not matched } } if (sum(noMatch) > 0) { ## still no matches - try adding .(Intercept) namCopy[indNoMatch] <- paste(namCopy[indNoMatch], "(Intercept)", sep = ".") } ## try matching modified value if (!anyNA(match(namCopy, namesForm))) { err <- FALSE } if (err) stop("'form' not consistent with 'nam'") } } } } if (is.matrix(object)) { # initialized as matrix, check consistency if (length(nam) > 0 && (length(nam) != dim(object)[2])) { stop("length of 'nam' not consistent with dimensions of initial value") } } attr(object, "formula") <- form attr(object, "Dimnames") <- list(nam, nam) object } pdFactor.pdMat <- function(object) { c(qr.R(qr(pdMatrix(object)))) } pdMatrix.pdMat <- function(object, factor = FALSE) { if (!isInitialized(object)) { stop("cannot access the matrix of uninitialized objects") } if (factor) { stop("no default method for extracting the square root of a \"pdMat\" object") } else { crossprod(pdMatrix(object, factor = TRUE)) } } ###*# Methods for standard generics as.matrix.pdMat <- function(x, ...) pdMatrix(x) coef.pdMat <- function(object, unconstrained = TRUE, ...) { if (unconstrained || !isInitialized(object)) { as.vector(object) } else { stop("do not know how to obtain constrained coefficients") } } "coef<-.pdMat" <- function(object, ..., value) { value <- as.numeric(value) if (isInitialized(object)) { if (length(value) != length(object)) { stop("cannot change the length of the parameter after initialization") } } else { return(pdConstruct(object, value)) } class(value) <- class(object) attributes(value) <- attributes(object) value } Dim.pdMat <- function(object, ...) { if ((val <- length(Names(object))) > 0) c(val, val) else if (isInitialized(object)) dim(as.matrix(object)) else stop("cannot access the number of columns of uninitialized objects without names") } formula.pdMat <- function(x, asList, ...) eval(attr(x, "formula")) isInitialized.pdMat <- function(object) length(object) > 0 logDet.pdMat <- function(object, ...) { if (!isInitialized(object)) stop("cannot extract the log of the determinant from an uninitialized object") sum(log(svd.d(pdMatrix(object, factor = TRUE)))) } `matrix<-.pdMat` <- function(object, value) { value <- as.matrix(value) ## check for consistency of dimensions when object is initialized if (isInitialized(object) && any(dim(value) != Dim(object))) { stop("cannot change dimensions on an initialized \"pdMat\" object") } pdConstruct(object, value) } Names.pdMat <- function(object, ...) { as.character(attr(object, "Dimnames")[[2]]) } `Names<-.pdMat` <- function(object, ..., value) { if (is.null(value)) { attr(object, "Dimnames") <- NULL return(object) } else { value <- as.character(value) if (length(dn <- Names(object)) == 0) { if (isInitialized(object)) { # object is initialized without names if (length(value) != (aux <- Dim(object)[2])) { stop(gettextf("Length of names should be %d", aux), domain = NA) } } attr(object, "Dimnames") <- list(value, value) return(object) } if (length(dn) != length(value)) { stop(gettextf("Length of names should be %d", length(dn)), domain = NA) } err <- FALSE if (any(noMatch <- is.na(match(value, dn)))) { err <- TRUE ## checking nlme case valueCopy <- value indNoMatch <- seq_along(value)[noMatch] nam1 <- value[noMatch] # no matching names if (any(wch1 <- (nchar(nam1, "c") > 12))) { ## possibly names with .(Intercept) in value wch1 <- substring(nam1, nchar(nam1, "c")-10) == "(Intercept)" if (any(wch1)) { valueCopy[indNoMatch[wch1]] <- substring(nam1[wch1], 1, nchar(nam1[wch1], "c") - 12) noMatch[wch1] <- FALSE indNoMatch <- indNoMatch[!wch1] # possibly not matched } } if (sum(noMatch) > 0) { ## still no matches - try adding .(Intercept) valueCopy[indNoMatch] <- paste(valueCopy[indNoMatch], "(Intercept)", sep = ".") } ## try matching modified value indMatch <- match(valueCopy, dn) if (!anyNA(indMatch)) { # all match attr(object, "Dimnames") <- list(value, value) if ((length(indMatch)) > 1 && any(diff(indMatch) != 1) && isInitialized(object)) { # permutation auxMat <- as.matrix(object)[indMatch, indMatch, drop = FALSE] dimnames(auxMat) <- list(value, value) return(pdConstruct(object, auxMat)) } return(object) } } if (err) { stop("names being assigned do not correspond to a permutation of previous names") } indMatch <- match(value, dn) if ((length(indMatch) == 1) || all(diff(indMatch) == 1)) { return(object) } ## must be a permutation of names attr(object, "Dimnames") <- list(value, value) if (isInitialized(object)) { auxMat <- as.matrix(object)[indMatch, indMatch, drop = FALSE] dimnames(auxMat) <- list(value, value) return(pdConstruct(object, auxMat)) } object } } plot.pdMat <- function(x, nseg = 50, levels = 1, center = rep(0, length(stdDev)), additional, ...) { corr <- corMatrix(x) stdDev <- attr(corr, "stdDev") attr(corr, "stdDev") <- NULL assign(".corr", corr) assign(".angles", seq(-pi, pi, length = nseg + 1)) assign(".cosines", cos(.angles)) nlev <- length(levels) dataMat <- array(aperm(outer(rbind(-stdDev, stdDev), levels), c(1, 3, 2)), dim = c(nlev * 2, length(stdDev)), dimnames = list(NULL, names(stdDev))) groups <- rep(1:nlev, rep(2, nlev)) dataMat <- t(t(dataMat) + center) if (!missing(additional)) { additional <- as.matrix(additional) dataMat <- rbind(dataMat, additional) groups <- c(groups, rep(0, nrow(additional))) } splom(~ dataMat, panel = function(x, y, subscripts, groups, ...) { groups <- groups[subscripts] # should be a no-op but if (any(g0 <- groups == 0)) { # plot as points panel.xyplot(x[g0], y[g0], ..., type = "p") } g1 <- groups == 1 # plot the center points panel.xyplot(mean(x[g1]), mean(y[g1]), ..., type = "p", pch = 3) p <- ncol(.corr) laggedCos <- cos(.angles + acos(.corr[round(mean(x[g1])*p + 0.5), round(mean(y[g1])*p + 0.5)])) xylist <- lapply(split(data.frame(x = x[!g0], y = y[!g0]), groups[!g0]), function(el, lagged) { if (nrow(el) != 2) { stop("x-y data to splom got botched somehow") } sumDif <- array(c(1,1,1,-1)/2, c(2,2)) %*% as.matrix(el) list(x = sumDif[1,1] + .cosines * sumDif[2,1], y = sumDif[1,2] + lagged * sumDif[2,2]) }, lagged = laggedCos) gg <- rep(seq_along(xylist), rep(length(.angles), length(xylist))) panel.superpose(unlist(lapply(xylist, `[[`, "x")), unlist(lapply(xylist, `[[`, "y")), subscripts = seq_along(gg), groups = gg, ..., type = "l") }, subscripts = TRUE, groups = groups) } print.pdMat <- function(x, ...) { if (isInitialized(x)) { cat("Positive definite matrix structure of class", class(x)[1], "representing\n") print(as.matrix(x), ...) } else { cat("Uninitialized positive definite matrix structure of class ", class(x)[1], ".\n", sep = "") } invisible(x) } str.pdMat <- function(object, ...) { if (isInitialized(object)) { cat(sQuote(class(object)[1], q=FALSE), "with matrix") str(pdMatrix(object), ...) } else { cat('Uninitialized ', paste(paste(sQuote(class(object), q=FALSE), collapse=", ")), ": ", deparse(attr(object,"formula")), "\n", sep="") } } print.summary.pdMat <- function(x, sigma = 1, rdig = 3, Level = NULL, resid = FALSE, ...) ## resid = TRUE causes an extra row to be added { if (!is.list(x)) { if (!(is.null(form <- attr(x, "formula")))) { cat(paste(" Formula: ")) if (inherits(form, "formula")) { cat(deparse(form)) if (!is.null(Level)) { cat( paste( " |", Level ) ) } } else { if (length(form) == 1) { cat(deparse(form[[1]])) if (!is.null(Level)) { cat( paste( " |", Level ) ) } } else { cat(deparse(lapply(form, function(el) as.name(deparse(el))))) cat("\n Level:", Level) } } cat( "\n" ) } if (ncol(x) == 1) { if (resid) { print(array(sigma * c(attr(x, "stdDev"), 1), c(1, 2), list("StdDev:", c(names(attr(x, "stdDev")), "Residual"))), ... ) } else { print(array(sigma * attr(x, "stdDev"), c(1,1), list("StdDev:", names(attr(x, "stdDev")))), ... ) } } else { cat(paste(" Structure: ", attr(x, "structName"), "\n", sep = "")) if (attr(x, "noCorrelation") | (1 >= (p <- dim(x)[2]))) { if (resid) { print(array(sigma * c(attr(x, "stdDev"), 1), c(1, p + 1), list("StdDev:", c(names(attr(x, "stdDev")), "Residual"))), ...) } else { print(array(sigma * attr(x, "stdDev"), c(1, p), list("StdDev:", names(attr(x, "stdDev")))), ...) } } else { # we essentially do print.correlation here ll <- lower.tri(x) stdDev <- attr(x, "stdDev") x[ll] <- format(round(x[ll], digits = rdig), ...) x[!ll] <- "" xx <- array("", dim(x), list(names(attr(x, "stdDev")), c("StdDev", "Corr", rep("", p - 2)))) xx[, 1] <- format(sigma * attr(x, "stdDev")) xx[-1, -1] <- x[ -1, -p ] if (!is.null(colnames(x))) { xx[1, -1] <- abbreviate(colnames(x)[ -p ], minlength = rdig + 3) } if (resid) { x <- array("", dim(xx) + c(1, 0), list(c(rownames(xx), "Residual"), colnames(xx))) x[ 1:p, ] <- xx x[ , 1 ] <- format(sigma * c(stdDev, 1)) xx <- x } print( xx, ..., quote = FALSE ) } } } else { # composite structure cat(paste(" Composite Structure: ", attr(x, "structName"), "\n", sep ="")) elName <- attr(x, "elementName") compNames <- names(x) for (i in seq_along(x)) { cat(paste("\n ", elName, " ", i, ": ", compNames[i], "\n", sep = "")) print.summary.pdMat(x[[i]], sigma = sigma, Level = Level, resid = resid && (i == length(x)), ...) } } invisible(x) } solve.pdMat <- function(a, b, ...) { if (!isInitialized(a)) { stop("cannot get the inverse of an uninitialized object") } matrix(a) <- solve(as.matrix(a)) a } summary.pdMat <- function(object, structName = class(object)[1], noCorrelation = FALSE, ...) { if (isInitialized(object)) { value <- corMatrix(object) attr(value, "structName") <- structName attr(value, "noCorrelation") <- noCorrelation attr(value, "formula") <- formula(object) class(value) <- "summary.pdMat" value } else { object } } "[.pdMat" <- function(x, i, j, drop = TRUE) { xx <- x x <- as.matrix(x) if (missing(i)) li <- 0 else li <- length(i) if (missing(j)) lj <- 0 else lj <- length(j) if ((li + lj == 0) || (li == lj) && ((mode(i) == mode(j)) && all(i == j))) { drop <- FALSE # even for a 1 by 1 submatrix, # you want it to be a matrix pdConstruct(xx, NextMethod()) } else { NextMethod() } } "[<-.pdMat" <- function(x, i, j, value) { xx <- x x <- as.matrix(x) pdConstruct(xx, NextMethod()) } ##*## Classes that substitute for (i.e. inherit from) pdMat ###*# pdSymm - a class of general pd matrices ####* Constructor pdSymm <- ## Constructor for the pdSymm class function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) { object <- numeric(0) class(object) <- c("pdSymm", "pdMat") pdConstruct(object, value, form, nam, data) } ####* Methods for local generics pdConstruct.pdSymm <- function(object, value = numeric(0), form = formula(object), nam = Names(object), data = parent.frame(), ...) { val <- NextMethod() if (length(val) == 0) { # uninitialized object class(val) <- c("pdSymm", "pdMat") return(val) } if (is.matrix(val)) { vald <- svd(val, nu = 0) object <- vald$v %*% (log(vald$d) * t(vald$v)) value <- object[row(object) <= col(object)] attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] class(value) <- c("pdSymm", "pdMat") return(value) } Ncol <- round((sqrt(8*length(val) + 1) - 1)/2) if (length(val) != round((Ncol * (Ncol + 1))/2)) { stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = NA) } class(val) <- c("pdSymm", "pdMat") val } pdFactor.pdSymm <- function(object) { Ncol <- round((-1 + sqrt(1 + 8 * length(object))) / 2) .C(matrixLog_pd, Factor = double(Ncol * Ncol), as.integer(Ncol), as.double(object))$Factor } pdMatrix.pdSymm <- function(object, factor = FALSE) { if (!isInitialized(object)) stop("cannot extract matrix from an uninitialized object") if (factor) { Ncol <- Dim(object)[2] value <- array(pdFactor(object), c(Ncol, Ncol), attr(object, "Dimnames")) attr(value, "logDet") <- sum(log(abs(svd.d(value)))) value } else { NextMethod() } } ####* Methods for standard generics coef.pdSymm <- function(object, unconstrained = TRUE, ...) { if (unconstrained || !isInitialized(object)) NextMethod() else { # upper triangular elements val <- as.matrix(object) aN <- Names(object) aN1 <- paste("cov(", aN, sep ="") aN2 <- paste(aN, ")", sep ="") aNmat <- t(outer(aN1, aN2, paste, sep = ",")) aNmat[row(aNmat) == col(aNmat)] <- paste("var(",aN,")",sep="") val <- val[row(val) <= col(val)] names(val) <- aNmat[row(aNmat) <= col(aNmat)] val } } Dim.pdSymm <- function(object, ...) { if (isInitialized(object)) { val <- round((sqrt(8*length(object) + 1) - 1)/2) c(val, val) } else { NextMethod() } } logDet.pdSymm <- function(object, ...) { if (!isInitialized(object)) { stop("cannot extract the log of the determinant from an uninitialized object") } attr(pdMatrix(object, factor = TRUE), "logDet") } solve.pdSymm <- function(a, b, ...) { if (!isInitialized(a)) { stop("cannot extract the inverse from an uninitialized object") } coef(a) <- -coef(a, TRUE) a } summary.pdSymm <- function(object, structName = "General positive-definite", ...) { summary.pdMat(object, structName) } ### No need to implement other methods as the methods for pdMat ### are sufficient. ###*# pdLogChol - a general positive definite structure parameterized ### by the non-zero elements of the Cholesky factor with the diagonal ### elements given in the logarithm scale. ####* Constructor pdLogChol <- ## Constructor for the pdLogChol class function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) { object <- numeric(0) class(object) <- c("pdLogChol", "pdMat") pdConstruct(object, value, form, nam, data) } ####* Methods for local generics pdConstruct.pdLogChol <- function(object, value = numeric(0), form = formula(object), nam = Names(object), data = parent.frame(), ...) { val <- pdConstruct.pdMat(object, value, form, nam, data) if (length(val) == 0) { # uninitialized object class(val) <- c("pdLogChol", "pdSymm", "pdMat") return(val) } if (is.matrix(val)) { value <- c(log(diag(val)), val[row(val) < col(val)]) attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] class(value) <- c("pdLogChol", "pdSymm", "pdMat") return(value) } Ncol <- round((sqrt(8*length(val) + 1) - 1)/2) if (length(val) != round((Ncol * (Ncol + 1))/2)) { stop(gettextf("an object of length %d does not match a Cholesky factor", length(val)), domain = NA) } class(val) <- c("pdLogChol", "pdSymm", "pdMat") val } pdFactor.pdLogChol <- function(object) { Ncol <- round((-1 + sqrt(1 + 8 * length(object))) / 2) .C(logChol_pd, Factor = double(Ncol * Ncol), as.integer(Ncol), as.double(object))$Factor } ####* Methods for standard generics solve.pdLogChol <- function(a, b, ...) { if (!isInitialized(a)) { stop("cannot get the inverse of an uninitialized object") } # Ncol <- (-1 + sqrt(1 + 8 * length(a))) / 2 # val <- array(.Fortran("dbksl", # as.double(pdFactor(a)), # as.integer(Ncol), # as.integer(Ncol), # val = as.double(diag(Ncol)), # as.integer(Ncol), # integer(1))[["val"]], c(Ncol, Ncol)) # val <- qr(t(val))$qr val <- qr(t(solve(pdMatrix(a, factor = TRUE))))$qr val <- sign(diag(val)) * val coef(a) <- c(log(diag(val)), val[c(row(val) < col(val))]) a } summary.pdLogChol <- function(object, structName = "General positive-definite, Log-Cholesky parametrization", ...) { summary.pdMat(object, structName) } ### No need to implement other methods as the methods for pdMat ### are sufficient. ####*# pdChol - a general positive definite structure parameterized by #### the non-zero elements of the Cholesky factor. #####* Constructor #pdChol <- # ## Constructor for the pdChol class # function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) #{ # object <- numeric(0) # class(object) <- c("pdChol", "pdMat") # pdConstruct(object, value, form, nam, data) #} #####* Methods for local generics #pdConstruct.pdChol <- # function(object, value = numeric(0), form = formula(object), # nam = Names(object), data = parent.frame()) #{ # val <- pdConstruct.pdMat(object, value, form, nam, data) # if (length(val) == 0) { # uninitialized object # class(val) <- c("pdChol", "pdSymm", "pdMat") # return(val) # } # if (is.matrix(val)) { # value <- val[row(val) <= col(val)] # attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] # class(value) <- c("pdChol", "pdSymm", "pdMat") # return(value) # } # Ncol <- round((sqrt(8*length(val) + 1) - 1)/2) # if (length(val) != round((Ncol * (Ncol + 1))/2)) { # stop(paste("An object of length", length(val), # "does not match a Cholesky factor")) # } # class(val) <- c("pdChol", "pdSymm", "pdMat") # val #} #pdFactor.pdChol <- # function(object) #{ # round(Ncol <- (-1 + sqrt(1 + 8 * length(object))) / 2) # .C("Chol_pd", # Factor = double(Ncol * Ncol), # as.integer(Ncol), # as.double(object))$Factor #} #####* Methods for standard generics #solve.pdChol <- # function(a, b) #{ # if (!isInitialized(a)) { # stop("cannot get the inverse of an uninitialized object") # } # Ncol <- (-1 + sqrt(1 + 8 * length(a))) / 2 # val <- array(.Fortran("dbksl", # as.double(pdFactor(a)), # as.integer(Ncol), # as.integer(Ncol), # val = as.double(diag(Ncol)), # as.integer(Ncol), # integer(1))[["val"]], c(Ncol, Ncol)) # coef(a) <- qr(t(val))$qr[c(row(val) <= col(val))] # a #} #summary.pdChol <- # function(object, # structName = "General positive-definite, Cholesky parametrization") #{ # summary.pdMat(object, structName) #} #### No need to implement other methods as the methods for pdMat #### are sufficient. ####*# pdSpher - a general positive definite structure parameterized #### by the non-zero elements of the Cholesky factor with each column #### represented in spherical coordinates #####* Constructor #pdSpher <- # ## Constructor for the pdSpher class # function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) #{ # object <- numeric(0) # class(object) <- c("pdSpher", "pdMat") # pdConstruct(object, value, form, nam, data) #} #####* Methods for local generics #pdConstruct.pdSpher <- # function(object, value = numeric(0), form = formula(object), # nam = Names(object), data = parent.frame()) #{ # val <- pdConstruct.pdMat(object, value, form, nam, data) # if (length(val) == 0) { # uninitiliazed object # class(val) <- c("pdSpher", "pdSymm", "pdMat") # return(val) # } # if (is.matrix(val)) { # Ncol <- dim(val)[2] # value <- log(apply(val, FUN = function(x){sqrt(sum(x^2))},2)) # for(i in (1:Ncol)[-1]) { # aux <- acos(val[1:(i-1),i]/sqrt(cumsum(val[i:1,i]^2)[i:2])) # value <- c(value, log(aux/(pi - aux))) # } # attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] # class(value) <- c("pdSpher", "pdSymm", "pdMat") # return(value) # } # Ncol <- round((sqrt(8*length(val) + 1) - 1)/2) # if (length(val) != round((Ncol * (Ncol + 1))/2)) { # stop(paste("An object of length", length(val), # "does not match a Cholesky factor")) # } # class(val) <- c("pdSpher", "pdSymm", "pdMat") # val #} #pdFactor.pdSpher <- # function(object) #{ # round(Ncol <- (-1 + sqrt(1 + 8 * length(object))) / 2) # .C("spher_pd", # Factor = double(Ncol * Ncol), # as.integer(Ncol), # as.double(object))$Factor #} #####* Methods for standar generics #summary.pdSpher <- # function(object, # structName = "General positive-definite, Spherical parametrization") #{ # summary.pdMat(object, structName) #} ####*# pdMatrixLog - a general positive definite structure parameterized #### by the matrix logarithm. #####* Constructor #pdMatrixLog <- # ## Constructor for the pdMatrixLog class # function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) #{ # object <- numeric(0) # class(object) <- c("pdMatrixLog", "pdMat") # pdConstruct(object, value, form, nam, data) #} #####* Methods for local generics #pdConstruct.pdMatrixLog <- # function(object, value = numeric(0), form = formula(object), # nam = Names(object), data = parent.frame()) #{ # val <- pdConstruct.pdMat(object, value, form, nam, data) # if (length(val) == 0) { # uninitialized object # class(val) <- c("pdMatrixLog", "pdSymm", "pdMat") # return(val) # } # if (is.matrix(val)) { # object <- eigen(crossprod(val), symmetric = TRUE) # object <- object$vectors %*% (log(object$values) * t(object$vectors)) # value <- object[row(object) <= col(object)] # attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] # class(value) <- c("pdMatrixLog", "pdSymm", "pdMat") # return(value) # } # Ncol <- round((sqrt(8*length(val) + 1) - 1)/2) # if (length(val) != round((Ncol * (Ncol + 1))/2)) { # stop(paste("An object of length", length(val), # "does not match the required parameter size")) # } # class(val) <- c("pdMatrixLog", "pdSymm", "pdMat") # val #} #pdFactor.pdMatrixLog <- # function(object) #{ # round(Ncol <- (-1 + sqrt(1 + 8 * length(object))) / 2) # .C("matrixLog_pd", # Factor = double(Ncol * Ncol), # as.integer(Ncol), # as.double(object))$Factor #} #####* Methods for standard generics #solve.pdMatrixLog <- # function(a, b) #{ # if (!isInitialized(a)) { # stop("cannot extract the inverse from an uninitialized object") # } # coef(a) <- -coef(a, TRUE) # a #} #summary.pdMatrixLog <- # function(object, # structName = "General positive-definite") #{ # summary.pdMat(object, structName) #} #### No need to implement other methods as the methods for pdMat #### are sufficient. ####*# pdGivens - a general positive definite structure parameterized #### by the eigenvalues and eigenvectors (as Givens rotations) #####* Constructor #pdGivens <- # ## Constructor for the pdGivens class # function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) #{ # object <- numeric(0) # class(object) <- c("pdGivens", "pdMat") # pdConstruct(object, value, form, nam, data) #} #####* Methods for local generics #pdConstruct.pdGivens <- # function(object, value = numeric(0), form = formula(object), # nam = Names(object), data = parent.frame()) #{ # val <- pdConstruct.pdMat(object, value, form, nam, data) # if (length(val) == 0) { # uninitiliazed object # class(val) <- c("pdGivens", "pdSymm", "pdMat") # return(val) # } # if (is.matrix(val)) { # q <- dim(val)[1] # aux <- eigen(crossprod(val), symmetric = TRUE) # Q <- aux$vectors # values <- aux$values # angles <- array(0,q*(q-1)/2) # k <- 0 # for(i in 1:(q-1)) { # for(j in ((i+1):q)) { # k <- k + 1 # p <- sqrt(Q[i,i]^2 + Q[j,i]^2) # if (p == 0) { # angles[k] <- 0 # } else { # aux0 <- Q[i,i]/p # aux1 <- Q[j,i]/p # if (aux1 < 0) { # aux0 <- -aux0 # aux1 <- -aux1 # } # aux <- Q[i,] # angles[k] <- log(acos(aux0)/(pi - acos(aux0))) # Q[i,] <- Q[i,] * aux0 + Q[j,] * aux1 # Q[j,] <- Q[j,] * aux0 - aux * aux1 # } # } # } # value <- c(log(c(values[q], diff(values[q:1]))), angles) # attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] # class(value) <- c("pdGivens", "pdSymm", "pdMat") # return(value) # } # Ncol <- round((sqrt(8*length(val) + 1) - 1)/2) # if (length(val) != round((Ncol * (Ncol + 1))/2)) { # stop(paste("An object of length", length(val), # "does not match the required parameter size")) # } # class(val) <- c("pdGivens", "pdSymm", "pdMat") # val #} #pdFactor.pdGivens <- # function(object) #{ # round(Ncol <- (-1 + sqrt(1 + 8 * length(object))) / 2) # .C("Givens_pd", # Factor = double(Ncol * Ncol), # as.integer(Ncol), # as.double(object))$Factor #} #####* Methods for standard generics #summary.pdGivens <- # function(object, # structName = "General positive-definite, Givens parametrization") #{ # summary.pdMat(object, structName) #} #### No need to implement other methods as the methods for pdMat #### are sufficient. #pdConstruct.pdSymm <- pdConstruct.pdMatrixLog #default parametrization ####*# pdNatural - a general positive definite structure parameterized #### by the log of the square root of the diagonal elements and the #### generalized logit of the correlations. This is NOT an unrestricted #### parametrization ####* Constructor pdNatural <- ## Constructor for the pdNatural class function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) { object <- numeric(0) class(object) <- c("pdNatural", "pdMat") pdConstruct(object, value, form, nam, data) } ####* Methods for local generics pdConstruct.pdNatural <- function(object, value = numeric(0), form = formula(object), nam = Names(object), data = parent.frame(), ...) { val <- pdConstruct.pdMat(object, value, form, nam, data) if (length(val) == 0) { # uninitiliazed object class(val) <- c("pdNatural", "pdMat") return(val) } if (is.matrix(val)) { q <- ncol(val) if (q > 1) { aux <- crossprod(val) stdDev <- sqrt(diag(aux)) aux <- t(aux/stdDev)/stdDev aux <- aux[row(aux) > col(aux)] value <- c(log(stdDev), log((aux + 1)/(1 - aux))) } else { value <- log(val) } attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] class(value) <- c("pdNatural", "pdMat") return(value) } Ncol <- round((sqrt(8*length(val) + 1) - 1)/2) if (length(val) != round((Ncol * (Ncol + 1))/2)) { stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = NA) } class(val) <- c("pdNatural", "pdMat") val } pdFactor.pdNatural <- function(object) { Ncol <- round((-1 + sqrt(1 + 8 * length(object))) / 2) .C(natural_pd, Factor = double(Ncol * Ncol), as.integer(Ncol), as.double(object))$Factor } pdMatrix.pdNatural <- function(object, factor = FALSE) { if (!isInitialized(object)) { stop("cannot extract matrix from an uninitialized object") } if (factor) { Ncol <- Dim(object)[2] value <- array(pdFactor(object), c(Ncol, Ncol), attr(object, "Dimnames")) attr(value, "logDet") <- sum(log(diag(value))) value } else { NextMethod() } } ####* Methods for standard generics coef.pdNatural <- function(object, unconstrained = TRUE, ...) { if (unconstrained || !isInitialized(object)) NextMethod() else { # standard deviations and correlations Ncol <- round((-1 + sqrt(1 + 8 * length(object))) / 2) val <- exp(as.vector(object)) aux <- val[-(1:Ncol)] val[-(1:Ncol)] <- (aux - 1) / (aux + 1) aN <- Names(object) aNmat <- t(outer(aN, aN, paste, sep = ",")) names(val) <- c(paste("sd(",aN,")", sep = ""), if (Ncol > 1) { paste("cor(", aNmat[row(aNmat) > col(aNmat)],")",sep="") }) val } } Dim.pdNatural <- function(object, ...) { if (isInitialized(object)) { val <- round((sqrt(8*length(object) + 1) - 1)/2) c(val, val) } else { NextMethod() } } logDet.pdNatural <- function(object, ...) { if (!isInitialized(object)) { stop("cannot extract the log of the determinant from an uninitialized object") } attr(pdMatrix(object, factor = TRUE), "logDet") } solve.pdNatural <- function(a, b, ...) { if (!isInitialized(a)) { stop("cannot get the inverse of an uninitialized object") } Ncol <- round((-1 + sqrt(1 + 8 * length(a))) / 2) if (Ncol > 1) { # val <- array(.Fortran("dbksl", # as.double(pdFactor(a)), # as.integer(Ncol), # as.integer(Ncol), # val = as.double(diag(Ncol)), # as.integer(Ncol), # integer(1))[["val"]], c(Ncol, Ncol)) val <- solve(pdMatrix(a, factor = TRUE)) val <- val %*% t(val) stdDev <- sqrt(diag(val)) val <- t(val/stdDev)/stdDev val <- val[row(val) > col(val)] coef(a) <- c(log(stdDev), log((val + 1)/(1 - val))) } else { coef(a) <- -coef(a) } a } summary.pdNatural <- function(object, structName = "General positive-definite, Natural parametrization", ...) { summary.pdMat(object, structName) } ### No need to implement other methods as the methods for pdMat ### are sufficient. ###*# pdDiag - diagonal structure parameterized by the logarithm of ### the square root of the diagonal terms. ####* Constructor pdDiag <- ## Constructor for the pdDiag class function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) { object <- numeric(0) class(object) <- c("pdDiag", "pdMat") pdConstruct(object, value, form, nam, data) } ####* Methods for local generics corMatrix.pdDiag <- function(object, ...) { val <- diag(length(as.vector(object))) attr(val, "stdDev") <- exp(as.vector(object)) len <- length(as.vector(object)) if (length(nm <- Names(object)) == 0) { nm <- paste("V", 1:len, sep = "") dimnames(val) <- list(nm, nm) } names(attr(val, "stdDev")) <- nm val } pdConstruct.pdDiag <- function(object, value = numeric(0), form = formula(object), nam = Names(object), data = parent.frame(), ...) { val <- NextMethod() if (length(val) == 0) { # uninitiliazed object return(val) } if (is.matrix(val)) { # initialize from a positive definite # if (any(value[row(val) != col(val)])) { # warning("Initializing matrix is not diagonal") # } value <- log(diag(crossprod(val)))/2 attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] class(value) <- c("pdDiag", "pdMat") return(value) } if ((aux <- length(Names(val))) > 0) { if (aux && (aux != length(val))) { stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = NA) } } val } pdFactor.pdDiag <- function(object) { diag(exp(as.vector(object)), length(object)) } pdMatrix.pdDiag <- function(object, factor = FALSE) { if (!isInitialized(object)) { stop("cannot extract the matrix from an uninitialized object") } len <- length(as.vector(object)) if (factor) { value <- diag(exp(as.vector(object)), len) attr(value, "logDet") <- sum(as.vector(object)) } else { value <- diag(exp(2 * as.vector(object)), len) } dimnames(value) <- attr(object, "Dimnames") value } ####* Methods for standard generics coef.pdDiag <- function(object, unconstrained = TRUE, ...) { if (unconstrained) NextMethod() else { val <- exp(as.vector(object)) names(val) <- paste("sd(",Names(object),")", sep ="") val } } Dim.pdDiag <- function(object, ...) { if (isInitialized(object)) { val <- length(object) c(val, val) } else { NextMethod() } } logDet.pdDiag <- function(object, ...) { if (!isInitialized(object)) { stop("cannot extract the log of the determinant from an uninitialized object") } sum(as.vector(object)) } solve.pdDiag <- function(a, b, ...) { if (!isInitialized(a)) { stop("cannot extract the inverse from an uninitialized object") } coef(a) <- -coef(a, TRUE) a } summary.pdDiag <- function(object, structName = "Diagonal", ...) { summary.pdMat(object, structName, noCorrelation = TRUE) } ### No need to implement other methods as the "pdMat" methods suffice. ###*# pdIdent: multiple of the identity matrix - the parameter is ### the log of the multiple. ####* Constructor pdIdent <- ## Constructor for the pdIdent class function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) { object <- numeric(0) class(object) <- c("pdIdent", "pdMat") pdConstruct(object, value, form, nam, data) } ####* Methods for local generics corMatrix.pdIdent <- function(object, ...) { if (!isInitialized(object)) { stop("cannot extract the matrix from an uninitialized \"pdIdent\" object") } if (is.null(Ncol <- attr(object, "ncol"))) { stop("cannot extract the matrix with uninitialized dimensions") } val <- diag(nrow = Ncol) attr(val, "stdDev") <- rep(exp(as.vector(object)), Ncol) if (length(nm <- Names(object)) == 0) { nm <- paste("V", 1:Ncol, sep = "") } dimnames(val) <- list(nm, nm) names(attr(val, "stdDev")) <- nm val } pdConstruct.pdIdent <- function(object, value = numeric(0), form = formula(object), nam = Names(object), data = parent.frame(), ...) { val <- NextMethod() if (length(val) == 0) { # uninitialized object if ((ncol <- length(Names(val))) > 0) { attr(val, "ncol") <- ncol } return(val) } if (is.matrix(val)) { # if (any(val[row(val) != col(val)])) { # warning("Initializing pdIdent object from non-diagonal matrix") # } # if (any(diag(val) != val[1,1])) { # warning("Diagonal of initializing matrix is not constant") # } value <- log(mean(diag(crossprod(val))))/2 attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] attr(value, "ncol") <- dim(val)[2] class(value) <- c("pdIdent", "pdMat") return(value) } if (length(val) > 1) { stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = NA) } if (((aux <- length(Names(val))) == 0) && is.null(formula(val))) { stop("must give names when initializing \"pdIdent\" from parameter without a formula") } else { attr(val, "ncol") <- aux } val } pdFactor.pdIdent <- function(object) { exp(as.vector(object)) * diag(attr(object, "ncol")) } pdMatrix.pdIdent <- function(object, factor = FALSE) { if (!isInitialized(object)) { stop("cannot extract the matrix from an uninitialized \"pdIdent\" object") } if (is.null(Ncol <- attr(object, "ncol"))) { stop("cannot extract the matrix with uninitialized dimensions") } value <- diag(Ncol) if (factor) { value <- exp(as.vector(object)) * value attr(value, "logDet") <- Ncol * as.vector(object) } else { value <- exp(2 * as.vector(object)) * value } dimnames(value) <- attr(object, "Dimnames") value } ####* Methods for standard generics coef.pdIdent <- function(object, unconstrained = TRUE, ...) { if (unconstrained) NextMethod() else structure(exp(as.vector(object)), names = c(paste("sd(", deparse(formula(object)[[2]]),")",sep = ""))) } Dim.pdIdent <- function(object, ...) { if (!is.null(val <- attr(object, "ncol"))) { c(val, val) } else { stop("cannot extract the dimensions") } } logDet.pdIdent <- function(object, ...) { attr(object, "ncol") * as.vector(object) } solve.pdIdent <- function(a, b, ...) { if (!isInitialized(a)) { stop("cannot extract the inverse from an uninitialized object") } coef(a) <- -coef(a, TRUE) a } summary.pdIdent <- function(object, structName = "Multiple of an Identity", ...) { summary.pdMat(object, structName, noCorrelation = TRUE) } ###*# pdCompSymm: Compound symmetry structure ####* Constructor pdCompSymm <- ## Constructor for the pdCompSymm class function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame()) { object <- numeric(0) class(object) <- c("pdCompSymm", "pdMat") pdConstruct(object, value, form, nam, data) } ####* Methods for local generics corMatrix.pdCompSymm <- function(object, ...) { if (!isInitialized(object)) { stop("cannot extract the matrix from an uninitialized \"pdCompSymm\" object") } if (is.null(Ncol <- attr(object, "ncol"))) { stop("cannot extract the matrix with uninitialized dimensions") } obj <- as.vector(object) aux <- exp(obj[2]) aux <- c(exp(2 * obj[1]), (aux - 1/(Ncol - 1))/(aux + 1)) value <- array(aux[2], c(Ncol, Ncol)) value[row(value) == col(value)] <- 1 attr(value, "stdDev") <- rep(exp(obj[1]), Ncol) if (length(nm <- Names(object)) == 0) { nm <- paste("V", 1:Ncol, sep = "") dimnames(value) <- list(nm, nm) } names(attr(value, "stdDev")) <- nm value } pdConstruct.pdCompSymm <- function(object, value = numeric(0), form = formula(object), nam = Names(object), data = parent.frame(), ...) { val <- NextMethod() if (length(val) == 0) { # uninitialized object if ((nc <- length(Names(val))) > 0) { attr(val, "ncol") <- nc } return(val) } if (is.matrix(val)) { value <- crossprod(val) # if (length(unique(value[row(value) != col(value)])) > 1) { # warning("Initializing pdCompSymm object from non-compound symmetry matrix") # } # if (any(diag(value) != value[1,1])) { # warning("Diagonal of initializing matrix is not constant") # } nc <- dim(value)[2] aux <- 1/sqrt(diag(value)) aux <- aux * t(value * aux) if ((aux <- mean(aux[row(aux) != col(aux)])) <= -1/(nc - 1)) { aux <- -1/nc warning("initializing \"pdCompSymm\" object is not positive definite") } value <- c(log(mean(diag(value)))/2, log((aux + 1/(nc - 1))/(1 - aux))) attributes(value) <- attributes(val)[names(attributes(val)) != "dim"] attr(value, "ncol") <- nc class(value) <- c("pdCompSymm", "pdMat") return(value) } if (length(val) != 2) { stop(gettextf("an object of length %d does not match the required parameter size", length(val)), domain = NA) } if (((aux <- length(Names(val))) == 0) && is.null(formula(val))) { stop("must give names when initializing \"pdCompSymm\" from parameter without a formula") } else { attr(val, "ncol") <- aux } val } pdFactor.pdCompSymm <- function(object) { Ncol <- attr(object, "ncol") .C(compSymm_pd, Factor = double(Ncol * Ncol), as.integer(Ncol), as.double(object))$Factor } pdMatrix.pdCompSymm <- function(object, factor = FALSE) { if (!isInitialized(object)) { stop("cannot extract the matrix from an uninitialized \"pdCompSymm\" object") } if (is.null(Ncol <- attr(object, "ncol"))) { stop("cannot extract the matrix with uninitialized dimensions") } obj <- as.vector(object) aux <- exp(obj[2]) aux <- c(exp(2 * obj[1]), (aux - 1/(Ncol - 1))/(aux + 1)) if (factor) { value <- array(pdFactor(object), c(Ncol, Ncol)) attr(value, "logDet") <- Ncol * obj[1] + ((Ncol - 1) * log(1 - aux[2]) + log(1 + (Ncol - 1) * aux[2]))/2 } else { value <- array(aux[2], c(Ncol, Ncol)) value[row(value) == col(value)] <- 1 value <- aux[1] * value } dimnames(value) <- attr(object, "Dimnames") value } ####* Methods for standard generics coef.pdCompSymm <- function(object, unconstrained = TRUE, ...) { if (unconstrained || !isInitialized(object)) NextMethod() else { if (is.null(Ncol <- attr(object, "ncol"))) { stop("cannot obtain constrained coefficients with uninitialized dimensions") } val <- as.vector(object) aux <- exp(val[2]) val <- c(exp(val[1]), (aux - 1 / (Ncol - 1)) / (aux + 1)) names(val) <- c("std. dev", "corr.") val } } Dim.pdCompSymm <- function(object, ...) { if (!is.null(val <- attr(object, "ncol"))) { c(val, val) } else { stop("cannot extract the dimensions") } } logDet.pdCompSymm <- function(object, ...) { attr(pdMatrix(object, factor = TRUE), "logDet") } summary.pdCompSymm <- function(object, structName = "Compound Symmetry", ...) { summary.pdMat(object, structName) } ####*# pdBlocked: A blocked variance structure #####* Constructor pdBlocked <- ## Constructor for the pdBlocked class function(value = numeric(0), form = NULL, nam = NULL, data = parent.frame(), pdClass = "pdSymm") { object <- numeric(0) class(object) <- c("pdBlocked", "pdMat") pdConstruct(object, value, form, nam, data, pdClass) } ####* Methods for local generics corMatrix.pdBlocked <- function(object, ...) { if (!isInitialized(object)) { stop("cannot access the matrix of uninitialized objects") } if (length(Names(object)) == 0) { stop("cannot access the matrix of object without names") } namesList <- Names(object, TRUE) Ncol <- Dim(object)[2] value <- array(0, c(Ncol, Ncol), attr(object, "Dimnames")) stdDev <- double(Ncol) names(stdDev) <- colnames(value) for (i in seq_along(object)) { aux <- corMatrix(object[[i]]) value[namesList[[i]], namesList[[i]]] <- as.vector(aux) stdDev[namesList[[i]]] <- attr(aux, "stdDev") } attr(value, "stdDev") <- stdDev value } pdConstruct.pdBlocked <- function(object, value = numeric(0), form = formula(object, TRUE), nam = Names(object, TRUE), data = parent.frame(), pdClass = "pdSymm", ...) { if (inherits(value, "pdMat")) { # constructing from another pdMat if (inherits(value, "pdBlocked")) { if (length(form) == 0) form <- formula(value, TRUE) if (length(nam) == 0) nam <- Names(value, TRUE) if (missing(pdClass)) ## somewhat dubious (why keep all? / order?): pdClass <- unlist(lapply(value, data.class)) } if (isInitialized(value)) { return(pdConstruct(object, as.matrix(value), form, nam, data, pdClass)) } else { return(pdConstruct(object, form = form, nam = nam, data = data, pdClass = pdClass)) } } ## checking validity and consistency of form, nam, and pdClass if (!is.null(form)) { if(!is.list(form)) stop("'form' must be a list") nF <- length(form) } else { nF <- 0 } if (!is.null(nam)) { if(!is.list(nam)) stop("'nam' must be a list") nN <- length(nam) if ((nF > 0) && (nN != nF)) { stop("'form' and 'nam' have incompatible lengths") } } else { nN <- 0 } if (!missing(pdClass)) { if (!is.character(pdClass)) { stop("'pdClass' must be a character vector") } nP <- length(pdClass) if ((nP > 1)) { if ((nF > 0) && (nF != nP)) { stop("'form' and 'pdClass' have incompatible lengths") } if ((nN > 0) && (nN != nP)) { stop("'nam' and 'pdClass' have incompatible lengths") } } } else { nP <- 1 } nB <- max(c(nF, nN, nP)) oVal <- value if (length(value) == 0 || is.matrix(value) || is.numeric(value)) { if (nB == 1) { stop("LNone of the arguments specify more than one block") } ## will first do a null initialization when value is a matrix or numeric value <- lapply(vector("list", nB), function(el) numeric(0)) } else { if (!is.list(value)) stop("'object' must be a list when not missing, not a matrix, and not numeric") nO <- length(value) if ((nB > 1) && (nB != nO)) { stop("arguments imply different number of blocks") } nB <- nO } if (nP == 1) { pdClass <- rep(pdClass, nB) } object <- vector("list", nB) namInterc <- rep(FALSE, nB) namCoef <- vector("list", nB) for(i in 1:nB) { if (is.null(nm <- nam[[i]])) { if (is.null(frm <- form[[i]])) { if (inherits(value[[i]], "formula")) { nm <- Names(getCovariateFormula(value[[i]])) if ((length(nm) == 1) && (nm == "(Intercept)") && length(value[[i]]) == 3) { ## nlme case with single intercept terms nm <- sapply(splitFormula(getResponseFormula(value[[i]])[[2]], sep = "+"), function(el) deparse(el[[2]])) } if (length(value[[i]]) == 3) { # nlme case namCoef[[i]] <- sapply(splitFormula(getResponseFormula(value[[i]])[[2]], sep = "+"), function(el) deparse(el[[2]])) } } } else { if (inherits(frm, "formula")) { nm <- Names(getCovariateFormula(frm)) if ((length(nm) == 1) && (nm == "(Intercept)") && length(frm) == 3) { ## nlme case with single intercept terms nm <- sapply(splitFormula(getResponseFormula(frm)[[2]], sep = "+"), function(el) deparse(el[[2]])) } if (length(value[[i]]) == 3) { # nlme case namCoef[[i]] <- sapply(splitFormula(getResponseFormula(value[[i]])[[2]], sep = "+"), function(el) deparse(el[[2]])) } } else { # listForm nm <- unique(unlist(lapply(frm, function(el) { Names(getCovariateFormula(el)) }))) if ((length(nm) == 1) && (nm == "(Intercept)") && length(frm[[1]]) == 3) { ## nlme case with single intercept terms nm <- sapply(frm, function(el) { sapply(splitFormula(getResponseFormula(el)[[2]], sep = "+"), function(el1) deparse(el1[[2]])) }) } namCoef[[i]] <- sapply(frm, function(el) { sapply(splitFormula(getResponseFormula(el)[[2]], sep = "+"), function(el1) deparse(el1[[2]])) }) } } } if (!is.null(nm)) { namInterc[i] <- (length(nm) == 1) && (nm == "(Intercept)") } object[[i]] <- pdMat(value[[i]], form[[i]], nam[[i]], data, pdClass[i]) } if (!all(unlist(lapply(object, inherits, "pdMat")))) { stop("all elements in the argument must generate \"pdMat\" objects") } namesList <- lapply(object, Names) lNam <- lengths(namesList) # namInterc <- unlist(lapply(namesList, # function(el) { # (length(el) == 1) && (el == "(Intercept)") # })) if (!is.null(namCoef[[1]])) { # nlme case namCoef <- unlist(namCoef) duplCoef <- unique(namCoef[duplicated(namCoef)]) if (length(duplCoef) > 0) { for(i in 1:nB) { wchDupl <- !is.na(match(namesList[[i]], duplCoef)) if (any(wchDupl)) { namesList[[i]][wchDupl] <- paste(namesList[[i]][wchDupl], "(Intercept)", sep = ".") Names(object[[i]]) <- namesList[[i]] } } } } if (sum(namInterc) > 1 && (length(unique(lNam[namInterc])) == 1)) { stop("cannot have duplicated column names in a \"pdMat\" object") } if ((sum(namInterc) == length(lNam)) || !any(lNam[!namInterc])) { # no names class(object) <- c("pdBlocked", "pdMat") if (is.null(formula(object))) { stop("must have formula when no names are given") } if (length(oVal) && (is.matrix(oVal) || is.numeric(oVal))) { stop("must give names when initializing from matrix or parameter") } return(object) } else { if (!all(lNam)) { stop("all elements must have names when any has names") } attr(object, "namesList") <- namesList allNames <- unlist(namesList) if (anyDuplicated(allNames)) { stop("cannot have duplicated column names in a \"pdMat\" object") } plen <- unlist(lapply(object, function(el) { if (isInitialized(el)) { length(coef(el, TRUE)) } else { matrix(el) <- diag(length(Names(el))) length(coef(el, TRUE)) } })) if (!all(plen)) { stop("all elements must have a non-zero size") } attr(object, "plen") <- plen attr(object, "Dimnames") <- list(allNames, allNames) class(object) <- c("pdBlocked", "pdMat") if (length(oVal) > 0) { if (is.matrix(oVal)) { # initializing from matrix matrix(object) <- oVal } else if (is.numeric(oVal)){ # initializing from a vector coef(object) <- oVal } } return(object) } } pdMatrix.pdBlocked <- function(object, factor = FALSE) { if (!isInitialized(object)) { stop("cannot access the matrix of uninitialized objects") } if (length(Names(object)) == 0) { stop("cannot access the matrix of object without names") } namesList <- Names(object, TRUE) Ncol <- Dim(object)[2] value <- array(0, c(Ncol, Ncol), attr(object, "Dimnames")) if (factor) { lD <- 0 } for (i in seq_along(object)) { aux <- pdMatrix(object[[i]], factor) value[namesList[[i]], namesList[[i]]] <- as.vector(aux) if (factor) lD <- lD + attr(aux, "logDet") } if (factor) attr(value, "logDet") <- lD value } ####* Methods for standard generics coef.pdBlocked <- function(object, unconstrained = TRUE, ...) { unlist(lapply(object, coef, unconstrained)) } "coef<-.pdBlocked" <- function(object, ..., value) { if (is.null(plen <- attr(object, "plen"))) { stop("cannot change the parameter when length of parameters is undefined") } if (length(value) != sum(plen)) { stop("cannot change parameter length of initialized \"pdMat\" object") } ends <- cumsum(plen) starts <- 1 + c(0, ends[-length(ends)]) for (i in seq_along(object)) { coef(object[[i]]) <- value[(starts[i]):(ends[i])] } object } formula.pdBlocked <- function(x, asList = TRUE, ...) { val <- lapply(x, formula) isNULL <- unlist(lapply(val, is.null)) if (all(isNULL)) return(NULL) if (any(isNULL)) { stop("all elements must have formulas when any has a formula") } if (asList) return(val) isTwoSided <- unlist(lapply(val, function(el) { inherits(el, "listForm") })) if (all(isTwoSided)) { ## list of two-sided formulas val <- do.call("c", val) # for(i in seq(along = object)) { # val <- if (inherits(object[[i]], "formula")) list(object[[i]]) # else object[[i]] # } class(val) <- "listForm" return(val) } if (any(isTwoSided)) { stop("all elements of formula must be list of two-sided formulae or two-sided formulae") } val <- lapply(val, terms) aux <- paste(unlist(lapply(val, function(el) attr(el, "term.labels"))), collapse = "+") if (!any(unlist(lapply(val, function(el) attr(el, "intercept"))))) { ## no intercept aux <- paste(aux, " - 1") } eval(parse(text = paste("~", aux))) } isInitialized.pdBlocked <- function(object) { all(unlist(lapply(object, isInitialized))) } logDet.pdBlocked <- function(object, ...) { sum(unlist(lapply(object, logDet))) } "matrix<-.pdBlocked" <- function(object, value) { value <- as.matrix(value) namesList <- Names(object, TRUE) Ncol <- Dim(object)[2] dims <- dim(value) if (!((dims[1] == dims[2]) && (dims[1] == Ncol))) { stop("cannot change the number of columns on an initialized object") } if (is.null(vNames <- rownames(value))) { vNames <- unlist(namesList) dimnames(value) <- list(vNames, vNames) } else { if (!(all(match(unlist(namesList), vNames, nomatch = 0)))) { stop("names of object and value must match") } attr(object, "Dimnames") <- list(vNames, vNames) } for (i in seq_along(object)) { matrix(object[[i]]) <- value[namesList[[i]], namesList[[i]]] } object } Names.pdBlocked <- function(object, asList = FALSE, ...) { if (asList) attr(object, "namesList") else attr(object, "Dimnames")[[2]] } "Names<-.pdBlocked" <- function(object, ..., value) { if (!is.null(Names(object))) NextMethod() else { ## cannot do anything before initialization of names object } } pdFactor.pdBlocked <- function(object) { pdMatrix(object, factor = TRUE) } solve.pdBlocked <- function(a, b, ...) { if (!isInitialized(a)) { stop("cannot get the inverse of an uninitialized object") } coef(a) <- unlist(lapply(a, function(el) coef(solve(el), TRUE))) a } summary.pdBlocked <- function(object, structName = "Blocked", ...) { value <- lapply(object, summary) names(value) <- unlist(lapply(object, function(el) paste(Names(el), collapse = ", "))) attr(value, "structName") <- structName attr(value, "elementName") <- "Block" class(value) <- "summary.pdMat" value } "[.pdBlocked" <- function(x, i, j, drop = TRUE) { xx <- x x <- as.matrix(x) mCall <- match.call() mCall[[1]] <- get("[") mCall[["x"]] <- x mCall[["drop"]] <- drop if (length(i) == length(j) && mode(i) == mode(j) && all(i == j)) { mCall[["drop"]] <- FALSE # even for a 1 by 1 submatrix, # you want it to be a matrix val <- eval(mCall) vNames <- colnames(val) auxNames <- lapply(Names(xx, TRUE), function(el) { aux <- match(vNames, el) if(any(ok <- !is.na(aux))) el[aux[ok]] # else NULL }) auxWhich <- !vapply(auxNames, is.null, NA) if (sum(auxWhich) == 1) { pdConstruct(as.list(xx)[auxWhich][[1]], val) } else { auxNames <- auxNames[auxWhich] auxClass <- vapply(xx, function(el) class(el)[1L], "")[auxWhich] pdConstruct(xx, val, nam = auxNames, form = NULL, pdClass = auxClass) } } else { eval(mCall) } } nlme/R/VarCov.R0000644000176000001440000001252614630076362012776 0ustar ripleyusers## Contributed by Mary Lindstrom # Copyright 2007-2024 The R Core team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # getVarCov <- function(obj, ...) UseMethod("getVarCov") getVarCov.lme <- function(obj, individuals, type= c("random.effects","conditional","marginal"), ...) { type <- match.arg(type) if(inherits(obj, "nlme")) stop("not implemented for \"nlme\" objects") if(length(obj$groups) > 1) stop("not implemented for multiple levels of nesting") sigma <- obj$sigma D <- as.matrix(obj$modelStruct$reStruct[[1]]) * sigma^2 if (type=="random.effects") { result <- D } else { result <- list() groups <- obj$groups[[1]] ugroups <- unique(groups) ## CAVE: both default and numeric 'individuals' are undocumented, ## but unlike getVarCov.gls and perhaps unintentionally, these ## index the groups as they occur in the data, not the levels! if (missing(individuals)) { individuals <- ugroups[1] } else if (is.numeric(individuals)) { individuals <- ugroups[individuals] } for (individ in as.character(individuals)) { ind <- groups == individ ni <- sum(ind, na.rm = TRUE) if (ni == 0) stop(gettextf("individual %s was not used in the fit", sQuote(individ)), domain = NA) if(!is.null(csT <- obj$modelStruct$corStruct) && ni > 1) { # corMatrix.corSpatial() excludes 1-obs groups (PR#16806) V <- corMatrix(csT)[[individ]] } else V <- diag(ni) if(!is.null(obj$modelStruct$varStruct)) { ## CAVE: stored weights are based on internally reordered data, ## so cannot be indexed via obj$groups grp <- if(!is.null(csT)) getGroups(csT) else groups[order(groups)] sds <- 1/varWeights(obj$modelStruct$varStruct)[grp == individ] } else sds <- rep(1, ni) sds <- obj$sigma * sds cond.var <- t(V * sds) * sds dimnames(cond.var) <- list(1:nrow(cond.var),1:ncol(cond.var)) if (type=="conditional") result[[individ]] <- cond.var else { Z <- model.matrix(obj$modelStruct$reStruct, getData(obj))[ind, , drop = FALSE] result[[individ]] <- cond.var + Z %*% D %*% t(Z) } } } class(result) <- c(type,"VarCov") attr(result,"group.levels") <- names(obj$groups) result } getVarCov.gls <- function(obj, individual = 1, ...) { if (is.null(csT <- obj$modelStruct$corStruct)) stop("not implemented for uncorrelated errors") if (is.null(grp <- getGroups(csT))) stop("not implemented for correlation structures without a grouping factor") ind <- if (is.numeric(individual)) { as.integer(grp) == individual } else grp == individual ni <- sum(ind, na.rm = TRUE) if (ni == 0) stop(gettextf("individual %s was not used in the fit", sQuote(individual)), domain = NA) S <- if (ni > 1) corMatrix(csT)[[individual]] else diag(1) # PR#16806 if (!is.null( obj$modelStruct$varStruct)) { vw <- 1/varWeights(obj$modelStruct$varStruct)[ind] } else vw <- rep(1, ni) vars <- (obj$sigma * vw)^2 result <- t(S * sqrt(vars))*sqrt(vars) class(result) <- c("marginal","VarCov") attr(result,"group.levels") <- names(obj$groups) result } print.VarCov <- function(x, corr = FALSE, stdevs = TRUE, digits = 5, ...) { pvc <- function(x, type, corr, stdevs, digits) { cat(c("Random effects","Conditional", "Marginal")[match(type, c("random.effects","conditional", "marginal"))], " ", sep = "") x <- as.matrix(x) class(x) <- NULL attr(x,"group.levels") <- NULL if (corr) { cat("correlation matrix\n") sds <- sqrt(diag(x)) print(signif(t(x/sds)/sds,digits)) } else { cat("variance covariance matrix\n") print(signif(x,digits)) if(stdevs) sds <- sqrt(diag(x)) } if (stdevs) cat(" Standard Deviations:",signif(sds,digits),"\n") } if (!is.list(x)) pvc(x,class(x)[1],corr,stdevs,digits) else { for (nm in names(x)) { cat(attr(x,"group.levels"),nm,"\n") pvc(x[[nm]],class(x)[1],corr,stdevs,digits) } } invisible(x) } nlme/R/gls.R0000644000176000001440000014526514630066234012367 0ustar ripleyusers### Fit a linear model with correlated errors and/or heteroscedasticity ### ### Copyright 2005-2022 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # gls <- ## fits linear model with serial correlation and variance functions, ## by maximum likelihood using a Newton-Raphson algorithm. function(model, data = sys.frame(sys.parent()), correlation = NULL, weights = NULL, subset, method = c("REML", "ML"), na.action = na.fail, control = list(), verbose = FALSE) { Call <- match.call() ## control parameters controlvals <- glsControl() if (!missing(control)) controlvals[names(control)] <- control ## ## checking arguments ## if (!inherits(model, "formula") || length(model) != 3L) { stop("model must be a formula of the form \"resp ~ pred\"") } method <- match.arg(method) REML <- method == "REML" ## check if correlation is present and has groups groups <- if (!is.null(correlation)) getGroupsFormula(correlation) ## else NULL ## create a gls structure containing the plug-ins glsSt <- glsStruct(corStruct = correlation, varStruct = varFunc(weights)) ## we need to resolve '.' in the formula here model <- terms(model, data=data) ## extract a data frame with enough information to evaluate ## formula, groups, corStruct, and varStruct mfArgs <- list(formula = asOneFormula(formula(glsSt), model, groups), data = data, na.action = na.action) if (!missing(subset)) { mfArgs[["subset"]] <- asOneSidedFormula(Call[["subset"]])[[2L]] } mfArgs$drop.unused.levels <- TRUE dataMod <- do.call(model.frame, mfArgs) origOrder <- row.names(dataMod) # preserve the original order if (!is.null(groups)) { ## sort the model.frame by groups and get the matrices and parameters ## used in the estimation procedures ## always use innermost level of grouping groups <- eval(substitute(~ 1 | GR, list(GR = groups[[2L]]))) grps <- getGroups(dataMod, groups, level = length(getGroupsFormula(groups, asList = TRUE))) ## ordering data by groups ord <- order(grps) grps <- grps[ord] dataMod <- dataMod[ord, ,drop = FALSE] revOrder <- match(origOrder, row.names(dataMod)) # putting in orig. order } else grps <- NULL ## obtaining basic model matrices X <- model.frame(model, dataMod) Terms <- attr(X, "terms") if (length(attr(Terms, "offset"))) stop("offset() terms are not supported") ## keeping the contrasts for later use in predict contr <- lapply(X, function(el) if (inherits(el, "factor")) contrasts(el)) contr <- contr[!unlist(lapply(contr, is.null))] X <- model.matrix(model, X) if(ncol(X) == 0L) stop("no coefficients to fit") y <- eval(model[[2L]], dataMod) N <- nrow(X) p <- ncol(X) # number of coefficients parAssign <- attr(X, "assign") namTerms <- attr(Terms, "term.labels") if (attr(Terms, "intercept") > 0) { namTerms <- c("(Intercept)", namTerms) } namTerms <- factor(parAssign, labels = namTerms) parAssign <- split(order(parAssign), namTerms) fixedSigma <- (controlvals$sigma > 0) ## 17-11-2015; Fixed sigma patch ## creating the condensed linear model attr(glsSt, "conLin") <- list(Xy = array(c(X, y), c(N, ncol(X) + 1L), list(row.names(dataMod), c(colnames(X), deparse(model[[2]])))), dims = list(N = N, p = p, REML = as.integer(REML)), logLik = 0, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions sigma = controlvals$sigma, fixedSigma = fixedSigma) ## initialization glsEstControl <- controlvals["singular.ok"] glsSt <- Initialize(glsSt, dataMod, glsEstControl) parMap <- attr(glsSt, "pmap") ## ## getting the fitted object, possibly iterating for variance functions ## numIter <- numIter0 <- 0L repeat { oldPars <- c(attr(glsSt, "glsFit")[["beta"]], coef(glsSt)) if (length(coef(glsSt))) { # needs ms() optRes <- if (controlvals$opt == "nlminb") { nlminb(c(coef(glsSt)), function(glsPars) -logLik(glsSt, glsPars), control = list(trace = controlvals$msVerbose, iter.max = controlvals$msMaxIter)) } else { optim(c(coef(glsSt)), function(glsPars) -logLik(glsSt, glsPars), method = controlvals$optimMethod, control = list(trace = controlvals$msVerbose, maxit = controlvals$msMaxIter, reltol = if(numIter == 0L) controlvals$msTol else 100*.Machine$double.eps)) } coef(glsSt) <- optRes$par } else { optRes <- list(convergence = 0) } attr(glsSt, "glsFit") <- glsEstimate(glsSt, control = glsEstControl) ## checking if any updating is needed if (!needUpdate(glsSt)) { if (optRes$convergence) stop(optRes$message) break } ## updating the fit information numIter <- numIter + 1L glsSt <- update(glsSt, dataMod) ## calculating the convergence criterion aConv <- c(attr(glsSt, "glsFit")[["beta"]], coef(glsSt)) conv <- abs((oldPars - aConv)/ifelse(aConv == 0, 1, aConv)) aConv <- c("beta" = max(conv[1:p])) conv <- conv[-(1:p)] for(i in names(glsSt)) { if (any(parMap[,i])) { aConv <- c(aConv, max(conv[parMap[,i]])) names(aConv)[length(aConv)] <- i } } if (verbose) { cat("\nIteration:",numIter) cat("\nObjective:", format(optRes$value), "\n") print(glsSt) cat("\nConvergence:\n") print(aConv) } if (max(aConv) <= controlvals$tolerance) { break } if (numIter > controlvals$maxIter) { stop("maximum number of iterations reached without convergence") } } ## wrapping up glsFit <- attr(glsSt, "glsFit") namBeta <- names(glsFit$beta) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions attr(glsSt, "fixedSigma") <- fixedSigma attr(parAssign, "varBetaFact") <- varBeta <- glsFit$sigma * glsFit$varBeta * sqrt((N - REML * p)/(N - p)) varBeta <- crossprod(varBeta) dimnames(varBeta) <- list(namBeta, namBeta) ## ## fitted.values and residuals (in original order) ## Fitted <- fitted(glsSt) ## putting groups back in original order, if present if (!is.null(grps)) { grps <- grps[revOrder] Fitted <- Fitted[revOrder] Resid <- y[revOrder] - Fitted attr(Resid, "std") <- glsFit$sigma/varWeights(glsSt)[revOrder] } else { Resid <- y - Fitted attr(Resid, "std") <- glsFit$sigma/varWeights(glsSt) } names(Resid) <- names(Fitted) <- origOrder ## getting the approximate var-cov of the parameters apVar <- if (controlvals$apVar) glsApVar(glsSt, glsFit$sigma, .relStep = controlvals[[".relStep"]], minAbsPar = controlvals[["minAbsParApVar"]], natural = controlvals[["natural"]]) else "Approximate variance-covariance matrix not available" ## getting rid of condensed linear model and fit dims <- attr(glsSt, "conLin")[["dims"]] dims[["p"]] <- p attr(glsSt, "conLin") <- NULL attr(glsSt, "glsFit") <- NULL attr(glsSt, "fixedSigma") <- fixedSigma ## 17-11-2015; Fixed sigma patch; .. grpDta <- inherits(data, "groupedData") ## ## creating the gls object ## structure(class = "gls", list(modelStruct = glsSt, dims = dims, contrasts = contr, coefficients = glsFit[["beta"]], varBeta = varBeta, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions sigma = if(fixedSigma) controlvals$sigma else glsFit$sigma, apVar = apVar, logLik = glsFit$logLik, numIter = if (needUpdate(glsSt)) numIter else numIter0, groups = grps, call = Call, terms = Terms, method = method, fitted = Fitted, residuals = Resid, parAssign = parAssign, na.action = attr(dataMod, "na.action")), namBetaFull = colnames(X), ## saving labels and units for plots units = if(grpDta) attr(data, "units"), labels= if(grpDta) attr(data, "labels")) } ### Auxiliary functions used internally in gls and its methods glsApVar.fullGlsLogLik <- function(Pars, object, conLin, dims, N) { fixedSigma <- attr(object, "fixedSigma") ## logLik as a function of sigma and coef(glsSt) npar <- length(Pars) if (!fixedSigma) { lsigma <- Pars[npar] # within-group std. dev. Pars <- Pars[-npar] sigma <- 0 } else { sigma <- conLin$sigma } coef(object) <- Pars conLin <- recalc(object, conLin) val <- .C(gls_loglik, as.double(conLin$Xy), as.integer(unlist(dims)), logLik = double(1L), lRSS = double(1L), sigma = as.double(sigma), NAOK = TRUE)[c("logLik", "lRSS")] if (!fixedSigma) { aux <- 2 * (val[["lRSS"]] - lsigma) conLin[["logLik"]] + val[["logLik"]] + (N * aux - exp(aux))/2 } else { val[["logLik"]] } } glsApVar <- function(glsSt, sigma, conLin = attr(glsSt, "conLin"), .relStep = .Machine$double.eps^(1/3), minAbsPar = 0, natural = TRUE) { fixedSigma <- attr(glsSt, "fixedSigma") ## calculate approximate variance-covariance matrix of all parameters ## except the coefficients if (length(glsCoef <- coef(glsSt)) > 0L) { cSt <- glsSt[["corStruct"]] if (natural && !is.null(cSt) && inherits(cSt, "corSymm")) { cStNatPar <- coef(cSt, unconstrained = FALSE) class(cSt) <- c("corNatural", "corStruct") coef(cSt) <- log((1 + cStNatPar)/(1 - cStNatPar)) glsSt[["corStruct"]] <- cSt glsCoef <- coef(glsSt) } dims <- conLin$dims N <- dims$N - dims$REML * dims$p conLin[["logLik"]] <- 0 # making sure Pars <- if(fixedSigma) glsCoef else c(glsCoef, lSigma = log(sigma)) val <- fdHess(Pars, glsApVar.fullGlsLogLik, glsSt, conLin, dims, N, .relStep = .relStep, minAbsPar = minAbsPar)[["Hessian"]] if (all(eigen(val, only.values=TRUE)$values < 0)) { ## negative definite - OK val <- solve(-val) nP <- names(Pars) dimnames(val) <- list(nP, nP) attr(val, "Pars") <- Pars attr(val, "natural") <- natural val } else { ## problem - solution is not a maximum "Non-positive definite approximate variance-covariance" } } # else NULL } glsEstimate <- function(object, conLin = attr(object, "conLin"), control = list(singular.ok = FALSE)) { dd <- conLin$dims p <- dd$p oXy <- conLin$Xy fixSig <- conLin$fixedSigma ## 17-11-2015; Fixed sigma patch; .. sigma <- conLin$sigma conLin <- recalc(object, conLin) # updating for corStruct and varFunc val <- .C(gls_estimate, as.double(conLin$Xy), as.integer(unlist(dd)), beta = double(p), sigma = as.double(sigma), ## 17-11-2015; Fixed sigma patch; .. logLik = double(1L), varBeta = double(p * p), rank = integer(1), pivot = as.integer(1:(p + 1L)), NAOK = TRUE)[c("beta","sigma","logLik","varBeta", "rank", "pivot")] rnk <- val[["rank"]] rnkm1 <- rnk - 1 if (!control$singular.ok && rnkm1 < p) { stop(gettextf("computed \"gls\" fit is singular, rank %s", rnk), domain = NA) } N <- dd$N - dd$REML * p namCoef <- colnames(oXy)[val[["pivot"]][1:rnkm1] + 1L] # coef names varBeta <- t(array(val[["varBeta"]], c(rnkm1, rnkm1), list(namCoef, namCoef))) beta <- val[["beta"]][1:rnkm1] names(beta) <- namCoef fitted <- c(oXy[, namCoef, drop = FALSE] %*% beta) resid <- oXy[, p + 1] - fitted ll <- conLin$logLik + val[["logLik"]] logLik <- if (!fixSig) { (N * (logb(N) - (1 + logb(2 * pi))))/2 + ll ## formula 2.21 on page 70 if sigma is estimated ML formula or 2.23 page 76 with REML } else { (-N/2) * logb(2*pi) + ll } list(logLik = logLik, beta = beta, sigma = val[["sigma"]], varBeta = varBeta, fitted = fitted, resid = resid, auxSigma = sqrt(sum((resid)^2))/sqrt(N)) } ### Methods for standard generics ACF.gls <- function(object, maxLag, resType = c("pearson", "response", "normalized"), form = ~1, na.action = na.fail, ...) { resType <- match.arg(resType) res <- resid(object, type = resType) wchRows <- NULL if (is.null(grps <- getGroups(object))) { ## check if formula defines groups if (!is.null(grpsF <- getGroupsFormula(form))) { if (is.null(data <- getData(object))) { ## will try to construct allV <- all.vars(grpsF) if (length(allV) > 0L) { alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } } grps <- model.frame(grpsF, data, na.action = na.action) wchRows <- !is.na(match(row.names(data), row.names(grps))) grps <- getGroups(grps, grpsF) } } if (!is.null(grps)) { if (!is.null(wchRows)) { res <- res[wchRows] } res <- split(res, grps) } else { res <- list(res) } if(missing(maxLag)) { maxLag <- min(c(maxL <- max(lengths(res)) - 1L, as.integer(10 * log10(maxL + 1)))) } val <- lapply(res, function(el, maxLag) { N <- maxLag + 1L tt <- double(N) nn <- integer(N) N <- min(c(N, n <- length(el))) nn[1:N] <- n + 1L - 1:N ## el <- el - mean(el) for(i in 1:N) { el1 <- el[1:(n-i+1L)] el2 <- el[i:n] tt[i] <- sum(el1 * el2) } array(c(tt,nn), c(length(tt), 2L)) }, maxLag = maxLag) val0 <- apply(sapply(val, function(x) x[,2L]), 1, sum) val1 <- apply(sapply(val, function(x) x[,1L]), 1, sum)/val0 val2 <- val1/val1[1L] structure(data.frame(lag = 0:maxLag, ACF = val2), n.used = val0, class = c("ACF", "data.frame")) } anova.gls <- function(object, ..., test = TRUE, type = c("sequential", "marginal"), adjustSigma = NA, Terms, L, verbose = FALSE) { fixSig <- attr(object$modelStruct, "fixedSigma") fixSig <- !is.null(fixSig) && fixSig Lmiss <- missing(L) ## returns the likelihood ratio statistics, the AIC, and the BIC if ((rt <- ...length() + 1L) == 1L) { ## just one object if (!inherits(object,"gls")) stop(gettextf("object must inherit from class %s", '"gls"'), domain = NA) if(is.na(adjustSigma)) ## REML correction already applied to gnls objects adjustSigma <- inherits(object, "gnls") dims <- object$dims N <- dims$N p <- dims$p REML <- dims$REML assign <- object$parAssign vBeta <- attr(assign, "varBetaFact") if (!REML && adjustSigma) ## using REML-like estimate of sigma under ML vBeta <- sqrt((N - p)/N) * vBeta c0 <- solve(t(vBeta), coef(object)) nTerms <- length(assign) dDF <- N - p lab <- paste("Denom. DF:", dDF,"\n") if (missing(Terms) && Lmiss) { ## returns the F.table (Wald) for the fixed effects type <- match.arg(type) Fval <- Pval <- double(nTerms) nDF <- integer(nTerms) for(i in 1:nTerms) { nDF[i] <- length(assign[[i]]) c0i <- if (type == "sequential") # type I SS c0[assign[[i]]] else ## "marginal" qr.qty(qr(vBeta[, assign[[i]], drop = FALSE]), c0)[1:nDF[i]] Fval[i] <- sum(c0i^2)/nDF[i] Pval[i] <- pf(Fval[i], nDF[i], dDF, lower.tail=FALSE) } ## ## fixed effects F-values, df, and p-values ## aod <- data.frame(numDF = nDF, "F-value" = Fval, "p-value" = Pval, check.names=FALSE) rownames(aod) <- names(assign) } else { if (Lmiss) { # terms is given if (is.numeric(Terms) && all(Terms == as.integer(Terms))) { if (min(Terms) < 1 || max(Terms) > nTerms) { stop(gettextf("'Terms' must be between 1 and %d", nTerms), domain = NA) } } else { if (is.character(Terms)) { if (any(noMatch <- is.na(match(Terms, names(assign))))) { stop(sprintf(ngettext(sum(noMatch), "term %s not matched", "terms %s not matched"), paste(Terms[noMatch], collapse = ", ")), domain = NA) } } else { stop("terms can only be integers or characters") } } lab <- paste(lab, "F-test for:", paste(names(assign[Terms]),collapse=", "),"\n") L <- diag(p)[unlist(assign[Terms]),,drop=FALSE] } else { L <- as.matrix(L) if (ncol(L) == 1L) L <- t(L) # single linear combination nrowL <- nrow(L) ncolL <- ncol(L) if (ncol(L) > p) { stop(sprintf(ngettext(ncol(L), "'L' must have at most %d column", "'L' must have at most %d columns"), ncol(L)), domain = NA) } dmsL1 <- rownames(L) L0 <- array(0, c(nrowL, p), list(NULL, names(coef(object)))) if (is.null(dmsL2 <- colnames(L))) { ## assume same order as effects L0[, 1:ncolL] <- L } else { if (any(noMatch <- is.na(match(dmsL2, colnames(L0))))) { stop(sprintf(ngettext(sum(noMatch), "effect %s not matched", "effects %s not matched"), paste(dmsL2[noMatch],collapse=", ")), domain = NA) } L0[, dmsL2] <- L } L <- L0[noZeroRowL <- as.logical((L0 != 0) %*% rep(1, p)), , drop = FALSE] nrowL <- nrow(L) noZeroColL <- as.logical(c(rep(1,nrowL) %*% (L != 0))) rownames(L) <- if(is.null(dmsL1)) 1:nrowL else dmsL1[noZeroRowL] lab <- paste(lab, "F-test for linear combination(s)\n") } nDF <- sum(svd.d(L) > 0) c0 <- c(qr.qty(qr(vBeta %*% t(L)), c0))[1:nDF] Fval <- sum(c0^2)/nDF Pval <- pf(Fval, nDF, dDF, lower.tail=FALSE) aod <- data.frame(numDF = nDF, "F-value" = Fval, "p-value" = Pval, check.names=FALSE) if (!Lmiss) { attr(aod, "L") <- if(nrow(L) > 1) L[, noZeroColL, drop = FALSE] else L[, noZeroColL] } } attr(aod, "label") <- lab attr(aod,"rt") <- rt class(aod) <- c("anova.lme", "data.frame") aod } ## ## Otherwise construct the likelihood ratio and information table ## objects in ... may inherit from gls, lm, lmList, and lme (for now) ## else { Call <- match.call() Call[[1]] <- quote(nlme::anova.lme) eval.parent(Call) } } ## (This is "cut'n'paste" similar to augPred.lme() in ./lme.R -- keep in sync!) augPred.gls <- function(object, primary = NULL, minimum = min(primary), maximum = max(primary), length.out = 51L, ...) { data <- eval.parent(object$call$data) if (!inherits(data, "data.frame")) { stop(gettextf("data in %s call must evaluate to a data frame", sQuote(substitute(object))), domain = NA) } if(is.null(primary)) { if (!inherits(data, "groupedData")) { stop(gettextf("%s without \"primary\" can only be used with fits of \"groupedData\" objects", sys.call()[[1L]]), domain = NA) } primary <- getCovariate(data) pr.var <- getCovariateFormula(data)[[2L]] } else { pr.var <- asOneSidedFormula(primary)[[2L]] primary <- eval(pr.var, data) } prName <- c_deparse(pr.var) newprimary <- seq(from = minimum, to = maximum, length.out = length.out) groups <- getGroups(object) # much simpler here than in augPred.lme grName <- ".groups" value <- if (noGrp <- is.null(groups)) { # no groups used groups <- rep("1", length(primary)) data.frame(newprimary, rep("1", length(newprimary))) } else { ugroups <- unique(groups) data.frame(rep(newprimary, length(ugroups)), rep(ugroups, rep(length(newprimary), length(ugroups)))) } names(value) <- c(prName, grName) ## recovering other variables in data that may be needed for predictions ## varying variables will be replaced by their means summData <- gsummary(data, groups = groups) if (any(toAdd <- is.na(match(names(summData), names(value))))) { summData <- summData[, toAdd, drop = FALSE] } value[, names(summData)] <- summData[value[, 2L], ] pred <- predict(object, value) newvals <- cbind(value[, 1:2], pred) names(newvals)[3] <- respName <- deparse(resp.var <- getResponseFormula(object)[[2L]]) orig <- data.frame(primary, groups, getResponse(object)) names(orig) <- names(newvals) value <- rbind(orig, newvals) attributes(value[, 2]) <- attributes(groups) value[, ".type"] <- ordered(c(rep("original", nrow(data)), rep("predicted", nrow(newvals))), levels = c("predicted", "original")) labs <- list(x = prName, y = respName) unts <- list(x = "", y = "") if(inherits(data, "groupedData")) { labs[names(attr(data, "labels"))] <- attr(data, "labels") unts[names(attr(data, "units"))] <- attr(data, "units") } subL <- list(Y = resp.var, X = pr.var, G = as.name(grName)) structure(value, class = c("augPred", class(value)), labels = labs, units = unts, formula= if(noGrp) eval (substitute(Y ~ X, subL)) else eval(substitute(Y ~ X | G, subL))) } coef.gls <- function(object, allCoef = FALSE, ...) { val <- object$coefficients if (allCoef) { namFull <- attr(object, "namBetaFull") if (length(val) != (lF <- length(namFull))) { aux <- rep(NA, lF) names(aux) <- namFull aux[names(val)] <- val val <- aux } } val } comparePred.gls <- function(object1, object2, primary = NULL, minimum = min(primary), maximum = max(primary), length.out = 51L, level = NULL, ...) { if (length(level) > 1L) { stop("only one level allowed for predictions") } args <- list(object = object1, primary = primary, level = level, length.out = length.out) if (!is.null(primary)) { ## need to do this before forcing the evaluations primary <- eval(asOneSidedFormula(primary)[[2]], eval(object1$call$data)) args[["minimum"]] <- minimum args[["maximum"]] <- maximum } val1 <- do.call(augPred, args) dm1 <- dim(val1) c1 <- deparse(substitute(object1)) levels(val1[,4])[1] <- c1 args[["object"]] <- object2 val2 <- do.call(augPred, args) dm2 <- dim(val2) c2 <- deparse(substitute(object2)) levels(val2[, 4L])[1] <- c2 val2 <- val2[val2[, 4L] != "original", , drop = FALSE] names(val2) <- names(val1) if (dm1[1L] == dm2[1L]) { lv1 <- sort(levels(val1[, 2L])) lv2 <- sort(levels(val2[, 2L])) if ((length(lv1) != length(lv2)) || any(lv1 != lv2)) { stop(gettextf("%s and %s must have the same group levels", c1, c2), domain = NA) } val <- rbind(val1[, -4L], val2[, -4L]) val[, ".type"] <- ordered(c(as.character(val1[,4L]), as.character(val2[,4L])), levels = c(c1, c2, "original")) attr(val, "formula") <- attr(val1, "formula") } else { # one may have just "fixed" if (dm1[1L] > dm2[1L]) { mult <- dm1[1L] %/% dm2[1L] if ((length(levels(val2[, 2])) != 1L) || (length(levels(val1[, 2])) != mult)) { stop("wrong group levels") } val <- data.frame(c(val1[,1L], rep(val2[,1L], mult)), rep(val1[,1L], 2L), c(val1[,3L], rep(val2[,3L], mult)), ordered(c(as.character(val1[,4L]), rep(as.character(val2[,4L]), mult)), levels = c(c1, c2, "original"))) attr(val, "formula") <- attr(val1, "formula") } else { mult <- dm2[1L] %/% dm1[1L] if ((length(levels(val1[, 2])) != 1L) || (length(levels(val2[, 2])) != mult)) { stop("wrong group levels") } val <- data.frame(c(rep(val1[,1L], mult), val2[,1L]), rep(val2[,1L], 2L), c(rep(val1[,3L], mult), val2[,3L]), ordered(c(rep(as.character(val1[,4L]), mult), as.character(val1[,4L])), levels = c(c1, c2, "original"))) attr(val, "formula") <- attr(val2, "formula") } } class(val) <- c("comparePred", "augPred", class(val)) attr(val, "labels") <- attr(val1, "labels") attr(val, "units") <- attr(val1, "units") val } fitted.gls <- function(object, ...) { val <- napredict(object$na.action, object$fitted) lab <- "Fitted values" if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } attr(val, "label") <- lab val } formula.gls <- function(x, ...) { if (is.null(x$terms)) { # gls objects from nlme <= 3.1-155 eval(x$call$model) } else formula(x$terms) } getGroups.gls <- function(object, form, level, data, sep) object$groups getGroupsFormula.gls <- function(object, asList = FALSE, sep) { if (!is.null(cSt <- object$modelStruct$corStruct)) getGroupsFormula(cSt, asList) ## else NULL } getResponse.gls <- function(object, form) { val <- resid(object) + fitted(object) if (is.null(lab <- attr(object, "labels")$y)) { lab <- deparse(getResponseFormula(object)[[2]]) } if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } attr(val, "label") <- lab val } intervals.gls <- function(object, level = 0.95, which = c("all", "var-cov", "coef"), ...) { which <- match.arg(which) val <- list() dims <- object$dims ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixSig <- attr(object$modelStruct, "fixedSigma") fixSig <- !is.null(fixSig) && fixSig if (which != "var-cov") { # coefficients included len <- -qt((1-level)/2, dims$N - dims$p) * sqrt(diag(object$varBeta)) est <- coef(object) val[["coef"]] <- array(c(est - len, est, est + len), c(length(est), 3L), list(names(est), c("lower", "est.", "upper"))) attr(val[["coef"]], "label") <- "Coefficients:" } if (which != "coef") { # variance-covariance included if (is.null(aV <- object$apVar)) { # only sigma Nr <- if (inherits(object, "gnls")) { #always REML-like sigma dims$N - dims$p } else { dims$N - dims$REML * dims$p } ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions if(!fixSig) { est <- object$sigma * sqrt(Nr) val[["sigma"]] <- structure(c(lower = est/sqrt(qchisq((1+level)/2, Nr)), "est."= object$sigma, upper = est/sqrt(qchisq((1-level)/2, Nr))), label = "Residual standard error:") } else { est <- 1 val[["sigma"]] <- structure(setNames(rep(object$sigma, 3), c("lower", "est.", "upper")), label = "Fixed Residual standard error:") } } else { if (is.character(aV)) { stop(gettextf("cannot get confidence intervals on var-cov components: %s", aV), domain = NA) } len <- -qnorm((1-level)/2) * sqrt(diag(aV)) est <- attr(aV, "Pars") nP <- length(est) glsSt <- object[["modelStruct"]] pmap <- attr(glsSt, "pmap") if (!all(whichKeep <- apply(pmap, 2, any))) { ## need to deleted components with fixed coefficients aux <- glsSt[whichKeep] class(aux) <- class(glsSt) attr(aux, "settings") <- attr(glsSt, "settings") attr(aux, "pmap") <- pmap[, whichKeep, drop = FALSE] glsSt <- aux } cSt <- glsSt[["corStruct"]] if (!is.null(cSt) && inherits(cSt, "corSymm") && attr(aV, "natural")) { ## converting to corNatural class(cSt) <- c("corNatural", "corStruct") glsSt[["corStruct"]] <- cSt } namG <- names(glsSt) auxVal <- vector("list", length(namG) + 1L) names(auxVal) <- c(namG, "sigma") aux <- array(c(est - len, est, est + len), c(nP, 3), list(NULL, c("lower", "est.", "upper"))) auxVal[["sigma"]] <- structure(if(!fixSig) { # last param. = log(sigma) s <- exp(aux[nP, ]) aux <- aux[-nP,, drop = FALSE] s } else c(object$sigma, object$sigma, object$sigma), label = "Residual standard error:") rownames(aux) <- names(coef(glsSt, FALSE)) for(i in 1:3) { coef(glsSt) <- aux[,i] aux[,i] <- coef(glsSt, unconstrained = FALSE) } for(i in namG) { au.i <- aux[pmap[,i], , drop = FALSE] dimnames(au.i)[[1]] <- substring(dimnames(au.i)[[1]], nchar(i, "c") + 2L) attr(au.i, "label") <- switch(i, corStruct = "Correlation structure:", varStruct = "Variance function:", paste0(i, ":")) auxVal[[i]] <- au.i } val <- c(val, auxVal) } } structure(val, level = level, class = "intervals.gls") } logLik.gls <- function(object, REML, ...) { ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixSig <- attr(object[["modelStruct"]], "fixedSigma") fixSig <- !is.null(fixSig) && fixSig p <- object$dims$p N <- object$dims$N Np <- N - p estM <- object$method if (missing(REML)) REML <- estM == "REML" val <- object[["logLik"]] if (REML && estM == "ML") { # have to correct logLik val <- val + (p * (log(2 * pi) + 1) + Np * log(1 - p/N) + sum(log(abs(svd.d(object$varBeta))))) / 2 } else if (!REML && (estM == "REML")) { # have to correct logLik val <- val - (p * (log(2*pi) + 1) + N * log(1 - p/N) + sum(log(abs(svd.d(object$varBeta))))) / 2 } structure(val, nall = N, nobs = N - REML * p, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions df = p + length(coef(object[["modelStruct"]])) + as.integer(!fixSig), class = "logLik") } nobs.gls <- function(object, ...) object$dims$N plot.gls <- function(x, form = resid(., type = "pearson") ~ fitted(.), abline, id = NULL, idLabels = NULL, idResType = c("pearson", "normalized"), grid, ...) ## Diagnostic plots based on residuals and/or fitted values { plot.lme(x, form=form, abline=abline, id=id, idLabels=idLabels, idResType=idResType, grid=grid, ...) } predict.gls <- function(object, newdata, na.action = na.fail, ...) { ## ## method for predict() designed for objects inheriting from class gls ## if (missing(newdata)) { # will return fitted values return(fitted(object)) } form <- delete.response(object[["terms"]]) ## making sure factor levels are the same as in contrasts ## and supporting character-type 'newdata' for factors (all via xlev) contr <- object$contrasts # these are in matrix form dataMod <- model.frame(formula = form, data = newdata, na.action = na.action, drop.unused.levels = TRUE, xlev = lapply(contr, rownames)) N <- nrow(dataMod) if (length(all.vars(form)) > 0) { X <- model.matrix(form, dataMod, contr) } else { X <- array(1, c(N, 1), list(row.names(dataMod), "(Intercept)")) } cf <- coef(object) val <- c(X[, names(cf), drop = FALSE] %*% cf) lab <- "Predicted values" if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } structure(val, label = lab) } print.intervals.gls <- function(x, ...) { cat(paste0("Approximate ", attr(x, "level") * 100, "% confidence intervals\n")) for(i in names(x)) { aux <- x[[i]] cat("\n ",attr(aux, "label"), "\n", sep = "") attr(aux, "label") <- NULL print(if(i == "sigma") c(aux) else as.matrix(aux), ...) } invisible(x) } print.gls <- ## method for print() used for gls objects function(x, ...) { ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixSig <- attr(x[["modelStruct"]], "fixedSigma") fixSig <- !is.null(fixSig) && fixSig dd <- x$dims mCall <- x$call if (inherits(x, "gnls")) { cat("Generalized nonlinear least squares fit\n") } else { cat("Generalized least squares fit by ") cat(if(x$method == "REML") "REML\n" else "maximum likelihood\n") } cat(" Model:", deparse(mCall$model), "\n") cat(" Data:", deparse( mCall$data ), "\n") if (!is.null(mCall$subset)) { cat(" Subset:", deparse(asOneSidedFormula(mCall$subset)[[2]]),"\n") } if (inherits(x, "gnls")) { cat(" Log-likelihood: ", format(x$logLik), "\n", sep = "") } else { cat(" Log-", if(x$method == "REML") "restricted-" else "", "likelihood: ", format(x$logLik), "\n", sep = "") } cat("\nCoefficients:\n") print(coef(x), ...) cat("\n") if (length(x$modelStruct) > 0L) { print(summary(x$modelStruct), ...) } cat("Degrees of freedom:", dd[["N"]],"total;",dd[["N"]] - dd[["p"]], "residual\n") cat("Residual standard error:", format(x$sigma),"\n") invisible(x) } print.summary.gls <- function(x, verbose = FALSE, digits = .Options$digits, ...) { dd <- x$dims fixSig <- attr(x[["modelStruct"]], "fixedSigma") fixSig <- !is.null(fixSig) && fixSig verbose <- verbose || attr(x, "verbose") mCall <- x$call if (inherits(x, "gnls")) { cat("Generalized nonlinear least squares fit\n") } else { cat("Generalized least squares fit by ") cat(if(x$method == "REML") "REML\n" else "maximum likelihood\n") } cat(" Model:", deparse(mCall$model), "\n") cat(" Data:", deparse( mCall$data ), "\n") if (!is.null(mCall$subset)) { cat(" Subset:", deparse(asOneSidedFormula(mCall$subset)[[2]]),"\n") } print(data.frame(AIC=x$AIC, BIC=x$BIC, logLik=as.vector(x$logLik), row.names = " "), ...) if (verbose) { cat("Convergence at iteration:",x$numIter,"\n") } if (length(x$modelStruct)) { cat("\n") print(summary(x$modelStruct), ...) } cat("\nCoefficients:\n") xtTab <- as.data.frame(x$tTable) wchPval <- match("p-value", names(xtTab)) for(i in names(xtTab)[-wchPval]) { xtTab[, i] <- format(zapsmall(xtTab[, i])) } xtTab[,wchPval] <- format(round(xtTab[,wchPval], 4L)) if (any(wchLv <- (as.double(levels(xtTab[, wchPval])) == 0))) { levels(xtTab[, wchPval])[wchLv] <- "<.0001" } row.names(xtTab) <- dimnames(x$tTable)[[1]] print(xtTab, ...) if (nrow(x$tTable) > 1L) { corr <- x$corBeta class(corr) <- "correlation" print(corr, title = "\n Correlation:", ...) } cat("\nStandardized residuals:\n") print(x$residuals, ...) cat("\n") cat("Residual standard error:", format(x$sigma),"\n") cat("Degrees of freedom:", dd[["N"]],"total;", dd[["N"]] - dd[["p"]], "residual\n") invisible(x) } residuals.gls <- function(object, type = c("response", "pearson", "normalized"), ...) { type <- match.arg(type) val <- object$residuals if (type != "response") { val <- val/attr(val, "std") lab <- "Standardized residuals" if (type == "normalized") { if (!is.null(cSt <- object$modelStruct$corStruct)) { ## normalize according to inv-trans factor val <- recalc(cSt, list(Xy = as.matrix(val)))$Xy[, 1] lab <- "Normalized residuals" } } } else { lab <- "Residuals" if (!is.null(aux <- attr(object, "units")$y)) lab <- paste(lab, aux) } attr(val, "label") <- lab if (!is.null(object$na.action)) { res <- naresid(object$na.action, val) attr(res, "std") <- naresid(object$na.action, attr(val, "std")) attr(res, "label") <- attr(val, "label") res } else val } summary.gls <- function(object, verbose = FALSE, ...) { ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixSig <- attr(object[["modelStruct"]], "fixedSigma") fixSig <- !is.null(fixSig) && fixSig ## ## generates an object used in the print.summary method for lme ## ## variance-covariance estimates for coefficients ## stdBeta <- sqrt(diag(as.matrix(object$varBeta))) corBeta <- t(object$varBeta/stdBeta)/stdBeta ## ## coefficients, std. deviations and z-ratios ## beta <- coef(object) dims <- object$dims dimnames(corBeta) <- list(names(beta),names(beta)) object$corBeta <- corBeta tTable <- data.frame(beta, stdBeta, beta/stdBeta, beta) dimnames(tTable)<- list(names(beta),c("Value","Std.Error","t-value","p-value")) tTable[, "p-value"] <- 2 * pt(-abs(tTable[,"t-value"]), dims$N - dims$p) object$tTable <- as.matrix(tTable) ## ## residuals ## resd <- resid(object, type = "pearson") if (length(resd) > 5) { resd <- quantile(resd, na.rm = TRUE) names(resd) <- c("Min","Q1","Med","Q3","Max") } object$residuals <- resd ## ## generating the final object ## aux <- logLik(object) structure(c(object, list(BIC = BIC(aux), AIC = AIC(aux))), verbose = verbose, class = c("summary.gls", class(object))) } update.gls <- function (object, model., ..., evaluate = TRUE) { call <- object$call if (is.null(call)) stop("need an object with call component") extras <- match.call(expand.dots = FALSE)$... if (!missing(model.)) call$model <- update.formula(formula(object), model.) if(length(extras) > 0L) { ## the next two lines allow partial matching of argument names ## in the update. This is nonstandard but required for examples ## in chapter 5 of Pinheiro and Bates (2000). glsa <- names(as.list(args(gls))) names(extras) <- glsa[pmatch(names(extras), glsa[-length(glsa)])] existing <- !is.na(match(names(extras), names(call))) ## do these individually to allow NULL to remove entries. for (a in names(extras)[existing]) call[[a]] <- extras[[a]] if(any(!existing)) { call <- c(as.list(call), extras[!existing]) call <- as.call(call) } } if(evaluate) eval(call, parent.frame()) else call } Variogram.gls <- function(object, distance, form = ~1, resType = c("pearson", "response", "normalized"), data, na.action = na.fail, maxDist, length.out = 50, collapse = c("quantiles", "fixed", "none"), nint = 20, breaks, robust = FALSE, metric = c("euclidean", "maximum", "manhattan"), ...) { resType <- match.arg(resType) ## checking if object has a corSpatial element csT <- object$modelStruct$corStruct wchRows <- NULL if (missing(distance)) { if (missing(form) && inherits(csT, "corSpatial")) { distance <- getCovariate(csT) # this excludes 1-obs groups grps <- getGroups(object) } else { metric <- match.arg(metric) if (missing(data)) { data <- getData(object) } if (is.null(data)) { # will try to construct allV <- all.vars(form) if (length(allV) > 0L) { alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } } grpsF <- getGroupsFormula(form) grps <- NULL if (is.null(grpsF) || is.null(grps <- getGroups(data, grpsF))) { ## try to get from object grps <- getGroups(object) } covForm <- getCovariateFormula(form) covar <- if (length(all.vars(covForm)) > 0L) { if (attr(terms(covForm), "intercept") == 1L) { covForm <- eval(substitute(~ CV - 1, list(CV = covForm[[2]]))) } covar <- model.frame(covForm, data, na.action = na.action) ## making sure grps is consistent wchRows <- !is.na(match(row.names(data), row.names(covar))) if (!is.null(grps)) { grps <- grps[wchRows, drop = TRUE] } as.data.frame(unclass(model.matrix(covForm, covar))) } else if (is.null(grps)) 1:nrow(data) else data.frame(dist = unlist(tapply(rep(1, nrow(data)), grps, cumsum))) distance <- if (is.null(grps)) dist(as.matrix(covar), method = metric) else { covar <- split(covar, grps) ## getting rid of 1-observation groups covar <- covar[sapply(covar, function(el) nrow(as.matrix(el))) > 1] lapply(covar, function(el, metric) dist(as.matrix(el), method=metric), metric = metric) } } } res <- resid(object, type = resType) if (!is.null(wchRows)) { res <- res[wchRows] } if (is.null(grps)) { val <- Variogram(res, distance) } else { res <- split(res, grps) res <- res[lengths(res) > 1L] # no 1-observation groups levGrps <- levels(grps) val <- structure(vector("list", length(levGrps)), names = levGrps) for(i in levGrps) { val[[i]] <- Variogram(res[[i]], distance[[i]]) } val <- do.call(rbind, val) } if (!missing(maxDist)) { val <- val[val$dist <= maxDist, ] } collapse <- match.arg(collapse) if (collapse != "none") { # will collapse values dst <- val$dist udist <- sort(unique(dst)) ludist <- length(udist) if (!missing(breaks)) { if (min(breaks) > udist[1L]) { breaks <- c(udist[1L], breaks) } if (max(breaks) < udist[2L]) { breaks <- c(breaks, udist[2L]) } if (!missing(nint) && nint != (length(breaks) - 1L)) { stop("'nint' is not consistent with 'breaks'") } nint <- length(breaks) - 1L } if (nint < ludist) { if (missing(breaks)) { if (collapse == "quantiles") { # break into equal groups breaks <- unique(quantile(dst, seq(0, 1, 1/nint))) } else { # fixed length intervals breaks <- seq(udist[1L], udist[length(udist)], length = nint + 1) } } cutDist <- cut(dst, breaks) } else { cutDist <- dst } val <- lapply(split(val, cutDist), function(el, robust) { nh <- nrow(el) vrg <- el$variog if (robust) { vrg <- ((mean(vrg^0.25))^4)/(0.457+0.494/nh) } else { vrg <- mean(vrg) } dst <- median(el$dist) data.frame(variog = vrg, dist = dst) }, robust = robust) val <- do.call(rbind, as.list(val)) val$n.pairs <- unclass(table(na.omit(cutDist))) } row.names(val) <- 1:nrow(val) if (inherits(csT, "corSpatial") && resType != "normalized") { ## will keep model variogram sig2 <- if (resType == "pearson") 1 else object$sigma^2 attr(val, "modelVariog") <- Variogram(csT, sig2 = sig2, length.out = length.out) } structure(val, collapse = collapse != "none", class = c("Variogram", "data.frame")) } ###*### glsStruct - a model structure for gls fits glsStruct <- ## constructor for glsStruct objects function(corStruct = NULL, varStruct = NULL) { val <- list(corStruct = corStruct, varStruct = varStruct) val <- val[!vapply(val, is.null, NA)] # removing NULL components class(val) <- c("glsStruct", "modelStruct") val } ##*## glsStruct methods for standard generics fitted.glsStruct <- function(object, glsFit = attr(object, "glsFit"), ...) { glsFit[["fitted"]] } Initialize.glsStruct <- function(object, data, control = list(singular.ok = FALSE), ...) { if (length(object)) { object[] <- lapply(object, Initialize, data) theta <- lapply(object, coef) len <- lengths(theta) num <- seq_along(len) pmap <- if (sum(len) > 0) outer(rep(num, len), num, "==") else array(FALSE, c(1, length(len))) dimnames(pmap) <- list(NULL, names(object)) attr(object, "pmap") <- pmap attr(object, "glsFit") <- glsEstimate(object, control = control) if (needUpdate(object)) { object <- update(object, data) } } object } logLik.glsStruct <- function(object, Pars, conLin = attr(object, "conLin"), ...) { coef(object) <- Pars # updating parameter values conLin <- recalc(object, conLin) # updating conLin val <- .C(gls_loglik, as.double(conLin[["Xy"]]), as.integer(unlist(conLin[["dims"]])), logLik = as.double(conLin[["logLik"]]), ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions double(1L), as.double(conLin$sigma), NAOK = TRUE) val[["logLik"]] } residuals.glsStruct <- function(object, glsFit = attr(object, "glsFit"), ...) { glsFit[["resid"]] } varWeights.glsStruct <- function(object) { if (is.null(object$varStruct)) rep(1, attr(object, "conLin")$dims$N) else varWeights(object$varStruct) } ## Auxiliary control functions glsControl <- ## Control parameters for gls function(maxIter = 50L, msMaxIter = 200L, tolerance = 1e-6, msTol = 1e-7, msVerbose = FALSE, singular.ok = FALSE, returnObject = FALSE, apVar = TRUE, .relStep = .Machine$double.eps^(1/3), opt = c("nlminb", "optim"), optimMethod = "BFGS", minAbsParApVar = 0.05, natural = TRUE, sigma = NULL) { ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions if(is.null(sigma)) sigma <- 0 else { if(!is.finite(sigma) || length(sigma) != 1 || sigma < 0) stop("Within-group std. dev. must be a positive numeric value") ## if(missing(apVar)) apVar <- FALSE # not yet implemented } list(maxIter = maxIter, msMaxIter = msMaxIter, tolerance = tolerance, msTol = msTol, msVerbose = msVerbose, singular.ok = singular.ok, returnObject = returnObject, apVar = apVar, minAbsParApVar = minAbsParApVar, .relStep = .relStep, opt = match.arg(opt), optimMethod = optimMethod, natural = natural, sigma = sigma) } nlme/R/varFunc.R0000644000176000001440000012741114630076362013202 0ustar ripleyusers### Classes of variance functions ### ### Copyright 2007-2024 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # ##*## Generics that should be implemented for any varFunc class varWeights <- ## Calculates the weights of the variance function function(object) UseMethod("varWeights") ##*## varFunc - a virtual class of variance functions ###*# Constructor varFunc <- ## Can take as argument either a varFunc object, in which case it does ## nothing, a formula or a character string , in which case it ## calls varFixed function(object) { if(is.null(object)) return(object) # NULL object - no varFunc structure if (inherits(object, "varFunc")) { ## constructing from another varFunc object return(object) } if (inherits(object, "formula") || is.character(object)) { ## constructing from a formula of the form ~ x return(varFixed(asOneSidedFormula(object))) } stop("can only construct \"varFunc\" object from another \"varFunc\" object, a formula, or a character string") } ###*# Methods for local generics varWeights.varFunc <- function(object) attr(object, "weights") ###*# Methods for standard generics coef.varFunc <- function(object, unconstrained = TRUE, allCoef = FALSE, ...) { ### checking if initialized wPar <- attr(object, "whichFix") if (is.null(wPar) || (length(object) != (length(wPar) - sum(wPar)))) { stop("cannot extract parameters of uninitialized object") } if (unconstrained) { if (allCoef) { val <- double(length(wPar)) if (any(wPar)) { val[wPar] <- attr(object, "fixed") } if (any(!wPar)) { val[!wPar] <- as.vector(object) } } else { val <- as.vector(object) } val } else { stop(gettextf("do not know how to get coefficients for %s object", dQuote(class(object)[1])), domain = NA) } } "covariate<-.varFunc" <- function(object, value) { value <- as.numeric(value) if (!is.null(aux <- getCovariate(object))) { if (length(aux) != length(value)) { stop("cannot change the length of covariate in \"varFunc\" object") } } attr(object, "covariate") <- value object } formula.varFunc <- function(x, ...) eval(attr(x, "formula")) getCovariate.varFunc <- function(object, form, data) attr(object, "covariate") getGroups.varFunc <- function(object, form, level, data, sep) attr(object, "groups") Initialize.varFunc <- function(object, data, ...) { if (is.null(varWeights(object))) { attr(object, "weights") <- rep(1, dim(data)[1]) } if (is.null(logLik(object))) { attr(object, "logLik") <- 0 } object } ## NB no nobs logLik.varFunc <- function(object, data, ...) { if (is.null(ll <- attr(object, "logLik"))) ll else structure(ll, df = length(object), class = "logLik") } print.summary.varFunc <- function(x, header = TRUE, ...) { ox <- x class(x) <- attr(x, "oClass") if (length(aux <- coef(x, unconstrained = FALSE, allCoef = TRUE)) > 0) { if (header) cat("Variance function:\n") cat(paste(" Structure: ", attr(x, "structName"), "\n", sep = "")) cat(paste(" Formula:", deparse(formula(x)),"\n")) cat(" Parameter estimates:\n") print(aux) } else { if (inherits(x, "varIdent")) { ## varIdent with no parameters - nothing to print return() } cat("Variance function structure of class", class(x)[1], "with no parameters, or uninitialized\n") } invisible(ox) } print.varFunc <- function(x, ...) { if (length(aux <- coef(x, unconstrained = FALSE, allCoef = TRUE)) > 0) { cat("Variance function structure of class", class(x)[1], "representing\n") print(aux, ...) } else { cat("Variance function structure of class", class(x)[1], "with no parameters, or uninitialized\n") } invisible(x) } recalc.varFunc <- function(object, conLin, ...) { conLin$Xy[] <- conLin$Xy * varWeights(object) conLin$logLik <- conLin$logLik + logLik(object) conLin } summary.varFunc <- function(object, structName = class(object)[1], ...) { attr(object, "structName") <- structName attr(object, "oClass") <- class(object) class(object) <- "summary.varFunc" object } update.varFunc <- function(object, data, ...) { if (needUpdate(object)) { covariate(object) <- eval(getCovariateFormula(object)[[2]], data) } object } ##*## Classes that substitute for (i.e. inherit from) varFunc ###*# varFixed - fixed weights ####* Constructor varFixed <- function(value = ~ 1) { if (!inherits(value, "formula")) { stop("'value' must be a one sided formula") } form <- asOneSidedFormula(value) if (length(all.vars(getCovariateFormula(form))) == 0) { stop("'form' must have a covariate") } if (!is.null(getGroupsFormula(form))) { form <- getCovariateFormula(form) warning("ignoring 'group' in \"varFixed\" formula") } value <- numeric(0) attr(value, "formula") <- form class(value) <- c("varFixed", "varFunc") value } ###*# Methods for standard generics coef.varFixed <- function(object, ...) numeric(0) "coef<-.varFixed" <- function(object, ..., value) object Initialize.varFixed <- function(object, data, ...) { form <- formula(object) if (anyNA(match(all.vars(form), names(data)))) { ## cannot evaluate covariate on data stop("all variables used in 'formula' must be in 'data'") } attr(object, "needUpdate") <- FALSE attr(object, "covariate") <- getCovariate(data, form) attr(object, "logLik") <- sum(log(attr(object, "weights") <- 1/sqrt(abs(attr(object,"covariate"))))) object } print.summary.varFixed <- function(x, header = TRUE, ...) { cat("Variance function:\n") cat(" Structure: fixed weights\n") cat(paste(" Formula:", deparse(formula(x)),"\n")) invisible(x) } summary.varFixed <- function(object, structName, ...) { class(object) <- "summary.varFixed" object } ###*# varIdent - equal variances per stratum structure ####* Constructor varIdent <- function(value = numeric(0), form = ~ 1, fixed = NULL) { if (is.null(getGroupsFormula(form))) { # constant value if (length(value)) # possibly called as varIdent(~1|g) warning("ignoring initial values (no grouping factor)") value <- numeric(0) attr(value, "fixed") <- NULL # nothing to estimate } else { if ((lv <- length(value)) > 0) { # initialized if (is.null(grpNames <- names(value)) && (lv > 1)) { stop("initial values must have group names in 'varIdent'") } value <- unlist(value) # may be a list with names if (any(value <= 0)) { stop("initial values for 'varIdent' must be > 0") } value <- log(value) # unconstrained form } else grpNames <- NULL attr(value, "groupNames") <- grpNames if (!is.null(fixed)) { fix <- attr(value, "fixed") <- log(unlist(fixed)) if (is.null(fixNames <- names(fix))) { stop("fixed parameters must have names in 'varIdent'") } if (!is.null(attr(value, "groupNames"))) { attr(value, "groupNames") <- c(attr(value, "groupNames"), fixNames) } } } attr(value, "formula") <- asOneSidedFormula(form) class(value) <- c("varIdent", "varFunc") value } ###*# Methods for standard generics coef.varIdent <- function(object, unconstrained = TRUE, allCoef = FALSE, ...) { if (!is.null(getGroupsFormula(object)) && !is.null( wPar <- attr(object, "whichFix"))) { ## different groups variances if (unconstrained && !allCoef) { return(as.vector(object)) } val <- double(length(wPar)) if (any(wPar)) { val[wPar] <- attr(object, "fixed") } if (any(!wPar)) { val[!wPar] <- as.vector(object) } if (!unconstrained) { val <- c(1, exp(val)) names(val) <- attr(object, "groupNames") if (!allCoef) { val <- val[c(FALSE, !attr(object, "whichFix"))] } } val } else { numeric(0) } } "coef<-.varIdent" <- function(object, ..., value) { if (!(is.null(grps <- getGroups(object)) || all(attr(object, "whichFix")))) { ## different group variances & varying parameters value <- as.numeric(value) nGroups <- length(attr(object, "groupNames")) # if (nGroups == 0) { # stop("Cannot assign parameters of uninitialized varIdent object") # } ## fix from PR#9831 nFixed <- sum(as.numeric(attr(object,"whichFix"))) if (length(value) != nGroups - nFixed - 1) { stop("cannot change the length of the \"varIdent\" parameter after initialization") } object[] <- value natPar <- coef(object, FALSE, allCoef = TRUE) attr(object, "logLik") <- sum(log(attr(object, "weights") <- 1/natPar[grps])) } object } Initialize.varIdent <- function(object, data, ...) { if (!is.null(form <- formula(object)) && !is.null(grpForm <- getGroupsFormula(form))) { if (length(coef(object)) > 0) { # initialized - nothing to do return(object) } strat <- attr(object, "groups") <- as.character(getGroups(data, form, level = length(splitFormula(grpForm, sep = "*")), sep = "*")) if (length((uStrat <- unique(strat))) == 1) { ## equal variances structure return(Initialize(varIdent(), data)) } if (!is.null(fix <- attr(object, "fixed"))) { fixNames <- names(fix) if (anyNA(match(fixNames, uStrat))) { stop("fixed parameter names in 'varIdent' must be a subset of group names") } uStratVar <- uStrat[is.na(match(uStrat, fixNames))] # varying strata uStrat <- c(uStratVar, fixNames) } else { # nothing fixed uStratVar <- uStrat } if ((nStratVar <- length(uStratVar)) == 0) { stop("cannot fix variances in all groups") } if (nStratVar > 1) { if (length(object) <= 1) { ## repeat for all groups oldAttr <- attributes(object) if (length(object) > 0) { # initialized object <- rep(as.vector(object), nStratVar - 1) } else { # uninitialized object <- rep(0, nStratVar - 1) } attributes(object) <- oldAttr attr(object, "groupNames") <- uStrat } else { if (length(as.vector(object)) != (len <- (nStratVar - 1))) { stop(gettextf("initial value for \"varIdent\" should be of length %d", len), domain = NA) } if (!is.null(stN <- attr(object, "groupNames"))) { missStrat <- uStrat[is.na(match(uStrat, stN))] if (length(missStrat) != 1) { stop("names of starting value for \"varIdent\" object must contain all but one of the stratum levels") } stN <- c(missStrat, stN) if ((length(stN) != length(uStrat)) || any(sort(stN) != sort(uStrat))) { stop("nonexistent group names for initial values in 'varIdent'") } attr(object, "groupNames") <- stN } else { attr(object, "groupNames") <- uStrat } } } else { # fixed for all but one strata oldAttr <- attributes(object) object <- numeric(0) attributes(object) <- oldAttr attr(object, "groupNames") <- uStrat } attr(object, "whichFix") <- !is.na(match(attr(object, "groupNames")[-1], names(fix))) if (all(attr(object, "whichFix"))) { if (all(attr(object, "fixed") == 0)) { ## equal variances structure return(Initialize(varIdent(), data)) } else { oldAttr <- attributes(object) object <- numeric(0) attributes(object) <- oldAttr } } ## initializing weights and logDet attr(object, "logLik") <- sum(log(attr(object, "weights") <- 1/coef(object, FALSE, allCoef = TRUE)[strat])) object } else { # no strata attr(object, "whichFix") <- TRUE NextMethod() } } needUpdate.varIdent <- function(object) FALSE recalc.varIdent <- function(object, conLin, ...) { if (is.null(formula(object))) conLin else NextMethod() } summary.varIdent <- function(object, structName = if (is.null(getGroupsFormula(object))) "Constant variance" else "Different standard deviations per stratum", ...) { summary.varFunc(object, structName) } ###*# varPower - power of variance covariate variance structure ####* Constructor varPower <- function(value = numeric(0), form = ~ fitted(.), fixed = NULL) { value <- unlist(value) # may be given as a list fixed <- attr(value, "fixed") <- unlist(fixed) attr(value, "formula") <- form <- asOneSidedFormula(form) if (length(all.vars(getCovariateFormula(form))) == 0) { stop("'form' must have a covariate") } if (!is.null(getGroupsFormula(form))) { if (is.null(grpNames <- names(value)) && (length(value) > 1)) { stop("initial values must have group names in 'varPower'") } if (!is.null(fixed)) { if (is.null(names(fixed))) { stop("fixed parameters must have group names in 'varPower'") } } attr(value, "groupNames") <- c(grpNames, names(fixed)) } else { # single parameter attr(value, "whichFix") <- !is.null(fixed) } class(value) <- c("varPower", "varFunc") value } ###*# Methods for standard generics coef.varPower <- function(object, unconstrained = TRUE, allCoef = FALSE, ...) { if (((length(object) == 0) && (!allCoef || is.null(attr(object, "fixed")))) || is.null(wPar <- attr(object, "whichFix"))) { ## uninitialized return(numeric(0)) } val <- double(length(wPar)) if (any(wPar)) { val[wPar] <- attr(object, "fixed") } if (any(!wPar)) { val[!wPar] <- as.vector(object) } if (!is.null(getGroupsFormula(object))) { ##different values per group names(val) <- attr(object, "groupNames") } else { names(val) <- "power" } if (!allCoef) { val <- val[!wPar] } val } "coef<-.varPower" <- function(object, ..., value) { if ((len <- length(object)) > 0) { # varying parameters value <- as.numeric(value) if (length(value) != len) { stop("cannot change the length of the \"varStruct\" parameter after initialization") } object[] <- value aux <- coef(object, FALSE, allCoef = TRUE) if (!is.null(grps <- getGroups(object))) { aux <- aux[grps] } covariateObj <- getCovariate(object) if(is.null(covariateObj)) covariateObj <- NA attr(object, "logLik") <- sum(log(attr(object, "weights") <- abs(covariateObj)^(-aux))) } else { stop("cannot change coefficients before initialization or when all parameters are fixed") } object } Initialize.varPower <- function(object, data, ...) { form <- formula(object) if (all(!is.na(match(all.vars(getCovariateFormula(form)), names(data))))) { ## can evaluate covariate on data attr(object, "needUpdate") <- FALSE attr(object, "covariate") <- getCovariate(data, form) } else { attr(object, "needUpdate") <- TRUE } if (!is.null(grpForm <- getGroupsFormula(form))) { strat <- as.character(getGroups(data, form, level = length(splitFormula(grpForm, sep = "*")), sep = "*")) uStrat <- unique(strat) if (length(uStrat) > 1) { # multi-groups attr(object, "groups") <- strat if (!is.null(attr(object, "fixed"))) { fixNames <- names(attr(object, "fixed")) if (is.null(fixNames)) { stop("fixed parameters must have group names") } if (anyNA(match(fixNames, uStrat))) { stop("mismatch between group names and fixed values names") } } else { fixNames <- NULL } uStratVar <- uStrat[is.na(match(uStrat, fixNames))] nStratVar <- length(uStratVar) attr(object, "whichFix") <- !is.na(match(uStrat, fixNames)) if (nStratVar > 0) { if (length(object) <= 1) { ## repeat for all groups names(object) <- NULL oldAttr <- attributes(object) if (length(object) > 0) { object <- rep(as.vector(object), nStratVar) } else { object <- rep(0, nStratVar) } attributes(object) <- oldAttr attr(object, "groupNames") <- uStrat names(object) <- uStratVar } else { if (length(as.vector(object)) != nStratVar) { stop(gettextf("initial value for \"varPower\" should be of length %d", nStratVar), domain = NA) } stN <- attr(object, "groupNames") # must have names if (length(stN) != length(uStrat) || any(sort(stN) != sort(uStrat))) { stop("nonexistent group names for initial values in \"varPower\"") } } } else { # all parameters are fixed if (all(attr(object, "fixed") == 0)) { ## equal variances structure return(Initialize(varIdent(), data)) } else { oldAttr <- attributes(object) object <- numeric(0) attributes(object) <- oldAttr attr(object, "groupNames") <- uStrat } } } else { # single stratum attr(object, "formula") <- getCovariateFormula(formula(object)) attr(object, "whichFix") <- !is.null(attr(object, "fixed")) } } if (is.null(getGroupsFormula(object))) { ## single stratum if (attr(object, "whichFix")) { if (attr(object, "fixed") == 0) { ## equal variances structure return(Initialize(varIdent(), data)) } else { # fixed power oldAttr <- attributes(object) object <- numeric(0) attributes(object) <- oldAttr } } else { len <- length(as.vector(object)) if (len == 0) { # uninitialized oldAttr <- attributes(object) object <- 0 attributes(object) <- oldAttr } else if (len > 1) { stop("initial value for \"varPower\" should be of length 1") } } } if (!is.null(covar <- getCovariate(object))) { natPar <- coef(object, allCoef = TRUE) if (!is.null(grps <- getGroups(object))) { natPar <- natPar[grps] } attr(object, "logLik") <- sum(log(attr(object, "weights") <- abs(covar^(-natPar)))) object } else { NextMethod() } } summary.varPower <- function(object, structName = "Power of variance covariate", ...) { if (!is.null(getGroupsFormula(object))) { structName <- paste(structName, " different strata", sep = ",") } summary.varFunc(object, structName) } update.varPower <- function(object, data, ...) { val <- NextMethod() if (length(val) == 0) { # chance to update weights aux <- coef(val, allCoef = TRUE) if (!is.null(grps <- getGroups(val))) { aux <- aux[grps] } attr(val, "logLik") <- sum(log(attr(val, "weights") <- abs(getCovariate(val))^(-aux))) } val } ###*# varExp - exponential of variance covariate variance structure ####* Constructor varExp <- function(value = numeric(0), form = ~ fitted(.), fixed = NULL) { value <- unlist(value) # may be given as a list fixed <- attr(value, "fixed") <- unlist(fixed) attr(value, "formula") <- form <- asOneSidedFormula(form) if (length(all.vars(getCovariateFormula(form))) == 0) { stop("'form' must have a covariate") } if (!is.null(getGroupsFormula(form))) { if (is.null(grpNames <- names(value)) && (length(value) > 1)) { stop("initial values must have group names in 'varExp'") } if (!is.null(fixed)) { if (is.null(names(fixed))) { stop("fixed parameters must have group names in 'varExp'") } } attr(value, "groupNames") <- c(grpNames, names(fixed)) } else { attr(value, "whichFix") <- !is.null(fixed) } class(value) <- c("varExp", "varFunc") value } ###*# Methods for standard generics coef.varExp <- function(object, unconstrained = TRUE, allCoef = FALSE, ...) { if (((length(object) == 0) && (!allCoef || is.null(attr(object, "fixed")))) || is.null( wPar <- attr(object, "whichFix"))) { return(numeric(0)) } val <- double(length(wPar)) if (any(wPar)) { val[wPar] <- attr(object, "fixed") } if (any(!wPar)) { val[!wPar] <- as.vector(object) } if (!is.null(getGroupsFormula(object))) { ##different values per group names(val) <- attr(object, "groupNames") } else { names(val) <- "expon" } if (!allCoef) { val <- val[!wPar] } val } "coef<-.varExp" <- function(object, ..., value) { if (length(object) > 0) { # varying parameters value <- as.numeric(value) if (length(value) != length(object)) { stop("cannot change the length of the \"varExp\" parameter after initialization") } object[] <- value aux <- coef(object, FALSE, allCoef = TRUE) if (!is.null(grps <- getGroups(object))) { aux <- aux[grps] } attr(object, "logLik") <- sum(log(attr(object, "weights") <- exp(-aux * getCovariate(object)))) } else { stop("cannot change coefficients before initialization or when all parameters are fixed") } object } Initialize.varExp <- function(object, data, ...) { form <- formula(object) if (all(!is.na(match(all.vars(getCovariateFormula(form)), names(data))))) { ## can evaluate covariate on data attr(object, "needUpdate") <- FALSE attr(object, "covariate") <- getCovariate(data, form) } else { attr(object, "needUpdate") <- TRUE } if (!is.null(grpForm <- getGroupsFormula(form))) { strat <- as.character(getGroups(data, form, level = length(splitFormula(grpForm, sep = "*")), sep = "*")) uStrat <- unique(strat) if (length(uStrat) > 1) { # multi-groups attr(object, "groups") <- strat if (!is.null(attr(object, "fixed"))) { fixNames <- names(attr(object, "fixed")) if (is.null(fixNames)) { stop("fixed parameters must have group names") } if (anyNA(match(fixNames, uStrat))) { stop("mismatch between group names and fixed values names") } } else { fixNames <- NULL } uStratVar <- uStrat[is.na(match(uStrat, fixNames))] nStratVar <- length(uStratVar) attr(object, "whichFix") <- !is.na(match(uStrat, fixNames)) if (nStratVar > 0) { if (length(object) <= 1) { ## repeat for all groups names(object) <- NULL oldAttr <- attributes(object) if (length(object) > 0) { object <- rep(as.vector(object), nStratVar) } else { object <- rep(0, nStratVar) } attributes(object) <- oldAttr attr(object, "groupNames") <- uStrat names(object) <- uStratVar } else { if (length(as.vector(object)) != nStratVar) { stop(gettextf("initial value for \"varExp\" should be of length %d", nStratVar), domain = NA) } stN <- attr(object, "groupNames") #must have names if ((length(stN) != length(uStrat)) || any(sort(stN) != sort(uStrat))) { stop("nonexistent group names for initial values in \"varExp\"") } } } else { if (all(attr(object, "fixed") == 0)) { ## equal variances structure return(Initialize(varIdent(), data)) } else { oldAttr <- attributes(object) object <- numeric(0) attributes(object) <- oldAttr attr(object, "groupNames") <- uStrat } } } else { # single stratum attr(object, "formula") <- getCovariateFormula(formula(object)) attr(object, "whichFix") <- !is.null(attr(object, "fixed")) } } if (is.null(getGroupsFormula(object))) { ## single stratum if (attr(object, "whichFix")) { if (!attr(object, "fixed")) { ## equal variances structure return(Initialize(varIdent(), data)) } else { oldAttr <- attributes(object) object <- numeric(0) attributes(object) <- oldAttr } } else { len <- length(as.vector(object)) if (len == 0) { # uninitialized oldAttr <- attributes(object) object <- 0 attributes(object) <- oldAttr } else if (len > 1) { stop("initial value for \"varExp\" should be of length 1") } } } if (!is.null(covar <- getCovariate(object))) { natPar <- coef(object, allCoef = TRUE) if (!is.null(grps <- getGroups(object))) { natPar <- natPar[grps] } attr(object, "logLik") <- sum(log(attr(object, "weights") <- exp(-natPar * covar))) object } else { NextMethod() } } summary.varExp <- function(object, structName = "Exponential of variance covariate", ...) { if (!is.null(getGroupsFormula(object))) { structName <- paste(structName, " different strata", sep = ",") } summary.varFunc(object, structName) } update.varExp <- function(object, data, ...) { val <- NextMethod() if (length(val) == 0) { # chance to update weights aux <- coef(val, allCoef = TRUE) if (!is.null(grps <- getGroups(val))) { aux <- aux[grps] } attr(val, "logLik") <- sum(log(attr(val, "weights") <- exp(-aux * getCovariate(val)))) } val } ###*# varConstPower - Constant plus power of covariance function ###*# variance structure ####* Constructor for the varConstPower class varConstPower <- function(const = numeric(0), power = numeric(0), form = ~ fitted(.), fixed = NULL) { value <- list(const = const, power = power) form <- asOneSidedFormula(form) if (length(all.vars(getCovariateFormula(form))) == 0) stop("'form' must have a covariate") CPconstr <- function(val, form, nam) { if ((lv <- length(val)) == 0) return(val) if (lv > 2) { stop(gettextf("%s can have at most two components", nam), domain = NA) } if (is.null(nv <- names(val))) { names(val) <- c("const", "power")[1:lv] } else { if (anyNA(match(nv, c("const", "power")))) { stop(gettextf("%s can only have names \"const\" and \"power\"", nam), domain = NA) } } nv <- names(val) if (data.class(val) == "list") { val <- lapply(val, unlist) grpNames <- unique(unlist(lapply(val, names))) } else { # must be a vector or a scalar if (!is.numeric(val)) { stop(gettextf("%s can only be a list or numeric", nam), domain = NA) } val <- as.list(val) names(val) <- nv grpNames <- NULL } if (!is.null(getGroupsFormula(form))) { if (any(vapply(val, function(el) length(el) > 1 && is.null(names(el)), NA))) stop(gettextf("%s must have group names in 'varConstPower'", nam), domain = NA) attr(val, "groupNames") <- grpNames } if (length(const <- val$const) > 0) { if (any(const <= 0)) stop("constant in \"varConstProp\" structure must be > 0") const <- log(const) } list(const = const, power = val$power) } ## initial value may be given as a vector or list. If groups are ## present and different initial values are given for each group, then ## it must be a list with components "const" and/or "power" value <- CPconstr(value, form, "Value") fixed <- CPconstr(fixed, form, "Fixed") attr(value, "formula") <- form attr(value, "groupNames") <- unique(c(attr(value, "groupNames"), attr(attr(value[["const"]], "fixed"), "groupNames"), attr(attr(value[["power"]], "fixed"), "groupNames"))) for (i in names(fixed)) { attr(value[[i]], "fixed") <- c(fixed[[i]]) } if (is.null(getGroupsFormula(form))) { # no groups whichFix <- array(FALSE, c(2,1), list(c("const", "power"), NULL)) whichFix[,1] <- vapply(value, function(el) !is.null(attr(el, "fixed")), NA) attr(value, "whichFix") <- whichFix } class(value) <- c("varConstPower", "varFunc") value } ###*# Methods for standard generics coef.varConstPower <- function (object, unconstrained = TRUE, allCoef = FALSE, ...) { wPar <- attr(object, "whichFix") nonInit <- !lengths(object) nonInit <- is.null(wPar) || (any(nonInit) && !all(c(wPar[nonInit, ]))) if (nonInit || (!allCoef && (length(unlist(object)) == 0))) { return(numeric(0)) } val <- array(0, dim(wPar), dimnames(wPar)) for (i in names(object)) { if (any(wPar[i, ])) { val[i, wPar[i, ]] <- attr(object[[i]], "fixed") } if (any(!wPar[i, ])) { val[i, !wPar[i, ]] <- c(object[[i]]) } } if (!unconstrained) { val[1, ] <- exp(val[1, ]) } if (!allCoef) { val <- list(const = if (!all(wPar[1, ])) val[1, !wPar[1, ]], # else NULL power = if (!all(wPar[2, ])) val[2, !wPar[2, ]]) val <- lapply(val, function(el) if(length(el) == 1) as.vector(el) else el) unlist(val[!vapply(val, is.null, NA)]) } else { val[, 1:ncol(val)] } } "coef<-.varConstPower" <- function(object, ..., value) { if (length(unlist(object)) > 0) { # varying parameters value <- as.numeric(value) if (length(value) != length(unlist(object))) { stop("cannot change the length of the parameter after initialization") } start <- 0 for(i in names(object)) { if (aux <- length(object[[i]])) { object[[i]][] <- value[start + (1:aux)] start <- start + aux } } natPar <- as.matrix(coef(object, FALSE, allCoef = TRUE)) if (!is.null(grps <- getGroups(object))) { natPar <- natPar[, grps] } attr(object, "logLik") <- sum(log(attr(object, "weights") <- 1/(natPar[1,] + abs(getCovariate(object))^natPar[2,]))) } else { stop("cannot change coefficients before initialization or when all parameters are fixed") } object } Initialize.varConstPower <- function(object, data, ...) { form <- formula(object) if (all(!is.na(match(all.vars(getCovariateFormula(form)), names(data))))) { ## can evaluate covariate on data attr(object, "needUpdate") <- FALSE attr(object, "covariate") <- getCovariate(data, form) } else { attr(object, "needUpdate") <- TRUE } dfltCoef <- c(const = log(0.1), power = 0) if (!is.null(grpForm <- getGroupsFormula(form))) { strat <- as.character(getGroups(data, form, level = length(splitFormula(grpForm, sep = "*")), sep = "*")) uStrat <- unique(strat) whichFix <- array(FALSE, c(2, length(uStrat)), list(c("const", "power"), uStrat)) if (length(uStrat) > 1) { # multi-groups attr(object, "groups") <- strat for(i in names(object)) { if (!is.null(attr(object[[i]], "fixed"))) { fixNames <- names(attr(object[[i]], "fixed")) if (is.null(fixNames)) { stop("fixed parameters must have group names") } if (anyNA(match(fixNames, uStrat))) { stop("mismatch between group names and fixed values names") } } else { fixNames <- NULL } uStratVar <- uStrat[is.na(match(uStrat, fixNames))] nStratVar <- length(uStratVar) whichFix[i,] <- !is.na(match(uStrat, fixNames)) if (nStratVar > 0) { if (length(object[[i]]) <= 1) { ## repeat for all groups names(object[[i]]) <- NULL oldAttr <- attributes(object[[i]]) if (length(object[[i]]) > 0) { object[[i]] <- rep(as.vector(object[[i]]), nStratVar) } else { object[[i]] <- rep(dfltCoef[i], nStratVar) } attributes(object[[i]]) <- oldAttr names(object[[i]]) <- uStratVar } else { if (length(as.vector(object[[i]])) != nStratVar) { stop(gettext("initial value should be of length %d", nStratVar), domain = NA) } stN <- names(object[[i]]) # must have names if ((length(stN) != length(uStratVar)) || any(sort(stN) != sort(uStratVar))) { stop("nonexistent group names for initial values") } } } } if (all(whichFix) && all(attr(object[["const"]], "fixed") == 0) && all(attr(object[["power"]], "fixed") == 0)) { ## equal variances structure return(Initialize(varIdent(), data)) } for(i in names(object)) { if (all(whichFix[i,])) { oldAttr <- attributes(object[[i]]) object[[i]] <- numeric(0) attributes(object[[i]]) <- oldAttr } } attr(object, "whichFix") <- whichFix attr(object, "groupNames") <- uStrat return(NextMethod()) } } ## single stratum whichFix <- attr(object, "whichFix") if (all(whichFix) && !any(unlist(lapply(object, function(el) attr(el, "fixed"))))) { ## equal variances structure return(Initialize(varIdent(), data)) } for(i in names(object)) { if (all(whichFix[i,])) { oldAttr <- attributes(object[[i]]) object[[i]] <- numeric(0) attributes(object[[i]]) <- oldAttr } else { if (length(object[[i]]) == 0) { object[[i]] <- dfltCoef[i] } } } aux <- 2 - sum(whichFix[,1]) if (length(as.vector(unlist(object))) != aux) { stop(gettext("initial value should be of length %d", aux), domain = NA) } NextMethod() } summary.varConstPower <- function(object, structName = "Constant plus power of variance covariate", ...) { if (!is.null(getGroupsFormula(object))) { structName <- paste(structName, " different strata", sep = ",") } summary.varFunc(object, structName) } update.varConstPower <- function(object, data, ...) { val <- NextMethod() if (length(unlist(val)) == 0) { # chance to update weights aux <- as.matrix(coef(val, FALSE, allCoef = TRUE)) if (!is.null(grps <- getGroups(val))) { aux <- aux[, grps] } attr(val, "logLik") <- sum(log(attr(val, "weights") <- 1/(aux[1,] + abs(getCovariate(val))^aux[2,]))) } val } ## NB "varConstProp" was derived from "varConstPower" with minimal code changes. ###*# varConstProp - constant plus proportional variance function structure ####* Constructor for the "varConstProp" class varConstProp <- function(const = numeric(0), prop = numeric(0), form = ~ fitted(.), fixed = NULL) { value <- list(const = const, prop = prop) form <- asOneSidedFormula(form) if (length(all.vars(getCovariateFormula(form))) == 0) stop("'form' must have a covariate") CPconstr <- function(val, form, nam) { if ((lv <- length(val)) == 0) return(val) if (lv > 2) { stop(gettextf("%s can have at most two components", nam), domain = NA) } if (is.null(nv <- names(val))) { names(val) <- c("const", "prop")[1:lv] } else { if (anyNA(match(nv, c("const", "prop")))) { stop(gettextf("%s can only have names \"const\" and \"prop\"", nam), domain = NA) } } nv <- names(val) if (data.class(val) == "list") { val <- lapply(val, unlist) grpNames <- unique(unlist(lapply(val, names))) } else { # must be a vector or a scalar if (!is.numeric(val)) { stop(gettextf("%s can only be a list or numeric", nam), domain = NA) } val <- as.list(val) names(val) <- nv grpNames <- NULL } if (!is.null(getGroupsFormula(form))) { if (any(vapply(val, function(el) length(el) > 1 && is.null(names(el)), NA))) stop(gettextf("%s must have group names in 'varConstProp'", nam), domain = NA) attr(val, "groupNames") <- grpNames } if (length(const <- val$const) > 0) { if (any(const <= 0)) stop("constant in \"varConstProp\" structure must be > 0") const <- log(const) } list(const = const, prop = val$prop) } ## initial value may be given as a vector or list. If groups are ## present and different initial values are given for each group, then ## it must be a list with components "const" and/or "prop" value <- CPconstr(value, form, "Value") fixed <- CPconstr(fixed, form, "Fixed") attr(value, "formula") <- form attr(value, "groupNames") <- unique(c(attr(value, "groupNames"), attr(attr(value[["const"]], "fixed"), "groupNames"), attr(attr(value[["prop"]], "fixed"), "groupNames"))) for (i in names(fixed)) { attr(value[[i]], "fixed") <- c(fixed[[i]]) } if (is.null(getGroupsFormula(form))) { # no groups whichFix <- array(FALSE, c(2,1), list(c("const", "prop"), NULL)) whichFix[,1] <- vapply(value, function(el) !is.null(attr(el, "fixed")), NA) attr(value, "whichFix") <- whichFix } class(value) <- c("varConstProp", "varFunc") value } ###*# Methods for standard generics coef.varConstProp <- function (object, unconstrained = TRUE, allCoef = FALSE, ...) { wPar <- attr(object, "whichFix") nonInit <- !lengths(object) nonInit <- is.null(wPar) || (any(nonInit) && !all(c(wPar[nonInit, ]))) if (nonInit || (!allCoef && (length(unlist(object)) == 0))) { return(numeric(0)) } val <- array(0, dim(wPar), dimnames(wPar)) for (i in names(object)) { if (any(wPar[i, ])) { val[i, wPar[i, ]] <- attr(object[[i]], "fixed") } if (any(!wPar[i, ])) { val[i, !wPar[i, ]] <- c(object[[i]]) } } if (!unconstrained) { val[1, ] <- exp(val[1, ]) } if (!allCoef) { val <- list(const = if (!all(wPar[1, ])) val[1, !wPar[1, ]], # else NULL prop = if (!all(wPar[2, ])) val[2, !wPar[2, ]]) val <- lapply(val, function(el) if(length(el) == 1L) as.vector(el) else el) unlist(val[!vapply(val, is.null, NA)]) } else { val[, 1:ncol(val)] } } "coef<-.varConstProp" <- function(object, ..., value) { if (length(unlist(object)) > 0) { # varying parameters value <- as.numeric(value) if (length(value) != length(unlist(object))) { stop("cannot change the length of the parameter after initialization") } start <- 0 for(i in names(object)) { if (aux <- length(object[[i]])) { object[[i]][] <- value[start + (1:aux)] start <- start + aux } } natPar <- as.matrix(coef(object, FALSE, allCoef = TRUE)) if (!is.null(grps <- getGroups(object))) { natPar <- natPar[, grps] } attr(object, "logLik") <- sum(log(attr(object, "weights") <- 1/sqrt(natPar[1,]^2 + natPar[2, ]^2 * getCovariate(object)^2))) } else { stop("cannot change coefficients before initialization or when all parameters are fixed") } object } Initialize.varConstProp <- function(object, data, ...) { form <- formula(object) if (all(!is.na(match(all.vars(getCovariateFormula(form)), names(data))))) { ## can evaluate covariate on data attr(object, "needUpdate") <- FALSE attr(object, "covariate") <- getCovariate(data, form) } else { attr(object, "needUpdate") <- TRUE } dfltCoef <- c(const = 0.1, prop = 0.1) if (!is.null(grpForm <- getGroupsFormula(form))) { strat <- as.character(getGroups(data, form, level = length(splitFormula(grpForm, sep = "*")), sep = "*")) uStrat <- unique(strat) whichFix <- array(FALSE, c(2, length(uStrat)), list(c("const", "prop"), uStrat)) if (length(uStrat) > 1) { # multi-groups attr(object, "groups") <- strat for(i in names(object)) { if (!is.null(attr(object[[i]], "fixed"))) { fixNames <- names(attr(object[[i]], "fixed")) if (is.null(fixNames)) { stop("fixed parameters must have group names") } if (anyNA(match(fixNames, uStrat))) { stop("mismatch between group names and fixed values names") } } else { fixNames <- NULL } uStratVar <- uStrat[is.na(match(uStrat, fixNames))] nStratVar <- length(uStratVar) whichFix[i,] <- !is.na(match(uStrat, fixNames)) if (nStratVar > 0) { if (length(object[[i]]) <= 1) { ## repeat for all groups names(object[[i]]) <- NULL oldAttr <- attributes(object[[i]]) if (length(object[[i]]) > 0) { object[[i]] <- rep(as.vector(object[[i]]), nStratVar) } else { object[[i]] <- rep(dfltCoef[i], nStratVar) } attributes(object[[i]]) <- oldAttr names(object[[i]]) <- uStratVar } else { if (length(as.vector(object[[i]])) != nStratVar) { stop(gettext("initial value should be of length %d", nStratVar), domain = NA) } stN <- names(object[[i]]) # must have names if ((length(stN) != length(uStratVar)) || any(sort(stN) != sort(uStratVar))) { stop("nonexistent group names for initial values") } } } } if (all(whichFix) && all(attr(object[["const"]], "fixed") == 0) && all(attr(object[["prop"]], "fixed") == 0)) { ## equal variances structure return(Initialize(varIdent(), data)) } for(i in names(object)) { if (all(whichFix[i,])) { oldAttr <- attributes(object[[i]]) object[[i]] <- numeric(0) attributes(object[[i]]) <- oldAttr } } attr(object, "whichFix") <- whichFix attr(object, "groupNames") <- uStrat return(NextMethod()) } } ## single stratum whichFix <- attr(object, "whichFix") if (all(whichFix) && !any(unlist(lapply(object, function(el) attr(el, "fixed"))))) { ## equal variances structure return(Initialize(varIdent(), data)) } for(i in names(object)) { if (all(whichFix[i,])) { oldAttr <- attributes(object[[i]]) object[[i]] <- numeric(0) attributes(object[[i]]) <- oldAttr } else { if (length(object[[i]]) == 0) { object[[i]] <- dfltCoef[i] } } } aux <- 2 - sum(whichFix[,1]) if (length(as.vector(unlist(object))) != aux) { stop(gettext("initial value should be of length %d", aux), domain = NA) } NextMethod() } summary.varConstProp <- function(object, structName = "Constant plus proportion of variance covariate", ...) { if (!is.null(getGroupsFormula(object))) { structName <- paste(structName, " different strata", sep = ",") } summary.varFunc(object, structName) } update.varConstProp <- function(object, data, ...) { val <- NextMethod() if (length(unlist(val)) == 0) { # chance to update weights aux <- as.matrix(coef(val, FALSE, allCoef = TRUE)) if (!is.null(grps <- getGroups(val))) { aux <- aux[, grps] } attr(val, "logLik") <- sum(log(attr(val, "weights") <- 1/sqrt((aux[1, ]^2 + aux[2, ]^2 * getCovariate(val)^2)))) } val } ###*# varComb - combination of variance function structures ####* Constructor for the "varComb" class varComb <- function(...) { val <- list(...) if (!all(vapply(val, inherits, NA, "varFunc"))) { stop("all arguments to 'varComb' must be of class \"varFunc\".") } if (is.null(names(val))) { names(val) <- LETTERS[seq_along(val)] } class(val) <- c("varComb", "varFunc") val } ####* Methods for local generics varWeights.varComb <- function(object) { apply(as.data.frame(lapply(object, varWeights)), 1, prod) } ###*# Methods for standard generics coef.varComb <- function(object, unconstrained = TRUE, allCoef = FALSE, ...) { unlist(lapply(object, coef, unconstrained, allCoef)) } "coef<-.varComb" <- function(object, ..., value) { plen <- attr(object, "plen") if ((len <- sum(plen)) > 0) { # varying parameters if (length(value) != len) { stop("cannot change parameter length of initialized \"varComb\" object") } start <- 0 for (i in seq_along(object)) { if (plen[i] > 0) { coef(object[[i]]) <- value[start + (1:plen[i])] start <- start + plen[i] } } } object } formula.varComb <- function(x, ...) lapply(x, formula) Initialize.varComb <- function(object, data, ...) { val <- lapply(object, Initialize, data) structure(val, plen = vapply(val, function(el) length(coef(el)), 1L), class = c("varComb", "varFunc")) } logLik.varComb <- function(object, ...) { lls <- lapply(object, logLik) structure(sum(unlist(lls)), df = sum(vapply(lls, attr, 1, "df")), class = "logLik") } needUpdate.varComb <- function(object) any(vapply(object, needUpdate, NA)) print.varComb <- function(x, ...) { cat("Combination of:\n") lapply(x, print) invisible(x) } print.summary.varComb <- function(x, ...) { cat(attr(x, "structName"),"\n") lapply(x, print, FALSE) invisible(x) } summary.varComb <- function(object, structName = "Combination of variance functions:", ...) { object[] <- lapply(object, summary) attr(object, "structName") <- structName class(object) <- c("summary.varComb", class(object)) object } update.varComb <- function(object, data, ...) { object[] <- lapply(object, update, data) object } nlme/R/nlsList.R0000644000176000001440000001427614613731164013231 0ustar ripleyusers### Create a list of nls objects ### ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ### Copyright 2006-2021 The R Core team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # nlsList <- ## A list of nls objects function(model, data, start, control, level, subset, na.action = na.fail, pool = TRUE, warn.nls = NA) # Deprecation: will be 'TRUE' UseMethod("nlsList") nlsList.selfStart <- function (model, data, start, control, level, subset, na.action = na.fail, pool = TRUE, warn.nls = NA) # Deprecation: will be 'TRUE' { mCall <- match.call() if (!inherits(data, "groupedData")) { stop("second argument must be a groupedData object") } marg <- substitute(model) if (mode(marg) != "name") { stop("cannot use an anonymous function for the model") } ## Build up a call to the model function m <- call(as.character(marg)) args <- lapply(names(formals(eval(marg))), as.name) args[[1]] <- getCovariateFormula(data)[[2]] m[1 + seq_along(args)] <- args form <- formula(data) form[[3]][[2]] <- m mCall$model <- form mCall[[1]] <- quote(nlme::nlsList.formula) eval.parent(mCall) } nlsList.formula <- function(model, data, start = NULL, control, level, subset, na.action = na.fail, pool = TRUE, warn.nls = NA) # Deprecation: will be 'TRUE' { if (!missing(level) && length(level) > 1) stop("multiple levels not allowed") ## Deprecation: options(show.error.messages = FALSE) should continue to work for now if(is.na(warn.nls <- as.logical(warn.nls))) warn.nls <- !identical(FALSE, getOption("show.error.messages")) Call <- match.call() if (!missing(subset)) { data <- data[eval(asOneSidedFormula(Call[["subset"]])[[2]], data),, drop = FALSE] } if (!is.data.frame(data)) data <- as.data.frame(data) data <- na.action(data) if (is.null(grpForm <- getGroupsFormula(model))) { if (inherits(data, "groupedData")) { if (missing(level)) level <- length(getGroupsFormula(data, asList = TRUE)) groups <- getGroups(data, level = level)[drop = TRUE] grpForm <- getGroupsFormula(data) } else { stop("'data' must be a \"groupedData\" object if 'formula' does not include groups") } } else { if (missing(level)) level <- length(getGroupsFormula(model, asList = TRUE)) model <- eval(substitute(Y ~ RHS, list(Y = model[[2]], RHS= getCovariateFormula(model)[[2]]))) groups <- getGroups(data, form = grpForm, level = level)[drop = TRUE] } if (is.null(start) && is.null(attr(data, "parameters"))) { ## no starting values ## checking for old-style selfStart functions FUN <- eval(model[[3]][[1]]) if (is.function(FUN) && !inherits(FUN, "selfStart") && !is.null(attr(FUN, "initial"))) { stop("old-style self-starting model functions\nare no longer supported.\nNew selfStart functions are available.\nUse\n SSfpl instead of fpl,\n SSfol instead of first.order.log,\n SSbiexp instead of biexp,\n SSlogis instead of logistic.\nIf writing your own selfStart model, see\n \"help(selfStart)\"\nfor the new form of the \"initial\" attribute.") } } controlvals <- nls.control() if(!missing(control)) controlvals[names(control)] <- control val <- lapply(split(data, groups), function(dat) tryCatch({ data <- as.data.frame(dat) if (is.null(start)) { nls(model, data = data, control = controlvals) } else { nls(model, data = data, control = controlvals, start = start) } }, error = function(e) e)) val <- warnErrList(val, warn = warn.nls) if (inherits(data, "groupedData")) { ## saving labels and units for plots attr(val, "units") <- attr(data, "units") attr(val, "labels") <- attr(data, "labels") attr(val, "outer") <- attr(data, "outer") } structure(val, class = c("nlsList", "lmList"), call = Call, dims = list(N = nrow(data), M = length(val)), groups = ordered(groups, levels = names(val)), origOrder = match(unique(as.character(groups)), names(val)), pool = pool, groupsForm = grpForm) } ###*# Methods for standard generics coef.summary.nlsList <- function(object, ...) object$parameters formula.nlsList <- function(x, ...) eval(attr(x, "call")[["model"]]) # flaky if model is a name summary.nlsList <- function(object, ...) { val <- NextMethod("summary") # -> summary.lmList() class(val) <- c("summary.nlsList", class(val)) val } update.nlsList <- function (object, model., ..., evaluate = TRUE) { call <- attr(object, "call") if (is.null(call)) stop("missing call attribute in \"nlsList\" object") extras <- match.call(expand.dots = FALSE)$... if (!missing(model.)) call$model <- update.formula(formula(object), model.) if(length(extras) > 0) { existing <- !is.na(match(names(extras), names(call))) ## do these individually to allow NULL to remove entries. for (a in names(extras)[existing]) call[[a]] <- extras[[a]] if(any(!existing)) { call <- c(as.list(call), extras[!existing]) call <- as.call(call) } } if(evaluate) eval(call, parent.frame()) else call } #update.nlsList <- # function(object, model, data, start, control, level, subset, na.action, # pool, ...) #{ # thisCall <- as.list(match.call())[-(1:2)] # if (!missing(model)) { # names(thisCall)[match(names(thisCall), "model")] <- "object" # } # nextCall <- as.list(attr(object, "call")[-1]) # nextCall[names(thisCall)] <- thisCall # do.call("nlsList", nextCall) #} nlme/R/simulate.R0000644000176000001440000004456714251721455013432 0ustar ripleyusers### Fit a general linear mixed effects model ### ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ### Copyright 2006-2022 The R Core team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # createConLin <- function(fixed, data = sys.frame(sys.parent()), random = pdSymm(eval(as.call(fixed[-2]))), ...) { if(!inherits(fixed, "formula") || length(fixed) != 3) stop("\nfixed-effects model must be a formula of the form \"resp ~ pred\"") REML <- FALSE reSt <- reStruct(random, REML = REML, data = NULL) groups <- getGroupsFormula(reSt) if(is.null(groups)) { if(inherits(data, "groupedData")) { groups <- getGroupsFormula(data) groupsL <- rev(getGroupsFormula(data, asList = TRUE)) Q <- length(groupsL) if(length(reSt) != Q) { # may need to repeat reSt if(length(reSt) != 1) { stop("incompatible lengths for 'random' and grouping factors") } auxForm <- eval(parse(text = paste("~", deparse(formula(random)[[2]]), "|", deparse(groups[[2]])))) reSt <- reStruct(auxForm, REML = REML, data = NULL) } else { names(reSt) <- names(groupsL) } } else { stop("'data' must inherit from \"groupedData\" class if 'random' does not define groups") } } ## create an lme structure containing the random effects model lmeSt <- lmeStruct(reStruct = reSt) ## extract a data frame with enough information to evaluate ## fixed, groups, reStruct, corStruct, and varStruct dataMix <- model.frame(formula = asOneFormula(formula(lmeSt), fixed, groups), data = data, drop.unused.levels = TRUE) origOrder <- row.names(dataMix) # preserve the original order ## sort the model.frame by groups and get the matrices and parameters ## used in the estimation procedures grps <- getGroups(dataMix, eval(parse(text = paste("~1", deparse(groups[[2]]), sep = "|")))) ## ordering data by groups if(inherits(grps, "factor")) { # single level ##"order" treats a single named argument peculiarly so must split this off ord <- order(grps) grps <- data.frame(grps) row.names(grps) <- origOrder names(grps) <- as.character(deparse((groups[[2]]))) } else { ord <- do.call(order, grps) ## making group levels unique for(i in 2:ncol(grps)) { grps[, i] <- as.factor(paste(as.character(grps[, i - 1]), as.character(grps[, i ]), sep = "/")) } } grps <- grps[ord, , drop = FALSE] dataMix <- dataMix[ord, , drop = FALSE] ## revOrder <- match(origOrder, row.names(dataMix)) # putting in orig. order ## obtaining basic model matrices N <- nrow(grps) Z <- model.matrix(reSt, dataMix) ncols <- attr(Z, "ncols") Names(lmeSt$reStruct) <- attr(Z, "nams") ## keeping the contrasts for later use in predict contr <- attr(Z, "contr") X <- model.frame(fixed, dataMix) auxContr <- lapply(X, function(el) if(inherits(el, "factor")) contrasts(el)) contr <- c(contr, auxContr[is.na(match(names(auxContr), names(contr)))]) contr <- contr[!vapply(contr, is.null, NA)] X <- model.matrix(fixed, X) y <- eval(fixed[[2]], dataMix) ncols <- c(ncols, dim(X)[2], 1) ## Q <- ncol(grps) ## creating the condensed linear model : list(Xy = array(c(Z, X, y), c(N, sum(ncols)), list(row.names(dataMix), c(colnames(Z), colnames(X), deparse(fixed[[2]])))), dims = MEdims(grps, ncols), logLik = 0, sigma = 0) # <- no "fixed Sigma" yet } simulate.lme <- function(object, nsim = 1, seed = as.integer(runif(1, 0, .Machine$integer.max)), m2, method = c("REML", "ML"), niterEM = c(40, 200), useGen, ...) { ## object is a list of arguments to lme, or an lme object from which the ## call is extracted, to define the null model ## m2 is an option list of arguments to lme to define the feared model if (inherits(nsim, "lm") || inherits(nsim, "lme")) stop("order of arguments in 'simulate.lme' has changed to conform with generic in R-2.2.0", domain = NA) ### FIXME? if(!ALT) behave like a regular simulate() method --> return 'base2' (see below) getResults1 <- function(conLin, nIter, pdClass, REML, ssq, p, pp1) { unlist(.C(mixed_combined, as.double(conLin$Xy), as.integer(unlist(conLin$dims)), double(ssq), as.integer(nIter), as.integer(pdClass), as.integer(REML), logLik = double(1), R0 = double(pp1), lRSS = double(1), info = integer(1), # msg from optif9: <0 = error, 0 = OK sigma = as.double(conLin$sigma))[c("info", "logLik")]) } getResults2 <- function(conLin, reSt, REML, control) { lmeSt <- lmeStruct(reStruct = reStruct(reSt, REML = REML)) attr(lmeSt, "conLin") <- conLin lmeSt <- Initialize(lmeSt, data = NULL, groups = NULL, control = control) attr(lmeSt, "conLin") <- MEdecomp(attr(lmeSt, "conLin")) aMs <- nlminb(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt, lmePars), control = list(iter.max = control$msMaxIter, eval.max = control$msMaxEval, trace = control$msVerbose)) c(info = aMs$convergence, logLik = -aMs$objective) } if(!exists(".Random.seed", envir = .GlobalEnv)) runif(1) # initialize the RNG if necessary RNGstate <- get(".Random.seed", envir = .GlobalEnv) on.exit(assign(".Random.seed", RNGstate, envir = .GlobalEnv)) set.seed(seed) if (inherits(object, "lme")) { # given as an lme object fit1 <- object object <- as.list(object$call[-1]) } else { object <- as.list(match.call(lme, substitute(object))[ -1 ]) fit1 <- do.call(lme, object, envir = parent.frame()) } if (length(fit1$modelStruct) > 1) stop("models with \"corStruct\" and/or \"varFunc\" objects not allowed") reSt1 <- fit1$modelStruct$reStruct condL1 <- do.call(createConLin, object, envir = parent.frame()) pdClass1 <- vapply(reSt1, data.class, "") pdClass1 <- match(pdClass1, c("pdSymm", "pdDiag", "pdIdent", "pdCompSymm", "pdLogChol"), 0) - 1 control1 <- lmeControl() if (!is.null(object$control)) { control1[names(object$control)] <- object$control } control1$niterEM <- niterEM[1] sig <- fit1$sigma DeltaInv <- pdMatrix(reSt1, factor = TRUE) for(i in names(DeltaInv)) { DeltaInv[[i]] <- sig * DeltaInv[[i]] } if (missing(useGen)) { useGen <- any(pdClass1 == -1) } nullD <- condL1$dims N <- nullD$N Q <- nullD$Q p1 <- nullD$ncol[Q + 1] pp11 <- p1 * (p1 + 1) ycol1 <- sum(nullD$ncol) qvec <- nullD$qvec[1:Q] ssq1 <- sum(qvec^2) csq1 <- cumsum(c(1, qvec[ - Q])) csq2 <- cumsum(qvec) ngrp <- nullD$ngrps ## base for creating response base <- condL1$Xy[, ycol1 - (nullD$ncol[Q + 1]:1), drop = FALSE] %*% fixef(fit1) ind <- lapply(1:Q, function(i) rep(1:ngrp[i], nullD$ZXlen[[i]])) if (ML <- !is.na(match("ML", method))) nML <- array(0, c(nsim, 2), list(1:nsim, c("info", "logLik"))) if (REML <- !is.na(match("REML", method))) nREML <- array(0, c(nsim, 2), list(1:nsim, c("info", "logLik"))) if ((ALT <- !missing(m2))) { if (inherits(m2, "lme")) { # given as an lme object fit2 <- m2 m2 <- as.list(m2$call[-1]) } else { m2 <- as.list(match.call(lme, substitute(m2))[ -1 ]) if (is.null(m2$random)) { m2$random <- asOneSidedFormula(object$fixed[-2]) } aux <- object aux[names(m2)] <- m2 m2 <- aux fit2 <- do.call(lme, m2, envir = parent.frame()) } if (length(fit2$modelStruct) > 1) { stop("models with \"corStruct\" and/or \"varFunc\" objects not allowed") } condL2 <- do.call(createConLin, m2, envir = parent.frame()) reSt2 <- fit2$modelStruct$reStruct control2 <- lmeControl() if (!is.null(m2$control)) { control2[names(m2$control)] <- m2$control } control2$niterEM <- niterEM[2] pdClass2 <- vapply(fit2$modelStruct$reStruct, data.class, "") pdClass2 <- match(pdClass2, c("pdSymm", "pdDiag", "pdIdent", "pdCompSymm", "pdLogChol"), 0) - 1 useGen <- useGen || any(pdClass2 == -1) altD <- condL2$dims ssq2 <- sum((altD$qvec[1:altD$Q])^2) p2 <- altD$ncol[altD$Q + 1] pp12 <- p2 * (p2 + 1) ycol2 <- sum(altD$ncol) if (ML) aML <- nML if (REML) aREML <- nREML } for(i in 1:nsim) { base2 <- base + rnorm(N, sd = sig) ## = X beta + eps ## now add 'Z b' as Q different terms \sum_{j=1}^Q Z_j b_j : for(j in 1:Q) { base2 <- base2 + ((array(rnorm(ngrp[j] * qvec[j]), c(ngrp[j], qvec[j]), list(1:ngrp[j], NULL)) %*% DeltaInv[[j]])[ind[[j]], , drop = FALSE] * condL1$Xy[,csq1[j]:csq2[j], drop = FALSE]) %*% rep(1, qvec[j]) } condL1$Xy[, ycol1] <- base2 if (REML) { nREML[i,] <- if (useGen) getResults2(condL1, reSt1, TRUE, control1) else getResults1(condL1, niterEM[1], pdClass1, TRUE, ssq1, p1, pp11) } if (ML) { nML[i,] <- if (useGen) getResults2(condL1, reSt1, FALSE, control1) else getResults1(condL1, niterEM[1], pdClass1, FALSE, ssq1, p1, pp11) } if (ALT) { condL2$Xy[, ycol2] <- base2 if (REML) { aREML[i,] <- if (useGen) getResults2(condL2, reSt2, TRUE, control2) else getResults1(condL2, niterEM[2], pdClass2, TRUE, ssq2, p2, pp12) } if (ML) { aML[i,] <- if (useGen) getResults2(condL2, reSt2, FALSE, control2) else getResults1(condL2, niterEM[2], pdClass2, FALSE, ssq2, p2, pp12) } } } ## for i = 1,..,nsim v.null <- v.alt <- list() if (ML) { nML[, "logLik"] <- nML[, "logLik"] + N * (log(N) - (1 + log(2*pi)))/2 v.null$ML <- nML if (ALT) { aML[, "logLik"] <- aML[, "logLik"] + N * (log(N) - (1 + log(2*pi)))/2 v.alt$ML <- aML } } if (REML) { nREML[, "logLik"] <- nREML[, "logLik"] + (N - p1) * (log(N - p1) - (1 + log(2*pi)))/2 v.null$REML <- nREML if (ALT) { aREML[, "logLik"] <- aREML[, "logLik"] + (N - p2) * (log(N - p2) - (1 + log(2*pi)))/2 v.alt$REML <- aREML } } df <- p1 + length(coef(reSt1)) + 1 if (ALT) df <- abs(df - (p2 + length(coef(reSt2)) + 1)) ## return : structure(if(ALT && (ML || REML)) list(null = v.null, alt = v.alt) else list(null = v.null), class = "simulate.lme", call = match.call(), seed = seed, df = df, useGen = useGen) } print.simulate.lme <- function(x, ...) { ox <- x if (is.null(attr(x, "useGen"))) { # from simulate.lme attr(x$null, "dims") <- NULL if (!is.null(x$alt)) { attr(x$alt, "dims") <- NULL } } else { attr(x, "useGen") <- attr(x, "df") <- NULL } attr(x, "seed") <- attr(x, "call") <- NULL NextMethod() invisible(ox) } plot.simulate.lme <- function(x, form = y ~ x | df * method, df = attr(x, "df"), weights, xlab = "Empirical p-value", ylab = "Nominal p-value", xlim = c(0.037, 0.963), ylim = c(0.037, 0.963), aspect = 1, strip = function(...) strip.default(..., style = 1), ...) { if (is.null(df)) stop("no degrees of freedom specified") ML <- !is.null(x$null$ML) if(ML) { if (is.null(x$alt$ML)) stop("plot method only implemented for comparing models") okML <- x$null$ML[, "info"] == 0 & x$alt$ML[, "info"] == 0 } REML <- !is.null(x$null$REML) if(REML) { if (is.null(x$alt$REML)) stop("plot method only implemented for comparing models") okREML <- x$null$REML[, "info"] == 0 & x$alt$REML[, "info"] == 0 } if ((ldf <- length(df)) > 1) { df <- sort(unique(df)) if (missing(weights)) { weights <- rep.int(1/ldf, ldf) } else { if (!identical(weights,FALSE) && length(weights) != ldf) stop("degrees of freedom and weights must have the same length") } } else { weights <- FALSE } useWgts <- (length(weights) != 1) if (any(df < 0)) { stop("negative degrees of freedom not allowed") } else { if ((ldf == 1) && (df == 0)) { stop("more than one degree of freedom is needed when one them is zero.") } } if (ML) { MLstat <- rev(sort(2 * pmax(0, x$alt$ML[okML, "logLik"] - x$null$ML[okML,"logLik"]))) MLy <- lapply(df, function(df, x) { if (df > 0) pchisq(x, df, lower.tail=FALSE) else 1*(x == 0) }, x = MLstat) dfC <- paste("df",df,sep="=") if (useWgts) { # has weights if (ldf == 2) { # will interpolate MLy <- c(MLy[[1]], weights[1] * MLy[[1]] + weights[2] * MLy[[2]], MLy[[2]]) MLdf <- rep(c(dfC[1], paste("Mix(",df[1],",",df[2],")",sep=""), dfC[2]), rep(length(MLstat), ldf + 1)) } else { aux <- weights[1] * MLy[[1]] auxNam <- paste("Mix(",df[1],sep="") for(i in 2:ldf) { aux <- aux + weights[i] * MLy[[i]] auxNam <- paste(auxNam, ",", df[i],sep="") } auxNam <- paste(auxNam, ")",sep="") MLy <- c(unlist(MLy), aux) MLdf <- rep(c(dfC, auxNam), rep(length(MLstat), ldf + 1)) } MLx <- rep((seq_along(MLstat) - 0.5)/length(MLstat), ldf + 1) } else { MLy <- unlist(MLy) MLdf <- rep(dfC, rep(length(MLstat), ldf)) MLx <- rep((seq_along(MLstat) - 0.5)/length(MLstat), ldf) } auxInd <- MLdf != "df=0" meth <- rep("ML", length(MLy)) Mdf <- MLdf } else { MLy <- MLdf <- MLx <- auxInd <- meth <- Mdf <- NULL } if (REML) { REMLstat <- rev(sort(2 * pmax(0, x$alt$REML[okREML, "logLik"] - x$null$REML[okREML, "logLik"]))) REMLy <- lapply(df, function(df, x) { if (df > 0) { pchisq(x, df, lower.tail = FALSE) } else { 1*(x == 0) } }, x = REMLstat) dfC <- paste("df",df,sep="=") if (useWgts) { # has weights if (ldf == 2) { # will interpolate REMLy <- c(REMLy[[1]], weights[1] * REMLy[[1]] + weights[2] * REMLy[[2]], REMLy[[2]]) REMLdf <- rep(c(dfC[1], paste("Mix(",df[1],",",df[2],")",sep=""), dfC[2]), rep(length(REMLstat), ldf + 1)) } else { aux <- weights[1] * REMLy[[1]] auxNam <- paste("Mix(",df[1],sep="") for(i in 2:ldf) { aux <- aux + weights[i] * REMLy[[i]] auxNam <- paste(auxNam, ",", df[i],sep="") } auxNam <- paste(auxNam, ")",sep="") REMLy <- c(unlist(REMLy), aux) REMLdf <- rep(c(dfC, auxNam), rep(length(REMLstat), ldf + 1)) } REMLx <- rep((seq_along(REMLstat) - 0.5)/length(REMLstat), ldf + 1) } else { REMLy <- unlist(REMLy) REMLdf <- rep(dfC, rep(length(REMLstat), ldf)) REMLx <- rep((seq_along(REMLstat) - 0.5)/length(REMLstat), ldf) } auxInd <- c(auxInd, REMLdf != "df=0") meth <- c(meth, rep("REML", length(REMLy))) Mdf <- c(Mdf, REMLdf) } else { REMLy <- REMLdf <- REMLx <- NULL } meth <- meth[auxInd] Mdf <- Mdf[auxInd] Mdf <- ordered(Mdf, levels = unique(Mdf)) frm <- data.frame(x = c(MLx, REMLx)[auxInd], y = c(MLy, REMLy)[auxInd], df = Mdf, method = meth) ## names(frm$x) <- rep(1, nrow(frm)) ## if (df[1] == 0) { ## names(frm$x)[substring(frm$df,1,3) == "Mix"] <- 1 - weights[1] ## if (missing(ylim)) { ## ylim <- c(0.0384, 1) ## } ## } xyplot(form, data = frm, type = c('g', 'l'), ## panel = function(x, y, ...) { ## panel.grid() ## panel.xyplot(x, y, type = "l", ...) ## if ((dfType <- as.double(names(x)[1])) == 1) { ## panel.abline( 0, as.double(names(x)[1]), lty = 2 ) ## } else { ## panel.xyplot(c(0,dfType,dfType,1), c(0,dfType,1,1), ## type="l", lty = 2, col = 1) ## } ## }, strip = strip, xlab = xlab, ylab = ylab, aspect = aspect, xlim = xlim, ylim = ylim, ...) } nlme/R/lmList.R0000644000176000001440000013145214630076362013042 0ustar ripleyusers### Create a list of lm objects ### ### Copyright 2005-2022 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # lmList <- ## a list of lm objects from a formula or a groupedData object function(object, data, level, subset, na.action = na.fail, pool = TRUE, warn.lm = TRUE) UseMethod("lmList") lmList.groupedData <- function(object, data, level, subset, na.action = na.fail, pool = TRUE, warn.lm = TRUE) { ### object will provide the formula, the data, and the groups form <- formula(object) args <- as.list(match.call())[-1L] args[["object"]] <- eval(substitute(Y ~ RHS, list(Y = form[[2]], RHS= form[[3]][[2]]))) if (!missing(data)) { message("'data' argument not used, but taken from groupedData object") args[["data"]] <- substitute(object) } else { args <- c(args, list(data = substitute(object))) } do.call(lmList.formula, args) } lmList.formula <- function(object, data, level, subset, na.action = na.fail, pool = TRUE, warn.lm = TRUE) { Call <- match.call() if (!missing(subset)) { data <- data[eval(asOneSidedFormula(Call[["subset"]])[[2]], data),, drop = FALSE] } if (!inherits(data, "data.frame")) data <- as.data.frame(data) data <- na.action(data) if (is.null(grpForm <- getGroupsFormula(object))) { if (inherits(data, "groupedData")) { if (missing(level)) level <- length(getGroupsFormula(data, asList = TRUE)) else if (length(level) > 1) { stop("multiple levels not allowed") } groups <- getGroups(data, level = level)[drop = TRUE] grpForm <- getGroupsFormula(data) Call$object <- eval(parse(text=paste(deparse(Call$object), deparse(grpForm[[2]]), sep = "|"))) } else { stop ("'data' must be a \"groupedData\" object if 'groups' argument is missing") } } else { if (missing(level)) level <- length(getGroupsFormula(object, asList = TRUE)) else if (length(level) > 1) { stop("multiple levels not allowed") } groups <- getGroups(data, form = grpForm, level = level)[drop = TRUE] object <- eval(substitute(Y ~ X, list(Y = getResponseFormula (object)[[2]], X = getCovariateFormula(object)[[2]]))) } val <- lapply(split(data, groups), function(dat) tryCatch(lm(object, data = dat, na.action = na.action), error = function(e) e)) val <- warnErrList(val, warn = warn.lm) if (inherits(data, "groupedData")) { ## saving labels and units for plots attr(val, "units") <- attr(data, "units") attr(val, "labels") <- attr(data, "labels") } structure(val, class = "lmList", dims = list(N = nrow(data), M = length(val)), call = Call, groupsForm = grpForm, groups = ordered(groups, levels = names(val)), origOrder = match(unique(as.character(groups)), names(val)), level = level, pool = pool) } ###*# Methods for standard generics augPred.lmList <- function(object, primary = NULL, minimum = min(primary), maximum = max(primary), length.out = 51, ...) { data <- eval(attr(object, "call")[["data"]]) if (!inherits(data, "data.frame")) { stop(gettextf("'data' in %s call must evaluate to a data frame", sQuote(substitute(object))), domain = NA) } if(is.null(primary)) { if (!inherits(data, "groupedData")) { stop(gettextf("%s without \"primary\" can only be used with fits of \"groupedData\" objects", sys.call()[[1]]), domain = NA) } primary <- getCovariate(data) pr.var <- getCovariateFormula(data)[[2L]] } else { pr.var <- asOneSidedFormula(primary)[[2L]] primary <- eval(pr.var, data) } prName <- c_deparse(pr.var) newprimary <- seq(from = minimum, to = maximum, length.out = length.out) groups <- getGroups(object) grName <- deparse(gr.v <- getGroupsFormula(object)[[2]]) ugroups <- unique(groups) value <- data.frame(rep(newprimary, length(ugroups)), rep(ugroups, rep(length(newprimary), length(ugroups)))) names(value) <- c(prName, grName) ## recovering other variables in data that may be needed for predictions ## varying variables will be replaced by their means summData <- gsummary(data, groups = groups) if (any(toAdd <- is.na(match(names(summData), names(value))))) { summData <- summData[, toAdd, drop = FALSE] } value[, names(summData)] <- summData[value[, 2], ] pred <- c(predict(object, value, asList = FALSE)) newvals <- cbind(value[, 1:2], pred) names(newvals)[3] <- respName <- deparse(resp.v <- getResponseFormula(object)[[2]]) orig <- data.frame(primary, groups, getResponse(object)) names(orig) <- names(newvals) value <- rbind(orig, newvals) attributes(value[, 2]) <- attributes(groups) value[, ".type"] <- ordered(c(rep("original", nrow(data)), rep("predicted", nrow(newvals))), levels = c("predicted", "original")) labs <- list(x = prName, y = respName) unts <- list(x = "", y = "") if(inherits(data, "groupedData")) { labs[names(attr(data, "labels"))] <- attr(data, "labels") unts[names(attr(data, "units"))] <- attr(data, "units") attr(value, "units") <- attr(data, "units") } structure(value, class = c("augPred", class(value)), labels = labs, units = unts, formula = eval(substitute(Y ~ X | G, list(Y = resp.v, X = pr.var, G = gr.v)))) } coef.lmList <- ## Extract the coefficients and form a data.frame if possible function(object, augFrame = FALSE, data = NULL, which = NULL, FUN = mean, omitGroupingFactor = TRUE, ...) { coefs <- lapply(object, coef) non.null <- !vapply(coefs, is.null, NA) ## size the data frame to cope with combined levels for factors ## and name the columns so can fill by name if (any(non.null)) { coefNames <- unique(unlist(lapply(coefs[non.null], names))) co <- matrix(NA_real_, ncol=length(coefNames), nrow=length(coefs), dimnames=list(names(object), coefNames)) for (i in which(non.null)) { co[i, names(coefs[[i]])] <- coefs[[i]] } coefs <- as.data.frame(co) effectNames <- names(coefs) if(augFrame) { if (is.null(data)) { data <- getData(object) } data <- as.data.frame(data) if (is.null(which)) { which <- 1:ncol(data) } data <- data[, which, drop = FALSE] ## eliminating columns with same names as effects data <- data[, is.na(match(names(data), effectNames)), drop = FALSE] data <- gsummary(data, FUN = FUN, groups = getGroups(object)) if (omitGroupingFactor) { data <- data[, is.na(match(names(data), names(getGroupsFormula(object, asList = TRUE)))), drop = FALSE] } if (length(data) > 0) { coefs <- cbind(coefs, data[row.names(coefs),,drop = FALSE]) } } attr(coefs, "level") <- attr(object, "level") attr(coefs, "label") <- "Coefficients" attr(coefs, "effectNames") <- effectNames attr(coefs, "standardized") <- FALSE attr(coefs, "grpNames") <- deparse(getGroupsFormula(object)[[2]]) class(coefs) <- c("coef.lmList", "ranef.lmList", class(coefs)) } coefs } fitted.lmList <- function(object, subset = NULL, asList = FALSE, ...) { if(!is.null(subset)) { if(is.character(subset)) { if (anyNA(match(subset, names(object)))) { stop("nonexistent groups requested in 'subset'") } } else { if (is.integer(subset)) { if (anyNA(match(subset, seq_along(object)))) { stop("nonexistent groups requested in 'subset'") } } else { stop("'subset' can only be character or integer") } } oclass <- class(object) oatt <- attr(object, "call") object <- object[subset] attr(object, "call") <- oatt class(object) <- oclass } val <- lapply(object, fitted) if(!asList) { #convert to array ngrps <- table(getGroups(object))[names(object)] if(any(aux <- vapply(object, is.null, NA))) { for(i in names(ngrps[aux])) { val[[i]] <- rep(NA, ngrps[i]) } } val <- val[attr(object, "origOrder")] # putting in original order namVal <- names(val) val <- unlist(val) names(val) <- rep(namVal, ngrps) } lab <- "Fitted values" if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } attr(val, "label") <- lab val } fixef.lmList <- function(object, ...) { coeff <- coef(object) if(is.matrix(coeff) || is.data.frame(coeff)) { colMeans(coeff, na.rm = TRUE) } # else NULL } formula.lmList <- function(x, ...) eval(attr(x, "call")[["object"]]) # flaky if object is a name getData.lmList <- function(object) { mCall <- attr(object, "call") data <- eval(mCall$data) if (is.null(data)) return(data) naAct <- eval(mCall$na.action) if (!is.null(naAct)) { data <- naAct(data) } subset <- mCall$subset if (!is.null(subset)) { subset <- eval(asOneSidedFormula(subset)[[2]], data) data <- data[subset, ] } return(data) } getGroups.lmList <- function(object, form, level, data, sep) attr(object, "groups") getGroupsFormula.lmList <- function(object, asList = FALSE, sep) { val <- attr(object, "groupsForm") getGroupsFormula(eval(substitute(~ 1 | GR, list(GR = val[[2]]))), asList = asList) } getResponse.lmList <- function(object, form) fitted(object) + resid(object) intervals.lmList <- function(object, level = 0.95, pool = attr(object, "pool"), ...) { smry <- summary(object, pool = pool) coeff <- coef(smry) out <- coeff[ , 1:3 , ] dn <- dimnames(out) dimnames(out) <- if(is.null(dn)) list(NULL, c("lower", "est.", "upper")) else { dn[[2]] <- c("lower", "est.", "upper") dn } mult <- sqrt(qf(level, 1, smry$df.residual)) out[ , "est.", ] <- coeff[ , "Estimate", ] out[ , "lower", ] <- out[ , "est.", ] - mult * coeff[ , "Std. Error", ] out[ , "upper", ] <- out[ , "est.", ] + mult * coeff[ , "Std. Error", ] attr(out, "groupsName") <- deparse(attr(object, "groupsForm")[[2]]) class(out) <- "intervals.lmList" out } logLik.lmList <- function(object, REML = FALSE, pool = attr(object, "pool"), ...) { if(any(vapply(object, is.null, NA))) { stop("log-likelihood not available with NULL fits") } if(pool) { aux <- rowSums(sapply(object, function(el) { res <- resid(el) p <- el$rank n <- length(res) if (is.null(w <- el$weights)) w <- rep(1, n) else { excl <- w == 0 if (any(excl)) { res <- res[!excl] n <- length(res) w <- w[!excl] } } c(n, sum(w * res^2), p, sum(log(w)), sum(log(abs(diag(el$qr$qr)[1:p])))) })) N <- aux[1] - REML * aux[3] val <- (aux[4] - N * (log(2 * pi) + 1 - log(N) + log(aux[2])))/2 - REML * aux[5] attr(val, "nall") <- aux[1] attr(val, "nobs") <- N attr(val, "df") <- aux[3] + 1 } else { aux <- lapply(object, logLik, REML) val <- sum(unlist(aux)) attr(val, "nobs") <- sum(sapply(aux, function(x) attr(x, "nobs"))) attr(val, "df") <- sum(sapply(aux, function(x) attr(x, "df"))) } class(val) <- "logLik" val } pairs.lmList <- function(x, form = ~ coef(.), label, id = NULL, idLabels = NULL, grid = FALSE, ...) { object <- x ## scatter plot matrix plots, generally based on coef or random.effects if (!inherits(form, "formula")) { stop("'form' must be a formula") } if (length(form) != 2) { stop("'form' must be a one-sided formula") } ## constructing data allV <- all.vars(asOneFormula(form, id, idLabels)) allV <- allV[is.na(match(allV,c("T","F","TRUE","FALSE")))] if (length(allV) > 0) { data <- getData(object) if (is.null(data)) { # try to construct data alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } else { if (any(naV <- is.na(match(allV, names(data))))) { stop(sprintf(ngettext(sum(naV), "%s not found in data", "%s not found in data"), allV[naV]), domain = NA) } } } else data <- NULL ## argument list dots <- list(...) args <- if (length(dots) > 0) dots else list() ## covariate - must be present as a data.frame covF <- getCovariateFormula(form) .x <- eval(covF[[2]], list(. = object)) # only function of "." if (!inherits(.x, "data.frame")) { stop("covariate must be a data frame") } if (!is.null(effNams <- attr(.x, "effectNames"))) { .x <- .x[, effNams, drop = FALSE] } ## eliminating constant effects isFixed <- vapply(.x, function(el) length(unique(el)) == 1, NA) .x <- .x[, !isFixed, drop = FALSE] nc <- ncol(.x) if (nc == 1) { stop("cannot do pairs of just one variable") } if (!missing(label)) { names(.x) <- labels } if (nc == 2) { ## will use xyplot argForm <- .y ~ .x argData <- .x names(argData) <- c(".x", ".y") if (is.null(args$xlab)) { args$xlab <- names(.x)[1] } if (is.null(args$ylab)) { args$ylab <- names(.x)[2] } } else { # splom argForm <- ~ .x argData <- list(.x = .x) } auxData <- list() ## groups - need not be present grpsF <- getGroupsFormula(form) if (!is.null(grpsF)) { gr <- splitFormula(grpsF, sep = "*") for(i in seq_along(gr)) { auxData[[deparse(gr[[i]][[2]])]] <- eval(gr[[i]][[2]], data) } argForm <- eval(substitute(if(length(argForm) == 2) ~ .x | R else .y ~ .x | R, list(R = grpsF[[2L]]))) } ## id and idLabels - need not be present if (!is.null(id)) { # identify points in plot N <- attr(object, "dims")$N id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } aux <- as.matrix(na.omit(ranef(object))) auxV <- t(chol(var(aux))) as.logical(colSums((solve(auxV, t(aux)))^2) > qchisq(1 - id, dim(aux)[2])) }, call = eval(asOneSidedFormula(id)[[2]], data), stop("'id' can only be a formula or numeric") ) if (length(id) == N) { ## id as a formula evaluated in data auxData[[".id"]] <- id } if (is.null(idLabels)) { idLabels <- row.names(.x) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != N) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } if (length(idLabels) == N) { ## idLabels as a formula evaluated in data auxData[[".Lid"]] <- idLabels } } if (length(auxData)) { # need collapsing auxData <- gsummary(data.frame(auxData), groups = getGroups(object)) auxData <- auxData[row.names(.x), , drop = FALSE] if (!is.null(auxData[[".g"]])) { argData[[".g"]] <- auxData[[".g"]] } if (!is.null(auxData[[".id"]])) { id <- auxData[[".id"]] } if (!is.null(auxData[[".Lid"]])) { idLabels <- auxData[[".Lid"]] } wchDat <- is.na(match(names(auxData), c(".id", ".idLabels"))) if (any(wchDat)) { argData <- cbind(argData, auxData[, wchDat, drop = FALSE]) } } if (is.null(id)) assign("id", FALSE) else assign("id", as.logical(as.character(id)) ) assign("idLabels", as.character(idLabels)) assign("grid", grid) ## adding to args list args <- c(list(argForm, data = argData), args) ## if (is.null(args$strip)) { ## args$strip <- function(...) strip.default(..., style = 1) ## } if (is.null(args$cex)) args$cex <- par("cex") if (is.null(args$adj)) args$adj <- par("adj") ## defining the type of plot if (length(argForm) == 3) { # xyplot plotFun <- "xyplot" args <- c(args, panel = list(function(x, y, subscripts, ...) { x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y) if (any(id) & any(ids <- id[subscripts])) { ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } })) } else { # splom plotFun <- "splom" args <- c(args, panel = list(function(x, y, subscripts, ...) { x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y) if (any(id) & any(ids <- id[subscripts])) { ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } })) } do.call(plotFun, args) } ## {pairs.lmList} plot.intervals.lmList <- function(x, xlab = "", ylab = attr(x, "groupsName"), strip = function(...) strip.default(..., style = 1), ...) { dims <- dim(x) dn <- dimnames(x) ## changed definition of what to ordered to preserve order of parameters tt <- data.frame(group = ordered(rep(dn[[1]], dims[2] * dims[3]), levels = dn[[1]]), intervals = as.vector(x), what = ordered(rep(dn[[3]], rep(dims[1] * dims[2], dims[3])), levels = dn[[3]])) dotplot(group ~ intervals | what, data = tt, scales = list(x="free"), strip = strip, xlab = xlab, ylab = ylab, panel = function(x, y, pch = dot.symbol$pch, col = dot.symbol$col, cex = dot.symbol$cex, font = dot.symbol$font, ...) { x <- as.numeric(x) y <- as.numeric(y) ok <- !is.na(x) & !is.na(y) yy <- y[ok] xx <- x[ok] dot.symbol <- trellis.par.get("dot.symbol") dot.line <- trellis.par.get("dot.line") panel.abline(h = yy, lwd = dot.line$lwd, lty = dot.line$lty, col = dot.line$col) lpoints(xx, yy, pch = "|", col = col, cex = cex, font = font, ...) lower <- tapply(xx, yy, min) upper <- tapply(xx, yy, max) nams <- as.numeric(names(lower)) lsegments(lower, nams, upper, nams, col = 1, lty = 1, lwd = if (dot.line$lwd) dot.line$lwd else 2) }, ...) } ## {plot.intervals.lmList} plot.ranef.lmList <- function(x, form = NULL, grid = TRUE, control, ...) { plot.ranef.lme(x, form=form, grid=grid, control=control, ...) } plot.lmList <- function(x, form = resid(., type = "pool") ~ fitted(.), abline, id = NULL, idLabels = NULL, grid, ...) ## Diagnostic plots based on residuals and/or fitted values { if(!inherits(form, "formula")) stop("'form' must be a formula") ## constructing data allV <- all.vars(asOneFormula(form, id, idLabels)) allV <- allV[is.na(match(allV,c("T","F","TRUE","FALSE")))] if (length(allV) > 0) { data <- getData(x) if (is.null(data)) { # try to construct data alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } else { if (any(naV <- is.na(match(allV, names(data))))) { stop(sprintf(ngettext(sum(naV), "%s not found in data", "%s not found in data"), allV[naV]), domain = NA) } } } else data <- NULL if (inherits(data, "groupedData")) { # save labels and units, if present ff <- formula(data) rF <- deparse(getResponseFormula(ff)[[2]]) cF <- c_deparse(getCovariateFormula(ff)[[2]]) lbs <- attr(data, "labels") unts <- attr(data, "units") if (!is.null(lbs$x)) cL <- paste(lbs$x, unts$x) else cF <- NULL if (!is.null(lbs$y)) rL <- paste(lbs$y, unts$y) else rF <- NULL } else { rF <- cF <- NULL } ## argument list dots <- list(...) args <- if(length(dots) > 0) dots else list() ## appending object to data data <- as.list(c(as.list(data), . = list(x))) ## covariate - must always be present covF <- getCovariateFormula(form) .x <- eval(covF[[2]], data) if (!is.numeric(.x)) { stop("covariate must be numeric") } argForm <- ~ .x argData <- as.data.frame(.x) if (is.null(xlab <- attr(.x, "label"))) { xlab <- c_deparse(covF[[2]]) if (!is.null(cF) && (xlab == cF)) xlab <- cL else if (!is.null(rF) && (xlab == rF)) xlab <- rL } if (is.null(args$xlab)) args$xlab <- xlab ## response - need not be present respF <- getResponseFormula(form) if (!is.null(respF)) { .y <- eval(respF[[2]], data) if (is.null(ylab <- attr(.y, "label"))) { ylab <- deparse(respF[[2]]) if (!is.null(cF) && (ylab == cF)) ylab <- cL else if (!is.null(rF) && (ylab == rF)) ylab <- rL } argForm <- .y ~ .x argData[, ".y"] <- .y if (is.null(args$ylab)) args$ylab <- ylab } ## groups - need not be present grpsF <- getGroupsFormula(form) if (!is.null(grpsF)) { gr <- splitFormula(grpsF, sep = "*") for(i in seq_along(gr)) { argData[[deparse(gr[[i]][[2]])]] <- eval(gr[[i]][[2]], data) } argForm <- eval(substitute(if(length(argForm) == 2) ~ .x | R else .y ~ .x | R, list(R = grpsF[[2L]]))) } ## adding to args list args <- c(list(argForm, data = argData), args) ## if (is.null(args$strip)) { ## args$strip <- function(...) strip.default(..., style = 1) ## } if (is.null(args$cex)) args$cex <- par("cex") if (is.null(args$adj)) args$adj <- par("adj") if (!is.null(id)) { # identify points in plot id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } as.logical(abs(resid(x, type = "pooled")) > -qnorm(id / 2)) }, call = eval(asOneSidedFormula(id)[[2]], data), stop("'id' can only be a formula or numeric") ) if (is.null(idLabels)) { idLabels <- getGroups(x) if (length(idLabels) == 0) idLabels <- 1:x$dims$N idLabels <- as.character(idLabels) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != length(id)) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } } ## defining abline, if needed if(missing(abline)) abline <- if(missing(form)) c(0, 0) # else NULL ## defining the type of plot if (length(argForm) == 3) { if (is.numeric(.y)) { # xyplot plotFun <- "xyplot" args$panel <- function(x, y, subscripts, ...) { x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y) if (any(ids <- id[subscripts])) { ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } if (!is.null(abline)) { if (length(abline) == 2) panel.abline(a = abline, ...) else panel.abline(h = abline, ...) } } } else { # assume factor or character plotFun <- "bwplot" args$panel <- function(x, y, ...) { if (grid) panel.grid() panel.bwplot(x, y) if (!is.null(abline)) { panel.abline(v = abline[1], ...) } } } } else { ## '~ x' plotFun <- "histogram" args$panel <- function(x, y, ...) { if (grid) panel.grid() panel.histogram(x, y) if (!is.null(abline)) { panel.abline(v = abline[1], ...) } } } ## defining grid (seen from panel()s defined here): if (missing(grid)) grid <- (plotFun == "xyplot") # T/F do.call(plotFun, args) } ## {plot.lmList} predict.lmList <- function(object, newdata, subset = NULL, pool = attr(object, "pool"), asList = FALSE, se.fit = FALSE, ...) { if(missing(newdata)) { if (!se.fit) return(fitted(object, subset, asList)) myData <- getData(object) grps <- getGroups(object) myData <- split(myData, grps) newdata <- NULL sameData <- FALSE } else { newdata <- as.data.frame(newdata) sameData <- TRUE ## checking if same newdata for all groups formGrps <- getGroupsFormula(object) if(all(match(all.vars(formGrps), names(newdata), 0))) { ## newdata contains groups definition grps <- getGroups(newdata, getGroupsFormula(object, asList = TRUE), level = attr(object, "level")) grps <- grps[drop = TRUE] subset <- as.character(unique(grps)) if(anyNA(match(subset, names(object)))) { stop("nonexistent group in 'newdata'") } myData <- split(newdata, grps) newdata <- NULL sameData <- FALSE } } if(!is.null(subset)) { if(anyNA(match(subset, names(object)))) stop("nonexistent group requested in 'subset'") oclass <- class(object) ## fix for PR#13788 oatt <- attributes(object)[c("call", "groupsForm", "pool")] object <- object[subset] attributes(object) <- c(attributes(object), oatt) class(object) <- oclass if(is.null(newdata)) myData <- myData[subset] } nmGrps <- names(object) noNull <- !vapply(object, is.null, NA) val <- vector("list", length(nmGrps)) names(val) <- nmGrps if(!sameData) { if(!se.fit) { for(i in nmGrps[noNull]) { val[[i]] <- predict(object[[i]], myData[[i]]) } } else { if(pool) { poolSD <- pooledSD(object) } for(i in nmGrps[noNull]) { aux <- predict(object[[i]], myData[[i]], se.fit = TRUE) if(pool) { val[[i]] <- data.frame(fit = aux$fit, se.fit = aux$se.fit*poolSD/aux$residual.scale) } else { val[[i]] <- data.frame(fit = aux$fit, se.fit = aux$se.fit) } } } } else { if(pool) { poolSD <- pooledSD(object) val[noNull] <- lapply(object[noNull], function(el, newdata, se.fit, poolSD) { aux <- predict(el, newdata, se.fit = se.fit) if(se.fit) { data.frame(fit = aux$fit, se.fit = aux$se.fit*poolSD/aux$residual.scale) } else { aux } }, newdata = newdata, se.fit = se.fit, poolSD = poolSD) } else { val[noNull] <- lapply(object[noNull], function(el, newdata, se.fit) { aux <- predict(el, newdata, se.fit = se.fit) if(se.fit) { data.frame(fit = aux$fit, se.fit = aux$se.fit) } else { aux } }, newdata = newdata, se.fit = se.fit) } } if(!asList) { #convert to array if(is.null(newdata)) { ngrps <- table(grps)[names(object)] } else { ngrps <- rep(dim(newdata)[1], length(object)) names(ngrps) <- names(object) } if(any(aux <- vapply(object, is.null, NA))) { for(i in names(ngrps[aux])) { aux1 <- rep(NA, ngrps[i]) if(se.fit) { val[[i]] <- data.frame(fit = aux1, se.fit = aux1) } else { val[[i]] <- aux1 } } } if(se.fit) { val <- do.call("rbind", val) val[, as.character(getGroupsFormula(object)[[2]])] <- rep(names(ngrps), ngrps) val <- val[, c(3,1,2)] row.names(val) <- 1:nrow(val) } else { val <- unlist(val) names(val) <- rep(names(ngrps), ngrps) attr(val, "label") <- "Predicted values" if (!is.null(aux <- attr(object, "units")$y)) { attr(val, "label") <- paste(attr(val, "label"), aux) } } } val } print.intervals.lmList <- function(x, ...) { ox <- x x <- unclass(x) attr(x, "groupsName") <- NULL print(x, ...) invisible(ox) } print.lmList <- function(x, pool = attr(x, "pool"), ...) { mCall <- attr(x, "call") cat("Call:\n") form <- formula(x) cat(" Model:", deparse(getResponseFormula(form)[[2]]), "~", c_deparse(getCovariateFormula(form)[[2]]), "|", deparse(getGroupsFormula(x)[[2]]), "\n") if (!is.null(mCall$level)) { cat(" Level:", mCall$level, "\n") } cat(" Data:", deparse(mCall$data),"\n\n") cat("Coefficients:\n") print(coef(x), ...) if(pool) { cat("\n") poolSD <- pooledSD(x) dfRes <- attr(poolSD, "df") RSE <- c(poolSD) cat("Degrees of freedom: ", length(unlist(lapply(x, fitted))), " total; ", dfRes, " residual\n", sep = "") cat("Residual standard error:", format(RSE)) cat("\n") } invisible(x) } print.summary.lmList <- function(x, ...) { cat("Call:\n") form <- formula(x) cat(" Model:", deparse(getResponseFormula(form)[[2]]), "~", c_deparse(getCovariateFormula(form)[[2]]), "|", deparse(attr(x, "groupsForm")[[2]]), "\n") if (!is.null(x$call$level)) { cat(" Level:", x$call$level, "\n") } cat(" Data:", deparse(x$call$data),"\n\n") cat("Coefficients:\n") for(i in dimnames(coef(x))[[3]]) { cat(" ",i,"\n") print(coef(x)[,,i], ...) } if(x$pool) { cat("\n") cat("Residual standard error:", format(x$RSE), "on", x$df.residual, "degrees of freedom\n") } cat("\n") invisible(x) } qqnorm.lmList <- function(y, form = ~ resid(., type = "pooled"), abline = NULL, id = NULL, idLabels = NULL, grid = FALSE, resType = "pool", ...) ## normal probability plots for residuals and random effects { object <- y if (!inherits(form, "formula")) { stop("'form' must be a formula") } ## constructing data allV <- all.vars(asOneFormula(form, id, idLabels)) allV <- allV[is.na(match(allV,c("T","F","TRUE","FALSE")))] if (length(allV) > 0) { data <- getData(object) if (is.null(data)) { # try to construct data alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } else if (any(naV <- is.na(match(allV, names(data))))) { stop(sprintf(ngettext(sum(naV), "%s not found in data", "%s not found in data"), allV[naV]), domain = NA) } } else data <- NULL ## argument list dots <- list(...) args <- if (length(dots) > 0) dots else list() ## appending object to data data <- as.list(c(as.list(data), . = list(object))) ## covariate - must always be present covF <- getCovariateFormula(form) .x <- eval(covF[[2]], data) labs <- attr(.x, "label") type <- if (inherits(.x, "ranef.lmList")) "reff" # random effects else if (!is.null(labs) && ((labs == "Standardized residuals") || (substr(labs, 1, 9) == "Residuals"))) "res" # residuals else stop("only residuals and random effects allowed") if (is.null(args$xlab)) args$xlab <- labs if (is.null(args$ylab)) args$ylab <- "Quantiles of standard normal" if(type == "res") { # case 1: -------- residuals ------------------------ fData <- qqnorm(.x, plot.it = FALSE) data[[".y"]] <- fData$x data[[".x"]] <- fData$y dform <- ".y ~ .x" if (!is.null(grp <- getGroupsFormula(form))) { dform <- paste(dform, deparse(grp[[2]]), sep = "|") } if (!is.null(id)) { # identify points in plot id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } as.logical(abs(resid(object, type=resType)) > -qnorm(id / 2)) }, call = eval(asOneSidedFormula(id)[[2]], data), stop("'id' can only be a formula or numeric") ) if (is.null(idLabels)) { idLabels <- getGroups(object) if (length(idLabels) == 0) idLabels <- seq_len(object$dims$N) idLabels <- as.character(idLabels) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != length(id)) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } } } else { # case 2: ------- random.effects ------------------------------- level <- attr(.x, "level") std <- attr(.x, "standardized") if (!is.null(effNams <- attr(.x, "effectNames"))) { .x <- .x[, effNams, drop = FALSE] } nc <- ncol(.x) nr <- nrow(.x) fData <- lapply(as.data.frame(.x), qqnorm, plot.it = FALSE) fData <- data.frame(.x = unlist(lapply(fData, function(x) x[["y"]])), .y = unlist(lapply(fData, function(x) x[["x"]])), .g = ordered(rep(names(fData),rep(nr, nc)), levels = names(fData))) dform <- ".y ~ .x | .g" auxData <- if (!is.null(grp <- getGroupsFormula(form))) { dform <- paste(dform, deparse(grp[[2]]), sep = "*") data[is.na(match(names(data), "."))] } else list() ## id and idLabels - need not be present if (!is.null(id)) { # identify points in plot N <- object$dims$N id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } aux <- ranef(object, standard = TRUE) as.logical(abs(c(unlist(aux))) > -qnorm(id / 2)) }, call = eval(asOneSidedFormula(id)[[2]], data), stop("'id' can only be a formula or numeric") ) if (length(id) == N) { ## id as a formula evaluated in data auxData[[".id"]] <- id } if (is.null(idLabels)) { idLabels <- rep(row.names(.x), nc) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != N) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } if (length(idLabels) == N) { ## idLabels as a formula evaluated in data auxData[[".Lid"]] <- idLabels } } data <- if (length(auxData)) { # need collapsing auxData <- gsummary(data.frame(auxData), groups = getGroups(object, level = level)) auxData <- auxData[row.names(.x), , drop = FALSE] if (!is.null(auxData[[".id"]])) { id <- rep(auxData[[".id"]], nc) } if (!is.null(auxData[[".Lid"]])) { idLabels <- rep(auxData[[".Lid"]], nc) } cbind(fData, do.call("rbind", rep(list(auxData), nc))) } else { fData } } if(is.null(id)) id <- as.logical(as.character(id)) idLabels <- as.character(idLabels) if (is.null(args$strip)) { args$strip <- function(...) strip.default(..., style = 1) } if (is.null(args$cex)) args$cex <- par("cex") if (is.null(args$adj)) args$adj <- par("adj") args <- c(list(eval(parse(text = dform)), data = substitute(data), panel = function(x, y, subscripts, ...){ x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y, ...) if (any(ids <- id[subscripts])) { ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } if (!is.null(abline)) panel.abline(abline, ...) }), args) if(type == "reff" && !std) { args[["scales"]] <- list(x = list(relation = "free")) } do.call(xyplot, args) } ## {qqnorm.lmList} ranef.lmList <- ## Extracts the random effects from an lmList object. ## If aug.frame is true, the returned data frame is augmented with a ## values from the original data object, if available. The variables ## in the original data are collapsed over the cluster variable by the ## function fun. function(object, augFrame = FALSE, data = NULL, which = NULL, FUN = mean, standard = FALSE, omitGroupingFactor = TRUE, ...) { val <- coef(object, augFrame, data, which, FUN, omitGroupingFactor) effNames <- attr(val, "effectNames") effs <- val[, effNames, drop = FALSE] effs <- as.data.frame(lapply(effs, function(el) el - mean(el, na.rm = TRUE))) if(standard) { stdEff <- unlist(lapply(effs, function(el) sqrt(var(el[!is.na(el)])))) effs <- as.data.frame(as.matrix(effs) %*% diag(1/stdEff)) attr(val, "label") <- "Standardized random effects" } else { attr(val, "label") <- "Random effects" } val[, effNames] <- effs attr(val, "standardized") <- standard class(val) <- unique(c("ranef.lmList", class(val)[-1])) val } residuals.lmList <- function(object, type = c("response", "pearson", "pooled.pearson"), subset = NULL, asList = FALSE, ...) { type <- match.arg(type) if(type == "pooled.pearson") { poolSD <- pooledSD(object) } if(!is.null(subset)) { if(is.character(subset)) { if (anyNA(match(subset, names(object)))) stop("nonexistent groups requested in 'subset'") } else if (is.integer(subset)) { if (anyNA(match(subset, seq_along(object)))) stop("nonexistent groups requested in 'subset'") } else stop("'subset' can only be character or integer") oclass <- class(object) oatt <- attr(object, "call") object <- object[subset] attr(object, "call") <- oatt class(object) <- oclass } val <- switch(type, pooled.pearson = { lapply(object, function(el, pSD) if(!is.null(el)) resid(el)/pSD # else NULL , pSD = poolSD) }, pearson = lapply(object, function(el) { if(!is.null(el)) { aux <- resid(el) aux/sqrt(sum(aux^2)/(length(aux) - length(coef(el)))) } # else NULL }), response = lapply(object, function(el) if(!is.null(el)) resid(el)) # else NULL ) if(!asList) { #convert to array ngrps <- table(getGroups(object))[names(object)] if(any(aux <- vapply(object, is.null, NA))) { for(i in names(ngrps[aux])) { val[[i]] <- rep(NA, ngrps[i]) } } val <- val[attr(object, "origOrder")] # putting in original order val <- setNames(unlist(val), rep(names(val), ngrps)) } lab <- if (type == "response") { lab <- "Residuals" if(!is.null(aux <- attr(object, "units")$y)) paste(lab, aux) else lab } else "Standardized residuals" attr(val, "label") <- lab val } summary.lmList <- function(object, pool = attr(object, "pool"), ...) { to.3d.array <- ## Convert the list to a 3d array watching for null elements function(lst, template) { if (!is.matrix(template)) return(lst) ## Make empty array val[,,] and then fill it ----- dnames <- dimnames(template) use.i <- which(lengths(lst) > 0) ## TODO? just identical(dnames[[1]], dnames[[2]]) : if (length(dnames[[1]]) == length(dnames[[2]]) && all(dnames[[1]] == dnames[[2]])) { ## symmetric val <- array(NA_real_, dim=c(length(cfNms), length(cfNms), length(lst)), dimnames=list(cfNms, cfNms, names(lst))) for (ii in use.i) { use <- dimnames(lst[[ii]])[[1]] val[use, use, ii] <- lst[[ii]] ## ---- } } else { val <- array(NA_real_, dim=c(length(cfNms), dim(template)[2], length(lst)), dimnames=list(cfNms, dnames[[2]], names(lst))) for (ii in use.i) { use <- dimnames(lst[[ii]])[[1]] val[use, , ii] <- lst[[ii]] ## --- } } aperm(val, 3:1) ## val <- aperm(array(unlist(lapply(lst, function(el, template) ## if(is.null(el)) { template } ## else { el }, template = template)), ## c(dim(template), length(lst)), ## c(dnames, list(names(lst)))), ## c(3, 2, 1)) ## val[unlist(lapply(lst, is.null)), , ] <- NA } to.2d.array <- ## Convert the list to a 2d array watching for null elements function(lst, template) { if(is.null(template)) return(lst) template <- as.vector(template) val <- t(array(unlist(lapply(lst, function(el) if(is.null(el)) template else el)), c(length(template), length(lst)), list(names(template), names(lst)))) val[vapply(lst, is.null, NA), ] <- NA val } ## Create a summary by applying summary to each component of the list sum.lst <- lapply(object, function(el) if(!is.null(el)) summary(el)) nonNull <- !vapply(sum.lst, is.null, NA) if(!any(nonNull)) return(NULL) template <- sum.lst[[match(TRUE, nonNull)]] # the first one val <- as.list(setNames(nm = names(template))) for (i in names(template)) { val[[i]] <- lapply(sum.lst, `[[`, i) class(val[[i]]) <- "listof" } ## complete set of coefs [only used in to.3d.array()] cfNms <- unique(unlist(lapply(sum.lst[nonNull], function(x) dimnames(x[['coefficients']])[[1]]))) ## re-arrange the matrices into 3d arrays for(i in c("parameters", "cov.unscaled", "correlation", "coefficients")) if(length(val[[i]])) val[[i]] <- to.3d.array(val[[i]], template[[i]]) ## re-arrange the vectors into 2d arrays for(i in c("df", "fstatistic")) val[[i]] <- to.2d.array(val[[i]], template[[i]]) ## re-arrange the scalars into vectors for(i in c("sigma", "r.squared")) { ## val[[i]] <- unlist(val[[i]]) - this deletes NULL components val[[i]] <- c(to.2d.array(val[[i]], template[[i]])) } ## select those attributes that do not vary with groups for(i in c("terms", "formula")) val[[i]] <- template[[i]] val[["call"]] <- attr(object, "call") if(inherits(object, "nlsList")) names(val[["call"]]["model"]) <- "object" val[["pool"]] <- pool if(pool) { poolSD <- pooledSD(object) dfRes <- attr(poolSD, "df") RSE <- c(poolSD) corRSE <- RSE/val$sigma pname <- if(inherits(object, "nlsList")) "parameters" else "coefficients" val[[pname]][,2,] <- val[[pname]][,2,] * corRSE val[[pname]][,3,] <- val[[pname]][,3,] / corRSE if(!inherits(object, "nlsList")) val[[pname]][,4,] <- 2*pt(abs(val[[pname]][,3,]), dfRes, lower.tail=FALSE) val[["df.residual"]] <- dfRes val[["RSE"]] <- RSE } attr(val, "groupsForm") <- attr(object, "groupsForm") class(val) <- "summary.lmList" val } # based on R's update.default update.lmList <- function (object, formula., ..., evaluate = TRUE) { call <- attr(object, "call") if (is.null(call)) stop("need an object with call component") extras <- match.call(expand.dots = FALSE)$... if (!missing(formula.)) call$object <- update.formula(formula(object), formula.) if(length(extras) > 0) { existing <- !is.na(match(names(extras), names(call))) ## do these individually to allow NULL to remove entries. for (a in names(extras)[existing]) call[[a]] <- extras[[a]] if(any(!existing)) { call <- c(as.list(call), extras[!existing]) call <- as.call(call) } } if(evaluate) eval(call, parent.frame()) else call } #update.lmList <- # function(object, formula, data, level, subset, na.action, pool, ...) #{ # thisCall <- as.list(match.call())[-(1:2)] # if (!missing(formula)) { # names(thisCall)[match(names(thisCall), "formula")] <- "object" # } # nextCall <- attr(object, "call") # nextCall[names(thisCall)] <- thisCall # if (!is.null(thisCall$object)) { # nextCall$object <- update(as.formula(nextCall$object), nextCall$object) # } # nextCall[[1]] <- quote(lmList) # eval(nextCall, envir = parent.frame(1)) #} nlme/R/corStruct.R0000644000176000001440000020301714662037430013561 0ustar ripleyusers### Classes of correlation structures ### ### Copyright 2005-2024 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # ### FIXME: For larger problems, the approach of corFactor() / corMatrix() of ### ------ of size sumLenSq := sum(len^2), len := table(groups) sucks ! ### Conceptually, one could consider using something like Matrix::sparseVector(.) ### but would have to deal with corresponding C code as well ! ##*## Generics that should be implemented for any corStruct class corFactor <- ## extractor for transpose inverse square root factor of corr matrix function(object, ...) UseMethod("corFactor") corMatrix <- ## extractor for correlation matrix or the transpose inverse ## square root matrix function(object, ...) UseMethod("corMatrix") ###*# Constructor ### There is no constructor function for this class (i.e. no function ### called corStruct) because the class is virtual. ## --- We now check 'sumLenSq' when it is first computed! ## .chkLenSq <- function(nn) { ## if(nn > .Machine$integer.max) ## stop(gettextf("'sumLenSq' = %g is too large (larger than maximal integer)", ## nn), domain = NA) ## else ## nn ## } ###*# Methods for local generics corFactor.corStruct <- function(object, ...) { if (!is.null(aux <- attr(object, "factor"))) { return(aux) } corD <- Dim(object) ## .chkLenSq(corD[["sumLenSq"]]) val <- .C(corStruct_factList, as.double(unlist(corMatrix(object))), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] attr(val, "logDet") <- lD val } corMatrix.corStruct <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { if (corr) { ## Do not know how to calculate the correlation matrix stop(gettextf("do not know how to calculate correlation matrix of %s object", dQuote(class(object)[1])), domain = NA) } else { ## transpose inverse square root corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), lengths(covariate)) } else rep(1, length(covariate))) val <- .C(corStruct_factList, as.double(unlist(corMatrix(object, covariate))), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } } ###*# Methods for standard generics as.matrix.corStruct <- function(x, ...) corMatrix(x) coef.corStruct <- ## Accessor for constrained or unconstrained parameters of ## corStruct objects function(object, unconstrained = TRUE, ...) { if (unconstrained) { if (is.null(isFix <- attr(object, "fixed"))) { stop("\"corStruct\" object must have a \"fixed\" attribute") } if (isFix) { numeric(0) } else { as.vector(object) } } else { stop(gettextf("do not know how to obtain parameters of %s object", dQuote(class(object)[1])), domain = NA) } } ## not used in nlme but for custom classes (some are in ape, covBM) `coef<-.corStruct` <- function(object, ..., value) { ## Assignment of the unconstrained parameter of corStruct objects value <- as.numeric(value) if (length(value) != length(object)) { stop("cannot change the length of the parameter of a \"corStruct\" object") } object[] <- value ## updating the factor list and logDet, by forcing a recalculation attr(object, "factor") <- NULL attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- NULL attr(object, "logDet") <- logDet(object) object } Dim.corStruct <- function(object, groups, ...) { if (missing(groups)) return(attr(object, "Dim")) ugrp <- unique(groups) groups <- factor(groups, levels = ugrp) ## Note: The 'start' logic assumes the data to be ordered by 'groups', ## but 'start' is only used for internal recalc() in model fitting ## functions and these re-order the data as needed. len <- table(groups) suml2 <- sum(len^2) if(suml2 > .Machine$integer.max) stop(gettextf( "'sumLenSq := sum(table(groups)^2)' = %g is too large. Too large or no groups in your correlation structure?", suml2), call. = FALSE, domain = NA) list(N = length(groups), M = length(len), maxLen = max(len), sumLenSq = suml2, len = len, start = match(ugrp, groups) - 1L) } formula.corStruct <- ## Accessor for the covariate formula function(x, ...) eval(attr(x, "formula")) getCovariate.corStruct <- function(object, form = formula(object), data) { if (!missing(form)) { form <- formula(object) warning("cannot change 'form'") } if (is.null(covar <- attr(object, "covariate"))) { # need to calculate it if (missing(data)) { stop("need data to calculate covariate of \"corStruct\" object") } covForm <- getCovariateFormula(form) grps <- if(!is.null(getGroupsFormula(form))) getGroups(object, data = data) ## else NULL if (length(all.vars(covForm)) > 0) { # primary covariate present if (is.null(grps)) { covar <- getCovariate(data, covForm) } else { if (all(all.vars(covForm) == sapply(splitFormula(covForm, "+"), function(el) deparse(el[[2]])))) { covar <- split(getCovariate(data, covForm), grps) } else { covar <- lapply(split(data, grps), getCovariate, covForm) } } } else { if (is.null(grps)) { covar <- 1:nrow(data) } else { covar <- lapply(split(grps, grps), seq_along) } } if (!is.null(grps)) { covar <- as.list(covar) } } covar } getGroups.corStruct <- function(object, form = formula(object), level, data, sep) { if (is.null(val <- attr(object, "groups"))) { # need to calculate if (!missing(data)) { if ((grpLev <- length(getGroupsFormula(form, asList = TRUE))) > 0) { ## use innermost grouping level val <- getGroups(data, form, level = grpLev) factor(val, levels = unique(as.character(val))) } else { rep(1, dim(data)[1]) } } else { NULL } } else { val } } Initialize.corStruct <- ## Initializes some attributes of corStruct objects function(object, data, ...) { ## might already be initialized, e.g., from ARMA(1,0) <-> AR1 methods form <- formula(object) ## obtaining the groups information, if any groups <- if (!is.null(getGroupsFormula(form))) { attr(object, "groups") <- getGroups(object, form, data = data) } else { # no groups as.factor(rep(1L, nrow(data))) } attr(object, "Dim") <- Dim(object, groups) ## obtaining the covariate(s) attr(object, "covariate") <- getCovariate(object, data = data) object } logDet.corStruct <- function(object, covariate = getCovariate(object), ...) { if (!is.null(aux <- attr(object, "logDet"))) { return(aux) } if (is.null(aux <- attr(object, "factor"))) { ## getting the transpose sqrt factor aux <- corMatrix(object, covariate = covariate, corr = FALSE) } if (is.null(aux1 <- attr(aux, "logDet"))) { ## checking for logDet attribute; if not present, get corr matrix aux <- corMatrix(object, covariate) sum(log(abs(if(is.list(aux)) unlist(lapply(aux, svd.d)) else svd.d(aux) )))/2 } else { -aux1 } } ## NB, no "nobs" logLik.corStruct <- function(object, data, ...) -logDet(object) needUpdate.corStruct <- function(object) FALSE print.corStruct <- function(x, ...) { if (length(aux <- coef(x, unconstrained = FALSE)) > 0) { cat("Correlation structure of class", class(x)[1], "representing\n") print(aux, ...) } else { cat("Uninitialized correlation structure of class", class(x)[1], "\n") } invisible(x) } print.summary.corStruct <- function(x, ...) { class(x) <- attr(x, "oClass") cat(paste0("Correlation Structure: ", attr(x, "structName"), "\n")) cat(paste(" Formula:", deparse(formula(x)),"\n")) cat(" Parameter estimate(s):\n") print(coef(x, unconstrained = FALSE), ...) invisible(x) } ## not used in nlme but for custom classes (some are in ape, covBM) recalc.corStruct <- function(object, conLin, ...) { conLin[["Xy"]][] <- .C(corStruct_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(unlist(corFactor(object))))[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + logLik(object) conLin } summary.corStruct <- function(object, structName = class(object)[1], ...) { attr(object, "structName") <- structName attr(object, "oClass") <- class(object) class(object) <- "summary.corStruct" object } update.corStruct <- function(object, data, ...) { object } ##*## Classes that substitute for (i.e. inherit from) corStruct ###*# corSymm - general, unstructured correlation ####* Constructor corSymm <- ## Constructor for the corSymm class function(value = numeric(0), form = ~ 1, fixed = FALSE) { attr(value, "formula") <- form attr(value, "fixed") <- fixed class(value) <- c("corSymm", "corStruct") value } ###*# Methods for local generics corFactor.corSymm <- function(object, ...) { corD <- Dim(object) val <- .C(symm_factList, as.double(as.vector(object)), as.integer(unlist(attr(object, "covariate"))), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] attr(val, "logDet") <- lD val } corMatrix.corSymm <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), lengths(covariate)) } else rep(1, length(covariate))) if (corr) { val <- .C(symm_matList, as.double(as.vector(object)), as.integer(unlist(covariate)), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), mat = double(corD[["sumLenSq"]]))[["mat"]] lD <- NULL } else { val <- .C(symm_factList, as.double(as.vector(object)), as.integer(unlist(covariate)), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] } if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } ###*# Methods for standard generics coef.corSymm <- function(object, unconstrained = TRUE, ...) { if (unconstrained) { if (attr(object, "fixed")) { return(numeric(0)) } else { return(as.vector(object)) } } mC <- attr(object, "maxCov") .C(symm_fullCorr, as.double(object), as.integer(mC), corr = double(round(mC * (mC - 1) / 2)))[["corr"]] } `coef<-.corSymm` <- function(object, ..., value) { if (length(value) != length(object)) { stop("cannot change the length of the parameter of a \"corSymm\" object") } object[] <- value corD <- attr(object, "Dim") ## updating the factor list and logDet aux <- .C(symm_factList, as.double(as.vector(object)), as.integer(unlist(getCovariate(object))), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] attr(object, "factor") <- aux[["factor"]] attr(object, "logDet") <- -aux[["logDet"]] object } Initialize.corSymm <- function(object, data, ...) { if (!is.null(attr(object, "maxCov"))) {# initialized - nothing to do return(object) } object <- NextMethod() covar <- attr(object, "covariate") if(!is.list(covar)) covar <- list(covar) if (any(lapply(covar, anyDuplicated) > 0)) { stop("covariate must have unique values within groups for \"corSymm\" objects") } covar <- unlist(covar) - 1 maxCov <- max(uCov <- unique(covar)) + 1 if (length(uCov) != maxCov) { stop("unique values of the covariate for \"corSymm\" objects must be a sequence of consecutive integers") } if (Dim(object)[["M"]] > 1) { attr(object, "covariate") <- split(covar, getGroups(object)) } else { attr(object, "covariate") <- covar } attr(object, "maxCov") <- maxCov natPar <- as.vector(object) if (length(natPar) > 0) { ## parameters assumed in constrained form if (length(natPar) != round(maxCov * (maxCov - 1) / 2)) { stop("initial value for \"corSymm\" parameters of wrong dimension") } if (max(abs(natPar)) >= 1) { stop("initial values for \"corSymm\" must be between -1 and 1") } natMat <- diag(maxCov)/2 natMat[lower.tri(natMat)] <- natPar natMat <- t(natMat) + natMat ## checking if positive-definite if (any(eigen(natMat, symmetric=TRUE, only.values=TRUE)$values <= 0)) { stop("initial values for \"corSymm\" do not define a positive-definite correlation structure") } natMat <- chol(natMat) uncPar <- numeric(0) for(i in 2:maxCov) { aux <- acos(natMat[1:(i-1),i]/sqrt(cumsum(natMat[i:1,i]^2)[i:2])) uncPar <- c(uncPar, log(aux/(pi - aux))) } coef(object) <- uncPar } else { # initializing the parameters oldAttr <- attributes(object) object <- double(round(maxCov * (maxCov - 1) / 2)) attributes(object) <- oldAttr attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") } object } print.corSymm <- function(x, ...) { if (length(as.vector(x)) > 0 && !is.null(mC <- attr(x, "maxCov"))) { aux <- coef.corSymm(x, unconstrained = FALSE) val <- diag(mC) dimnames(val) <- list(1:mC, 1:mC) val[lower.tri(val)] <- aux class(val) <- "correlation" cat("Correlation structure of class corSymm representing\n") print(val, ...) } else cat("Uninitialized correlation structure of class corSymm\n") invisible(x) } print.summary.corSymm <- function(x, ...) { if (length(as.vector(x)) > 0 && !is.null(mC <- attr(x, "maxCov"))) { cat("Correlation Structure: General\n") cat(paste(" Formula:", deparse(formula(x)),"\n")) cat(" Parameter estimate(s):\n") val <- diag(mC) dimnames(val) <- list(1:mC, 1:mC) val[lower.tri(val)] <- coef.corSymm(x, unconstrained = FALSE) class(val) <- "correlation" print(val, ...) } else cat("Uninitialized correlation structure of class corSymm\n") invisible(x) } recalc.corSymm <- function(object, conLin, ...) { val <- .C(symm_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(as.vector(object)), as.integer(unlist(getCovariate(object))), as.integer(attr(object, "maxCov")), logLik = double(1))[c("Xy", "logLik")] conLin[["Xy"]][] <- val[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] conLin } summary.corSymm <- function(object, structName = "General correlation", ...) { attr(object, "structName") <- structName class(object) <- "summary.corSymm" object } ###*# corNatural - general correlation in natural parametrization ####* Constructor corNatural <- function(value = numeric(0), form = ~ 1, fixed = FALSE) { attr(value, "formula") <- form attr(value, "fixed") <- fixed class(value) <- c("corNatural", "corStruct") value } ###*# Methods for local generics corFactor.corNatural <- function(object, ...) { corD <- Dim(object) val <- .C(nat_factList, as.double(as.vector(object)), as.integer(unlist(attr(object, "covariate"))), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] attr(val, "logDet") <- lD val } corMatrix.corNatural <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), lengths(covariate)) } else rep(1, length(covariate))) if (corr) { val <- .C(nat_matList, as.double(as.vector(object)), as.integer(unlist(covariate)), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), mat = double(corD[["sumLenSq"]]))[["mat"]] lD <- NULL } else { val <- .C(nat_factList, as.double(as.vector(object)), as.integer(unlist(covariate)), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] } if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } ###*# Methods for standard generics coef.corNatural <- function(object, unconstrained = TRUE, ...) { if (unconstrained) { if (attr(object, "fixed")) { return(numeric(0)) } else { return(as.vector(object)) } } mC <- attr(object, "maxCov") val <- .C(nat_fullCorr, as.double(object), as.integer(mC), corr = double(round(mC * (mC - 1) / 2)))[["corr"]] names(val) <- outer(1:mC, 1:mC, function(x,y) paste0("cor(",y,",",x,")"))[ lower.tri(diag(mC))] val } `coef<-.corNatural` <- function(object, ..., value) { if (length(value) != length(object)) { stop("cannot change the length of the parameter of a \"corNatural\" object") } object[] <- value corD <- attr(object, "Dim") ## updating the factor list and logDet aux <- .C(nat_factList, as.double(as.vector(object)), as.integer(unlist(getCovariate(object))), as.integer(attr(object, "maxCov")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] attr(object, "factor") <- aux[["factor"]] attr(object, "logDet") <- -aux[["logDet"]] object } Initialize.corNatural <- function(object, data, ...) { if (!is.null(attr(object, "maxCov"))) {# initialized - nothing to do return(object) } object <- NextMethod() covar <- attr(object, "covariate") if(!is.list(covar)) covar <- list(covar) if (any(lapply(covar, anyDuplicated) > 0)) { stop("covariate must have unique values within groups for \"corNatural\" objects") } covar <- unlist(covar) - 1 maxCov <- max(uCov <- unique(covar)) + 1 if (length(uCov) != maxCov) { stop("unique values of the covariate for \"corNatural\" objects must be a sequence of consecutive integers") } if (Dim(object)[["M"]] > 1) { attr(object, "covariate") <- split(covar, getGroups(object)) } else { attr(object, "covariate") <- covar } attr(object, "maxCov") <- maxCov natPar <- as.vector(object) if (length(natPar) > 0) { ## parameters assumed in constrained form if (length(natPar) != round(maxCov * (maxCov - 1) / 2)) { stop("initial value for \"corNatural\" parameters of wrong dimension") } if (max(abs(natPar)) >= 1) { stop("initial values for \"corNatural\" must be between -1 and 1") } natMat <- diag(maxCov)/2 natMat[lower.tri(natMat)] <- natPar natMat <- t(natMat) + natMat ## checking if positive-definite if (any(eigen(natMat, symmetric=TRUE, only.values=TRUE)$values <= 0)) { stop("initial values for \"corNatural\" do not define a positive-definite correlation structure") } coef(object) <- log((natPar + 1)/(1 - natPar)) } else { # initializing the parameters oldAttr <- attributes(object) object <- double(round(maxCov * (maxCov - 1) / 2)) attributes(object) <- oldAttr attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") } object } print.corNatural <- function(x, ...) { if (length(as.vector(x)) > 0 && !is.null(mC <- attr(x, "maxCov"))) { aux <- coef(x, FALSE) val <- diag(mC) dimnames(val) <- list(1:mC, 1:mC) val[lower.tri(val)] <- aux class(val) <- "correlation" cat("Correlation structure of class corNatural representing\n") print(val, ...) } else cat("Uninitialized correlation structure of class corNatural\n") invisible(x) } print.summary.corNatural <- function(x, ...) { if (length(as.vector(x)) > 0 && !is.null(mC <- attr(x, "maxCov"))) { cat("Correlation Structure: General, with natural parametrization\n") cat(paste(" Formula:", deparse(formula(x)),"\n")) cat(" Parameter estimate(s):\n") aux <- coef.corNatural(x, FALSE) val <- diag(mC) dimnames(val) <- list(1:mC, 1:mC) val[lower.tri(val)] <- aux class(val) <- "correlation" print(val, ...) } else cat("Uninitialized correlation structure of class corNatural\n") invisible(x) } recalc.corNatural <- function(object, conLin, ...) { val <- .C(nat_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(as.vector(object)), as.integer(unlist(getCovariate(object))), as.integer(attr(object, "maxCov")), logLik = double(1))[c("Xy", "logLik")] conLin[["Xy"]][] <- val[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] conLin } summary.corNatural <- function(object, structName = "General correlation, with natural parametrization", ...) { attr(object, "structName") <- structName class(object) <- "summary.corNatural" object } ###*# corIdent - independent structure === DEPRECATED ####* Constructor corIdent <- ## Constructor for the corIdent class function(form = NULL) { .Deprecated( msg = paste0( "The \"corIdent\" class is deprecated.\n", "Use argument 'correlation = NULL' for uncorrelated errors in model functions." ), package = "nlme") value <- numeric(0) attr(value, "formula") <- form attr(value, "fixed") <- TRUE class(value) <- c("corIdent", "corStruct") value } ###*# Methods for local generics corMatrix.corIdent <- function(object, covariate = getCovariate(object), corr, ...) { .Deprecated(package="nlme", old = "corMatrix.corIdent(): \"corIdent\" class") if(is.list(covariate)) {# by group as.list(lapply(covariate, function(el, object) corMatrix(object, el))) } else { diag(length(covariate)) } } ###*# Methods for standard generics coef.corIdent <- function(object, unconstrained = TRUE, ...) numeric(0) `coef<-.corIdent` <- function(object, ..., value) object Initialize.corIdent <- function(object, data, ...) { .Deprecated(package="nlme", old = "Initialize.corIdent(): \"corIdent\" class") attr(object, "logDet") <- 0 object } logDet.corIdent <- function(object, covariate, ...) 0 recalc.corIdent <- function(object, conLin, ...) conLin summary.corIdent <- function(object, structName = "Independent", ...) { .Deprecated(package="nlme", old = "summary.corIdent(): \"corIdent\" class") summary.corStruct(object, structName) } ###*# corAR1 - autoregressive of order one structure ####* Constructor corAR1 <- ## Constructor for the corAR1 class function(value = 0, form = ~ 1, fixed = FALSE) { if (abs(value) >= 1) { stop("parameter in AR(1) structure must be between -1 and 1") } value <- log((1 + value)/( 1 - value)) attr(value, "formula") <- form attr(value, "fixed") <- fixed class(value) <- c("corAR1", "corStruct") value } ###*# Methods for local generics corFactor.corAR1 <- function(object, ...) { corD <- Dim(object) if(corD[["sumLenSq"]] > .Machine$integer.max) stop(gettextf("'sumLenSq' = %g is too large (larger than maximal integer)", corD[["sumLenSq"]]), domain = NA) val <- .C(AR1_factList, as.double(as.vector(object)), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), ## of size n^2 -- too large !! logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] attr(val, "logDet") <- lD val } corMatrix.corAR1 <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), lengths(covariate)) } else rep(1, length(covariate))) if (corr) { val <- .C(AR1_matList, as.double(as.vector(object)), as.integer(unlist(corD)), mat = double(corD[["sumLenSq"]]))[["mat"]] lD <- NULL } else { val <- .C(AR1_factList, as.double(as.vector(object)), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] } if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } ###*# Methods for standard generics coef.corAR1 <- function(object, unconstrained = TRUE, ...) { if (unconstrained) { if (attr(object, "fixed")) { return(numeric(0)) } else { return(as.vector(object)) } } aux <- exp(as.vector(object)) aux <- c((aux - 1)/(aux + 1)) names(aux) <- "Phi" aux } `coef<-.corAR1` <- function(object, ..., value) { if (length(value) != length(object)) { stop("cannot change the length of the parameter of a \"corAR1\" object") } object[] <- value corD <- attr(object, "Dim") ## updating the factor list and logDet aux <- .C(AR1_factList, as.double(as.vector(object)), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] attr(object, "factor") <- aux[["factor"]] attr(object, "logDet") <- -aux[["logDet"]] object } Initialize.corAR1 <- ## Initializes corAR1 objects function(object, data, ...) { object <- NextMethod() covar <- attr(object, "covariate") if(!is.list(covar)) covar <- list(covar) if (any(lapply(covar, anyDuplicated) > 0)) { stop("covariate must have unique values within groups for \"corAR1\" objects") } if (any(unlist(lapply(covar, diff)) != 1)) { ## Cannot use formulas for inverse of square root matrix ## will convert to class ARMA(1,0) attr(object, "p") <- 1 attr(object, "q") <- 0 class(object) <- c("corARMA", "corStruct") Initialize(object, data) } else { ## obtaining the factor list and logDet attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") object } } recalc.corAR1 <- function(object, conLin, ...) { val <- .C(AR1_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(as.vector(object)), logLik = double(1))[c("Xy", "logLik")] conLin[["Xy"]][] <- val[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] conLin } summary.corAR1 <- function(object, structName = "AR(1)", ...) { summary.corStruct(object, structName) } ####*# corCAR1 - continuous time autoregressive of order one structure #####* Constructor corCAR1 <- ## Constructor for the corCAR1 class function(value = 0.2, form = ~ 1, fixed = FALSE) { if (value <= 0 | value >= 1) { stop("parameter in CAR(1) structure must be between 0 and 1") } value <- log(value / (1 - value)) attr(value, "formula") <- form attr(value, "fixed") <- fixed class(value) <- c("corCAR1", "corStruct") value } ###*# Methods for local generics corFactor.corCAR1 <- function(object, ...) { corD <- Dim(object) val <- .C(CAR1_factList, as.double(as.vector(object)), as.double(unlist(attr(object, "covariate"))), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] attr(val, "logDet") <- lD val } corMatrix.corCAR1 <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), lengths(covariate)) } else rep(1, length(covariate))) if (corr) { val <- .C(CAR1_matList, as.double(as.vector(object)), as.double(unlist(covariate)), as.integer(unlist(corD)), mat = double(corD[["sumLenSq"]]))[["mat"]] lD <- NULL } else { val <- .C(CAR1_factList, as.double(as.vector(object)), as.double(unlist(covariate)), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] } if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } ###*# Methods for standard generics coef.corCAR1 <- function(object, unconstrained = TRUE, ...) { if (unconstrained) { if (attr(object, "fixed")) { return(numeric(0)) } else { return(as.vector(object)) } } aux <- c(exp(as.vector(object))) aux <- aux/(1+aux) names(aux) <- "Phi" aux } `coef<-.corCAR1` <- function(object, ..., value) { if (length(value) != length(object)) { stop("cannot change the length of the parameter of a \"corCAR1\" object") } object[] <- value corD <- attr(object, "Dim") ## updating the factor list and logDet aux <- .C(CAR1_factList, as.double(as.vector(object)), as.double(unlist(getCovariate(object))), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] attr(object, "factor") <- aux[["factor"]] attr(object, "logDet") <- -aux[["logDet"]] object } Initialize.corCAR1 <- ## Initializes corCAR1 objects function(object, data, ...) { object <- NextMethod() covar <- attr(object, "covariate") if(!is.list(covar)) covar <- list(covar) if (any(lapply(covar, anyDuplicated) > 0)) { stop("covariate must have unique values within groups for \"corCAR1\" objects") } attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") object } recalc.corCAR1 <- function(object, conLin, ...) { val <- .C(CAR1_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(as.vector(object)), as.double(unlist(getCovariate(object))), logLik = double(1))[c("Xy", "logLik")] conLin[["Xy"]][] <- val[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] conLin } summary.corCAR1 <- function(object, structName = "Continuous AR(1)", ...) { summary.corStruct(object, structName) } ###*# corARMA - autoregressive-moving average structures ####* Constructor corARMA <- ## Constructor for the corARMA class function(value = double(p + q), form = ~ 1, p = 0, q = 0, fixed = FALSE) { if (!(p >= 0 && (p == round(p)))) { stop("autoregressive order must be a non-negative integer") } if (!(q >= 0 && (q == round(q)))) { stop("moving average order must be a non-negative integer") } if (0 == (p + q)) { stop("at least one of 'p' and 'q' must be > 0") } if (length(value) != p + q) { stop("initial value for parameter of wrong length") } if (max(abs(value)) >= 1) { stop("parameters in ARMA structure must be < 1 in absolute value") } ## unconstrained parameters value <- .C(ARMA_unconstCoef, as.integer(p), as.integer(q), pars = as.double(value))$pars attributes(value) <- list(formula = form, p = p, q = q, fixed = fixed) class(value) <- c("corARMA", "corStruct") value } ###*# Methods for local generics corFactor.corARMA <- function(object, ...) { maxLag <- attr(object, "maxLag") if(is.null(maxLag)) stop("'object' has not been Initialize()d") corD <- Dim(object) val <- .C(ARMA_factList, as.double(as.vector(object)), as.integer(attr(object, "p")), as.integer(attr(object, "q")), as.integer(unlist(attr(object, "covariate"))), as.integer(attr(object, "maxLag")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] attr(val, "logDet") <- lD val } corMatrix.corARMA <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), lengths(covariate)) } else rep(1, length(covariate))) p <- attr(object, "p") q <- attr(object, "q") maxLag <- attr(object, "maxLag") if(is.null(maxLag)) stop("'object' has not been Initialize()d") if (corr) { val <- .C(ARMA_matList, as.double(as.vector(object)), as.integer(p), as.integer(q), as.integer(unlist(covariate)), as.integer(maxLag), as.integer(unlist(corD)), mat = double(corD[["sumLenSq"]]))[["mat"]] lD <- NULL } else { val <- .C(ARMA_factList, as.double(as.vector(object)), as.integer(attr(object, "p")), as.integer(attr(object, "q")), as.integer(unlist(covariate)), as.integer(attr(object, "maxLag")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] } if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } ###*# Methods for standard generics coef.corARMA <- function(object, unconstrained = TRUE, ...) { if (attr(object, "fixed") && unconstrained) { return(numeric(0)) } val <- as.vector(object) if (!unconstrained) { p <- attr(object, "p") q <- attr(object, "q") nams <- NULL if (p > 0) { nams <- paste(rep("Phi", p), 1:p, sep="") } if (q > 0) { nams <- c(nams, paste(rep("Theta", q), 1:q, sep="")) } val <- c(.C(ARMA_constCoef, as.integer(attr(object,"p")), as.integer(attr(object,"q")), pars = as.double(val))$pars) names(val) <- nams } val } `coef<-.corARMA` <- function(object, ..., value) { maxLag <- attr(object, "maxLag") if(is.null(maxLag)) stop("'object' has not been Initialize()d") if (length(value) != length(object)) { stop("cannot change the length of the parameter of a \"corARMA\" object") } p <- attr(object, "p") q <- attr(object, "q") object[] <- value ## updating the factor list and logDet corD <- Dim(object) aux <- .C(ARMA_factList, as.double(as.vector(object)), as.integer(p), as.integer(q), as.integer(unlist(getCovariate(object))), as.integer(attr(object, "maxLag")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] attr(object, "factor") <- aux[["factor"]] attr(object, "logDet") <- -aux[["logDet"]] object } Initialize.corARMA <- function(object, data, ...) { ## Initializes corARMA objects object <- NextMethod() covar <- attr(object, "covariate") if(!is.list(covar)) covar <- list(covar) covar <- lapply(covar, as.integer) if (any(lapply(covar, anyDuplicated) > 0)) { stop("covariate must have unique integer values within groups for \"corARMA\" objects") } p <- attr(object, "p") q <- attr(object, "q") if (p == 1 && q == 0 && all(unlist(lapply(covar, diff)) == 1)) { ## Use AR1 methods instead class(object) <- c("corAR1", "corStruct") Initialize(object, data) } else { maxLag <- max(unlist(lapply(covar, function(el) diff(range(el))))) if (p > maxLag || q > maxLag) { stop(gettextf("\"corARMA\" order (%g, %g) exceeds maximum lag in data (%g)", p, q, maxLag), domain = NA) } attr(object, "maxLag") <- maxLag attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") object } } recalc.corARMA <- function(object, conLin, ...) { maxLag <- attr(object, "maxLag") if(is.null(maxLag)) stop("'object' has not been Initialize()d") val <- .C(ARMA_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(as.vector(object)), as.integer(attr(object, "p")), as.integer(attr(object, "q")), as.integer(unlist(getCovariate(object))), as.integer(attr(object, "maxLag")), logLik = double(1))[c("Xy", "logLik")] conLin[["Xy"]][] <- val[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] conLin } summary.corARMA <- function(object, structName = paste("ARMA(",attr(object,"p"),",", attr(object,"q"), ")", sep = ""), ...) { summary.corStruct(object, structName) } ###*# corCompSymm - Compound symmetry structure structure ####* Constructor corCompSymm <- ## Constructor for the corCompSymm class function(value = 0, form = ~ 1, fixed = FALSE) { if (abs(value) >= 1) { stop("parameter in \"corCompSymm\" structure must be < 1 in absolute value") } attr(value, "formula") <- form attr(value, "fixed") <- fixed class(value) <- c("corCompSymm", "corStruct") value } ###*# Methods for local generics corFactor.corCompSymm <- function(object, ...) { corD <- Dim(object) val <- .C(compSymm_factList, as.double(as.vector(object)), as.double(attr(object, "inf")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] attr(val, "logDet") <- lD val } corMatrix.corCompSymm <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), lengths(covariate)) } else rep(1, length(covariate))) if (corr) { val <- .C(compSymm_matList, as.double(as.vector(object)), as.double(attr(object, "inf")), as.integer(unlist(corD)), mat = double(corD[["sumLenSq"]]))[["mat"]] lD <- NULL } else { val <- .C(compSymm_factList, as.double(as.vector(object)), as.double(attr(object, "inf")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] } if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } ###*# Methods for local generics coef.corCompSymm <- function(object, unconstrained = TRUE, ...) { if (unconstrained) { if (attr(object, "fixed")) { return(numeric(0)) } else { return(as.vector(object)) } } val <- exp(as.vector(object)) val <- c((val + attr(object, "inf"))/(val + 1)) names(val) <- "Rho" val } `coef<-.corCompSymm` <- function(object, ..., value) { if (length(value) != length(object)) { stop("cannot change the length of the parameter of a \"corCompSymm\" object") } object[] <- value corD <- attr(object, "Dim") ## updating the factor list and logDet aux <- .C(compSymm_factList, as.double(as.vector(object)), as.double(attr(object, "inf")), as.integer(unlist(corD)), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] attr(object, "factor") <- aux[["factor"]] attr(object, "logDet") <- -aux[["logDet"]] object } Initialize.corCompSymm <- ## Initializes corCompSymm objects function(object, data, ...) { if (!is.null(attr(object, "inf"))) { # initialized - nothing to do return(object) } object <- NextMethod() natPar <- as.vector(object) corD <- Dim(object) if (natPar <= (attr(object, "inf") <- -1/(corD[["maxLen"]] - 1))) { stop(gettextf("initial value in \"corCompSymm\" must be greater than %s", attr(object, "inf")), domain = NA) } object[] <- log((natPar - attr(object, "inf"))/(1 - natPar)) attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") object } print.corCompSymm <- function(x, ...) { if (length(as.vector(x)) > 0 && !is.null(attr(x, "inf"))) { NextMethod() } else { cat("Uninitialized correlation structure of class corCompSymm\n") invisible(x) } } print.summary.corCompSymm <- print.corCompSymm recalc.corCompSymm <- function(object, conLin, ...) { val <- .C(compSymm_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(as.vector(object)), as.double(attr(object, "inf")), logLik = double(1))[c("Xy", "logLik")] conLin[["Xy"]][] <- val[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] conLin } summary.corCompSymm <- function(object, structName = "Compound symmetry", ...) { object <- summary.corStruct(object, structName) class(object) <- c("summary.corCompSymm", class(object)) object } ####*# corHF - Huyn-Feldt structure #corHF <- # ## Constructor for the corHuynFeldt class # function(value = numeric(0), form = ~ 1) #{ # attr(value, "formula") <- form # class(value) <- c("corHF", "corStruct") # value #} ####*# Methods for local generics #corFactor.corHF <- # function(object) #{ # corD <- Dim(object) # val <- .C("HF_factList", # as.double(as.vector(object)), # as.integer(attr(object, "maxCov")), # as.integer(unlist(getCovariate(object))), # as.integer(unlist(corD)), # factor = double(corD[["sumLenSq"]]), # logDet = double(1))[c("factor", "logDet")] # lD <- val[["logDet"]] # val <- val[["factor"]] # attr(val, "logDet") <- lD # val #} #corMatrix.corHF <- # function(object, covariate = getCovariate(object), corr = TRUE) #{ # corD <- Dim(object, # if(is.list(covariate)) { # if (is.null(names(covariate))) # names(covariate) <- seq_along(covariate) # rep(names(covariate), lengths(covariate)) # } else # rep(1, length(covariate))) # if (corr) { # val <- .C("HF_matList", # as.double(as.vector(object)), # as.integer(attr(object, "maxCov")), # as.integer(unlist(covariate)), # as.integer(unlist(corD)), # mat = double(corD[["sumLenSq"]]))[["mat"]] # lD <- NULL # } else { # val <- .C("HF_factList", # as.double(as.vector(object)), # as.integer(attr(object, "maxCov")), # as.integer(unlist(covariate)), # as.integer(unlist(corD)), # factor = double(corD[["sumLenSq"]]), # logDet = double(1))[c("factor", "logDet")] # lD <- val[["logDet"]] # val <- val[["factor"]] # } # if (corD[["M"]] > 1) { # val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) # val <- lapply(val, function(el) { # nel <- round(sqrt(length(el))) # array(el, c(nel, nel)) # }) # names(val) <- names(corD[["len"]]) # } else { # val <- array(val, c(corD[["N"]], corD[["N"]])) # } # attr(val, "logDet") <- lD # val #} ####*# Methods for standard generics #coef.corHF <- # function(object, unconstrained = TRUE) #{ # aux <- as.vector(object) # if (!unconstrained) { # aux <- 2 * (exp(aux) + attr(object, "inf")) + 1 # } # aux #} #"coef<-.corHF" <- # function(object, value) #{ # if (length(value) != length(object)) { # stop("Cannot change the length of the parameter of a corStruct object") # } # object[] <- value # corD <- attr(object, "Dim") # ## updating the factor list and logDet # aux <- .C("HF_factList", # as.double(as.vector(object)), # as.integer(attr(object, "maxCov")), # as.integer(unlist(getCovariate(object))), # as.integer(unlist(corD)), # factor = double(corD[["sumLenSq"]]), # logDet = double(1))[c("factor", "logDet")] # attr(object, "factor") <- aux[["factor"]] # attr(object, "logDet") <- -aux[["logDet"]] # object #} #initialize.corHF <- # function(object, data, ...) #{ # if (!is.null(attr(object, "inf"))) { # initialized - nothing to do # return(object) # } # object <- NextMethod() # covar <- attr(object, "covariate") # if (is.list(covar)) { # attr(object, "covariate") <- covar <- # lapply(covar, function(el) el - 1) # } else { # attr(object, "covariate") <- covar <- covar - 1 # covar <- list(covar) # } # if (any(unlist(lapply(covar, duplicated)))) { # stop(paste("Covariate must have unique values", # "within groups for corHF objects")) # } # maxCov <- max(uCov <- unique(unlist(covar))) + 1 # if (length(uCov) != maxCov) { # stop(paste("Unique values of the covariate for \"corHF\"", # "objects must be a sequence of consecutive integers")) # } # attr(object, "maxCov") <- maxCov # attr(object, "inf") <- -1/(2*maxCov) # natPar <- as.vector(object) # if (length(natPar) > 0) { # if (length(aux) != attr(object, "maxCov")) # stop("Initial value for Huyn-Feldt parameters of wrong dimension") # ## verifying if initial values satisfy constraints # if (any(natPar <= attr(object, "inf"))) { # stop(paste("Initial values for \"corHF\" parameters", # "must be > than", attr(object, "inf"))) # } # object[] <- log(natPar - attr(object, "inf")) # } else { # initializing the parameters # oldAttr <- attributes(object) # object <- log(rep(-attr(object, "inf"), att(object, "maxCov"))) # attributes(object) <- oldAttr # } # attr(object, "factor") <- corFactor(object) # attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") # object #} #print.corHF <- # function(x, ...) #{ # if (length(as.vector(x)) > 0 && !is.null(attr(object, "maxCov"))) # NextMethod() # else cat("Uninitialized correlation structure of class corHF\n") #} #recalc.corHF <- # function(object, conLin) #{ # val <- # .C("HF_recalc", # Xy = as.double(conLin[["Xy"]]), # as.integer(unlist(Dim(object))), # as.integer(ncol(conLin[["Xy"]])), # as.double(as.vector(object)), # as.integer(unlist(getCovariate(object))), # as.integer(attr(object, "maxCov")), # logLik = double(1))[c("Xy", "logLik")] # conLin[["Xy"]][] <- val[["Xy"]] # conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] # conLin #} #summary.corHF <- # function(object, structName = "Huyn-Feldt") #{ # summary.corStruct(object, structName) #} ###*# corSpatial - a virtual class of spatial correlation structures ###*# Constructor corSpatial <- ## Constructor for the corSpatial class function(value = numeric(0), form = ~ 1, nugget = FALSE, type = c("spherical", "exponential", "gaussian", "linear", "rational"), metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE) { spClass <- c(spherical = "corSpher", exponential = "corExp", gaussian = "corGaus", linear = "corLin", rational = "corRatio")[match.arg(type)] structure(value, "formula" = form, "nugget" = nugget, "metric" = match.arg(metric), "fixed" = fixed, class = c(spClass, "corSpatial", "corStruct")) } ###*# Methods for local generics corFactor.corSpatial <- function(object, ...) { corD <- Dim(object) val <- .C(spatial_factList, as.double(as.vector(object)), as.integer(attr(object, "nugget")), as.double(unlist(getCovariate(object))), as.integer(unlist(corD)), as.double(attr(object, "minD")), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] structure(val[["factor"]], logDet = val[["logDet"]]) } corMatrix.corSpatial <- function(object, covariate = getCovariate(object), corr = TRUE, ...) { ## the default 'covariate' excludes 1-obs groups (empty distance) nRt <- function(vec) round((1 + sqrt(1 + 8 * length(vec))) / 2) corD <- Dim(object, if(is.list(covariate)) { if (is.null(names(covariate))) names(covariate) <- seq_along(covariate) rep(names(covariate), vapply(covariate, nRt, numeric(1))) } else rep(1, nRt(covariate))) if (corr) { val <- .C(spatial_matList, as.double(as.vector(object)), as.integer(attr(object, "nugget")), as.double(unlist(covariate)), as.integer(unlist(corD)), as.double(attr(object, "minD")), mat = double(corD[["sumLenSq"]]))[["mat"]] lD <- NULL } else { val <- .C(spatial_factList, as.double(as.vector(object)), as.integer(attr(object, "nugget")), as.double(unlist(covariate)), as.integer(unlist(corD)), as.double(attr(object, "minD")), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] lD <- val[["logDet"]] val <- val[["factor"]] } if (corD[["M"]] > 1) { val <- split(val, rep(1:corD[["M"]], (corD[["len"]])^2)) val <- lapply(val, function(el) { nel <- round(sqrt(length(el))) array(el, c(nel, nel)) }) names(val) <- names(corD[["len"]]) val <- as.list(val) } else { val <- array(val, c(corD[["N"]], corD[["N"]])) } attr(val, "logDet") <- lD val } ###*# Methods for standard generics coef.corSpatial <- function(object, unconstrained = TRUE, ...) { if (attr(object, "fixed") && unconstrained) { return(numeric(0)) } val <- as.vector(object) if (length(val) == 0) { # uninitialized return(val) } if (!unconstrained) { val <- exp(val) if (attr(object, "nugget")) val[2] <- val[2]/(1+val[2]) } names(val) <- if(attr(object, "nugget")) c("range", "nugget") else "range" val } `coef<-.corSpatial` <- function(object, ..., value) { if (length(value) != length(object)) { stop("cannot change the length of the parameter after initialization") } object[] <- value corD <- attr(object, "Dim") ## updating the factor list and logDet aux <- .C(spatial_factList, as.double(as.vector(object)), as.integer(attr(object, "nugget")), as.double(unlist(getCovariate(object))), as.integer(unlist(corD)), as.double(attr(object, "minD")), factor = double(corD[["sumLenSq"]]), logDet = double(1))[c("factor", "logDet")] attr(object, "factor") <- aux[["factor"]] attr(object, "logDet") <- -aux[["logDet"]] object } Dim.corSpatial <- function(object, groups, ...) { if (missing(groups)) return(attr(object, "Dim")) val <- Dim.corStruct(object, groups) val[["start"]] <- c(0, cumsum(val[["len"]] * (val[["len"]] - 1)/2)[-val[["M"]]]) ## will use third component of Dim list for spClass names(val)[3] <- "spClass" val[[3]] <- match(class(object)[1], c("corSpher", "corExp", "corGaus", "corLin", "corRatio"), 0) val } getCovariate.corSpatial <- function(object, form = formula(object), data) { if (is.null(covar <- attr(object, "covariate"))) { # need to calculate it if (missing(data)) { stop("need data to calculate covariate") } covForm <- getCovariateFormula(form) covar <- if (length(all.vars(covForm)) > 0) { # covariate present if (attr(terms(covForm), "intercept") == 1) { covForm <- eval(substitute(~ CV - 1, list(CV = covForm[[2]]))) } as.data.frame(unclass( model.matrix(covForm, model.frame(covForm, data, drop.unused.levels = TRUE)))) } ## else NULL covar <- if (!is.null(getGroupsFormula(form))) { # by groups grps <- getGroups(object, data = data) grps <- if (is.null(covar)) { lapply(split(grps, grps), function(x) as.vector(dist(seq_along(x)))) } else { lapply(split(covar, grps), function(el, metric) { el <- as.matrix(el) if (nrow(el) > 1) as.vector(dist(el, metric)) else numeric(0) }, metric = attr(object, "metric")) } grps[lengths(grps) > 0]# no 1-obs groups } else { # no groups as.vector( if (is.null(covar)) dist(1:nrow(data)) else dist(as.matrix(covar), method = attr(object, "metric"))) } if (any(unlist(covar) == 0)) { stop("cannot have zero distances in \"corSpatial\"") } } covar } Initialize.corSpatial <- function(object, data, ...) { if (!is.null(attr(object, "minD"))) { #already initialized return(object) } object <- Initialize.corStruct(object, data) nug <- attr(object, "nugget") val <- as.vector(object) if (length(val) > 0) { # initialized if (val[1] <= 0) { stop("'range' must be > 0 in \"corSpatial\" initial value") } if (nug) { # with nugget effect if (length(val) == 1) { # assuming nugget effect not given val <- c(val, 0.1) # setting it to 0.1 } else { if (length(val) != 2) { stop("initial value for \"corSpatial\" parameters of wrong dimension") } } if ((val[2] <= 0) || (val[2] >= 1)) { stop("initial value of nugget ratio must be between 0 and 1") } } else { # only range parameter if (length(val) != 1) { stop("initial value for \"corSpatial\" parameters of wrong dimension") } } } else { val <- min(unlist(attr(object, "covariate"))) * 0.9 if (nug) val <- c(val, 0.1) } val[1] <- log(val[1]) if (nug) val[2] <- log(val[2]/(1 - val[2])) oldAttr <- attributes(object) object <- val attributes(object) <- oldAttr attr(object, "minD") <- min(unlist(attr(object, "covariate"))) attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") object } recalc.corSpatial <- function(object, conLin, ...) { val <- .C(spatial_recalc, Xy = as.double(conLin[["Xy"]]), as.integer(unlist(Dim(object))), as.integer(ncol(conLin[["Xy"]])), as.double(as.vector(object)), as.double(unlist(getCovariate(object))), as.double(attr(object, "minD")), as.integer(attr(object, "nugget")), logLik = double(1))[c("Xy", "logLik")] conLin[["Xy"]][] <- val[["Xy"]] conLin[["logLik"]] <- conLin[["logLik"]] + val[["logLik"]] conLin } Variogram.corSpatial <- function(object, distance = NULL, sig2 = 1, length.out = 50, FUN, ...) { if (is.null(distance)) { rangeDist <- range(unlist(getCovariate(object))) distance <- seq(rangeDist[1], rangeDist[2], length.out = length.out) } params <- coef(object, unconstrained = FALSE) if (length(params) == 1) { # no nugget effect rang <- params nugg <- 0 } else { # nugget effect rang <- params[1] nugg <- params[2] } val <- data.frame(variog = sig2 * (nugg + (1 - nugg) * FUN(distance, rang)), dist = distance) class(val) <- c("Variogram", "data.frame") val } ###*# corExp - exponential spatial correlation structure corExp <- ## Constructor for the corExp class function(value = numeric(0), form = ~ 1, nugget = FALSE, metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE) { attr(value, "formula") <- form attr(value, "nugget") <- nugget attr(value, "metric") <- match.arg(metric) attr(value, "fixed") <- fixed class(value) <- c("corExp", "corSpatial", "corStruct") value } ###*# Methods for standard generics summary.corExp <- function(object, structName = "Exponential spatial correlation", ...) { summary.corStruct(object, structName) } Variogram.corExp <- function(object, distance = NULL, sig2 = 1, length.out = 50, ...) { Variogram.corSpatial(object, distance, sig2, length.out, function(x, y) { 1 - exp(-x/y) }) } ###*# corGaus - Gaussian spatial correlation structure corGaus <- ## Constructor for the corGaus class function(value = numeric(0), form = ~ 1, nugget = FALSE, metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE) { attr(value, "formula") <- form attr(value, "nugget") <- nugget attr(value, "metric") <- match.arg(metric) attr(value, "fixed") <- fixed class(value) <- c("corGaus", "corSpatial", "corStruct") value } ###*# Methods for standard generics summary.corGaus <- function(object, structName = "Gaussian spatial correlation", ...) { summary.corStruct(object, structName) } Variogram.corGaus <- function(object, distance = NULL, sig2 = 1, length.out = 50, ...) { Variogram.corSpatial(object, distance, sig2, length.out, function(x, y){ 1 - exp(-(x/y)^2) }) } ###*# corLin - Linear spatial correlation structure corLin <- ## Constructor for the corLin class function(value = numeric(0), form = ~ 1, nugget = FALSE, metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE) { attr(value, "formula") <- form attr(value, "nugget") <- nugget attr(value, "metric") <- match.arg(metric) attr(value, "fixed") <- fixed class(value) <- c("corLin", "corSpatial", "corStruct") value } ###*# Methods for standard generics coef.corLin <- function(object, unconstrained = TRUE, ...) { val <- NextMethod() if (!unconstrained) val[1] <- val[1] + attr(object, "minD") val } Initialize.corLin <- function(object, data, ...) { if (!is.null(attr(object, "minD"))) { #already initialized return(object) } object <- Initialize.corStruct(object, data) nug <- attr(object, "nugget") minD <- min(unlist(attr(object, "covariate"))) val <- as.vector(object) if (length(val) > 0) { # initialized if (val[1] <= 0) { stop("'range' must be > 0 in \"corLin\" initial value") } if (val[1] <= minD) { warning("initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)") val[1] <- 1.1 * minD } if (nug) { # with nugget effect if (length(val) == 1) { # assuming nugget effect not given val <- c(val, 0.1) # setting it to 0.1 } else { if (length(val) != 2) { stop("initial value for \"corLin\" parameters of wrong dimension") } } if ((val[2] <= 0) || (val[2] >= 1)) { stop("initial value of nugget ratio must be between 0 and 1") } } else { # only range parameter if (length(val) != 1) { stop("initial value for \"corLin\" parameters of wrong dimension") } } } else { val <- minD * 1.1 if (nug) val <- c(val, 0.1) } val[1] <- log(val[1] - minD) if (nug) val[2] <- log(val[2]/(1 - val[2])) oldAttr <- attributes(object) object <- val attributes(object) <- oldAttr attr(object, "minD") <- minD attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") object } summary.corLin <- function(object, structName = "Linear spatial correlation", ...) { summary.corStruct(object, structName) } Variogram.corLin <- function(object, distance = NULL, sig2 = 1, length.out = 50, ...) { Variogram.corSpatial(object, distance, sig2, length.out, function(x, y) { pmin(x/y, 1) }) } ###*# corRatio - rational quadratic spatial correlation structure corRatio <- ## Constructor for the corRational class function(value = numeric(0), form = ~ 1, nugget = FALSE, metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE) { attr(value, "formula") <- form attr(value, "nugget") <- nugget attr(value, "metric") <- match.arg(metric) attr(value, "fixed") <- fixed class(value) <- c("corRatio", "corSpatial", "corStruct") value } ###*# Methods for standard generics summary.corRatio <- function(object, structName = "Rational quadratic spatial correlation", ...) { summary.corStruct(object, structName) } Variogram.corRatio <- function(object, distance = NULL, sig2 = 1, length.out = 50, ...) { Variogram.corSpatial(object, distance, sig2, length.out, function(x, y) { x <- (x/y)^2 x/(1+x) }) } ###*# corSpher - spherical spatial correlation structure corSpher <- ## Constructor for the corSpher class function(value = numeric(0), form = ~ 1, nugget = FALSE, metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE) { attr(value, "formula") <- form attr(value, "nugget") <- nugget attr(value, "metric") <- match.arg(metric) attr(value, "fixed") <- fixed class(value) <- c("corSpher", "corSpatial", "corStruct") value } ###*# Methods for standard generics coef.corSpher <- function(object, unconstrained = TRUE, ...) { val <- NextMethod() if (!unconstrained) val[1] <- val[1] + attr(object, "minD") val } Initialize.corSpher <- function(object, data, ...) { if (!is.null(attr(object, "minD"))) { #already initialized return(object) } object <- Initialize.corStruct(object, data) nug <- attr(object, "nugget") minD <- min(unlist(attr(object, "covariate"))) val <- as.vector(object) if (length(val) > 0) { # initialized if (val[1] <= 0) { stop("range must be > 0 in \"corSpher\" initial value") } if (val[1] <= minD) { warning("initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)") val[1] <- 1.1 * minD } if (nug) { # with nugget effect if (length(val) == 1) { # assuming nugget effect not given val <- c(val, 0.1) # setting it to 0.1 } else { if (length(val) != 2) { stop("initial value for \"corSpher\" parameters of wrong dimension") } } if ((val[2] <= 0) || (val[2] >= 1)) { stop("initial value of nugget ratio must be between 0 and 1") } } else { # only range parameter if (length(val) != 1) { stop("initial value for \"corSpher\" parameters of wrong dimension") } } } else { val <- minD * 1.1 if (nug) val <- c(val, 0.1) } val[1] <- log(val[1] - minD) if (nug) val[2] <- log(val[2]/(1 - val[2])) oldAttr <- attributes(object) object <- val attributes(object) <- oldAttr attr(object, "minD") <- minD attr(object, "factor") <- corFactor(object) attr(object, "logDet") <- -attr(attr(object, "factor"), "logDet") object } summary.corSpher <- function(object, structName = "Spherical spatial correlation", ...) { summary.corStruct(object, structName) } Variogram.corSpher <- function(object, distance = NULL, sig2 = 1, length.out = 50, ...) { Variogram.corSpatial(object, distance, sig2, length.out, function(x, y) { x <- pmin(x/y, 1) 1.5 * x - 0.5 * x^3 }) } ####*# corWave - Wave spatial correlation structure #corWave <- # ## Constructor for the corWave class # function(value = numeric(0), form = ~ 1, nugget = FALSE, # metric = c("euclidean", "maximum", "manhattan")) #{ # attr(value, "formula") <- form # attr(value, "nugget") <- nugget # attr(value, "metric") <- match.arg(metric) # class(value) <- c("corWave", "corSpatial", "corStruct") # value #} ####*# Methods for standard generics #summary.corWave <- # function(object, structName = "Wave spatial correlation") #{ # summary.corStruct(object, structName) #} ##*## Beginning of epilogue ### This file is automatically placed in Outline minor mode. ### The file is structured as follows: ### Chapters: ^L # ### Sections: ##*## ### Subsections: ###*### ### Components: non-comment lines flushed left ### Random code beginning with a ####* comment ### Local variables: ### mode: outline-minor ### outline-regexp: "\^L\\|\\`#\\|##\\*\\|###\\*\\|[a-zA-Z]\\|\\\"[a-zA-Z]\\|####\\*" ### ess-indent-offset: 2 ### End: nlme/R/modelStruct.R0000644000176000001440000000471614251721455014104 0ustar ripleyusers### modelStruct - a virtual class of model structures ### ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ### Copyright 2007-2016 The R Core team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # ### Constructor ### There is no constructor function for this class (i.e. no function ### called modelStruct) because the class is virtual. ### Objects inheriting from this class are required to have a "conLin" ### (condensed linear model) attribute and a "pmap" (parameter map) ### attribute ###*# Methods for standard generics coef.modelStruct <- function(object, unconstrained = TRUE, ...) { unlist(lapply(object, coef, unconstrained)) } "coef<-.modelStruct" <- function(object, ..., value) { value <- as.numeric(value) parMap <- attr(object, "pmap") for(i in names(object)) { if (any(parMap[,i])) { coef(object[[i]]) <- value[parMap[,i]] } } object } formula.modelStruct <- function(x, ...) { lapply(x, formula) } needUpdate.modelStruct <- function(object) any(unlist(lapply(object, needUpdate))) print.modelStruct <- function(x, ...) { for(i in names(x)) { if ((length(aux <- coef(x[[i]]))) > 0) { cat(paste(i, " parameters:\n")) print(aux, ...) } } invisible(x) } print.summary.modelStruct <- function(x, ...) { lapply(x, print, ...) invisible(x) } recalc.modelStruct <- function(object, conLin = attr(object, "conLin"), ...) { for(i in rev(seq_along(object))) { conLin <- recalc(object[[i]], conLin) NULL } conLin } summary.modelStruct <- function(object, ...) { value <- lapply(object, summary) class(value) <- "summary.modelStruct" value } ## will not work as it is. fitted needs more than one argument! update.modelStruct <- function(object, data, ...) { if (needUpdate(object)) { object[] <- lapply(object, update, c(list("." = object), as.list(data))) } object } nlme/R/zzMethods.R0000644000176000001440000000551314364556327013573 0ustar ripleyusers### Miscellaneous methods that must be defined last in the library ### ### Copyright 2007-2022 The R Core Team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # `%||%` <- function(x, y) if(is.null(x)) y else x ## used in test scripts to switch on additional maintainer checks doExtras <- function () { interactive() || nzchar(Sys.getenv("R_nlme_check_extra")) || identical("true", unname(Sys.getenv("R_PKG_CHECKING_doExtras"))) } ## Note that require( stats ) has already happened ... comparePred.lme <- comparePred.lmList <- comparePred.gls getData.nlme <- getData.gnls getData.lme <- getData.gls <- getData.nls qqnorm.gls <- qqnorm.lm <- qqnorm.nls plot.lme <- plot.nls fitted.gnls <- fitted.gls residuals.gnls <- residuals.gls vcov.gls <- function (object, ...) object$varBeta vcov.lme <- function (object, ...) object$varFix deviance.gls <- deviance.lme <- function(object, ...) { if(object$method == "ML") -2 * logLik(object) else { warning("deviance undefined for REML fit") NULL } } ## From MASS/R/stepAIC.R : extractAIC.gls <- extractAIC.lme <- function(fit, scale, k = 2, ...) { if(fit$method != "ML") stop("AIC undefined for REML fit") res <- logLik(fit) edf <- attr(res, "df") c(edf, -2*res + k * edf) } ## no longer needed, because gls() and lme() keep the model "terms" ## terms.gls <- function(x, ...) terms(formula(x), ...) ## terms.lme <- function(x, ...) terms(formula(x), ...) ## end{from MASS} sigma.gls <- sigma.lme <- function(object, ...) object$sigma ## also works for "nlsList" sigma.lmList <- function(object, ...) vapply(object, sigma, 1, ...) ## confint() works for "gls" via confint.default() ! confint.lme <- function(object, ...) stop("not (yet) implemented. Contributions are welcome; use intervals() instead (for now)") confint.lmList <- function(object, ...) sapply(object, confint, ..., simplify=FALSE) confint.nlsList <- function(object, ...) { sapply(object, function(ob) tryCatch(confint(ob, ...), error = function(e) structure(c(NA,NA), errMsg = conditionMessage(e))), simplify=FALSE) } ## at the very end : --------------------------- .onUnload <- function(libpath) library.dynam.unload("nlme", libpath) nlme/R/VarCorr.R0000644000176000001440000001070314251721455013146 0ustar ripleyusers### Extract variance components of lme models. ### ### Copyright 2007-2017 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ### ### This program is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### This program is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### A copy of the GNU General Public License is available at ### http://www.r-project.org/Licenses/ VarCorr <- function(x, sigma = 1, ...) UseMethod("VarCorr") VarCorr.lme <- function(x, sigma = x$sigma, rdig = 3, ...) { m <- lapply(rev(x$modelStruct$reStruct), VarCorr, sigma = sigma, rdig = rdig, ...) Q <- length( m ) if (Q <= 1) { nm <- names(m) m <- m[[1]] mm <- rbind(m, Residual = c(Variance = sigma^2, StdDev = sigma)) v <- array( "", dim(mm), dimnames(mm) ) v[, 1] <- format( mm[, 1] ) v[, 2] <- format( mm[, 2] ) if (!is.null(corr <- attr(m, "corr"))) { v <- cbind(v, rbind(corr, Residual = rep("", ncol(corr)))) } return(structure(v, title = paste(nm, "=", attr( m, "formStr" )), class = "VarCorr.lme")) } ## multiple nested levels case: Q >= 2 nrows <- vapply(m, nrow, 1L) trows <- 1L + c(0L, cumsum(1L + nrows))[1:Q] bd <- rbind(do.call(rbind, m), c(Variance = sigma^2, StdDev = sigma) ) corr <- lapply( m, attr, which = "corr") colnames <- colnames(bd) maxCorr <- 0L if (!all( Nulls <- vapply(corr, is.null, NA) )) { maxCorr <- max(vapply(corr[!Nulls], ncol, 1L)) colnames <- c( colnames, "Corr", rep("", maxCorr - 1L) ) } v <- array("", c(sum(nrows) + Q + 1L, 2L + maxCorr), list(NULL, colnames)) v[-trows, 1] <- format(bd[, 1]) v[-trows, 2] <- format(bd[, 2]) v[trows, 1] <- sapply( m, attr, which = "formStr" ) rownames <- rep("", sum(nrows) + Q) rownames[trows] <- paste( names( m ), "=" ) rr <- 1L for (i in seq_along( m ) ) { ri <- rr + seq_len(nrows[i]) rownames[ri] <- rownames(m[[i]]) if (!is.null(corr[[i]])) { v[ri, 2L + (1:ncol(corr[[i]])) ] <- corr[[i]] } rr <- rr + nrows[i] + 1L } rownames(v) <- c(rownames, "Residual") class(v) <- "VarCorr.lme" v } print.VarCorr.lme <- function(x, ...) { if(hasT <- !is.null(tit <- attr(x, "title"))) { cat(tit, "\n") xo <- x ## print(x, *) must return 'x' unchanged attr(x, "title") <- NULL } print(unclass(x), ..., quote = FALSE) invisible(if(hasT) xo else x) } VarCorr.pdMat <- function( x, sigma = 1., rdig = 3, ...) { sx <- summary( x ) sd <- sigma * attr( sx, "stdDev" ) var <- sd^2 p <- dim(sx)[2] v <- array(c(var, sd), c(p, 2), list( names(sd), c( "Variance", "StdDev" ))) # attr(v, "formStr") <- deparse(as.call(list(as.name(class(x)[[1]]), # as.vector(attr(x, "formula"))))) # ## puts in an extra blank. We'll do it the clunky way instead attr(v, "formStr") <- if ( inherits( attr(x, "formula"), "listForm" ) ) {# an nlme'ism paste0(class(x)[[1]], "(list(", paste( sapply(attr(x, "formula"), function(x) as.character(deparse(x))), collapse=","), "))") } else { paste0(class(x)[[1]], "(", substring(deparse(attr(x, "formula")), 2), ")") } if (p >= 2L && !attr(sx, "noCorrelation")) { ll <- lower.tri(sx) sx[ll] <- format(round(sx[ll], digits = rdig)) sx[!ll] <- "" if (!is.null(colnames(sx))) { sx[1,] <- abbreviate(colnames(sx), minlength = rdig + 3) } dimnames(sx) <- list(names(sd), c("Corr", rep("", p - 1L))) attr(v, "corr") <- sx[, -p, drop = FALSE ] } v } VarCorr.pdBlocked <- function( x, sigma = 1., rdig = 3, ...) { m <- lapply(X=x, FUN=VarCorr, sigma = sigma, rdig = rdig, ...) bd <- do.call(rbind, m) ## the following code does not appear to be used at all ## corr <- lapply( m, attr, which = "corr") ## maxCorr <- 0 ## if ( !all( Nulls <- sapply( corr, is.null ) ) ) { ## maxCorr <- max( sapply( corr[!Nulls], ncol ) ) ## } attr(bd, "formStr") <- paste( sapply( m, attr, which = "formStr" ), collapse = ", ") bd } nlme/R/groupedData.R0000644000176000001440000005770014630076362014040 0ustar ripleyusers### groupedData - data frame with a grouping structure ### ### Copyright 2006-2023 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # groupedData <- ## Constructor for the groupedData class. Takes a formula and a frame ## The formula must be of the form "response ~ primary | groups", ## "response ~ primary | groups1/groups2/.../groups_k", ## or "response ~ (primary1 | groups1) / ... / (primary|groups_k)" ## where groups_i evaluates to a factor in frame. function(formula, data = NULL, order.groups = TRUE, FUN = function(x) max(x, na.rm = TRUE), outer = NULL, inner = NULL, labels = NULL, units = NULL) { if (!(inherits(formula, "formula") && length(formula) == 3)) { stop("first argument to 'groupedData' must be a two-sided formula") } if (is.null(grpForm <- getGroupsFormula(formula, asList = TRUE))) { stop("right-hand side of first argument must be a conditional expression") } mCall <- match.call() mCall[[1]] <- if(length(grpForm) == 1)## nlme:: needed if 'nlme' not attached quote(nlme::nfGroupedData) else quote(nlme::nmGroupedData) eval(mCall, envir = parent.frame()) } nfGroupedData <- ## Constructor for the nfGroupedData class. Takes a formula and a frame ## The formula must be of the form "response ~ primary | groups" ## where groups evaluates to a factor in frame. function(formula, data = NULL, order.groups = TRUE, FUN = function(x) max(x, na.rm = TRUE), outer = NULL, inner = NULL, labels = NULL, units = NULL) { ## want to stop exporting nfGroupedData() ## called internally from groupedData() via eval or from collapse.groupedData() .internal <- any(unlist(lapply(tail(sys.frames()[-sys.nframe()], 3), # no need to look further up utils::packageName)) == "nlme") if(!.internal) .Deprecated("groupedData", "nlme") if (!(inherits(formula, "formula") && length(formula) == 3)) { stop("first argument to 'nfGroupedData' must be a two-sided formula") } grpForm <- getGroupsFormula(formula, asList = TRUE) if (is.null(grpForm)) { stop("right-hand side of first argument must be a conditional expression") } if (length(grpForm) > 1) { stop("only one level of grouping allowed") } ## create a data frame in which formula, inner, and outer can be evaluated if (missing(data) || is.null(data)) { vnames <- all.vars(asOneFormula(formula, inner, outer)) alist <- lapply(as.list(vnames), as.name) names(alist) <- vnames data <- do.call('data.frame', alist) } else if (!inherits(data, "data.frame")) stop("second argument to 'groupedData' must inherit from data.frame") ## Although response and primary are not always used, they are ## evaluated here to verify that they can be evaluated. response <- getResponse(data, formula) primary <- getCovariate(data, formula) groupName <- names(grpForm) groups <- getGroups(data, formula) data[[groupName]] <- groups if (order.groups && !inherits(groups, "ordered")) { levs <- if (is.null(outer)) { names(sort(tapply(response, groups, FUN))) } else { ## split the data according to the 'outer' factors and ## obtain the order within each group outer <- asOneSidedFormula(outer) ## paste together all variables in outer with a character ## unlikely to be in a name combined <- do.call("paste", c(data[, all.vars(outer), drop = FALSE], sep='\007')) as.vector(unlist(lapply(split(data.frame(response = response, groups = groups), combined), function(obj, func) { names(sort(tapply(obj$response, obj$groups, func))) }, func = FUN))) } data[[groupName]] <- ordered(groups, levels = levs) } attr(data, "formula") <- formula attr(data, "labels") <- labels attr(data, "units") <- units attr(data, "outer") <- outer attr(data, "inner") <- inner attr( data, "FUN" ) <- FUN attr( data, "order.groups" ) <- order.groups cl <- if ((length(all.vars(getCovariateFormula(formula))) == 0) || !is.numeric(primary)) { "nffGroupedData" # primary covariate is a factor or a "1" } else { "nfnGroupedData" # primary covariate is numeric } class(data) <- unique(c(cl, "nfGroupedData", "groupedData", class(data))) data } nmGroupedData <- ## Constructor for the nmGroupedData class. Takes a formula and a frame ## The formula must be of the form ## "respose ~ primary | groups1/groups2/.../groups_k", ## where groups_i evaluates to a factor in frame. function(formula, data=NULL, order.groups = TRUE, FUN = function(x) max(x, na.rm = TRUE), outer = NULL, inner = NULL, labels = NULL, units = NULL) { ## want to stop exporting nmGroupedData() ## called internally from groupedData() via eval .internal <- any(unlist(lapply(tail(sys.frames()[-sys.nframe()], 3), # no need to look further up utils::packageName)) == "nlme") if(!.internal) .Deprecated("groupedData", "nlme") if (!(inherits(formula, "formula") && length(formula) == 3)) stop("first argument to 'nmGroupedData' must be a two-sided formula") grpForm <- getGroupsFormula(formula, asList = TRUE) if (is.null(grpForm)) stop("right-hand side of first argument must be a conditional expression") if (length(grpForm) == 1) stop("single group not supported -- use groupedData()") checkForList <- function(object, nams, expand = FALSE) { if (is.null(object)) return(object) if (is.list(object)) { if (is.null(names(object))) { names(object) <- nams[seq_along(object)] } } else if (expand) { object <- rep(list(object), length(nams)) names(object) <- nams } else { object <- list(object) names(object) <- nams[length(nams)] } object } grpNames <- names(grpForm) names(grpNames) <- grpNames ## ckecking if arguments are lists order.groups <- checkForList(order.groups, grpNames, TRUE) outer <- checkForList(outer, grpNames) inner <- checkForList(inner, grpNames) ## create a data frame in which formula, outer, and inner can be evaluated if (missing(data) || is.null(data)) { vnames <- all.vars(asOneFormula(formula, outer, inner)) alist <- lapply(as.list(vnames), as.name) names(alist) <- vnames data <- do.call('data.frame', alist) } else if (!inherits(data, "data.frame")) stop("second argument to 'groupedData' must inherit from data.frame") ## Although response and primary are not always used, they are ## evaluated here to verify that they can be evaluated. response <- getResponse(data, formula) primary <- getCovariate(data, formula) groups <- getGroups(data, formula) rm(response, primary, groups)# -NOTE(codetools) attr(data, "formula") <- formula attr(data, "formulaList") <- grpForm attr(data, "labels") <- labels attr(data, "units") <- units attr(data, "inner") <- inner attr(data, "outer") <- outer attr(data, "order.groups") <- order.groups attr(data, "FUN") <- FUN class(data) <- unique(c("nmGroupedData", "groupedData", class(data))) data } ###*# Methods for standard generics as.data.frame.groupedData <- function(x, row.names = NULL, optional = FALSE, ...) { attributes(x) <- attributes(x)[c("names", "row.names")] class(x) <- "data.frame" NextMethod() } collapse.groupedData <- function(object, collapseLevel = Q, displayLevel = collapseLevel, outer = NULL, inner = NULL, preserve = NULL, FUN = mean, subset = NULL, ...) { form <- formula(object) grpForm <- getGroupsFormula(form, asList = TRUE) grpNames <- names(grpForm) names(grpNames) <- grpNames Q <- length(grpForm) # number of levels if (Q == 1) { # no collapsing if (!missing(subset)) { warning("'subset' ignored with single grouping factor") } return(object) } groups <- getGroups(object, form, level = 1:Q) if (!is.null(subset)) { ## choosing some levels of grouping factors if (!is.list(subset)) { stop("'subset' must be a list") } if (!anyNA(match(names(subset), 1:Q))) { ## subset names given as integers names(subset) <- grpNames[names(subset)] } if (anyNA(match(names(subset), grpNames))) { stop("undefined group declared in 'subset'") } auxSubset <- rep(TRUE, dim(object)[1]) for(i in names(subset)) { auxSubset <- auxSubset & as.logical(match(groups[[i]], subset[[i]], 0)) } object <- object[auxSubset, , drop = FALSE] groups <- groups[auxSubset, , drop = FALSE] groups[] <- lapply(groups, function(x) x[drop = TRUE]) } if (length(displayLevel) != 1) { stop("only one display level allowed") } if (is.null(grpForm[[displayLevel]])) { stop(gettextf("undefined display level %s for %s", displayLevel, sQuote(substitute(object))), domain = NA) } attribs <- attributes(object) ord <- attribs[["order.groups"]][[displayLevel]] if (is.logical(outer)) { outer <- attribs[["outer"]][[displayLevel]] } if (is.logical(inner)) { inner <- attribs[["inner"]][[displayLevel]] } form[[3]][[3]] <- grpForm[[displayLevel]][[2]] args <- list(formula = form, order.groups = ord, FUN = attribs[["FUN"]], outer = outer, inner = inner, labels = attribs[["labels"]], units = attribs[["units"]]) dlevel <- if (is.character(displayLevel)) { # as the level name match(displayLevel, grpNames) } else { # as the level number displayLevel } if (dlevel < Q) { # may need to collapse object if (is.null(grpForm[[collapseLevel]])) { stop(gettextf("undefined collapsing level %s for %s", collapseLevel, sQuote(substitute(object))), domain = NA) } clevel <- if (is.character(collapseLevel)) { match(collapseLevel, grpNames) } else { collapseLevel } if (clevel < dlevel) { clevel <- dlevel warning("collapsing level cannot be smaller than display level; setting it to the display level") } if ((dlevel < clevel) || (clevel < Q)) { collapseGroups <- do.call("paste", c(lapply(groups[, 1:clevel, drop = FALSE ], as.character), sep = "\007")) if (dlevel < clevel) { # may need innerGroups object[[".collapseGroups"]] <- as.factor(collapseGroups) } if (!is.null(preserve)) { if (!(inherits(preserve, "formula") && length(preserve) == 2)) { stop("'preserve' must be a two-sided formula") } collapseGroups <- paste(collapseGroups, eval(preserve[[2]], object), sep = "\007") } collapseGroups <- paste(collapseGroups, getCovariate(object), sep = "\007") collapseGroups <- ordered(collapseGroups, levels = unique(as.character(collapseGroups))) if (length(levels(collapseGroups)) < dim(object)[1]) { ## collapsing the object object <- gsummary(object, groups = collapseGroups, FUN = FUN) row.names(object) <- 1:dim(object)[1] ## need to recalculate groups --- fix from JCP groups <- getGroups(object, grpForm, level = 1:Q) } } } object <- as.data.frame(object) if (dlevel == 1) { # no outer groups args[["data"]] <- object value <- do.call("nfGroupedData", args) } else { ## need to establish an appropriate ordering namesDgrp <- names(groups) for(i in 2:Q) { groups[, i] <- paste(as.character(groups[, i - 1]), as.character(groups[, i]), sep = "/") namesDgrp[i] <- paste(namesDgrp[i-1], namesDgrp[i], sep = "/") } displayGroups <- groups[, dlevel] isOrd <- unlist(lapply(groups, is.ordered))[1:dlevel] ordOrig <- unlist(attribs[["order.groups"]][1:dlevel]) & !isOrd if (any(ordOrig)) { groups[ordOrig] <- lapply(groups[ordOrig], function(el, y, func) { ordered(el, levels = names(sort(tapply(y, el, func)))) }, y = getResponse(object, form), func = attribs[["FUN"]]) } if (!is.null(outer)) { outFact <- do.call("paste", c(lapply(object[, all.vars(outer)], as.character), sep = "\007")) groups <- c(list(outFact), groups) } displayGroups <- ordered(displayGroups, levels = unique(as.character(displayGroups[do.call("order", groups)]))) form[[3]][[3]] <- quote(.groups) object[[".groups"]] <- displayGroups args[["formula"]] <- form args[["data"]] <- object value <- do.call("nfGroupedData", args) } if (match(".collapseGroups", names(object), 0)) { groups <- eval(form[[3]][[3]], value) rnams <- unlist(split(1:nrow(value), groups)) cGroups <- unlist(lapply(split(value[[".collapseGroups"]], groups), function(el) as.integer(el[drop = TRUE]))) value[[".collapseGroups"]] <- cGroups[order(rnams)] attr(value, "innerGroups") <- ~.collapseGroups } if (dlevel > 1 && !is.na(match(".groups", names(value)))) { attr(value[,".groups"], "label") <- namesDgrp[dlevel] } value } formula.groupedData <- function(x, ...) eval(attr(x, "formula")) plot.nfnGroupedData <- function(x, outer = NULL, inner = NULL, innerGroups = NULL, xlab = paste(attr(x, "labels")$x, attr(x, "units")$x), ylab = paste(attr(x, "labels")$y, attr(x, "units")$y), strip = function(...) strip.default(..., style = 1), aspect = "xy", panel = function(x, y, ...) { if (grid) panel.grid() panel.xyplot(x, y, ...) y.avg <- tapply(y, x, mean) # lines through average y y.avg <- y.avg[!is.na(y.avg)] if (length(y.avg) > 0) { xvals <- as.numeric(names(y.avg)) ord <- order(xvals) panel.xyplot(xvals[ord], y.avg[ord], type = "l") } }, key = TRUE, grid = TRUE, ...) { labels <- list(xlab = xlab, ylab = ylab) labels <- labels[lengths(labels) > 0] args <- c(list(attr(x, "formula"), data = x, strip = strip, aspect = aspect, panel = panel), labels) if (length(outer) > 0) { if (is.logical(outer) && outer) { # get the default outer formula outer <- attr(x, "outer") } args[[1]][[3]][[3]] <- asOneSidedFormula(outer)[[2]] if (length(innerGroups) == 0) { innerGroups <- getGroupsFormula(x) } } if ((length(innerGroups) > 0) && (length(inner) == 0)) { inner <- innerGroups innerGroups <- NULL } if (length(inner) > 0) { if (is.logical(inner) && inner) { # get the default inner formula inner <- attr(x, "inner") } args[["subscripts"]] <- TRUE trll.set <- trellis.par.get("superpose.line")[c("lty", "col")] if (length(innerGroups) == 0) { args[["groups"]] <- asOneSidedFormula(inner)[[2]] if (missing(inner)) { Inner <- NULL trll.lty <- trll.set[["lty"]][1] trll.col <- trll.set[["col"]][1] assign("trll.lty", trll.lty) assign("trll.col", trll.col) args[["panel"]] <- function(x, y, subscripts, groups, ...) { panel.grid() panel.xyplot(x, y, ...) panel.superpose(x, y, subscripts, groups, type = "l", col = trll.col, lty = trll.lty) } } else { Inner <- as.factor(eval(asOneSidedFormula(inner)[[2]], x)) levInn <- levels(Inner) args[["panel"]] <- function(x, y, subscripts, groups, ...) { panel.grid() panel.xyplot(x, y, ...) panel.superpose(x, y, subscripts, groups, type = "l") } } } else { #inner and innerGroups args[["groups"]] <- asOneSidedFormula(innerGroups)[[2]] Inner <- as.factor(eval(asOneSidedFormula(inner)[[2]], x)) levInn <- levels(Inner) Inner <- (as.integer(Inner) - 1) %% length(trll.set[["lty"]]) + 1 trll.lty <- trll.set[["lty"]][Inner] trll.col <- trll.set[["col"]][Inner] assign("trll.lty", trll.lty) assign("trll.col", trll.col) args[["panel"]] <- function(x, y, subscripts, groups, ...) { panel.grid() panel.xyplot(x, y, ...) aux <- match(unique(groups), groups) panel.superpose(x, y, subscripts, groups, type = "l", col = trll.col[aux], lty = trll.lty[aux]) } } } else { Inner <- NULL } if(is.logical(key)) { if(key && (!is.null(Inner) && (lInn <- length(levInn)) > 1)) { ## lInn <- min(c(lInn, length(trll.set[["lty"]]))) args[["key"]] <- list(lines = Rows(trellis.par.get("superpose.line"), 1:lInn), text = list(levels = levInn), columns = min(6, lInn)) } } else { args[["key"]] <- key } dots <- list(...) args[names(dots)] <- dots assign("grid", grid) do.call("xyplot", args) } plot.nffGroupedData <- function(x, outer = NULL, inner = NULL, innerGroups = NULL, xlab = paste(attr(x, "labels")$y, attr(x, "units")$y), ylab = groupLabel, strip = function(...) strip.default(..., style = 1), panel = function(x, y) { dot.line <- trellis.par.get("dot.line") panel.abline(h = y, lwd = dot.line$lwd, lty = dot.line$lty, col = dot.line$col) panel.dotplot(x, y) }, key = length(inner) > 0, grid, ...) { groupExpr <- c_deparse(getGroupsFormula(x)[[2]]) if (is.null(groupLabel <- attr(x[, groupExpr], "label"))) { groupLabel <- groupExpr } labels <- list(xlab = xlab, ylab = ylab) labels <- labels[lengths(labels) > 0] if (length(outer) > 0) { if (is.logical(outer) && outer) { # get the default outer formula form <- formula(paste(groupExpr, "~", deparse(getResponseFormula(x)[[2]]),"|", c_deparse(attr(x, "outer")[[2]]))) } else { form <- formula(paste(groupExpr, "~", deparse(getResponseFormula(x)[[2]]),"|", c_deparse(outer[[2]]))) } } else { form <- formula(paste(groupExpr, "~", deparse(getResponseFormula(x)[[2]]))) } args <- c(list(form, data = x, strip = strip, panel = panel), labels) if ((length(innerGroups) > 0) && (length(inner) == 0)) { inner <- innerGroups innerGroups <- NULL } if (length(inner) == 0) { covForm <- getCovariateFormula(x) if (length(all.vars(covForm)) > 0) {# non-trivial covariate inner <- covForm } } if (length(inner) > 0) { if (is.logical(inner) && inner) { # get the default inner formula inner <- attr(x, "inner") } args[["subscripts"]] <- TRUE args[["groups"]] <- asOneSidedFormula(inner)[[2]] args[["panel"]] <- function(x, y, subscripts, groups) { dot.line <- trellis.par.get("dot.line") panel.abline(h = y, lwd = dot.line$lwd, lty = dot.line$lty, col = dot.line$col) panel.superpose(x, y, subscripts, groups) } } if(is.logical(key) && key && (length(inner) > 0)) { Inner <- eval(inner[[2]], x) levInn <- levels(as.factor(Inner)) lInn <- length(levInn) ## lInn <- min(c(lInn, length(trellis.par.get("superpose.symbol")$pch))) args[["key"]] <- list(points = Rows(trellis.par.get("superpose.symbol"), 1:lInn), text = list(levels = levInn), columns = min(6, lInn)) } dots <- list(...) args[names(dots)] <- dots do.call("dotplot", args) } plot.nmGroupedData <- function(x, collapseLevel = Q, displayLevel = collapseLevel, outer = NULL, inner = NULL, preserve = NULL, FUN = mean, subset = NULL, key = TRUE, grid = TRUE, ...) { args <- list(outer = outer, inner = inner, key = key, grid = grid, ...) Q <- length(getGroupsFormula(x, asList = TRUE)) if (is.null(preserve) && collapseLevel < Q && !is.null(inner)) { preserve <- if(is.logical(inner)) attr(x, "inner")[[displayLevel]] else inner } x <- collapse(x, collapseLevel, displayLevel, outer, inner, preserve, FUN, subset) args[["innerGroups"]] <- attr(x, "innerGroups") args[["x"]] <- x do.call("plot", args) } print.groupedData <- function(x, ...) { cat("Grouped Data: ") if(identical(emptyenv(), environment(frm <- attr(x, "formula")))) environment(frm) <- globalenv()# for printing, as that will be suppressed print(frm, ...) print.data.frame(x, ...) } update.groupedData <- function(object, formula, data, order.groups, FUN, outer, inner, labels, units, ...) { args <- as.list( attributes( object ) ) args <- args[is.na(match(names(args), c("names", "row.names", "class", "formulaList")))] thisCall <- as.list(match.call())[-(1:2)] args[names(thisCall)] <- thisCall if (is.null(args[["data"]])) args[["data"]] <- as.data.frame(object) do.call("groupedData", args) } "[.groupedData" <- function(x, i, j, drop = missing(i) || (nargs() >= 3L && length(cols) == 1)) { oAttr <- attributes(x) x <- as.data.frame(x) data <- NextMethod() if (!inherits(data, "data.frame")) return(data) allV <- all.vars(asOneFormula(oAttr[["formula"]], oAttr[["inner"]], oAttr[["outer"]])) ## check if any columns used in formulas were deleted if(anyNA(match(allV, names(data)))) { # return data frame cols <- ncol(data) return(data[, seq_len(cols), drop = drop]) } args <- as.list(oAttr) args <- args[ is.na( match( names( args ), c( "names", "row.names" ) ) ) ] if (nrow(x) == nrow(data)) { # only columns deleted attributes(data) <- c( attributes( data ), args ) return( data ) } ## otherwise, return "groupedData" : ## pruning the levels of factors whichFact <- unlist(lapply(data, is.factor)) data[whichFact] <- lapply(data[whichFact], function(x) x[drop = TRUE]) args <- c(args[!is.na(match(names( args ), c("formula", "order.groups", "FUN", "outer", "inner", "labels", "units")))], list(data = data)) do.call("groupedData", args) } isBalanced.groupedData <- function(object, countOnly = FALSE, level) { if (missing(level)) { level <- length(getGroupsFormula(object, asList = TRUE)) } if ( countOnly ) { return( length( unique( table( getGroups(object, level = level) ) ) ) == 1 ) } length(unique(table(getCovariate(object), getGroups(object, level = level)))) == 1 } asTable.groupedData <- function(object) { if (length(getGroupsFormula(object, asList = TRUE)) > 1) { stop("'asTable' cannot be used with multilevel grouped data") } tab <- table( getGroups(object), getCovariate(object) ) if (1 != length(unique(tab))) stop("'asTable' can only be used with balanced 'groupedData' objects") tab[] <- getResponse(object)[order(getCovariate(object),getGroups(object))] tab } balancedGrouped <- function(form, data, labels = NULL, units = NULL) { form <- as.formula( form ) data <- t( as.matrix( data ) ) dn <- dimnames( data ) if ( !anyNA( suppressWarnings( as.numeric( dn[[1]] ) ) ) ) { dn[[1]] <- as.numeric( dn[[1]] ) } names(dn) <- c( as.character(getCovariateFormula(form)[[2]]), as.character(getGroupsFormula (form)[[2]]) ) df <- do.call("expand.grid", dn) df[[ as.character(getResponseFormula(form)[[2]]) ]] <- as.vector(data) groupedData(form, data = df, labels = labels, units = units) } nlme/R/newMethods.R0000644000176000001440000006306214251721455013713 0ustar ripleyusers### Methods for generics from newGenerics.q for some standard classes ### ### Copyright 2006-2022 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ##*## Methods for some of the generics in newGenerics.q for standard classes Dim.default <- function(object, ...) dim(object) getCovariate.data.frame <- function(object, form = formula(object), data) { ## Return the primary covariate if (!(inherits(form, "formula"))) { stop("'form' must be a formula") } aux <- getCovariateFormula(form) if (length(all.vars(aux)) > 0) { eval(aux[[2]], object) } else { rep(1, dim(object)[1]) } } getData.nls <- function(object) { mCall <- object$call ## avoid partial matches here. data <- eval(if("data" %in% names(object)) object$data else mCall$data) if (is.null(data)) return(data) naAct <- object[["na.action"]] if (!is.null(naAct)) { ## guessing here: known values (omit, exclude) work. data <- if (inherits(naAct, "omit")) data[-naAct, ] else if (inherits(naAct, "exclude")) data else eval(mCall$na.action)(data) } subset <- mCall$subset if (!is.null(subset)) { subset <- eval(asOneSidedFormula(subset)[[2]], data) data <- data[subset, ] } data } getGroups.data.frame <- ## Return the groups associated with object according to form for level function(object, form = formula(object), level, data, sep = "/") { if (!missing(data)) { stop( "data argument to \"data.frame\" method for 'getGroups' does not make sense" ) } if (inherits(form, "formula")) { grpForm <- getGroupsFormula(form, asList = TRUE, sep = sep) if (is.null(grpForm)) { ## will use right hand side of form as the group formula grpForm <- splitFormula(asOneSidedFormula(form[[length(form)]]), sep = sep) names(grpForm) <- unlist( lapply( grpForm, function(el) deparse( el[[ length(el) ]] ) ) ) } if (any(vapply(grpForm, function(el) length(all.vars(el)) != 1, NA))) stop("invalid formula for groups") form <- grpForm } else if(is.list(form)) { if (!all(vapply(form, function(el) inherits(el, "formula"), NA))) { stop("'form' must have all components as formulas") } } else { stop("'form' can only be a formula, or a list of formulas") } vlist <- lapply(form, function(x, N) { val <- eval(x[[length(x)]], object) if (length(val) == 1L) # repeat groups as.factor(rep(val, N)) else as.factor(val)[drop = TRUE] }, N = nrow(object)) if (length(vlist) == 1) return(vlist[[1]]) # ignore level - only one choice ## make the list into a data frame with appropriate names value <- do.call("data.frame", vlist) row.names(value) <- row.names(object) ## needed for fitted.lme if (missing(level)) return(value) if (is.character(level)) { nlevel <- match(level, names(vlist)) if (any(aux <- is.na(nlevel))) { stop(gettextf("level of %s does not match formula %s", level[aux], sQuote(deparse(form))), domain = "NA") } } else { nlevel <- as.numeric(level) if (any(aux <- is.na(match(nlevel, 1:ncol(value))))) { stop(gettextf("level of %s does not match formula %s", level[aux], sQuote(deparse(form))), domain = "NA") } } if (length(nlevel) > 1) return(value[, nlevel]) # multicolumn selection if (nlevel == 1) return(value[, 1]) # no need to do more work value <- value[, 1:nlevel] val <- as.factor(do.call("paste", c(lapply(as.list(value), as.character), sep = sep))) if (inherits(value[, 1], "ordered")) { value <- value[do.call("order", value),] aux <- unique(do.call("paste", c(lapply(as.list(value), as.character), sep = sep))) ordered(val, aux) } else { ordered(val, unique(as.character(val))) } } getResponse.data.frame <- function(object, form = formula(object)) { ## Return the response, the evaluation of the left hand side of a formula ## on object if (!(inherits(form, "formula") && (length(form) == 3))) { stop("'form' must be a two-sided formula") } eval(form[[2]], object) } getGroupsFormula.default <- ## Return the formula(s) for the groups associated with object. ## The result is a one-sided formula unless asList is TRUE in which case ## it is a list of formulas, one for each level. function(object, asList = FALSE, sep = "/") { form <- formula(object) if (!inherits(form, "formula")){ stop("'form' argument must be a formula") } form <- form[[length(form)]] if (!(length(form) == 3L && form[[1L]] == as.name("|"))) ## no conditioning expression return(NULL) val <- eval(call("~", form[[3]]), .GlobalEnv) if (!asList) return(val) val <- splitFormula(val, sep = sep) names(val) <- unlist(lapply(val, function(el) deparse(el[[2]]))) as.list(val) } Names.formula <- function(object, data = list(), exclude = c("pi", "."), ...) { if (!is.list(data)) { return(NULL) } # no data to evaluate variable names allV <- all.vars(object) allV <- allV[is.na(match(allV, exclude))] if (length(allV) == 0) { if (attr(terms(object), "intercept")) "(Intercept)" ## else NULL } else if (!anyNA(match(allV, names(data)))) dimnames(model.matrix(object, model.frame(object, data)))[[2]] ## else NULL } Names.listForm <- function(object, data = list(), exclude = c("pi", "."), ...) { pnames <- as.character(unlist(lapply(object, `[[`, 2L))) nams <- lapply(object, function(el) Names(getCovariateFormula(el), data, exclude)) if (is.null(nams[[1]])) return(NULL) val <- c() for(i in seq_along(object)) val <- c(val, if ((length(nams[[i]]) == 1) && (nams[[i]] == "(Intercept)")) pnames[i] else paste(pnames[i], nams[[i]], sep = ".")) val } needUpdate.default <- function(object) { val <- attr(object, "needUpdate") !is.null(val) && val } ##--- needs Trellis/Lattice : pairs.compareFits <- function(x, subset, key = TRUE, ...) { object <- x if(!missing(subset)) { object <- object[subset,,] } dims <- dim(object) if(dims[3] == 1) { stop("at least two coefficients are needed") } dn <- dimnames(object) coefs <- array(c(object), c(dims[1]*dims[2], dims[3]), list(rep(dn[[1]], dims[2]), dn[[3]])) if(dims[3] > 2) { # splom tt <- list(coefs = coefs, grp = ordered(rep(dn[[2]], rep(dims[1], dims[2])), levels = dn[[2]])) args <- list(~ coefs, data = tt, groups = tt$grp, panel = function(x, y, subscripts, groups, ...) { x <- as.numeric(x) y <- as.numeric(y) panel.superpose(x, y, subscripts, groups) aux <- groups[subscripts] aux <- aux == unique(aux)[1] lsegments(x[aux], y[aux], x[!aux], y[!aux], lty = 2, lwd = 0.5) }) } else { tt <- list(x = coefs[,1], y = coefs[,2], grp = ordered(rep(dn[[2]], rep(dims[1], dims[2])), levels = dn[[2]])) args <- list(y ~ x, data = tt, groups = tt$grp, panel = function(x, y, subscripts, groups, ...) { x <- as.numeric(x) y <- as.numeric(y) panel.grid() panel.superpose(x, y, subscripts, groups) aux <- groups[subscripts] aux <- aux == unique(aux)[1] lsegments(x[aux], y[aux], x[!aux], y[!aux], lty = 2, lwd = 0.5) }, xlab = dn[[3]][1], ylab = dn[[3]][2]) } dots <- list(...) args[names(dots)] <- dots if(is.logical(key)) { if(key && length(unique(tt$grp)) > 1) { args[["key"]] <- list(points = Rows(trellis.par.get("superpose.symbol"), 1:2), text = list(levels = levels(tt$grp)), columns = 2) } } else { args[["key"]] <- key } if(dims[3] > 2) do.call("splom", args) else do.call("xyplot", args) } ##--- needs Trellis/Lattice : plot.nls <- function(x, form = resid(., type = "pearson") ~ fitted(.), abline, id = NULL, idLabels = NULL, idResType = c("pearson", "normalized"), grid, ...) ## Diagnostic plots based on residuals and/or fitted values { object <- x if (!inherits(form, "formula")) { stop("'form' must be a formula") } ## constructing data allV <- all.vars(asOneFormula(form, id, idLabels)) allV <- allV[is.na(match(allV,c("T","F","TRUE","FALSE")))] if (length(allV) > 0) { data <- getData(object) if (is.null(data)) { # try to construct data alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } else { if (any(naV <- is.na(match(allV, names(data))))) { stop(sprintf(ngettext(sum(naV), "%s not found in data", "%s not found in data"), allV[naV]), domain = NA) } } } else data <- NULL if (inherits(data, "groupedData")) { # save labels and units, if present ff <- formula(data) rF <- deparse(getResponseFormula(ff)[[2]]) cF <- c_deparse(getCovariateFormula(ff)[[2]]) lbs <- attr(data, "labels") unts <- attr(data, "units") if (!is.null(lbs$x)) cL <- paste(lbs$x, unts$x) else cF <- NULL if (!is.null(lbs$y)) rL <- paste(lbs$y, unts$y) else rF <- NULL } else { rF <- cF <- NULL } ## argument list dots <- list(...) args <- if (length(dots) > 0) dots else list() ## appending object to data data <- as.list(c(as.list(data), . = list(object))) ## covariate - must always be present covF <- getCovariateFormula(form) .x <- eval(covF[[2]], data) if (!is.numeric(.x)) { stop("covariate must be numeric") } argForm <- ~ .x argData <- data.frame(.x = .x, check.names = FALSE) if (is.null(xlab <- attr(.x, "label"))) { xlab <- deparse(covF[[2]]) if (!is.null(cF) && (xlab == cF)) xlab <- cL #### BUG!!!! else if (!is.null(rF) && (xlab == rF)) xlab <- rL } if (is.null(args$xlab)) args$xlab <- xlab ## response - need not be present respF <- getResponseFormula(form) if (!is.null(respF)) { .y <- eval(respF[[2]], data) if (is.null(ylab <- attr(.y, "label"))) { ylab <- deparse(respF[[2]]) if (!is.null(cF) && (ylab == cF)) ylab <- cL else if (!is.null(rF) && (ylab == rF)) ylab <- rL } argForm <- .y ~ .x argData[, ".y"] <- .y if (is.null(args$ylab)) args$ylab <- ylab } ## groups - need not be present grpsF <- getGroupsFormula(form) if (!is.null(grpsF)) { gr <- splitFormula(grpsF, sep = "*") for(i in seq_along(gr)) { auxGr <- all.vars(gr[[i]]) for(j in auxGr) { argData[[j]] <- eval(as.name(j), data) } } if (length(argForm) == 2) argForm <- eval(parse(text = paste("~ .x |", deparse(grpsF[[2]])))) else argForm <- eval(parse(text = paste(".y ~ .x |", deparse(grpsF[[2]])))) } ## adding to args list args <- c(list(argForm, data = argData), args) ## if (is.null(args$strip)) { ## args$strip <- function(...) strip.default(..., style = 1) ## } if (is.null(args$cex)) args$cex <- par("cex") if (is.null(args$adj)) args$adj <- par("adj") if (!is.null(id)) { # identify points in plot idResType <- match.arg(idResType) id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } as.logical(abs(resid(object, type = idResType)) > -qnorm(id / 2)) }, call = eval(asOneSidedFormula(id)[[2]], data), stop("'id' can only be a formula or numeric") ) if (is.null(idLabels)) { idLabels <- getGroups(object) if (length(idLabels) == 0) idLabels <- 1:object$dims$N idLabels <- as.character(idLabels) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != length(id)) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } } ## defining abline, if needed if (missing(abline)) { if (missing(form)) { # r ~ f abline <- c(0, 0) } else { abline <- NULL } } #assign("id", id , where = 1) #assign("idLabels", idLabels, where = 1) #assign("abl", abline, where = 1) assign("abl", abline) ## defining the type of plot if (length(argForm) == 3) { if (is.numeric(.y)) { # xyplot plotFun <- "xyplot" if (is.null(args$panel)) { args <- c(args, panel = list(function(x, y, subscripts, ...) { x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y, ...) if (any(ids <- id[subscripts])){ ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } if (!is.null(abl)) { if (length(abl) == 2) panel.abline(a = abl, ...) else panel.abline(h = abl, ...) } })) } } else { # assume factor or character plotFun <- "bwplot" if (is.null(args$panel)) { args <- c(args, panel = list(function(x, y, ...) { if (grid) panel.grid() panel.bwplot(x, y, ...) if (!is.null(abl)) { panel.abline(v = abl[1], ...) } })) } } } else { plotFun <- "histogram" if (is.null(args$panel)) { args <- c(args, panel = list(function(x, ...) { if (grid) panel.grid() panel.histogram(x, ...) if (!is.null(abl)) { panel.abline(v = abl[1], ...) } })) } } ## needed in panel(): if (missing(grid)) grid <- (plotFun == "xyplot") ## T / F do.call(plotFun, as.list(args)) } #pruneLevels.factor <- function(object) object[drop = TRUE] ##*## Plot method for ACF objects plot.ACF <- function(x, alpha = 0, xlab = "Lag", ylab = "Autocorrelation", grid = FALSE, ...) { object <- x ylim <- range(object$ACF) if (alpha) { assign("stdv", qnorm(1-alpha/2)/sqrt(attr(object,"n.used"))) stMax <- max(stdv) ylim <- c(min(c(-stMax, ylim[1])), max(c(ylim[2], stMax))) } assign("alpha", as.logical(alpha)) assign("grid", grid) xyplot(ACF ~ lag, object, ylim = ylim, panel = function(x, y, ...) { x <- as.numeric(x) y <- as.numeric(y) if (grid) panel.grid() panel.xyplot(x, y, type = "h") panel.abline(0, 0) if (alpha) { llines(x, stdv, lty = 2) llines(x, -stdv, lty = 2) } }, xlab = xlab, ylab = ylab, ...) } plot.augPred <- function(x, key = TRUE, grid = FALSE, ...) { labels <- list(xlab = paste(attr(x, "labels")$x, attr(x, "units")$x), ylab = paste(attr(x, "labels")$y, attr(x, "units")$y)) labels <- labels[unlist(lapply(labels, function(el) length(el) > 0))] args <- c(list(attr(x, "formula"), groups = quote(.type), data = x, strip = function(...) strip.default(..., style = 1), panel = if (length(levels(x[[".type"]])) == 2) { ## single prediction level function(x, y, subscripts, groups, ...) { if (grid) panel.grid() orig <- groups[subscripts] == "original" panel.xyplot(x[orig], y[orig], ...) panel.xyplot(x[!orig], y[!orig], ..., type = "l") } } else { # multiple prediction levels function(x, y, subscripts, groups, ...) { if (grid) panel.grid() orig <- groups[subscripts] == "original" panel.xyplot(x[orig], y[orig], ...) panel.superpose(x[!orig], y[!orig], subscripts[!orig], groups, ..., type = "l") } }), labels) ## perhaps include key argument allowing logical values dots <- list(...) args[names(dots)] <- dots if (is.logical(key) && key) { levs <- levels(x[[".type"]]) if ((lLev <- length(levs)) > 2) { # more than one levels lLev <- lLev - 1 levs <- levs[1:lLev] aux <- !is.na(match(substring(levs, 1, 8), "predict.")) if (sum(aux) > 0) { levs[aux] <- substring(levs[aux], 9) } args[["key"]] <- list(lines = c(Rows(trellis.par.get("superpose.line"), 1:lLev), list(size = rep(3, lLev))), text = list(levels = levs), columns = min(6, lLev)) } } else { args[["key"]] <- key } assign("grid", grid) do.call("xyplot", args) } plot.compareFits <- function(x, subset, key = TRUE, mark = NULL, ...) { object <- x if(!missing(subset)) { object <- object[subset,,] } dims <- dim(object) dn <- dimnames(object) assign("mark", rep(mark, rep(dims[1] * dims[2], dims[3]))) tt <- data.frame(group = ordered(rep(dn[[1]], dims[2] * dims[3]), levels = dn[[1]]), coefs = as.vector(object), what = ordered(rep(dn[[3]], rep(dims[1] * dims[2], dims[3])), levels = dn[[3]]), grp = ordered(rep(rep(dn[[2]], rep(dims[1], dims[2])), dims[3]), levels = dn[[2]])) args <- list(group ~ coefs | what, data = tt, scales = list(x=list(relation="free")), strip = function(...) strip.default(..., style = 1), xlab = "", groups = tt$grp, panel = function(x, y, subscripts, groups, ...) { x <- as.numeric(x) y <- as.numeric(y) dot.line <- trellis.par.get("dot.line") panel.abline(h = y, lwd = dot.line$lwd, lty = dot.line$lty, col = dot.line$col) if(!is.null(mark)) { panel.abline(v = mark[subscripts][1], lty = 2) } panel.superpose(x, y, subscripts, groups) }) dots <- list(...) args[names(dots)] <- dots if(is.logical(key)) { if(key && length(unique(tt$grp)) > 1) { args[["key"]] <- list(points = Rows(trellis.par.get("superpose.symbol"), 1:2), text = list(levels = levels(tt$grp)), columns = 2) } } else { args[["key"]] <- key } do.call("dotplot", args) } plot.Variogram <- function(x, smooth, showModel, sigma = NULL, span = 0.6, xlab = "Distance", ylab = "Semivariogram", type = "p", ylim, grid = FALSE, ...) { object <- x trlLin <- trellis.par.get("superpose.line") ## coll <- attr(object, "collapse") modVrg <- attr(object, "modelVariog") lineT <- 1 if (!is.na(match(type, c("l","o","b")))) { lineT <- lineT + 1 } if (missing(showModel)) { showModel <- !is.null(modVrg) } if (showModel) { if (is.null(modVrg)) { stop("no model variogram available with 'showModel = TRUE'") } assign("ltyM", trlLin$lty[lineT]) assign("colM", trlLin$col[lineT]) assign("modVrg", modVrg) lineT <- lineT + 1 } if (missing(smooth)) { smooth <- !showModel } if (smooth) { assign("ltyS", trlLin$lty[lineT]) assign("colS", trlLin$col[lineT]) } assign("smooth", smooth) assign("showModel", showModel) assign("span", span) assign("type", type) assign("sigma", sigma) assign("grid", grid) if (missing(ylim)) { ylim <- c(0, max(object$variog)) } xyplot(variog ~ dist, object, ylim = ylim, panel = function(x, y, ...) { if (grid) panel.grid() panel.xyplot(x, y, type = type, ...) if (showModel) { panel.xyplot(modVrg$dist, modVrg$variog, type = "l", col = colM, lty = ltyM, ...) } if (smooth) { panel.loess(x, y, span = span, col = colS, lty = ltyS, ...) } if (!is.null(sigma)) { panel.abline(c(sigma, 0), lty = 2) } }, xlab = xlab, ylab = ylab, ...) } print.compareFits <- function(x, ...) { # Will need to be changed for S4! print(unclass(x), ...) invisible(x) } print.correlation <- ## Print only the lower triangle of a correlation matrix function(x, title = " Correlation:", rdig = 3, ...) { p <- dim(x)[2] if (p > 1) { cat(title, "\n") ll <- lower.tri(x) x[ll] <- format(round(x[ll], digits = rdig)) x[!ll] <- "" if (!is.null(colnames(x))) { colnames(x) <- abbreviate(colnames(x), minlength = rdig + 3) } print(x[-1, - p, drop = FALSE], ..., quote = FALSE) } invisible(x) } ##if(R.version$major <= 1 && R.version$minor < 3) ## not in R 1.3 and later ##--- needs Trellis/Lattice : qqnorm.nls <- function(y, form = ~ resid(., type = "p"), abline = NULL, id = NULL, idLabels = NULL, grid = FALSE, ...) ## normal probability plots for residuals { object <- y if (!inherits(form, "formula")) { stop("'form' must be a formula") } ## constructing data allV <- all.vars(asOneFormula(form, id, idLabels)) allV <- allV[is.na(match(allV,c("T","F","TRUE","FALSE")))] if (length(allV) > 0) { data <- getData(object) if (is.null(data)) { # try to construct data alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } else { if (any(naV <- is.na(match(allV, names(data))))) { stop(sprintf(ngettext(sum(naV), "%s not found in data", "%s not found in data"), allV[naV]), domain = NA) } } } else data <- NULL ## argument list dots <- list(...) if (length(dots) > 0) args <- dots else args <- list() ## appending object to data data <- as.list(c(as.list(data), . = list(object))) ## covariate - must always be present covF <- getCovariateFormula(form) .x <- eval(covF[[2]], data) labs <- attr(.x, "label") if (is.null(labs) || ((labs != "Standardized residuals") && (labs != "Normalized residuals") && (substring(labs, 1, 9) != "Residuals"))) { stop("only residuals allowed") } if (is.null(args$xlab)) args$xlab <- labs if (is.null(args$ylab)) args$ylab <- "Quantiles of standard normal" fData <- qqnorm(.x, plot.it = FALSE) data[[".y"]] <- fData$x data[[".x"]] <- fData$y dform <- ".y ~ .x" if (!is.null(grp <- getGroupsFormula(form))) { dform <- paste(dform, deparse(grp[[2]]), sep = "|") } if (!is.null(id)) { # identify points in plot id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } if (labs == "Normalized residuals") { as.logical(abs(resid(object, type="normalized")) > -qnorm(id / 2)) } else { as.logical(abs(resid(object, type="pearson")) > -qnorm(id / 2)) } }, call = eval(asOneSidedFormula(id)[[2]], data), stop("'id' can only be a formula or numeric") ) if (is.null(idLabels)) { idLabels <- getGroups(object) if (length(idLabels) == 0) idLabels <- 1:object$dims$N idLabels <- as.character(idLabels) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != length(id)) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } } # assign("id", if (is.null(id)) NULL else as.logical(as.character(id)), # frame = 1) assign("id", if (is.null(id)) NULL else as.logical(as.character(id))) assign("idLabels", as.character(idLabels)) assign("grid", grid) assign("abl", abline) if (is.null(args$strip)) { args$strip <- function(...) strip.default(..., style = 1) } if (is.null(args$cex)) args$cex <- par("cex") if (is.null(args$adj)) args$adj <- par("adj") args <- c(list(eval(parse(text = dform)), data = substitute(data)), args) if (is.null(args$panel)) { args <- c(list(panel = function(x, y, subscripts, ...){ x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y, ...) if (any(ids <- id[subscripts])){ ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } if (!is.null(abl)) { if (length(abl) == 2) panel.abline(a = abl, ...) else panel.abline(h = abl, ...) } }), args) } do.call("xyplot", args) } Variogram.default <- function(object, distance, ...) { ld <- length(distance) lo <- length(object) if (ld != round(lo*(lo-1)/2)) { stop("'distance' and 'object' have incompatible lengths") } val <- outer(object, object, function(x,y) ((x - y)^2)/2) val <- val[lower.tri(val)] val <- data.frame(variog = val, dist = as.numeric(distance)) class(val) <- c("Variogram", "data.frame") val } ## local function for complete deparsing c_deparse <- function(...) paste(deparse(..., width.cutoff=500), collapse="") nlme/R/lme.R0000644000176000001440000031100014630233560012333 0ustar ripleyusers### Fit a general linear mixed effects model ### ### Copyright 2005-2024 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ### ### This program is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### This program is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### A copy of the GNU General Public License is available at ### http://www.r-project.org/Licenses/ lme <- ## fits general linear mixed effects model by maximum likelihood, or ## residual maximum likelihood using Newton-Raphson algorithm. function(fixed, data = sys.frame(sys.parent()), random, correlation = NULL, weights = NULL, subset, method = c("REML", "ML"), na.action = na.fail, control = list(), contrasts = NULL, keep.data = TRUE) UseMethod("lme") lme.groupedData <- function(fixed, data = sys.frame(sys.parent()), random, correlation = NULL, weights = NULL, subset, method = c("REML", "ML"), na.action = na.fail, control = list(), contrasts = NULL, keep.data = TRUE) { args <- as.list(match.call())[-1L] names(args)[1L] <- "data" form <- getResponseFormula(fixed) form[[3]] <- getCovariateFormula(fixed)[[2L]] do.call(lme, c(list(fixed = form), args)) } lme.lmList <- function(fixed, data = sys.frame(sys.parent()), random, correlation = NULL, weights = NULL, subset, method = c("REML", "ML"), na.action = na.fail, control = list(), contrasts = NULL, keep.data = TRUE) { if (length(grpForm <- getGroupsFormula(fixed, asList = TRUE)) > 1) { stop("can only fit \"lmList\" objects with single grouping variable") } this.call <- as.list(match.call())[-1L] ## warn "data" is passed to this function if (!is.na(match("data", names(this.call)))) { warning("'lme.lmList' will redefine 'data'") } ## add object, data, and groups from the call that created object last.call <- as.list(attr(fixed, "call"))[-1L] whichLast <- match(c("object", "data", "na.action"), names(last.call)) whichLast <- whichLast[!is.na(whichLast)] last.call <- last.call[whichLast] names(last.call)[match(names(last.call), "object")] <- "fixed" this.call[names(last.call)] <- last.call this.call$fixed <- eval(substitute(L ~ R, list(L = getResponseFormula (fixed)[[2L]], R = getCovariateFormula(fixed)[[2L]]))) if (missing(random)) { random <- eval(as.call(this.call[["fixed"]][-2])) } random <- reStruct(random, data = NULL) mData <- this.call[["data"]] if (is.null(mData)) { # will try to construct allV <- all.vars(formula(random)) if (length(allV) > 0) { alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" mData <- eval(alist, sys.parent(1)) } } else { if (mode(mData) == "name" || mode(mData) == "call") { mData <- eval(mData) } } reSt <- reStruct(random, data = mData) # getting random effects names names(reSt) <- names(grpForm) if (length(reSt) > 1) { stop("can only fit \"lmList\" objects with single grouping variable") } rNames <- Names(reSt[[1L]]) if (all(match(rNames, names(cf <- na.omit(coef(fixed))), 0))) { if (isInitialized(reSt)) { warning("initial value for \"reStruct\" overwritten in 'lme.lmList'") } madRes <- mad(resid(fixed), na.rm = TRUE) madRan <- unlist(lapply(cf, mad, na.rm = TRUE)[rNames]) names(madRan) <- rNames matrix(reSt) <- diag((madRan/madRes)^2, ncol = length(rNames)) } this.call[["random"]] <- reSt val <- do.call(lme.formula, this.call) val$origCall <- match.call() val } lme.formula <- function(fixed, data = sys.frame(sys.parent()), random = pdSymm( eval( as.call(fixed[-2]) ) ), correlation = NULL, weights = NULL, subset, method = c("REML", "ML"), na.action = na.fail, control = list(), contrasts = NULL, keep.data = TRUE) { Call <- match.call() miss.data <- missing(data) || !is.data.frame(data) ## control parameters controlvals <- lmeControl() if (!missing(control)) { controlvals[names(control)] <- control } fixedSigma <- controlvals$sigma > 0 ## if(fixedSigma && controlvals$apVar) { ## if("apVar" %in% names(control)) ## warning("for 'sigma' fixed, 'apVar' is set FALSE, as the cov approxmation is not yet available.") ## controlvals$apVar <- FALSE ## } ## ## checking arguments ## if (!inherits(fixed, "formula") || length(fixed) != 3) { stop("fixed-effects model must be a formula of the form \"resp ~ pred\"") } method <- match.arg(method) REML <- method == "REML" reSt <- reStruct(random, REML = REML, data = NULL) groups <- getGroupsFormula(reSt) if (is.null(groups)) { if (inherits(data, "groupedData")) { groups <- getGroupsFormula(data) namGrp <- rev(names(getGroupsFormula(data, asList = TRUE))) Q <- length(namGrp) if (length(reSt) != Q) { # may need to repeat reSt if (length(reSt) != 1) { stop("incompatible lengths for 'random' and grouping factors") } randL <- vector("list", Q) names(randL) <- rev(namGrp) for(i in 1:Q) randL[[i]] <- random reSt <- reStruct(as.list(randL), REML = REML, data = NULL) } else { names(reSt) <- namGrp } } else { ## will assume single group groups <- ~ 1 names(reSt) <- "1" } } ## check if corStruct is present and assign groups to its formula, ## if necessary if (!is.null(correlation)) { add.form <- FALSE if(!is.null(corGrpsForm <- getGroupsFormula(correlation, asList = TRUE))) { corGrpsForm <- unlist(lapply(corGrpsForm, function(el) deparse(el[[2L]]))) lmeGrpsForm <- unlist(lapply(splitFormula(groups), function(el) deparse(el[[2L]]))) corQ <- length(corGrpsForm) lmeQ <- length(lmeGrpsForm) if (corQ <= lmeQ) { if (any(corGrpsForm != lmeGrpsForm[1:corQ])) { stop("incompatible formulas for groups in 'random' and 'correlation'") } if (corQ < lmeQ) { warning("cannot use smaller level of grouping for 'correlation' than for 'random'. Replacing the former with the latter.") add.form <- TRUE } } else if (any(lmeGrpsForm != corGrpsForm[1:lmeQ])) { stop("incompatible formulas for groups in 'random' and 'correlation'") } } else { add.form <- TRUE corQ <- lmeQ <- 1 } if(add.form) ## using the same grouping as in random attr(correlation, "formula") <- eval(substitute(~ COV | GRP, list(COV = getCovariateFormula(formula(correlation))[[2L]], GRP = groups[[2L]]))) } else { corQ <- lmeQ <- 1 } ## create an lme structure containing the random effects model and plug-ins lmeSt <- lmeStruct(reStruct = reSt, corStruct = correlation, varStruct = varFunc(weights)) ## extract a data frame with enough information to evaluate ## fixed, groups, reStruct, corStruct, and varStruct mfArgs <- list(formula = asOneFormula(formula(lmeSt), fixed, groups), data = data, na.action = na.action) if (!missing(subset)) { mfArgs[["subset"]] <- asOneSidedFormula(Call[["subset"]])[[2L]] } mfArgs$drop.unused.levels <- TRUE dataMix <- do.call(model.frame, mfArgs) origOrder <- row.names(dataMix) # preserve the original order for(i in names(contrasts)) # handle contrasts statement contrasts(dataMix[[i]]) <- contrasts[[i]] ## sort the model.frame by groups and get the matrices and parameters ## used in the estimation procedures grps <- getGroups(dataMix, groups) ## ordering data by groups if (inherits(grps, "factor")) { # single level ord <- order(grps) #"order" treats a single named argument peculiarly grps <- data.frame(grps) row.names(grps) <- origOrder names(grps) <- as.character(deparse((groups[[2L]]))) } else { ord <- do.call(order, grps) ## making group levels unique for(i in 2:ncol(grps)) { grps[, i] <- as.factor(paste(as.character(grps[, i-1]), as.character(grps[, i ]), sep = "/")) } } if (corQ > lmeQ) { ## may have to reorder by the correlation groups ord <- do.call(order, getGroups(dataMix, getGroupsFormula(correlation))) } grps <- grps[ord, , drop = FALSE] dataMix <- dataMix[ord, ,drop = FALSE] revOrder <- match(origOrder, row.names(dataMix)) # putting in orig. order ## obtaining basic model matrices N <- nrow(grps) Z <- model.matrix(reSt, dataMix) # stores contrasts in matrix form ncols <- attr(Z, "ncols") Names(lmeSt$reStruct) <- attr(Z, "nams") ## keeping the contrasts for later use in predict contr <- attr(Z, "contr") X <- model.frame(fixed, dataMix) Terms <- attr(X, "terms") if (length(attr(Terms, "offset"))) stop("offset() terms are not supported") auxContr <- lapply(X, function(el) if (inherits(el, "factor") && length(levels(el)) > 1) contrasts(el)) contr <- c(contr, auxContr[is.na(match(names(auxContr), names(contr)))]) contr <- contr[!unlist(lapply(contr, is.null))] X <- model.matrix(fixed, data=X) y <- eval(fixed[[2L]], dataMix) ncols <- c(ncols, dim(X)[2L], 1) Q <- ncol(grps) ## creating the condensed linear model dims <- MEdims(grps, ncols) attr(lmeSt, "conLin") <- list(Xy = array(c(Z, X, y), c(N, sum(ncols)), list(row.names(dataMix), c(colnames(Z), colnames(X), deparse(fixed[[2L]])))), dims = dims, logLik = 0, ## 17-11-2015; Fixed sigma: sigma = controlvals$sigma, auxSigma = 0) ## checking if enough observations per group to estimate ranef if(max(dims$ZXlen[[1L]]) < dims$qvec[1L] && !isTRUE(allow <- controlvals$allow.n.lt.q)) { msg <- gettextf("fewer observations than random effects in all level %s groups", Q) if(isFALSE(allow)) stop (msg, domain = NA) else # typically NA, was hardwired default in nlme <= 3.1-137 [2018] warning(msg, domain = NA) } ## degrees of freedom for testing fixed effects fixDF <- getFixDF(X, grps, dims$ngrps, terms = Terms) ## initialization lmeSt <- Initialize(lmeSt, dataMix, grps, control = controlvals) parMap <- attr(lmeSt, "pmap") ## Checking possibility of single decomposition if (length(lmeSt) == 1) { # reStruct only, can do one decomposition ## need to save conLin for calculating fitted values and residuals oldConLin <- attr(lmeSt, "conLin") decomp <- TRUE attr(lmeSt, "conLin") <- MEdecomp(attr(lmeSt, "conLin")) } else decomp <- FALSE ## Setup for optimization iterations if(controlvals$opt == "nlminb") { control <- list(iter.max = controlvals$msMaxIter, eval.max = controlvals$msMaxEval, trace = controlvals$msVerbose) keep <- c("abs.tol", "rel.tol", "x.tol", "xf.tol", "step.min", "step.max", "sing.tol", "scale.init", "diff.g") } else { ## "optim" control <- list(maxit = controlvals$msMaxIter, reltol = controlvals$msTol,# if(numIter == 0) controlvals$msTol else reltol trace = controlvals$msVerbose) keep <- c("fnscale", "parscale", "ndeps", "abstol", "alpha", "beta", "gamma", "REPORT", "type", "lmm", "factr", "pgtol", "temp", "tmax") } control <- c(control, controlvals[names(controlvals) %in% keep]) ## ## getting the linear mixed effects fit object, ## possibly iterating for variance functions ## numIter <- 0L repeat { oldPars <- coef(lmeSt) optRes <- if (controlvals$opt == "nlminb") { nlminb(c(oldPars), function(lmePars) -logLik(lmeSt, lmePars), control = control) } else { ## "optim" if(numIter == 1L) { # (yes, strange, but back-compatible ..) : reltol <- controlvals$reltol if(is.null(reltol)) reltol <- 100*.Machine$double.eps control$reltol <- reltol } optim(c(oldPars), function(lmePars) -logLik(lmeSt, lmePars), control = control, method = controlvals$optimMethod) } coef(lmeSt) <- optRes$par attr(lmeSt, "lmeFit") <- MEestimate(lmeSt, grps) ## checking if any updating is needed if (!needUpdate(lmeSt)) { if (optRes$convergence) { msg <- gettextf("%s problem, convergence error code = %s\n message = %s", controlvals$opt, optRes$convergence, paste(optRes$message, collapse = "")) if(!controlvals$returnObject) stop(msg, domain = NA) else warning(msg, domain = NA) } break } ## updating the fit information numIter <- numIter + 1L lmeSt <- update(lmeSt, dataMix) ## calculating the convergence criterion aConv <- coef(lmeSt) conv <- abs((oldPars - aConv)/ifelse(aConv == 0, 1, aConv)) aConv <- NULL for(i in names(lmeSt)) { if (any(parMap[,i])) { aConv <- c(aConv, max(conv[parMap[,i]])) names(aConv)[length(aConv)] <- i } } if (max(aConv) <= controlvals$tolerance) { break } if (numIter > controlvals$maxIter) { msg <- gettext("maximum number of iterations (lmeControl(maxIter)) reached without convergence") if (controlvals$returnObject) { warning(msg, domain = NA) break } else stop(msg, domain = NA) } } ## end{repeat} ## wrapping up lmeFit <- attr(lmeSt, "lmeFit") names(lmeFit$beta) <- namBeta <- colnames(X) attr(fixDF, "varFixFact") <- varFix <- lmeFit$sigma * lmeFit$varFix varFix <- crossprod(varFix) dimnames(varFix) <- list(namBeta, namBeta) ## ## fitted.values and residuals (in original order) ## Fitted <- fitted(lmeSt, level = 0:Q, conLin = if (decomp) oldConLin else attr(lmeSt, "conLin"))[ revOrder, , drop = FALSE] Resid <- y[revOrder] - Fitted rownames(Resid) <- rownames(Fitted) <- origOrder attr(Resid, "std") <- lmeFit$sigma/(varWeights(lmeSt)[revOrder]) ## putting groups back in original order grps <- grps[revOrder, , drop = FALSE] ## making random effects estimates consistently ordered ## for(i in names(lmeSt$reStruct)) { ## lmeFit$b[[i]] <- lmeFit$b[[i]][unique(as.character(grps[, i])),, drop = F] ## NULL ## } ## inverting back reStruct lmeSt$reStruct <- solve(lmeSt$reStruct) ## saving part of dims dims <- attr(lmeSt, "conLin")$dims[c("N", "Q", "qvec", "ngrps", "ncol")] ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions attr(lmeSt, "fixedSigma") <- fixedSigma ## getting the approximate var-cov of the parameters apVar <- if (controlvals$apVar) { lmeApVar(lmeSt, lmeFit$sigma, .relStep = controlvals[[".relStep"]], minAbsPar = controlvals[["minAbsParApVar"]], natural = controlvals[["natural"]]) } else { "Approximate variance-covariance matrix not available" } ## getting rid of condensed linear model and fit attr(lmeSt, "conLin") <- NULL attr(lmeSt, "lmeFit") <- NULL grpDta <- inherits(data, "groupedData") ## ## creating the lme object ## structure(class = "lme", list(modelStruct = lmeSt, dims = dims, contrasts = contr, coefficients = list( fixed = lmeFit$beta, random = lmeFit$b), varFix = varFix, sigma = lmeFit$sigma, apVar = apVar, logLik = lmeFit$logLik, numIter = if (needUpdate(lmeSt)) numIter, # else NULL groups = grps, call = Call, terms = Terms, method = method, fitted = Fitted, residuals = Resid, fixDF = fixDF, na.action = attr(dataMix, "na.action"), data = if (keep.data && !miss.data) data), ## saving labels and units for plots units = if(grpDta) attr(data, "units"), labels= if(grpDta) attr(data, "labels")) } ### Auxiliary functions used internally in lme and its methods getFixDF <- function(X, grps, ngrps, assign = attr(X, "assign"), terms) { ## calculates degrees of freedom for fixed effects Wald tests if (!is.list(assign)) { # in R namTerms <- attr(terms, "term.labels") if (attr(terms, "intercept") > 0) { namTerms <- c("(Intercept)", namTerms) } namTerms <- factor(assign, labels = namTerms) assign <- split(order(assign), namTerms) } ## function to check if a vector is (nearly) a multiple of (1,1,...,1) const <- function(x, tolerance = sqrt(.Machine$double.eps)) { if (length(x) < 1) return(NA) x <- as.numeric(x) ## return all(abs(if(x[1L] == 0) x else x/x[1L] - 1) < tolerance) } N <- nrow(X) p <- ncol(X) Q <- ncol(grps) Qp1 <- Q + 1L namX <- colnames(X) ngrps <- rev(ngrps)[-(1:2)] stratNam <- c(names(ngrps), "Residual") dfX <- dfTerms <- setNames(c(ngrps, N) - c(0, ngrps), stratNam) valX <- setNames(double(p), namX) namTerms <- names(assign) valTerms <- double(length(assign)) names(valTerms) <- namTerms if (any(notIntX <- !apply(X, 2, const))) { ## percentage of groups for which columns of X are inner innP <- array(c(rep(1, p), .C(inner_perc_table, as.double(X), as.integer(unlist(grps)), as.integer(p), as.integer(Q), as.integer(N), val = double(p * Q))[["val"]]), dim = c(p, Qp1), dimnames = list(namX, stratNam)) ## strata in which columns of X are estimated ## ignoring fractional inner percentages for now stratX <- stratNam[apply(innP, 1, function(el, index) max(index[el > 0]), index = 1:Qp1)] ## strata in which terms are estimated notIntTerms <- unlist(lapply(assign, function(el, notIntX) { any(notIntX[el]) }, notIntX = notIntX)) stratTerms <- stratNam[unlist(lapply(assign, function(el) max(match(stratX[el], stratNam)) ))][notIntTerms] stratX <- stratX[notIntX] xDF <- table(stratX) dfX[names(xDF)] <- dfX[names(xDF)] - xDF if (!all(notIntX)) { # correcting df for intercept dfX[1L] <- dfX[1L] - 1L } else { dfX[-1L] <- dfX[-1L] + 1L } valX[notIntX] <- dfX[stratX] ## number of parameters in each term pTerms <- lengths(assign)[notIntTerms] tDF <- tapply(pTerms, stratTerms, sum) dfTerms[names(tDF)] <- dfTerms[names(tDF)] - tDF if (!all(notIntTerms)) { dfTerms[1L] <- dfTerms[1L] - 1L } else { dfTerms[-1L] <- dfTerms[-1L] + 1L } valTerms[notIntTerms] <- dfTerms[stratTerms] } else { notIntTerms <- vapply(assign, function(el) any(notIntX[el]), NA) } if (!all(notIntX)) { #intercept included valX[!notIntX] <- max(dfX) if (!all(notIntTerms)) valTerms[!notIntTerms] <- max(dfTerms) } structure(list(X = valX, terms = valTerms), assign = assign) } lmeApVar.fullLmeLogLik <- function(Pars, object, conLin, dims, N, settings) { ## logLik as a function of sigma and coef(lmeSt) fixedSigma <- attr(object, "fixedSigma") npar <- length(Pars) if (!fixedSigma) { sigma <- exp(Pars[npar]) # within-group std. dev. Pars <- Pars[-npar] lsigma <- 0 } else { sigma <- lsigma <- conLin$sigma } coef(object) <- Pars if ((lO <- length(object)) > 1) { for(i in lO:2) conLin <- recalc(object[[i]], conLin) } val <- .C(mixed_loglik, as.double(conLin$Xy), as.integer(unlist(dims)), as.double(sigma * unlist(pdFactor(solve(object$reStruct)))), as.integer(settings), logLik = double(1L), lRSS = double(1L), sigma=as.double(lsigma))[c("logLik", "lRSS")] aux <- (exp(val[["lRSS"]])/sigma)^2 conLin[["logLik"]] + val[["logLik"]] + (N * log(aux) - aux)/2 } lmeApVar <- function(lmeSt, sigma, conLin = attr(lmeSt, "conLin"), .relStep = .Machine$double.eps^(1/3), minAbsPar = 0, natural = TRUE) { fixedSigma <- attr(lmeSt,"fixedSigma") ## calculate approximate variance-covariance matrix of all parameters ## except the fixed effects. By default, uses natural parametrization for ## for pdSymm matrices dims <- conLin$dims sett <- attr(lmeSt, "settings") N <- dims$N - sett[1L] * dims$ncol[dims$Q + 1L] sett[2:3] <- c(1, 0) # asDelta = TRUE and no grad/Hess conLin[["logLik"]] <- 0 # making sure sig2 <- sigma * sigma reSt <- lmeSt[["reStruct"]] for(i in seq_along(reSt)) { matrix(reSt[[i]]) <- as.double(sig2) * pdMatrix(reSt[[i]]) if (inherits(reSt[[i]], "pdSymm") && natural) { reSt[[i]] <- pdNatural(reSt[[i]]) } if (inherits(reSt[[i]], "pdBlocked") && natural) { for(j in seq_along(reSt[[i]])) { if (inherits(reSt[[i]][[j]], "pdSymm")) { reSt[[i]][[j]] <- pdNatural(reSt[[i]][[j]]) } } } } lmeSt[["reStruct"]] <- reSt cSt <- lmeSt[["corStruct"]] if (!is.null(cSt) && inherits(cSt, "corSymm") && natural) { cStNatPar <- coef(cSt, unconstrained = FALSE) class(cSt) <- c("corNatural", "corStruct") coef(cSt) <- log((cStNatPar + 1)/(1 - cStNatPar)) lmeSt[["corStruct"]] <- cSt } Pars <- if(fixedSigma) coef(lmeSt) else c(coef(lmeSt), lSigma = log(sigma)) val <- fdHess(Pars, lmeApVar.fullLmeLogLik, lmeSt, conLin, dims, N, sett, .relStep = .relStep, minAbsPar = minAbsPar)[["Hessian"]] if (all(eigen(val, only.values=TRUE)$values < 0)) { ## negative definite - OK val <- solve(-val) nP <- names(Pars) dimnames(val) <- list(nP, nP) attr(val, "Pars") <- Pars attr(val, "natural") <- natural val } else { ## problem - solution is not a maximum "Non-positive definite approximate variance-covariance" } } MEdecomp <- function(conLin) ## decompose a condensed linear model. Returns another condensed ## linear model { dims <- conLin$dims if (dims[["StrRows"]] >= dims[["ZXrows"]]) { ## no point in doing the decomposition return(conLin) } dc <- array(.C(mixed_decomp, as.double(conLin$Xy), as.integer(unlist(dims)))[[1L]], c(dims$StrRows, dims$ZXcols)) dims$ZXrows <- dims$StrRows dims$ZXoff <- dims$DecOff dims$ZXlen <- dims$DecLen conLin[c("Xy", "dims")] <- list(Xy = dc, dims = dims) conLin } MEEM <- function(object, conLin, niter = 0) ## perform niter iterations of the EM algorithm for conLin ## assumes that object is in precision form { if (niter > 0) { dd <- conLin$dims pdCl <- attr(object, "settings")[-(1:3)] pdCl[pdCl == -1] <- 0 precvec <- unlist(pdFactor(object)) zz <- .C(mixed_EM, as.double(conLin$Xy), as.integer(unlist(dd)), precvec = as.double(precvec), as.integer(niter), as.integer(pdCl), as.integer(attr(object, "settings")[1L]), double(1), double(length(precvec)), double(1), as.double(conLin$sigma))[["precvec"]] Prec <- vector("list", length(object)) names(Prec) <- names(object) for (i in seq_along(object)) { len <- dd$qvec[i]^2 matrix(object[[i]]) <- crossprod(matrix(zz[1:len + dd$DmOff[i]], ncol = dd$qvec[i])) } } object } MEestimate <- function(object, groups, conLin = attr(object, "conLin")) { dd <- conLin$dims nc <- dd$ncol REML <- attr(object$reStruct, "settings")[1L] Q <- dd$Q rConLin <- recalc(object, conLin) zz <- .C(mixed_estimate, as.double(rConLin$Xy), as.integer(unlist(dd)), as.double(unlist(pdFactor(object$reStruct))), as.integer(REML), double(1), estimates = double(dd$StrRows * dd$ZXcols), as.logical(FALSE), ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions sigma = as.double(conLin$sigma))[["estimates"]] estimates <- array(zz, c(dd$StrRows, dd$ZXcols)) resp <- estimates[ , dd$ZXcols] reSt <- object$reStruct nam <- names(reSt) val <- vector(mode = "list", length = Q) start <- dd$StrRows * c(0, cumsum(nc)) for (i in seq_along(reSt)) { val[[i]] <- matrix(resp[as.vector(outer(1:(nc[i]), dd$SToff[[i]] - start[i], "+"))], ncol = nc[i], byrow = TRUE, dimnames = list(unique(as.character(groups[, nam[i]])), Names(reSt[[i]]))) } names(val) <- nam p <- nc[[Q + 1L]] N <- dd$N - REML * p dimE <- dim(estimates) ## 17-11-2015; Fixed sigma patch; ... modified by MM notably for p == 0: Np <- N auxSigma <- abs(resp[dimE[1]])/sqrt(Np) if(conLin$sigma > 0) { loglik <- (N * (-log(2 * pi)-2*log(conLin$sigma)))/2 + rConLin$logLik sigma <- conLin$sigma } else { loglik <- (N * (log(N) - (1 + log(2 * pi))))/2 + rConLin$logLik sigma <- auxSigma } list(logLik = loglik, b = rev(val), beta = if(p) resp[dimE[1] - (p:1)] else double(), sigma = sigma, auxSigma = auxSigma, varFix = if(p) t(solve(estimates[dimE[1] - (p:1), dimE[2] - (p:1), drop = FALSE])) else matrix(,p,p)) } MEdims <- function(groups, ncols) { ## define constants used in matrix decompositions and log-lik calculations ## first need some local functions glengths <- ## returns the group lengths from a vector of last rows in the group function(lstrow) diff(c(0, lstrow)) offsets <- ## converts total number of columns(N), columns per level(ncols), and ## a list of group lengths to offsets in C arrays function(N, ncols, lstrow, triangle = FALSE) { pop <- function(x) x[-length(x)] cstart <- c(0, cumsum(N * ncols)) for (i in seq_along(lstrow)) { lstrow[[i]] <- cstart[i] + if (triangle) { lstrow[[i]] - ncols[i] # storage offsets style } else { pop(c(0, lstrow[[i]])) # decomposition style } } lstrow } Q <- ncol(groups) # number of levels N <- nrow(groups) # number of observations ## 'isLast' indicates if the row is the last row in the group at that level. ## this version propagates changes from outer groups to inner groups ## isLast <- (array(unlist(lapply(c(rev(as.list(groups)), ## list(X = rep(0, N), y = rep(0, N))), ## function(x) c(0 != diff(codes(x)), TRUE))), ## c(N, Q+2), list(NULL, c(rev(names(groups)), "X", "y"))) ## %*% (row(diag(Q+2)) >= col(diag(Q+2)))) != 0 ## this version does not propagate changes from outer to inner. isLast <- array(FALSE, dim(groups) + c(0, 2), list(NULL, c(rev(names(groups)), "X", "y"))) for(i in 1:Q) { isLast[, Q + 1L - i] <- c(0 != diff(as.integer(groups[[i]])), TRUE) } isLast[N, ] <- TRUE lastRow <- apply(isLast, 2, function(x) seq_along(x)[x]) if(!is.list(lastRow)) { nm <- names(lastRow) lastRow <- as.list(lastRow) names(lastRow) <- nm } isLast <- t(isLast) strSizes <- cumsum(ncols * isLast) * isLast # required storage sizes lastStr <- apply(t(strSizes), 2, function(x) x[x != 0]) if(!is.list(lastStr)) { nm <- names(lastStr) lastStr <- as.list(lastStr) names(lastStr) <- nm } strRows <- max(lastStr[[length(lastStr)]]) lastBlock <- vector("list", Q) names(lastBlock) <- rownames(strSizes)[1:Q] for(i in 1:Q) lastBlock[[i]] <- c(strSizes[i, -N], strRows) maxStr <- do.call(pmax, lastBlock) for(i in 1:Q) lastBlock[[i]] <- maxStr[as.logical(lastBlock[[i]])] lastBlock <- c(lastBlock, list(X = strRows, y = strRows)) list(N = N, # total number of rows in data ZXrows = N, # no. of rows in array ZXcols = sum(ncols), # no. of columns in array Q = Q, # no. of levels of random effects StrRows = strRows, # no. of rows required for storage qvec = ncols * c(rep(1, Q), 0, 0), # lengths of random effects ngrps = lengths(lastRow),# no. of groups at each level and 1s for X, y DmOff = c(0, cumsum(ncols^2))[1:(Q+2)],# offsets into DmHalf array by level ncol = ncols, # no. of columns decomposed per level nrot = rev(c(0, cumsum(rev(ncols))))[-1L],# no. of columns rotated per level ZXoff = offsets(N, ncols, lastRow), # offsets into ZXy ZXlen = lapply(lastRow, glengths), # lengths of ZXy groups # storage array offsets SToff = offsets(strRows, ncols, lastStr, triangle = TRUE), # decomposition offsets DecOff = offsets(strRows, ncols, lastBlock), # decomposition lengths DecLen = lapply(lastBlock, glengths) ) } ### Methods for standard generics ACF.lme <- function(object, maxLag, resType = c("pearson", "response", "normalized"), ...) { resType <- match.arg(resType) res <- resid(object, type = resType, asList = TRUE) if(missing(maxLag)) { maxLag <- min(c(maxL <- max(lengths(res)) - 1, as.integer(10 * log10(maxL + 1)))) } val <- lapply(res, function(el, maxLag) { N <- maxLag + 1L tt <- double(N) nn <- integer(N) N <- min(c(N, n <- length(el))) nn[1:N] <- n + 1L - 1:N ## el <- el - mean(el) for(i in 1:N) { tt[i] <- sum(el[1:(n-i+1)] * el[i:n]) } array(c(tt,nn), c(length(tt), 2)) }, maxLag = maxLag) val0 <- rowSums(sapply(val, function(x) x[,2])) val1 <- rowSums(sapply(val, function(x) x[,1]))/val0 val2 <- val1/val1[1L] z <- data.frame(lag = 0:maxLag, ACF = val2) attr(z, "n.used") <- val0 class(z) <- c("ACF", "data.frame") z } anova.lme <- function(object, ..., test = TRUE, type = c("sequential", "marginal"), adjustSigma = TRUE, Terms, L, verbose = FALSE) { fixSig <- attr(object$modelStruct, "fixedSigma") fixSig <- !is.null(fixSig) && fixSig ## returns the likelihood ratio statistics, the AIC, and the BIC Lmiss <- missing(L) if ((rt <- ...length() + 1L) == 1L) { ## just one object if (!inherits(object,"lme")) { stop(gettextf("object must inherit from class %s", '"lme"'), domain = NA) } vFix <- attr(object$fixDF, "varFixFact") if (adjustSigma && object$method == "ML") ## using REML-like estimate of sigma under ML vFix <- sqrt(object$dims$N/(object$dims$N - ncol(vFix))) * vFix c0 <- solve(t(vFix), fixef(object)) assign <- attr(object$fixDF, "assign") nTerms <- length(assign) if (missing(Terms) && Lmiss) { ## returns the F.table (Wald) for the fixed effects type <- match.arg(type) Fval <- Pval <- double(nTerms) nDF <- integer(nTerms) dDF <- object$fixDF$terms for(i in 1:nTerms) { nDF[i] <- length(assign[[i]]) if (type == "sequential") { # type I SS c0i <- c0[assign[[i]]] } else { c0i <- c(qr.qty(qr(vFix[, assign[[i]], drop = FALSE]), c0))[1:nDF[i]] } Fval[i] <- sum(c0i^2)/nDF[i] Pval[i] <- 1 - pf(Fval[i], nDF[i], dDF[i]) } ## ## fixed effects F-values, df, and p-values ## aod <- data.frame(numDF= nDF, denDF= dDF, "F-value"= Fval, "p-value"= Pval, check.names = FALSE) rownames(aod) <- names(assign) attr(aod,"rt") <- rt } else { nX <- length(unlist(assign)) if (Lmiss) { # terms is given if (is.numeric(Terms) && all(Terms == as.integer(Terms))) { if (min(Terms) < 1 || max(Terms) > nTerms) { stop(gettextf("'Terms' must be between 1 and %d", nTerms), domain = NA) } } else { if (is.character(Terms)) { if (any(noMatch <- is.na(match(Terms, names(assign))))) { stop(sprintf(ngettext(sum(noMatch), "term %s not matched", "terms %s not matched"), paste(Terms[noMatch], collapse = ", ")), domain = NA) } } else { stop("terms can only be integers or characters") } } dDF <- unique(object$fixDF$terms[Terms]) if (length(dDF) > 1) { stop("terms must all have the same denominator DF") } lab <- paste("F-test for:",paste(names(assign[Terms]),collapse=", "),"\n") L <- diag(nX)[unlist(assign[Terms]),,drop=FALSE] } else { L <- as.matrix(L) if (ncol(L) == 1) L <- t(L) # single linear combination nrowL <- nrow(L) ncolL <- ncol(L) if (ncol(L) > nX) { stop(sprintf(ngettext(nX, "'L' must have at most %d column", "'L' must have at most %d columns"), nX), domain = NA) } dmsL1 <- rownames(L) L0 <- array(0, c(nrowL, nX), list(NULL, names(object$fixDF$X))) if (is.null(dmsL2 <- colnames(L))) { ## assume same order as effects L0[, 1:ncolL] <- L } else { if (any(noMatch <- is.na(match(dmsL2, colnames(L0))))) { stop(sprintf(ngettext(sum(noMatch), "effect %s not matched", "effects %s not matched"), paste(dmsL2[noMatch],collapse=", ")), domain = NA) } L0[, dmsL2] <- L } L <- L0[noZeroRowL <- as.logical((L0 != 0) %*% rep(1, nX)), , drop = FALSE] nrowL <- nrow(L) rownames(L) <- if(is.null(dmsL1)) 1:nrowL else dmsL1[noZeroRowL] dDF <- unique(object$fixDF$X[noZeroColL <- as.logical(c(rep(1,nrowL) %*% (L != 0)))]) if (length(dDF) > 1) { stop("L may only involve fixed effects with the same denominator DF") } lab <- "F-test for linear combination(s)\n" } nDF <- sum(svd.d(L) > 0) c0 <- c(qr.qty(qr(vFix %*% t(L)), c0))[1:nDF] Fval <- sum(c0^2)/nDF Pval <- pf(Fval, nDF, dDF, lower.tail=FALSE) aod <- data.frame(numDF = nDF, denDF = dDF, "F-value" = Fval, "p-value" = Pval, check.names=FALSE) attr(aod, "rt") <- rt attr(aod, "label") <- lab if (!Lmiss) { attr(aod, "L") <- if(nrow(L) > 1) L[, noZeroColL, drop = FALSE] else L[, noZeroColL] } } } ## ## Otherwise construct the likelihood ratio and information table ## objects in ... may inherit from gls, gnls, lm, lmList, lme, ## nlme, nlsList, and nls ## else { ancall <- sys.call() # yuck.. hack ancall$verbose <- ancall$test <- ancall$type <- NULL object <- list(object, ...) valid.cl <- c("gls", "gnls", "lm", "lmList", "lme","nlme","nlsList","nls") if (!all(vapply(object, inherits, TRUE, what = valid.cl))) { valid.cl <- paste0('"', valid.cl, '"') stop(gettextf("objects must inherit from classes %s, or %s", paste(head(valid.cl, -1), collapse=", "), tail(valid.cl, 1)), domain=NA) } resp <- vapply(object, function(el) deparse(getResponseFormula(el)[[2L]]), "") ## checking if responses are the same subs <- as.logical(match(resp, resp[1L], FALSE)) if (!all(subs)) warning("some fitted objects deleted because response differs from the first model") if (sum(subs) == 1) stop("first model has a different response from the rest") object <- object[subs] rt <- length(object) termsModel <- lapply(object, function(el) formula(el)[-2]) estMeth <- vapply(object, function(el) if (is.null(val <- el[["method"]])) NA_character_ else val, "") ## checking consistency of estimation methods if(length(uEst <- unique(estMeth[!is.na(estMeth)])) > 1) { stop("all fitted objects must have the same estimation method") } estMeth[is.na(estMeth)] <- uEst ## checking if all models have same fixed effects when estMeth = "REML" REML <- uEst == "REML" if(REML) { aux <- vapply(termsModel, function(el) { tt <- terms(el) val <- paste(sort(attr(tt, "term.labels")), collapse = "&") if (attr(tt, "intercept") == 1) paste(val, "(Intercept)", sep = "&") else val }, ".") if(length(unique(aux)) > 1) { warning("fitted objects with different fixed effects. REML comparisons are not meaningful.") } } termsCall <- lapply(object, function(el) { if (is.null(val <- el$call) && is.null(val <- attr(el, "call"))) stop("objects must have a \"call\" component or attribute") val }) termsCall <- vapply(termsCall, function(el) paste(deparse(el), collapse =""), "") aux <- lapply(object, logLik, REML) if (length(unique(vapply(aux, attr, 1, "nall"))) > 1) { stop("all fitted objects must use the same number of observations") } dfModel <- vapply(aux, attr, 1, "df") logLik <- vapply(aux, c, 1.1) aod <- data.frame(call = termsCall, Model = 1:rt, df = dfModel, AIC = vapply(aux, AIC, 1.), BIC = vapply(aux, BIC, 1.), logLik = logLik, check.names = FALSE) if (test) { ddf <- diff(dfModel) if (sum(abs(ddf)) > 0) { effects <- rep("", rt) for(i in 2:rt) { if (ddf[i-1] != 0) { effects[i] <- paste(i - 1, i, sep = " vs ") } } pval <- rep(NA, rt - 1) ldf <- as.logical(ddf) lratio <- 2 * abs(diff(logLik)) lratio[!ldf] <- NA pval[ldf] <- pchisq(lratio[ldf], abs(ddf[ldf]), lower.tail=FALSE) aod <- data.frame(aod, Test = effects, "L.Ratio" = c(NA, lratio), "p-value" = c(NA, pval), check.names = FALSE, stringsAsFactors = TRUE) } } row.names(aod) <- vapply(as.list(ancall[-1L]), c_deparse, "") attr(aod, "rt") <- rt attr(aod, "verbose") <- verbose } class(aod) <- c("anova.lme", "data.frame") aod } ## (This is "cut'n'paste" similar to augPred.gls() in ./gls.R -- keep in sync!) augPred.lme <- function(object, primary = NULL, minimum = min(primary), maximum = max(primary), length.out = 51L, level = Q, ...) { data <- eval.parent(object$call$data) if (!inherits(data, "data.frame")) { stop(gettextf("data in %s call must evaluate to a data frame", sQuote(substitute(object))), domain = NA) } if(is.null(primary)) { if (!inherits(data, "groupedData")) { stop(gettextf( "%s without \"primary\" can only be used with fits of \"groupedData\" objects", sys.call()[[1L]]), domain = NA) } primary <- getCovariate(data) pr.var <- getCovariateFormula(data)[[2L]] } else{ pr.var <- asOneSidedFormula(primary)[[2L]] primary <- eval(pr.var, data) } prName <- c_deparse(pr.var) newprimary <- seq(from = minimum, to = maximum, length.out = length.out) Q <- object$dims$Q # number of levels if (is.null(level)) level <- Q nL <- length(level) # number of requested levels maxLev <- max(c(level, 1)) groups <- getGroups(object, level = maxLev) if (!is.ordered(groups)) { groups <- ordered(groups, levels = unique(as.character(groups))) } grName <- ".groups" ugroups <- unique(groups) value <- data.frame(rep(rep(newprimary, length(ugroups)), nL), rep(rep(ugroups, rep(length(newprimary), length(ugroups))), nL)) names(value) <- c(prName, grName) ## recovering other variables in data that may be needed for predictions ## varying variables will be replaced by their means summData <- gsummary(data, groups = groups) if (any(toAdd <- is.na(match(names(summData), names(value))))) { summData <- summData[, toAdd, drop = FALSE] } value[, names(summData)] <- summData[value[, 2L], ] pred <- predict(object, value[seq_len(nrow(value)/nL), , drop = FALSE], level = level) if (nL > 1) { # multiple levels pred <- pred[, ncol(pred) - (nL - 1):0] # eliminating groups predNames <- rep(names(pred), rep(nrow(pred), nL)) pred <- c(unlist(pred)) } else { predNames <- rep("predicted", nrow(value)) } newvals <- cbind(value[, 1:2], pred) names(newvals)[3] <- respName <- deparse(resp.var <- getResponseFormula(object)[[2L]]) orig <- data.frame(primary, groups, getResponse(object)) names(orig) <- names(newvals) value <- rbind(orig, newvals) attributes(value[, 2]) <- attributes(groups) value[, ".type"] <- ordered(c(rep("original", nrow(data)), predNames), levels = c(unique(predNames), "original")) labs <- list(x = prName, y = respName) unts <- list(x = "", y = "") if(inherits(data, "groupedData")) { labs[names(attr(data, "labels"))] <- attr(data, "labels") unts[names(attr(data, "units"))] <- attr(data, "units") attr(value, "units") <- attr(data, "units") } structure(value, class = c("augPred", class(value)), labels = labs, units = unts, formula= eval(substitute(Y ~ X | G, list(Y = resp.var, X = pr.var, G = as.name(grName))))) } coef.lme <- function(object, augFrame = FALSE, level = Q, data, which = 1:ncol(data), FUN = mean, omitGroupingFactor = TRUE, subset = NULL, ...) { Q <- object$dims$Q if (length(level) > 1) { stop("only single level allowed") } fixed <- fixef(object) p <- length(fixed) value <- ranef(object, level = 1:level) grps <- object[["groups"]] if (Q > 1) { grpNames <- t(array(rep(rev(names(grps)), Q), c(Q, Q))) grpNames[lower.tri(grpNames)] <- "" grpNames <- rev(apply(grpNames, 1, function(x) paste(x[x != ""], collapse = " %in% ")))[level] } else { grpNames <- names(grps) } grps <- grps[, 1:level, drop = FALSE] grps <- gsummary(grps, groups = grps[, level]) if (level == 1) value <- list(value) effNams <- unlist(lapply(value, names)) grps <- grps[row.names(value[[level]]), , drop = FALSE] M <- nrow(grps) effNams <- unique(c(names(fixed), effNams)) effs <- array(0, c(M, length(effNams)), list(row.names(grps), effNams)) effs[, names(fixed)] <- array(rep(fixed, rep(M, p)), c(M, p)) for (i in 1:level) { nami <- names(value[[i]]) effs[, nami] <- as.matrix(effs[, nami] + value[[i]][as.character(grps[, i]), ]) } if (augFrame) { # can only do that for last level if (missing(data)) { data <- getData(object) } data <- as.data.frame(data) data <- data[, which, drop = FALSE] value <- ranef(object, TRUE, level, data, FUN = FUN, omitGroupingFactor = omitGroupingFactor, subset = subset) whichKeep <- is.na(match(names(value), effNams)) if (any(whichKeep)) { effs <- cbind(effs, value[, whichKeep, drop = FALSE]) } } effs <- as.data.frame(effs) attr(effs, "level") <- level attr(effs, "label") <- "Coefficients" attr(effs, "effectNames") <- effNams attr(effs, "standardized") <- FALSE attr(effs, "grpNames") <- grpNames class(effs) <- unique(c("coef.lme", "ranef.lme", class(effs))) effs } fitted.lme <- function(object, level = Q, asList = FALSE, ...) { Q <- object$dims$Q val <- object[["fitted"]] if (is.character(level)) { # levels must be given consistently nlevel <- match(level, names(val)) if (any(aux <- is.na(nlevel))) { stop(sprintf(ngettext(sum(aux), "nonexistent level %s", "nonexistent levels %s"), level[aux]), domain = NA) } level <- nlevel } else { # assuming integers level <- 1 + level } if (length(level) == 1L) { grp.nm <- row.names(object[["groups"]]) grps <- as.character(object[["groups"]][, max(c(1, level - 1))]) if (asList) { val <- as.list(split(val, ordered(grps, levels = unique(grps)))) } else { val <- napredict(object$na.action, val[, level]) names(val) <- grps[match(names(val), grp.nm)] } lab <- "Fitted values" if (!is.null(aux <- attr(object, "units")$y)) lab <- paste(lab, aux) attr(val, "label") <- lab val } else napredict(object$na.action, val[, level]) } formula.lme <- function(x, ...) formula(x$terms) fixef.lme <- function(object, ...) object$coefficients$fixed getGroups.lme <- function(object, form, level = Q, data, sep) { Q <- object$dims$Q val <- object[["groups"]][, level] if (length(level) == 1) { # single group attr(val, "label") <- names(object[["groups"]])[level] } val } getGroupsFormula.lme <- function(object, asList = FALSE, sep) { getGroupsFormula(object$modelStruct$reStruct, asList) } getResponse.lme <- function(object, form) { val <- resid(object) + fitted(object) if (is.null(lab <- attr(object, "labels")$y)) { lab <- deparse(getResponseFormula(object)[[2L]]) } if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } attr(val, "label") <- lab val } intervals.lme <- function(object, level = 0.95, which = c("all", "var-cov", "fixed"), ...) { which <- match.arg(which) val <- list() ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixSig <- attr(object$modelStruct, "fixedSigma") fixSig <- !is.null(fixSig) && fixSig if (which != "var-cov") { # fixed effects included est <- fixef(object) len <- -qt((1-level)/2, object$fixDF$X) * sqrt(diag(object$varFix)) vfix <- array(c(est - len, est, est + len), c(length(est), 3), list(names(est), c("lower", "est.", "upper"))) attr(vfix, "label") <- "Fixed effects:" val <- list(fixed = vfix) } if (which != "fixed") { # variance-covariance included if (is.character(aV <- object$apVar)) { stop(gettextf("cannot get confidence intervals on var-cov components: %s\n Consider '%s'", aV, "which = \"fixed\""), domain = NA) } est <- attr(aV, "Pars") nP <- length(est) len <- -qnorm((1-level)/2) * sqrt(diag(aV)) origInt <- # intervals in unconstrained parameters array(c(est - len, est, est + len), c(nP, 3), list(names(est), c("lower", "est.", "upper"))) lmeSt <- object$modelStruct if (!all(whichKeep <- apply(attr(lmeSt, "pmap"), 2, any))) { ## need to deleted components with fixed coefficients aux <- lmeSt[whichKeep] class(aux) <- class(lmeSt) attr(aux, "settings") <- attr(lmeSt, "settings") attr(aux, "pmap") <- attr(lmeSt, "pmap")[, whichKeep, drop = FALSE] lmeSt <- aux } cSt <- lmeSt[["corStruct"]] if (!is.null(cSt) && inherits(cSt, "corSymm") && attr(aV, "natural")) { ## converting to corNatural class(cSt) <- c("corNatural", "corStruct") lmeSt[["corStruct"]] <- cSt } pmap <- attr(lmeSt, "pmap") namL <- names(lmeSt) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions if (fixSig) { natInt <- vector("list", length(namL)) names(natInt) <- namL } else { natInt <- vector("list", length(namL) + 1) names(natInt) <- c(namL, "sigma") # list of intervals in natural pars ## intervals for sigma are stored separately and dropped from origInt vsig <- exp(origInt[nP, ]) attr(vsig, "label") <- "Within-group standard error:" natInt[["sigma"]] <- vsig origInt <- origInt[ - nP,, drop = FALSE] } if (attr(aV, "natural")) { # convert any pdSymm's to pdNatural's for(i in seq_along(lmeSt$reStruct)) { if (inherits(s.i <- lmeSt$reStruct[[i]], "pdSymm")) { s.i <- pdNatural(s.i) } else if (inherits(s.i, "pdBlocked")) { for(j in seq_along(s.i)) if (inherits(s.i[[j]], "pdSymm")) s.i[[j]] <- pdNatural(s.i[[j]]) } lmeSt$reStruct[[i]] <- s.i } } rownames(origInt) <- # re-express names if necessary ## namP <- names(coef(lmeSt, unconstrained = FALSE)) for(i in 1:3) { # re-express intervals in constrained pars coef(lmeSt) <- origInt[,i] origInt[,i] <- coef(lmeSt, unconstrained = FALSE) } for(i in namL) { natInt[[i]] <- origInt[ pmap[ , i ], , drop = FALSE ] switch(i, "reStruct" = { plen <- attr( lmeSt$reStruct, "plen" ) natInt[[i]] <- rev(as.matrix( split( as.data.frame( natInt[[i]] ), rep( seq_along(plen), plen )))) names(natInt[[i]]) <- rev(names(plen)) for (j in names(plen)) { dimnames(natInt[[i]][[j]])[[1L]] <- names( coef( lmeSt[[i]][[j]], unconstrained = FALSE ) ) } }, "corStruct" =, "varStruct" = { dimnames(natInt[[i]])[[1L]] <- names(coef(lmeSt[[i]], unconstrained = FALSE)) } ) attr(natInt[[i]], "label") <- switch(i, reStruct = "Random Effects:", corStruct = "Correlation structure:", varStruct = "Variance function:", paste0(i,":")) } val <- c(val, natInt) } attr(val, "level") <- level class(val) <- "intervals.lme" val } logLik.lme <- function(object, REML, ...) { ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixSig <- attr(object[["modelStruct"]], "fixedSigma") fixSig <- !is.null(fixSig) && fixSig od <- object$dims p <- od$ncol[[od$Q + 1L]] N <- od$N ## Np <- N - p estM <- object$method if (missing(REML)) REML <- estM == "REML" val <- object[["logLik"]] if (REML && (estM == "ML")) { # have to correct logLik val <- val + (p * (log(2 * pi) + 1L) + (N - p) * log(1 - p/N) + sum(log(abs(svd.d(object$varFix))))) / 2 } if (!REML && (estM == "REML")) { # have to correct logLik val <- val - (p * (log(2*pi) + 1L) + N * log(1 - p/N) + sum(log(abs(svd.d(object$varFix))))) / 2 } structure(val, class = "logLik", nall = N, nobs = N - REML * p, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions df = p + length(coef(object[["modelStruct"]])) + as.integer(!fixSig)) } nobs.lme <- function(object, ...) object$dims$N pairs.lme <- function(x, form = ~coef(.), label, id = NULL, idLabels = NULL, grid = FALSE, ...) { object <- x ## scatter plot matrix plots, generally based on coef or ranef if (!inherits(form, "formula")) { stop("'form' must be a formula") } if (length(form) != 2) { stop("'form' must be a one-sided formula") } ## constructing data allV <- all.vars(asOneFormula(form, id, idLabels)) allV <- allV[is.na(match(allV,c("T","F","TRUE","FALSE")))] if (length(allV) > 0) { data <- getData(object) if (is.null(data)) { # try to construct data alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } else { if (any(naV <- is.na(match(allV, names(data))))) { stop(sprintf(ngettext(sum(naV), "%s not found in data", "%s not found in data"), allV[naV]), domain = NA) } } } else data <- NULL ## argument list dots <- list(...) args <- if(length(dots) > 0) dots else list() ## covariate - must be present as a data.frame covF <- getCovariateFormula(form) .x <- eval(covF[[2L]], list(. = object)) # only function of "." if (!inherits(.x, "data.frame")) { stop("covariate must be a data frame") } level <- attr(.x, "level") if (!is.null(effNams <- attr(.x, "effectNames"))) { .x <- .x[, effNams, drop = FALSE] } ## eliminating constant effects isFixed <- vapply(.x, function(el) length(unique(el)) == 1L, NA) .x <- .x[, !isFixed, drop = FALSE] nc <- ncol(.x) if (nc == 1) { stop("cannot do pairs of just one variable") } if (!missing(label)) { names(.x) <- label } if (nc == 2) { ## will use xyplot argForm <- .y ~ .x argData <- .x names(argData) <- c(".x", ".y") if (is.null(args$xlab)) args$xlab <- names(.x)[1L] if (is.null(args$ylab)) args$ylab <- names(.x)[2L] } else { # splom argForm <- ~ .x argData <- list(.x = .x) } auxData <- list() ## groups - need not be present grpsF <- getGroupsFormula(form) if (!is.null(grpsF)) { gr <- splitFormula(grpsF, sep = "*") for(i in seq_along(gr)) { for(j in all.vars(gr[[i]])) { auxData[[j]] <- eval(as.name(j), data) } } argForm <- eval(substitute( if(length(argForm) == 2) ~ .x | R else .y ~ .x | R, list(R = grpsF[[2L]]))) } ## id and idLabels - need not be present if (!is.null(id)) { # identify points in plot N <- object$dims$N id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } if (is.null(level)) { stop("covariate must have a level attribute when groups are present") } aux <- t(as.matrix(ranef(object, level = level))) aux <- as.logical(colSums( (solve(t(pdMatrix(object$modelStruct$reStruct, factor = TRUE)[[level]]), aux)/object$sigma)^2) > qchisq(1 - id, dim(aux)[1L])) aux }, call = eval(asOneSidedFormula(id)[[2L]], data), stop("'id' can only be a formula or numeric") ) if (length(id) == N) { ## id as a formula evaluated in data if (is.null(level)) { stop("covariate must have a level attribute when 'id' is a formula") } auxData[[".id"]] <- id } if (is.null(idLabels)) { idLabels <- row.names(.x) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2L]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != N) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } if (length(idLabels) == N) { ## idLabels as a formula evaluated in data if (is.null(level)) { stop("covariate must have a level attribute when 'idLabels' is a formula") } auxData[[".Lid"]] <- idLabels } } if (length(auxData)) { # need collapsing auxData <- gsummary(as.data.frame(auxData), groups = getGroups(object, level = level)) auxData <- auxData[row.names(.x), , drop = FALSE] if (!is.null(auxData[[".id"]])) { id <- auxData[[".id"]] } if (!is.null(auxData[[".Lid"]])) { idLabels <- auxData[[".Lid"]] } wchDat <- is.na(match(names(auxData), c(".id", ".idLabels"))) if (any(wchDat)) { argData <- c(argData, as.list(auxData[, wchDat, drop = FALSE])) } } if (!is.null(id)) id <- as.logical(as.character(id)) idLabels <- as.character(idLabels) ## adding to args list args <- c(list(argForm, data = argData), args) if (is.null(args$strip)) { args$strip <- function(...) strip.default(..., style = 1) } if (is.null(args$cex)) args$cex <- par("cex") if (is.null(args$adj)) args$adj <- par("adj") ## defining the type of plot if (length(argForm) == 3) { # xyplot plotFun <- "xyplot" if(is.null(args$panel)) args$panel <- function(x, y, subscripts, ...) { x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y, ...) if (any(ids <- id[subscripts])){ ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } } } else { # splom plotFun <- "splom" if(is.null(args$panel)) { args$panel <- function(x, y, subscripts, ...) { x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y, ...) if (any(ids <- id[subscripts])){ ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } } } } do.call(plotFun, as.list(args)) } plot.ranef.lme <- function(x, form = NULL, omitFixed = TRUE, level = Q, grid = TRUE, control, xlab = NULL, ylab = NULL, strip = NULL, ...) { plotControl <- function(drawLine = TRUE, span.loess = 2/3, degree.loess = 1) { list(drawLine = drawLine, span.loess = span.loess, degree.loess = degree.loess) } pControl <- plotControl() if (!missing(control)) pControl[names(control)] <- control if (!inherits(x, "data.frame")) { ## must be a list of data frames Q <- length(x) # the default for 'level' if (length(level) > 1) { stop("only single level allowed") } oAttr <- attributes(x)[c("label", "standardized", "namsEff")] x <- x[[level]] oAttr$namsEff <- oAttr$namsEff[level] attributes(x)[c("label", "standardized", "namsEff")] <- oAttr } if (omitFixed) { # eliminating constant effects isFixed <- vapply(x, function(el) length(unique(el)) == 1L, NA) if (any(isFixed)) { oattr <- attributes(x) oattr <- oattr[names(oattr) != "names"] x <- x[, !isFixed, drop = FALSE] oattr$effectNames <- oattr$effectNames[!is.na(match(oattr$effectNames, names(x)))] attributes(x)[names(oattr)] <- oattr } } eNames <- attr(x, "effectNames") if (is.null(form) || (inherits(form, "formula") && length(form) == 2)) { ## ~ x : dotplot eLen <- length(eNames) argData <- data.frame(.pars = as.vector(unlist(x[, eNames])), .enames = ordered(rep(eNames, rep(nrow(x), eLen)), levels = eNames), check.names = FALSE) for(i in names(x)[is.na(match(names(x), eNames))]) { argData[[i]] <- rep(x[[i]], eLen) } argForm <- .groups ~ .pars | .enames argData[[".groups"]] <- rep(row.names(x), eLen) if (inherits(form, "formula")) { onames <- all.vars(form) if (any(whichNA <- is.na(match(onames, names(argData))))) { stop(sprintf(ngettext(sum(whichNA), "%s not available for plotting", "%s not available for plotting"), onames[whichNA], collapse = ", "), domain = NA) } argData[[".groups"]] <- as.character(argData[[as.character(onames[1L])]]) if (length(onames) > 1) { for(i in onames[-1L]) { argData[[".groups"]] <- paste(as.character(argData[[".groups"]]), as.character(argData[[i]])) } } } argData[[".groups"]] <- ordered(argData[[".groups"]], levels = unique(argData[[".groups"]])) args <- list(argForm, data = argData, ...) args$xlab <- xlab %||% attr(x, "label") args$ylab <- ylab %||% if (is.null(form)) attr(x, "grpNames") else deparse(form[[2L]]) if (is.null(args$scales)) { if (!is.null(attr(x, "standardized")) && !attr(x, "standardized")) { args$scales <- list(x = list(relation = "free")) } } args$strip <- strip %||% function(...) strip.default(..., style = 1) do.call(dotplot, args) } else { ## y ~ x ---> xyplot(): ------------------------------------------ if (!inherits(form, "formula")) stop("'form' must be a formula when not NULL") reName <- form[[2L]] if (length(reName) != 1 && substring(deparse(reName), nchar(deparse(reName), "c") - 10) != "(Intercept)") { stop("only single effects allowed in left side of 'form'") } reName <- deparse(reName) if (is.na(match(reName, eNames))) { stop(gettextf("%s is not a valid effect name", sQuote(reName)), domain = NA) } vNames <- all.vars(form[[3]]) # variable names if (any(!is.na(match(vNames, eNames)))) { stop("no effects allowed in right side of formula") } if (any(whichNA <- is.na(match(vNames, names(x))))) { stop(sprintf(ngettext(sum(whichNA), "%s not available for plotting", "%s not available for plotting"), onames[whichNA], collapse = ", "), domain = NA) } nV <- length(vNames) # number of variables nG <- nrow(x) # number of groups reVal <- vNam <- vVal <- vector("list", nV) vLevs <- vNam; names(vLevs) <- vNames vType <- character(nV); names(vType) <- vNames aux <- x[, reName] for(i in 1:nV) { obj <- x[, vNames[i]] if (inherits(obj, "factor") || is.character(obj)) { vType[i] <- "factor" obj <- as.factor(obj) vLevs[[i]] <- levels(obj) reVal[[i]] <- c(NA, NA, aux) vVal [[i]] <- c(0.5, length(levels(obj)) + 0.5, as.integer(obj)) vNam [[i]] <- rep(vNames[i], nG + 2) } else { # numeric vType[i] <- "numeric" reVal[[i]] <- aux vVal [[i]] <- obj vNam [[i]] <- rep(vNames[i], nG) } } vNam <- unlist(vNam) argData <- data.frame(y = unlist(reVal), x = unlist(vVal), g = ordered(vNam, levels = vNames)) ## this is a hack to make this work, it's probably possible to ## implement the whole thing much more succintly -- ds ## The idea here is that the limits component of scales$x is going ## to be a list -- and character vectors have special meaning as ## limits, controlling both limits and the tick mark ## positions/labels condvar <- eval(expression(g), argData) xscales.lim <- as.list(levels(condvar)) subsc <- seq_along(condvar) for (i in seq_along(xscales.lim)) { subscripts <- subsc[condvar == xscales.lim[[i]]] vN <- vNam[subscripts][1L] xscales.lim[[i]] <- if(vType[vN] == "numeric") range(argData$x[subscripts]) else vLevs[vN][[1L]] } ## --- further used from the panel() below: --- .drawLine <- pControl$drawLine .span <- pControl$span.loess .degree <- pControl$degree.loess ## assign("panel.bwplot2", panel.bwplot2, where = 1) ## assign(".cex", pControl$cex.axis)#, where = 1) ## assign(".srt", pControl$srt.axis)#, where = 1) ## assign(".mgp", pControl$mgp.axis)#, where = 1) xyplot(y ~ x | g, data = argData, subscripts = TRUE, scales = list(x = list(relation = "free", limits = xscales.lim)), panel = function(x, y, subscripts, ...) { vN <- vNam[subscripts][1L] if (grid) panel.grid() if (vType[vN] == "numeric") { panel.xyplot(x, y, ...) if (.drawLine) { panel.loess(x, y, span = .span, degree = .degree) } } else { panel.bwplot(x, y, horizontal = FALSE) if (.drawLine) { plot.line <- trellis.par.get("plot.line") panel.linejoin(x, y, fun = median, horizontal = FALSE, col.line = plot.line$col, lwd = plot.line$lwd, lty = plot.line$lty) } } }, xlab = xlab %||% "", ylab = ylab %||% reName, strip = strip %||% strip.default, ...) } } ## {plot.ranef.lme} predict.lme <- function(object, newdata, level = Q, asList = FALSE, na.action = na.fail, ...) { ## ## method for predict() designed for objects inheriting from class lme ## Q <- object$dims$Q if (missing(newdata)) { # will return fitted values val <- fitted(object, level, asList) if (length(level) == 1) return(val) return(data.frame(object[["groups"]][,level[level != 0], drop = FALSE], predict = val)) } maxQ <- max(level) # maximum level for predictions nlev <- length(level) fixed <- formula(object)[-2L] # RHS Terms <- object$terms newdata <- as.data.frame(newdata) if (maxQ > 0) { # predictions with random effects whichQ <- Q - (maxQ-1):0 reSt <- object$modelStruct$reStruct[whichQ] lmeSt <- lmeStruct(reStruct = reSt) groups <- getGroupsFormula(reSt) if (anyNA(match(all.vars(groups), names(newdata)))) { ## groups cannot be evaluated in newdata stop("cannot evaluate groups for desired levels on 'newdata'") } } else { reSt <- NULL } ## use xlev to make sure factor levels are the same as in contrasts ## and to support character-type 'newdata' for factors contr <- object$contrasts # these are in matrix form dataMix <- model.frame(formula = asOneFormula(formula(reSt), fixed), data = newdata, na.action = na.action, drop.unused.levels = TRUE, xlev = lapply(contr, rownames)) origOrder <- row.names(dataMix) # preserve the original order whichRows <- match(origOrder, row.names(newdata)) if (maxQ > 0) { ## sort the model.frame by groups and get the matrices and parameters ## used in the estimation procedures grps <- getGroups(newdata, # (unused levels are dropped here) eval(substitute(~ 1 | GRPS, list(GRPS = groups[[2]])))) ## ordering data by groups if (inherits(grps, "factor")) { # single level grps <- grps[whichRows] oGrps <- data.frame(grps) ## checking if there are missing groups if (any(naGrps <- is.na(grps))) { grps[naGrps] <- levels(grps)[1L] # input with existing level } ord <- order(grps) #"order" treats a single named argument peculiarly grps <- data.frame(grps) row.names(grps) <- origOrder names(grps) <- names(oGrps) <- as.character(deparse((groups[[2L]]))) } else { grps <- oGrps <- grps[whichRows, ] ## checking for missing groups if (any(naGrps <- is.na(grps))) { ## need to input missing groups for(i in names(grps)) { grps[naGrps[, i], i] <- levels(grps[,i])[1L] } naGrps <- t(apply(naGrps, 1, cumsum)) # propagating NAs } ord <- do.call(order, grps) ## making group levels unique for(i in 2:ncol(grps)) { grps[, i] <- as.factor(paste(as.character(grps[, i-1]), as.character(grps[, i ]), sep = "/")) } } naGrps <- cbind(FALSE, naGrps)[ord, , drop = FALSE] grps <- grps[ord, , drop = FALSE] dataMix <- dataMix[ord, ,drop = FALSE] } ## restore contrasts for the below model.matrix() calls (which may use ## different factor variables, so we avoid passing the whole contr list) for(i in intersect(names(dataMix), names(contr))) { attr(dataMix[[i]], "contrasts") <- contr[[i]] } if (maxQ > 0) { revOrder <- match(origOrder, row.names(dataMix)) # putting in orig. order Z <- model.matrix(reSt, dataMix) ncols <- attr(Z, "ncols") Names(lmeSt$reStruct) <- attr(Z, "nams") } N <- nrow(dataMix) X <- if (length(all.vars(fixed)) > 0) { model.matrix(fixed, model.frame(delete.response(Terms), dataMix)) } else if(attr(terms(fixed), "intercept")) { array(1, c(N, 1), list(row.names(dataMix), "(Intercept)")) } else { array(, c(N, 0)) } if (maxQ == 0) { ## only population predictions val <- if(ncol(X)) c(X %*% fixef(object)) else rep(0, nrow(X)) attr(val, "label") <- "Predicted values" return(val) } ncols <- c(ncols, dim(X)[2L], 1) ## creating the condensed linear model attr(lmeSt, "conLin") <- list(Xy = array(c(Z, X, double(N)), c(N, sum(ncols)), list(row.names(dataMix), c(colnames(Z), colnames(X), "resp"))), dims = MEdims(grps, ncols)) ## Getting the appropriate BLUPs of the random effects re <- object$coefficients$random[1:maxQ] for(i in names(re)) { ugrps <- unique(as.character(grps[, i])) val <- array(NA, c(length(ugrps), ncol(re[[i]])), list(ugrps, dimnames(re[[i]])[[2L]])) mGrps <- match(ugrps, dimnames(re[[i]])[[1L]]) mGrps <- mGrps[!is.na(mGrps)] re[[i]] <- re[[i]][mGrps, , drop = FALSE] val[dimnames(re[[i]])[[1L]], ] <- re[[i]] re[[i]] <- val } attr(lmeSt, "lmeFit") <- list(beta = fixef(object), b = re) val <- fitted(lmeSt, level = 0:maxQ) val[as.logical(naGrps)] <- NA # setting missing groups to NA ## putting back in original order and extracting levels val <- val[revOrder, level + 1L] # predictions if (maxQ > 1) { # making groups unique for(i in 2:maxQ) oGrps[, i] <- as.factor(paste(as.character(oGrps[,i-1]), as.character(oGrps[,i ]), sep = "/")) } if (nlev == 1) { grps <- as.character(oGrps[, level]) if (asList) { val <- split(val, ordered(grps, levels = unique(grps))) } else { names(val) <- grps } lab <- "Predicted values" if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } attr(val, "label") <- lab val } else { data.frame(oGrps, predict = val) } } print.anova.lme <- function(x, verbose = attr(x, "verbose"), ...) { ox <- x if ((rt <- attr(x,"rt")) == 1) { ## one object if (!is.null(lab <- attr(x, "label"))) { cat(lab) if (!is.null(L <- attr(x, "L"))) { print(zapsmall(L), ...) } } pval <- format(round(x[, "p-value"],4)) pval[as.double(pval) == 0] <- "<.0001" x[, "F-value"] <- format(zapsmall(x[, "F-value"])) x[, "p-value"] <- pval print(as.data.frame(x), ...) } else { ## several objects if (verbose) { cat("Call:\n") objNams <- row.names(x) for(i in 1:rt) { cat(" ",objNams[i],":\n", sep ="") cat(" ",as.character(x[i,"call"]),"\n") } cat("\n") } x <- as.data.frame(x[,-1]) for(i in names(x)) { xx <- x[[i]] if (i == "p-value") { xx <- round(xx, 4) xna <- is.na(xx) xx[!xna] <- format(xx[!xna]) xx[as.double(xx) == 0] <- "<.0001" xx[xna] <- "" } else { if (match(i, c("AIC", "BIC", "logLik", "L.Ratio"), 0)) { xna <- is.na(xx) xx <- zapsmall(xx) xx[xna] <- 0 xx <- format(xx) xx[xna] <- "" } } x[[i]] <- xx } print(as.data.frame(x), ...) } invisible(ox) } print.intervals.lme <- function(x, ...) { cat(paste0("Approximate ", attr(x,"level") *100, "% confidence intervals\n")) for(i in names(x)) { aux <- x[[i]] cat("\n ",attr(aux, "label"), "\n", sep = "") attr(aux, "label") <- NULL if (i == "reStruct") { for(j in names(aux)) { cat(" Level:", j, "\n") print(as.matrix(aux[[j]]), ...) } } else if (i == "sigma") print(c(aux), ...) else print(as.matrix(aux), ...) } invisible(x) } print.lme <- function(x, ...) { dd <- x$dims if (inherits(x, "nlme")) { # nlme object cat( "Nonlinear mixed-effects model fit by " ) cat( if(x$method == "REML") "REML\n" else "maximum likelihood\n") cat(" Model:", deparse(x$call$model),"\n") } else { # lme objects cat( "Linear mixed-effects model fit by " ) cat( if(x$method == "REML") "REML\n" else "maximum likelihood\n") } cat(" Data:", deparse( x$call$data ), "\n") if (!is.null(x$call$subset)) { cat(" Subset:", deparse(asOneSidedFormula(x$call$subset)[[2L]]),"\n") } cat(" Log-", if(x$method == "REML") "restricted-" else "", "likelihood: ", format(x$logLik), "\n", sep = "") fixF <- x$call$fixed cat(" Fixed:", deparse( if(inherits(fixF, "formula") || is.call(fixF) || is.name(fixF)) fixF else lapply(fixF, function(el) as.name(deparse(el)))), "\n") print(fixef(x), ...) cat("\n") print(summary(x$modelStruct), sigma = x$sigma, ...) cat("Number of Observations:", dd[["N"]]) cat("\nNumber of Groups: ") Ngrps <- dd$ngrps[1:dd$Q] if ((lNgrps <- length(Ngrps)) == 1) { # single nesting cat(Ngrps,"\n") } else { # multiple nesting sNgrps <- 1:lNgrps aux <- rep(names(Ngrps), sNgrps) aux <- split(aux, array(rep(sNgrps, lNgrps), c(lNgrps, lNgrps))[!lower.tri(diag(lNgrps))]) names(Ngrps) <- unlist(lapply(aux, paste, collapse = " %in% ")) cat("\n") print(rev(Ngrps), ...) } invisible(x) } print.ranef.lme <- function(x, ...) { if (!inherits(x[[1L]], "data.frame")) { print.data.frame(x, ...) } else { # list for(i in seq_along(x)) { cat("Level:", attr(x, "grpNames")[i],"\n") print.data.frame(x[[i]]) if (i < length(x)) cat("\n") } } invisible(x) } print.summary.lme <- function(x, verbose = FALSE, ...) { dd <- x$dims verbose <- verbose || attr(x, "verbose") if (inherits(x, "nlme")) { # nlme object cat( "Nonlinear mixed-effects model fit by " ) cat( if(x$method == "REML") "REML\n" else "maximum likelihood\n") cat(" Model:", deparse(x$call$model),"\n") } else { # lme objects cat( "Linear mixed-effects model fit by " ) cat( if(x$method == "REML") "REML\n" else "maximum likelihood\n") } ## method <- x$method cat(" Data:", deparse( x$call$data ), "\n") if (!is.null(x$call$subset)) { cat(" Subset:", deparse(asOneSidedFormula(x$call$subset)[[2L]]),"\n") } print(data.frame(AIC = x$AIC, BIC = x$BIC, logLik = c(x$logLik), row.names = " "), ...) if (verbose) cat("Convergence at iteration:",x$numIter,"\n") cat("\n") print(summary(x$modelStruct), sigma = x$sigma, reEstimates = x$coefficients$random, verbose = verbose, ...) fixF <- x$call$fixed cat("Fixed effects: ", deparse( if(inherits(fixF, "formula") || is.call(fixF)) fixF else lapply(fixF, function(el) as.name(deparse(el)))), "\n") ## fixed effects t-table and correlations xtTab <- as.data.frame(x$tTable) wchPval <- match("p-value", names(xtTab)) for(i in names(xtTab)[-wchPval]) { xtTab[, i] <- format(zapsmall(xtTab[, i])) } xtTab[,wchPval] <- format(round(xtTab[,wchPval], 4)) if (any(wchLv <- (as.double(levels(xtTab[, wchPval])) == 0))) { levels(xtTab[, wchPval])[wchLv] <- "<.0001" } row.names(xtTab) <- dimnames(x$tTable)[[1L]] print(xtTab, ...) if (nrow(x$tTable) > 1) { corr <- x$corFixed class(corr) <- "correlation" print(corr, title = " Correlation:", ...) } cat("\nStandardized Within-Group Residuals:\n") print(x$residuals, ...) cat("\nNumber of Observations:",x$dims[["N"]]) cat("\nNumber of Groups: ") Ngrps <- dd$ngrps[1:dd$Q] if ((lNgrps <- length(Ngrps)) == 1) { # single nesting cat(Ngrps,"\n") } else { # multiple nesting sNgrps <- 1:lNgrps aux <- rep(names(Ngrps), sNgrps) aux <- split(aux, array(rep(sNgrps, lNgrps), c(lNgrps, lNgrps))[!lower.tri(diag(lNgrps))]) names(Ngrps) <- unlist(lapply(aux, paste, collapse = " %in% ")) cat("\n") print(rev(Ngrps), ...) } invisible(x) } ## coef(summary( obj )) # should work for "gls" or "lme" similarly as for lm(): getCTable <- function (object, ...) object$tTable qqnorm.lme <- function(y, form = ~ resid(., type = "p"), abline = NULL, id = NULL, idLabels = NULL, grid = FALSE, ...) ## normal probability plots for residuals and random effects { if (!inherits(form, "formula")) stop("'form' must be a formula") ## object <- y ## constructing data allV <- all.vars(asOneFormula(form, id, idLabels)) allV <- allV[is.na(match(allV,c("T","F","TRUE","FALSE")))] if (length(allV) > 0) { data <- getData(y) if (is.null(data)) { # try to construct data alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } else { if (any(naV <- is.na(match(allV, names(data))))) { stop(sprintf(ngettext(sum(naV), "%s not found in data", "%s not found in data"), allV[naV]), domain = NA) } } } else data <- NULL ## argument list args <- list(...) # may be empty list() ## appending object to data data <- as.list(c(as.list(data), . = list(y))) ## covariate - must always be present covF <- getCovariateFormula(form) .x <- eval(covF[[2L]], data) labs <- attr(.x, "label") type <- if (inherits(.x, "ranef.lme")) "reff" # random effects else if (!is.null(labs) && (labs == "Standardized residuals" || labs == "Normalized residuals" || substr(labs, 1, 9) == "Residuals")) "res" # residuals else stop("only residuals and random effects allowed") if (is.null(args$xlab)) args$xlab <- labs if (is.null(args$ylab)) args$ylab <- "Quantiles of standard normal" if(type == "res") { ## residuals ---------------------------------------- fData <- qqnorm(.x, plot.it = FALSE) data[[".y"]] <- fData$x data[[".x"]] <- fData$y dform <- if (!is.null(grp <- getGroupsFormula(form))) eval(substitute(.y ~ .x | G, list(G = grp[[2L]]))) else .y ~ .x if (!is.null(id)) { # identify points in plot id <- switch(mode(id), numeric = { if (any(id <= 0) || any(id >= 1)) { stop("'Id' must be between 0 and 1") } if (labs == "Normalized residuals") { as.logical(abs(resid(y, type="normalized")) > -qnorm(id / 2)) } else { as.logical(abs(resid(y, type="pearson")) > -qnorm(id / 2)) } }, call = eval(asOneSidedFormula(id)[[2L]], data), stop("'id' can only be a formula or numeric") ) if (is.null(idLabels)) { idLabels <- getGroups(y) if (length(idLabels) == 0) idLabels <- seq_len(y$dims$N) idLabels <- as.character(idLabels) } else { if (mode(idLabels) == "call") { idLabels <- as.character(eval(asOneSidedFormula(idLabels)[[2L]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != length(id)) { stop("'idLabels' of incorrect length") } idLabels <- as.character(idLabels) } else { stop("'idLabels' can only be a formula or a vector") } } } } else { # type "ref" -- random.effects -------------------------------- level <- attr(.x, "level") std <- attr(.x, "standardized") if (!is.null(effNams <- attr(.x, "effectNames"))) { .x <- .x[, effNams, drop = FALSE] } nc <- ncol(.x) nr <- nrow(.x) fData <- lapply(as.data.frame(.x), qqnorm, plot.it = FALSE) fData <- data.frame(.x = unlist(lapply(fData, function(x) x[["y"]])), .y = unlist(lapply(fData, function(x) x[["x"]])), .g = ordered(rep(names(fData),rep(nr, nc)), levels = names(fData)), check.names = FALSE) if (!is.null(grp <- getGroupsFormula(form))) { dform <- substitute(.y ~ .x | .g * GG, list(GG = deparse(grp[[2L]]))) auxData <- data[is.na(match(names(data), "."))] } else { dform <- .y ~ .x | .g auxData <- list() } ## id and idLabels - need not be present if (!is.null(id)) { # identify points in plot N <- y$dims$N id <- switch(mode(id), numeric = { if ((id <= 0) || (id >= 1)) { stop("'id' must be between 0 and 1") } aux <- ranef(y, level = level, standard = TRUE) as.logical(abs(c(unlist(aux))) > -qnorm(id / 2)) }, call = eval(asOneSidedFormula(id)[[2L]], data), stop("'id' can only be a formula or numeric") ) if (length(id) == N) { ## id as a formula evaluated in data auxData[[".id"]] <- id } idLabels <- if (is.null(idLabels)) { rep(row.names(.x), nc) } else if (mode(idLabels) == "call") { as.character(eval(asOneSidedFormula(idLabels)[[2L]], data)) } else if (is.vector(idLabels)) { if (length(idLabels <- unlist(idLabels)) != N) stop("'idLabels' of incorrect length") as.character(idLabels) } else stop("'idLabels' can only be a formula or a vector") if (length(idLabels) == N) { ## idLabels as a formula evaluated in data auxData[[".Lid"]] <- idLabels } } data <- if (length(auxData)) { # need collapsing auxData <- gsummary(as.data.frame(auxData), groups = getGroups(y, level = level)) auxData <- auxData[row.names(.x), , drop = FALSE] if (!is.null(auxData[[".id"]])) id <- rep(auxData[[".id"]], nc) if (!is.null(auxData[[".Lid"]])) idLabels <- rep(auxData[[".Lid"]], nc) cbind(fData, do.call(rbind, rep(list(auxData), nc))) } else fData } id <- if (!is.null(id)) as.logical(as.character(id)) idLabels <- as.character(idLabels) abl <- abline if (is.null(args$strip)) args$strip <- function(...) strip.default(..., style = 1) if (is.null(args$cex)) args$cex <- par("cex") if (is.null(args$adj)) args$adj <- par("adj") args <- c(list(dform, data = substitute(data)), args) if (is.null(args$panel)) args$panel <- function(x, y, subscripts, ...) { x <- as.numeric(x) y <- as.numeric(y) dots <- list(...) if (grid) panel.grid() panel.xyplot(x, y, ...) if (any(ids <- id[subscripts])){ ltext(x[ids], y[ids], idLabels[subscripts][ids], cex = dots$cex, adj = dots$adj) } if (!is.null(abl)) { if (length(abl) == 2) panel.abline(a = abl, ...) else panel.abline(h = abl, ...) } } if(type == "reff" && !std) { args[["scales"]] <- list(x = list(relation = "free")) } do.call(xyplot, as.list(args)) } ranef.lme <- ## Extracts the random effects from an lme object. ## If aug.frame is true, the returned data frame is augmented with a ## values from the original data object, if available. The variables ## in the original data are collapsed over the cluster variable by the ## function fun. function(object, augFrame = FALSE, level = 1:Q, data, which = 1:ncol(data), FUN = mean, standard = FALSE , omitGroupingFactor = TRUE, subset = NULL, ...) { Q <- object$dims$Q effects <- object$coefficients$random if (Q > 1) { grpNames <- t(array(rep(rev(names(effects)), Q), c(Q, Q))) grpNames[lower.tri(grpNames)] <- "" grpNames <- rev(apply(grpNames, 1, function(x) paste(x[x != ""], collapse = " %in% "))) } else { grpNames <- names(effects) } effects <- effects[level] grpNames <- grpNames[level] if (standard) { for (i in names(effects)) { effects[[i]] <- t(t(effects[[i]]) / (object$sigma * sqrt(diag(as.matrix(object$modelStruct$reStruct[[i]]))))) } } effects <- lapply(effects, as.data.frame) if (augFrame) { if (length(level) > 1) { stop("augmentation of random effects only available for single level") } effects <- effects[[1L]] effectNames <- names(effects) if (missing(data)) { data <- getData(object) } data <- as.data.frame(data) subset <- if (is.null(subset)) { # nlme case eval(object$call[["naPattern"]]) } else { asOneSidedFormula(as.list(match.call())[["subset"]]) } if (!is.null(subset)) { subset <- eval(subset[[2L]], data) data <- data[subset, ,drop=FALSE] } data <- data[, which, drop = FALSE] ## eliminating columns with same names as effects data <- data[, is.na(match(names(data), effectNames)), drop = FALSE] grps <- as.character(object[["groups"]][, level]) data <- gsummary(data, FUN = FUN, groups = grps) if (omitGroupingFactor) { data <- data[, is.na(match(names(data), names(object$modelStruct$reStruct))), drop = FALSE] } if (length(data) > 0) { effects <- cbind(effects, data[row.names(effects),, drop = FALSE]) } attr(effects, "effectNames") <- effectNames } else { effects <- lapply(effects, function(el) { attr(el, "effectNames") <- names(el) el }) if (length(level) == 1) effects <- effects[[1L]] } structure(effects, class = c("ranef.lme", class(effects)), label= if (standard) "Standardized random effects" else "Random effects", level = max(level), standardized = standard, grpNames = grpNames) } residuals.lme <- function(object, level = Q, type = c("response", "pearson", "normalized"), asList = FALSE, ...) { type <- match.arg(type) Q <- object$dims$Q val <- object[["residuals"]] if (is.character(level)) { # levels must be given consistently nlevel <- match(level, names(val)) if (any(aux <- is.na(nlevel))) { stop(sprintf(ngettext(sum(aux), "nonexistent level %s", "nonexistent levels %s"), level[aux]), domain = NA) } level <- nlevel } else { # assuming integers level <- 1 + level } if (type != "response") { # standardize ## have to standardize properly for when corStruct neq NULL val <- val[, level]/attr(val, "std") } else { val <- val[, level] } if (type == "normalized") { if (!is.null(cSt <- object$modelStruct$corStruct)) { ## normalize according to inv-trans factor val <- recalc(cSt, list(Xy = as.matrix(val)))$Xy[, seq_along(level)] } else { # will just standardized type <- "pearson" } } if (length(level) == 1) { grps <- as.character(object[["groups"]][, max(c(1, level - 1))]) if (asList) { val <- as.list(split(val, ordered(grps, levels = unique(grps)))) } else { grp.nm <- row.names(object[["groups"]]) val <- naresid(object$na.action, val) names(val) <- grps[match(names(val), grp.nm)] } attr(val, "label") <- switch(type, response = { if (!is.null(aux <- attr(object, "units")$y)) paste("Residuals", aux) else "Residuals" }, pearson = "Standardized residuals", normalized = "Normalized residuals" ) val } else naresid(object$na.action, val) } summary.lme <- function(object, adjustSigma = TRUE, verbose = FALSE, ...) { ## variance-covariance estimates for fixed effects fixed <- fixef(object) stdFixed <- sqrt(diag(as.matrix(object$varFix))) object$corFixed <- array(t(object$varFix/stdFixed)/stdFixed, dim(object$varFix), list(names(fixed),names(fixed))) if (adjustSigma && object$method == "ML") stdFixed <- stdFixed * sqrt(object$dims$N/(object$dims$N - length(stdFixed))) ## fixed effects coefficients, std. deviations and t-ratios ## fDF <- object$fixDF[["X"]] tVal <- fixed/stdFixed object$tTable <- cbind(Value = fixed, Std.Error = stdFixed, DF = fDF, "t-value" = tVal, "p-value" = 2 * pt(-abs(tVal), fDF)) ## ## residuals ## resd <- resid(object, type = "pearson") if (length(resd) > 5) { resd <- quantile(resd, na.rm = TRUE) # might have NAs from na.exclude names(resd) <- c("Min","Q1","Med","Q3","Max") } object$residuals <- resd ## ## generating the final object ## aux <- logLik(object) object$BIC <- BIC(aux) object$AIC <- AIC(aux) structure(object, verbose = verbose, oClass = class(object), class = c("summary.lme", class(object))) } ## based on R's update.default update.lme <- function (object, fixed., ..., evaluate = TRUE) { call <- object$call if (is.null(call)) stop("need an object with call component") extras <- match.call(expand.dots = FALSE)$... if (!missing(fixed.)) call$fixed <- update.formula(formula(object), fixed.) if(length(extras) > 0) { existing <- !is.na(match(names(extras), names(call))) ## do these individually to allow NULL to remove entries. for (a in names(extras)[existing]) call[[a]] <- extras[[a]] if(any(!existing)) call <- as.call(c(as.list(call), extras[!existing])) } if(evaluate) eval(call, parent.frame()) else call } ## update.lme <- ## function(object, fixed, data, random, correlation, weights, subset, ## method, na.action, control, contrasts, ...) ## { ## thisCall <- as.list(match.call())[-(1:2)] ## if (is.null(nextCall <- object$origCall) || ## !is.null(thisCall$fixed) || ## is.null(thisCall$random)) { ## nextCall <- object$call ## } ## nextCall <- as.list(nextCall)[-1L] ## if (is.null(thisCall$random) && is.null(thisCall$subset)) { ## ## no changes in ranef model and no subsetting ## thisCall$random <- object$modelStruct$reStruct ## } ## if (is.na(match("correlation", names(thisCall))) && ## !is.null(thCor <- object$modelStruct$corStruct)) { ## thisCall$correlation <- thCor ## } ## if (is.na(match("weights", names(thisCall))) && ## !is.null(thWgt <- object$modelStruct$varStruct)) { ## thisCall$weights <- thWgt ## } ## argNams <- unique( c(names(nextCall), names(thisCall)) ) ## args <- vector("list", length(argNams)) ## names(args) <- argNams ## args[ names(nextCall) ] <- nextCall ## nextCall <- args ## if (!is.null(thisCall$fixed)) { ## thisCall$fixed <- update(as.formula(nextCall$fixed), fixed) ## } ## nextCall[names(thisCall)] <- thisCall ## do.call(lme, nextCall) ## } Variogram.lme <- function(object, distance, form = ~1, resType = c("pearson", "response", "normalized"), data, na.action = na.fail, maxDist, length.out = 50, collapse = c("quantiles", "fixed", "none"), nint = 20, breaks, robust = FALSE, metric = c("euclidean", "maximum", "manhattan"), ...) { resType <- match.arg(resType) grps <- getGroups(object, level = object$dims$Q) ## checking if object has a corSpatial element csT <- object$modelStruct$corStruct wchRows <- NULL if (missing(distance)) { if (missing(form) && inherits(csT, "corSpatial")) { distance <- getCovariate(csT) # this excludes 1-obs groups } else { metric <- match.arg(metric) if (missing(data)) { data <- getData(object) } if (is.null(data)) { # will try to construct allV <- all.vars(form) if (length(allV) > 0) { alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" data <- eval(alist, sys.parent(1)) } } covForm <- getCovariateFormula(form) if (length(all.vars(covForm)) > 0) { if (attr(terms(covForm), "intercept") == 1) { covForm <- eval(substitute( ~ cFORM - 1, list(cFORM = covForm[[2L]]))) } covar <- model.frame(covForm, data, na.action = na.action) ## making sure grps is consistent wchRows <- !is.na(match(row.names(data), row.names(covar))) grps <- grps[wchRows, drop = TRUE] covar <- as.data.frame(unclass(model.matrix(covForm, covar))) } else { covar <- data.frame(dist = unlist(tapply(rep(1, nrow(data)), grps, cumsum))) } covar <- split(covar, grps) ## getting rid of 1-observation groups covar <- covar[sapply(covar, function(el) nrow(as.matrix(el))) > 1] distance <- lapply(covar, function(el, metric) dist(as.matrix(el), metric), metric = metric) } } res <- resid(object, type = resType) if (!is.null(wchRows)) { res <- res[wchRows] } res <- split(res, grps) res <- res[lengths(res) > 1L] # no 1-observation groups ## levGrps <- levels(grps) val <- lapply(seq_along(res), function(i) Variogram(res[[i]], distance[[i]])) names(val) <- names(res) val <- do.call(rbind, val) if (!missing(maxDist)) { val <- val[val$dist <= maxDist, ] } collapse <- match.arg(collapse) if (collapse != "none") { # will collapse values dst <- val$dist udist <- sort(unique(dst)) ludist <- length(udist) if (!missing(breaks)) { if (min(breaks) > udist[1L]) breaks <- c(udist[1L], breaks) if (max(breaks) < udist[2L]) breaks <- c(breaks, udist[2L]) if (!missing(nint) && nint != (length(breaks) - 1L)) { stop("'nint' is not consistent with 'breaks'") } nint <- length(breaks) - 1 } cutDist <- if (nint < ludist) { if (missing(breaks)) breaks <- if (collapse == "quantiles") { # break into equal groups unique(quantile(dst, seq(0, 1, 1/nint), names=FALSE)) } else { # fixed length intervals seq(udist[1L], udist[length(udist)], length = nint + 1L) } cut(dst, breaks) } else dst val <- lapply(split(val, cutDist), function(el) { vrg <- el$variog vrg <- if (robust) ((mean(vrg^0.25))^4) / (0.457+ 0.494/nrow(el)) else mean(vrg) data.frame(variog = vrg, dist = median(el$dist)) }) val <- do.call(rbind, val) val$n.pairs <- as.vector(table(na.omit(cutDist))) val <- na.omit(val) # getting rid of NAs } row.names(val) <- 1:nrow(val) if (inherits(csT, "corSpatial") && resType != "normalized") { ## will keep model variogram sig2 <- if (resType == "pearson") 1 else object$sigma^2 attr(val, "modelVariog") <- Variogram(csT, sig2 = sig2, length.out = length.out) } structure(val, class = c("Variogram", "data.frame"), collapse = (collapse != "none")) } ###*### lmeStruct - a model structure for lme fits lmeStruct <- ## constructor for lmeStruct objects function(reStruct, corStruct = NULL, varStruct = NULL) { val <- list(reStruct = reStruct, corStruct = corStruct, varStruct = varStruct) structure(val[!vapply(val, is.null, NA)], # removing NULL components settings = attr(val$reStruct, "settings"), class = c("lmeStruct", "modelStruct")) } ##*## lmeStruct methods for standard generics fitted.lmeStruct <- function(object, level = Q, conLin = attr(object, "conLin"), lmeFit = attr(object, "lmeFit"), ...) { if (is.null(conLin)) { stop("no condensed linear model") } if (is.null(lmeFit)) { stop("no fitted \"lme\" object") } dd <- conLin$dims Q <- dd$Q Qp1 <- Q + 1L nc <- dd$ncol fit <- array(0, c(dd$N, Qp1), list(dimnames(conLin$Xy)[[1L]], c("fixed", rev(names(object$reStruct))))) ZXstart <- rev(cumsum(c(1, nc[1:Q]))) ZXend <- rev(cumsum(nc[1:Qp1])) ZXlen <- dd$ZXlen[Q:1] ZXngrps <- dd$ngrps[Q:1] ZXb <- lmeFit$b nc <- nc[Q:1] if(ZXstart[1L] <= ZXend[1L]) fit[, "fixed"] <- # population fitted values conLin$Xy[, ZXstart[1L]:ZXend[1L], drop = FALSE] %*% lmeFit$beta for(i in 1:Q) { j <- i + 1L fit[, j] <- fit[, i] + (conLin$Xy[, ZXstart[j]:ZXend[j], drop = FALSE] * ZXb[[i]][rep(1:ZXngrps[i], ZXlen[[i]]),,drop = FALSE]) %*% rep(1, nc[i]) } ## this is documented to return a vector for one level, matrix for more. ## So it should be a matrix if there is only one row, but not if ## there is only one columns. if(length(level) > 1) fit[, level + 1L, drop = FALSE] else fit[, level+1] } Initialize.lmeStruct <- function(object, data, groups, conLin = attr(object, "conLin"), control= list(niterEM = 20, gradHess = TRUE), ...) { object[] <- lapply(object, Initialize, data, conLin, control) theta <- lapply(object, coef) len <- lengths(theta) pmap <- if (sum(len) > 0) { num <- seq_along(len) outer(rep(num, len), num, "==") } else { array(FALSE, c(1, length(len))) } dimnames(pmap) <- list(NULL, names(object)) attr(object, "pmap") <- pmap if (length(object) == 1 && # only reStruct all(attr(object, "settings")[-(1:3)] >= 0) && # known pdMat class control[["gradHess"]]) { ## can use numerical derivatives attr(object, "settings")[2:3] <- c(0, 1) class(object) <- c("lmeStructInt", class(object)) } if (needUpdate(object)) { attr(object, "lmeFit") <- MEestimate(object, groups) update(object, data) } else { object } } logLik.lmeStruct <- function(object, Pars, conLin = attr(object, "conLin"), ...) { coef(object) <- Pars # updating parameter values recalc(object, conLin)[["logLik"]] # updating conLin } logLik.lmeStructInt <- function(object, Pars, conLin = attr(object, "conLin"), ...) { ## logLik for objects with reStruct parameters only, with ## internally defined class q <- length(Pars) settings <- as.integer(attr(object, "settings")) aux <- .C(mixed_loglik, # >> ../src/nlmefit.c as.double(conLin[["Xy"]]), # ZXy as.integer(unlist(conLin$dims)), # pdims[] as.double(Pars), # pars[] settings, # settings val = double(1 + q * (q + 1)), # logLik[] = (value, gradient, Hessian) double(1), # lRSS as.double(conLin$sigma) # sigma (17-11-2015; Fixed sigma patch ..) )[["val"]] val <- aux[1L] attr(val, "gradient") <- -aux[1 + (1:q)] attr(val, "hessian") <- -array(aux[-(1:(q+1))], c(q, q)) val } residuals.lmeStruct <- function(object, level = conLin$dims$Q, conLin = attr(object, "conLin"), lmeFit = attr(object, "lmeFit"), ...) { conLin$Xy[, conLin$dims$ZXcols] - fitted(object, level, conLin, lmeFit) } varWeights.lmeStruct <- function(object) { if (is.null(object$varStruct)) rep(1, attr(object, "conLin")$dims$N) else varWeights(object$varStruct) } ## Auxiliary control functions lmeControl <- ## Control parameters for lme function(maxIter = 50, msMaxIter = 50, tolerance = 1e-6, niterEM = 25, msMaxEval = 200, msTol = 1e-7, msVerbose = FALSE, returnObject = FALSE, gradHess = TRUE, apVar = TRUE, .relStep = .Machine$double.eps^(1/3), minAbsParApVar = 0.05, opt = c("nlminb", "optim"), optimMethod = "BFGS", natural = TRUE, sigma = NULL, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions allow.n.lt.q = FALSE, # 23-01-2019 (NA would be back compatible) ...) { if(is.null(sigma)) sigma <- 0 else if(!is.finite(sigma) || length(sigma) != 1 || sigma < 0) stop("Within-group std. dev. must be a positive numeric value") list(maxIter = maxIter, msMaxIter = msMaxIter, tolerance = tolerance, niterEM = niterEM, msMaxEval = msMaxEval, msTol = msTol, msVerbose = msVerbose, returnObject = returnObject, gradHess = gradHess , apVar = apVar, .relStep = .relStep, opt = match.arg(opt), optimMethod = optimMethod, minAbsParApVar = minAbsParApVar, natural = natural, sigma = sigma, allow.n.lt.q = allow.n.lt.q, ...) } ## Local Variables: ## ess-indent-offset: 2 ## End: nlme/R/gnls.R0000644000176000001440000007150114630066234012534 0ustar ripleyusers### Fit a general nonlinear regression model with correlated and/or ### heteroscedastic errors ### ### Copyright 2007-2023 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # gnls <- function(model, data = sys.frame(sys.parent()), params, start, correlation = NULL, weights = NULL, subset, na.action = na.fail, naPattern, control = list(), verbose= FALSE) { finiteDiffGrad <- function(model, data, pars) { dframe <- data.frame(data, pars) base <- eval(model, dframe) nm <- colnames(pars) grad <- array(base, c(length(base), length(nm)), list(NULL, nm)) ssize <- sqrt(.Machine$double.eps) for (i in nm) { diff <- pp <- pars[ , i] diff[pp == 0] <- ssize diff[pp != 0] <- pp[pp != 0] * ssize dframe[[i]] <- pp + diff grad[ , i] <- (base - eval(model, dframe))/diff dframe[[i]] <- pp } grad } ## keeping the call Call <- match.call() ## assigning a new name to the "object" argument form <- model ## control parameters controlvals <- gnlsControl() if (!missing(control)) { controlvals[names(control)] <- control } ## ## checking arguments ## if (!inherits(form, "formula")) stop("'object' must be a formula") if (length(form)!=3) stop("object formula must be of the form \"resp ~ pred\"") ## if (length(attr(terms(form), "offset"))) ## stop("offset() terms are not supported") ## ## checking if self-starting formula is given ## if (missing(start)) { if (!is.null(attr(eval(form[[3]][[1]]), "initial"))) { nlsCall <- Call[c("","model","data")] nlsCall[[1]] <- quote(stats::nls) names(nlsCall)[2] <- "formula" ## checking if "data" is not equal to sys.frame(sys.parent()) if (is.null(dim(data))) { stop("'data' must be given explicitly to use 'nls' to get initial estimates") } start <- coef(eval.parent(nlsCall)) } else { stop("no initial values for model parameters") } } else { start <- unlist(start) } gnlsModel <- call("-", form[[2]], form[[3]]) ## ## save writing list(...) when only one element ## if (missing(params)) { if (is.null(pNams <- names(start))) { stop("starting estimates must have names when 'params' is missing") } params <- list(formula(paste(paste(pNams, collapse = "+"), "1", sep = "~"))) } else if (!is.list(params)) params <- list(params) params <- unlist(lapply(params, function(pp) { if (is.name(pp[[2]])) { list(pp) } else { ## multiple parameters on left hand side eval(parse(text = paste("list(", paste(paste(all.vars(pp[[2]]), deparse(pp[[3]]), sep = "~"), collapse = ","), ")"))) } }), recursive=FALSE) pnames <- character(length(params)) for (i in seq_along(params)) { this <- eval(params[[i]]) if (!inherits(this, "formula")) stop ("'params' must be a formula or list of formulae") if (length(this) != 3) stop ("formulae in 'params' must be of the form \"parameter ~ expr\"") if (!is.name(this[[2]])) stop ("formulae in 'params' must be of the form \"parameter ~ expr\"") pnames[i] <- as.character(this[[2]]) } names(params) <- pnames ## check if correlation is present and has groups groups <- if (!is.null(correlation)) getGroupsFormula(correlation) # else NULL # if (!is.null(correlation)) { # groups <- getGroupsFormula(correlation, asList = TRUE) # if (!is.null(groups)) { # if (length(groups) > 1) { # stop("Only single level of grouping allowed") # } # groups <- groups[[1]] # } else { # if (inherits(data, "groupedData")) { # will use as groups # groups <- getGroupsFormula(data, asList = TRUE) # if (length(groups) > 1) { # ignore it # groups <- NULL # } else { # groups <- groups[[1]] # attr(correlation, "formula") <- # eval(parse(text = paste("~", # deparse(getCovariateFormula(formula(correlation))[[2]]), # "|", deparse(groups[[2]])))) # } # } # } # } else groups <- NULL ## create an gnls structure containing the correlation and weights gnlsSt <- gnlsStruct(corStruct = correlation, varStruct = varFunc(weights)) ## extract a data frame with enough information to evaluate ## form, params, random, groups, correlation, and weights mfArgs <- list(formula = asOneFormula(formula(gnlsSt), form, params, groups, omit = c(pnames, "pi")), data = data, na.action = na.action) if (!missing(subset)) { mfArgs[["subset"]] <- asOneSidedFormula(Call[["subset"]])[[2]] } mfArgs$drop.unused.levels <- TRUE dataMod <- do.call("model.frame", mfArgs) origOrder <- row.names(dataMod) # preserve the original order ## ## Evaluating the groups expression, if needed ## if (!is.null(groups)) { ## sort the model.frame by groups and get the matrices and parameters ## used in the estimation procedures ## always use innermost level of grouping groups <- eval(substitute( ~1 | GRP, list(GRP = groups[[2]]))) grps <- getGroups(dataMod, groups, level = length(getGroupsFormula(groups, asList = TRUE))) ## ordering data by groups ord <- order(grps) grps <- grps[ord] dataMod <- dataMod[ord, ,drop = FALSE] ## revOrder <- match(origOrder, row.names(dataMod)) # putting in orig. order } else grps <- NULL N <- dim(dataMod)[1] # number of observations ## ## evaluating the naPattern expression, if any ## naPat <- if (missing(naPattern)) rep(TRUE, N) else as.logical(eval(asOneSidedFormula(naPattern)[[2]], dataMod)) origOrderShrunk <- origOrder[naPat] dataModShrunk <- dataMod[naPat, , drop=FALSE] yShrunk <- eval(form[[2]], dataModShrunk) grpShrunk <- if (!is.null(groups)) { ## ordShrunk <- ord[naPat] revOrderShrunk <- match(origOrderShrunk, row.names(dataModShrunk)) grps[naPat] } # else NULL ## ## defining list with parameter information ## contr <- list() plist <- vector("list", length(pnames)) names(plist) <- pnames for (nm in pnames) { rhs <- params[[nm]][[3]] plist[[nm]] <- if(identical(rhs, 1) || identical(rhs, 1L)) ## constant RHS TRUE else { form1s <- asOneSidedFormula(rhs) .X <- model.frame(form1s, dataModShrunk) ## keeping the contrast matrices for later use in predict auxContr <- lapply(.X, function(el) if (is.factor(el)) contrasts(el)) contr <- c(contr, auxContr[!vapply(auxContr, is.null, NA) & is.na(match(names(auxContr), names(contr)))]) model.matrix(form1s, .X) } } ## ## Params effects names ## pn <- character(0) currPos <- 0 parAssign <- list() for(nm in pnames) { if (is.logical(p <- plist[[nm]])) { currPos <- currPos + 1 currVal <- list(currPos) pn <- c(pn, nm) names(currVal) <- nm parAssign <- c(parAssign, currVal) } else { currVal <- attr(p, "assign") fTerms <- terms(asOneSidedFormula(params[[nm]][[3]]), data=data) namTerms <- attr(fTerms, "term.labels") if (attr(fTerms, "intercept") > 0) { namTerms <- c("(Intercept)", namTerms) } namTerms <- factor(currVal, labels = namTerms) currVal <- split(order(currVal), namTerms) names(currVal) <- paste(nm, names(currVal), sep = ".") parAssign <- c(parAssign, lapply(currVal, function(el, currPos) { el + currPos }, currPos = currPos)) currPos <- currPos + length(unlist(currVal)) pn <- c(pn, paste(nm, colnames(p), sep = ".")) } } pLen <- length(pn) if (length(start) != pLen) stop(sprintf(ngettext(length(start), "supplied %d starting value, need %d", "supplied %d starting values, need %d"), length(start), pLen), domain = NA) spar <- start names(spar) <- pn NReal <- sum(naPat) ## ## Creating the params map ## pmap <- list() n1 <- 1 for(nm in pnames) { if (is.logical(p <- plist[[nm]])) { pmap[[nm]] <- n1 n1 <- n1 + 1 } else { pmap[[nm]] <- n1:(n1+ncol(p) - 1) n1 <- n1 + ncol(p) } } ## ## defining the nlFrame, i.e., nlEnv, an environment in R : ## nlEnv <- list2env( list(model = gnlsModel, data = dataMod, plist = plist, beta = as.vector(spar), X = array(0, c(NReal, pLen), list(NULL, pn)), pmap = pmap, N = NReal, naPat = naPat, .parameters = c("beta"), finiteDiffGrad = finiteDiffGrad)) modelExpression <- ~ { pars <- getParsGnls(plist, pmap, beta, N) res <- eval(model, data.frame(data, pars)) if (!length(grad <- attr(res, "gradient"))) { grad <- finiteDiffGrad(model, data, pars)[naPat, , drop = FALSE] } else { grad <- grad[naPat, , drop = FALSE] } res <- res[naPat] for (nm in names(plist)) { gradnm <- grad[, nm] X[, pmap[[nm]]] <- if(is.logical(p <- plist[[nm]])) gradnm else gradnm * p } result <- c(X, res) result[is.na(result)] <- 0 result } modelResid <- ~eval(model, data.frame(data, getParsGnls(plist, pmap, beta, N)))[naPat] w <- eval(modelResid[[2]], envir = nlEnv) ## creating the condensed linear model ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixedSigma <- controlvals$sigma > 0 Dims <- list(p = pLen, N = NReal, REML = FALSE) attr(gnlsSt, "conLin") <- list(Xy = array(w, c(NReal, 1), list(row.names(dataModShrunk), deparse(form[[2]]))), dims = Dims, logLik = 0, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions sigma=controlvals$sigma, auxSigma=0, fixedSigma=fixedSigma) ## additional attributes of gnlsSt attr(gnlsSt, "resp") <- yShrunk attr(gnlsSt, "model") <- modelResid attr(gnlsSt, "local") <- nlEnv attr(gnlsSt, "NReal") <- NReal ## initialization gnlsSt <- Initialize(gnlsSt, dataModShrunk) parMap <- attr(gnlsSt, "pmap") numIter <- 0 # number of iterations nlsSettings <- c(controlvals$nlsMaxIter, controlvals$minScale, controlvals$nlsTol, 0, 0, 0) nlModel <- nonlinModel(modelExpression, nlEnv) repeat { ## alternating algorithm numIter <- numIter + 1 ## GLS step if (needUpdate(gnlsSt)) { # updating varying weights gnlsSt <- update(gnlsSt, dataModShrunk) } if (length(oldPars <- coef(gnlsSt)) > 0) { if (controlvals$opt == "nlminb") { optRes <- nlminb(c(coef(gnlsSt)), function(gnlsPars) -logLik(gnlsSt, gnlsPars), control = list(trace = controlvals$msVerbose, iter.max = controlvals$msMaxIter)) convIter <- optRes$iterations } else { optRes <- optim(c(coef(gnlsSt)), function(gnlsPars) -logLik(gnlsSt, gnlsPars), method = controlvals$optimMethod, control = list(trace = controlvals$msVerbose, maxit = controlvals$msMaxIter, reltol = if(numIter == 0) controlvals$msTol else 100*.Machine$double.eps)) convIter <- optRes$count[2] } aConv <- coef(gnlsSt) <- optRes$par if (verbose) { cat("\n**Iteration", numIter) cat("\n") cat("GLS step: Objective:", format(optRes$value)) print(gnlsSt) } } else { aConv <- oldPars <- NULL } ## NLS step if (is.null(correlation)) { cF <- 1.0 cD <- 1 } else { cF <- corFactor(gnlsSt$corStruct) cD <- Dim(gnlsSt$corStruct) } if (is.null(weights)) { vW <- 1.0 } else { vW <- varWeights(gnlsSt$varStruct) } work <- .C(fit_gnls, thetaNLS = as.double(spar), as.integer(unlist(Dims)), as.double(cF), as.double(vW), as.integer(unlist(cD)), settings = as.double(nlsSettings), additional = double(NReal), as.integer(!is.null(correlation)), as.integer(!is.null(weights)), nlModel, NAOK = TRUE)[c("thetaNLS", "settings", "additional")] if (work$settings[4] == 1) { ## convResult <- 2 msg <- gettext("step halving factor reduced below minimum in NLS step") if (controlvals$returnObject) { warning(msg) break } else stop(msg) } oldPars <- c(spar, oldPars) spar[] <- work$thetaNLS if (length(coef(gnlsSt)) == 0 && work$settings[5] < controlvals$nlsMaxIter) { break } attr(gnlsSt, "conLin")$Xy[] <- work$additional attr(gnlsSt, "conLin")$logLik <- 0 if (verbose) { cat("\nNLS step: RSS = ", format(work$settings[6]), "\n model parameters:") for (i in 1:pLen) cat(format(signif(spar[i]))," ") cat("\n iterations:",work$settings[5],"\n") } aConv <- c(spar, aConv) conv <- abs((oldPars - aConv)/ ifelse(abs(aConv) < controlvals$tolerance, 1, aConv)) aConv <- c(max(conv[1:pLen])) names(aConv) <- "params" if (length(conv) > pLen) { conv <- conv[-(1:pLen)] for(i in names(gnlsSt)) { if (any(parMap[,i])) { aConv <- c(aConv, max(conv[parMap[,i]])) names(aConv)[length(aConv)] <- i } } } if (verbose) { cat("\nConvergence:\n") print(aConv) } if ((max(aConv) <= controlvals$tolerance) || (aConv["params"] <= controlvals$tolerance && convIter == 1)) { ## convResult <- 0 break } if (numIter >= controlvals$maxIter) { ## convResult <- 1 msg <- "maximum number of iterations reached without convergence" if (controlvals$returnObject) { warning(msg) break } else stop(msg) } } ## end{ repeat } -------------- ## wraping up ww <- eval(modelExpression[[2]], envir = nlEnv) auxRes <- ww[NReal * pLen + (1:NReal)] attr(gnlsSt, "conLin")$Xy <- array(ww, c(NReal, pLen + 1)) attr(gnlsSt, "conLin") <- c.L <- recalc(gnlsSt) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions if((sigma <- controlvals$sigma) == 0) { sigma <- sqrt(sum((c.L$Xy[, pLen + 1])^2)/(NReal - pLen)) lsig <- log(sigma) + 0.5 * log(1 - pLen/NReal) loglik <- ( - NReal * (1 + log(2 * pi) + 2 * lsig))/2 + c.L$logLik } else { lsig <- log(sigma) loglik <- - (NReal * (log(2 * pi)/2 + lsig) + sum((c.L$Xy[, pLen + 1])^2) / (2 * sigma^2)) + c.L$logLik } ## #### varBeta <- qr(c.L$Xy[ , 1:pLen, drop = FALSE]) if (varBeta$rank < pLen) { ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions print("approximate covariance matrix for parameter estimates not of full rank") return() } attr(parAssign, "varBetaFact") <- varBeta <- sigma * t(backsolve(qr.R(varBeta), diag(pLen))) varBeta <- crossprod(varBeta) dimnames(varBeta) <- list(pn, pn) ## ## fitted.values and residuals (in original order) ## Resid <- resid(gnlsSt) Fitted <- yShrunk - Resid attr(Resid, "std") <- sigma/(varWeights(gnlsSt)) if (!is.null(groups)) { attr(Resid, "std") <- attr(Resid, "std")[revOrderShrunk] Resid[] <- Resid[revOrderShrunk] Fitted[] <- Fitted[revOrderShrunk] grpShrunk[] <- grpShrunk[revOrderShrunk] } names(Resid) <- names(Fitted) <- origOrderShrunk ## getting the approximate var-cov of the parameters ## first making Xy into single column array again attr(gnlsSt, "conLin")$Xy <- array(auxRes, c(NReal, 1)) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions attr(gnlsSt, "fixedSigma") <- (controlvals$sigma > 0) apVar <- if (controlvals$apVar) gnlsApVar(gnlsSt, lsig, .relStep = controlvals[[".relStep"]], minAbsPar = controlvals[["minAbsParApVar"]]) else "Approximate variance-covariance matrix not available" ## getting rid of condensed linear model and fit oClass <- class(gnlsSt) attributes(gnlsSt) <- attributes(gnlsSt)[!is.na(match(names(attributes(gnlsSt)), ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions c("names","pmap","fixedSigma")))] class(gnlsSt) <- oClass grpDta <- inherits(data, "groupedData") ## ## creating the gnls object ## structure(class = c("gnls", "gls"), list(modelStruct = gnlsSt, dims = Dims, contrasts = contr, coefficients = spar, varBeta = varBeta, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions sigma = if(controlvals$sigma) controlvals$sigma else sigma, apVar = apVar, logLik = loglik, numIter = numIter, groups = grpShrunk, call = Call, method = "ML", fitted = Fitted, residuals = Resid, plist = plist, pmap = pmap, parAssign = parAssign, formula = form, na.action = attr(dataMod, "na.action")), ## saving labels and units for plots units = if(grpDta) attr(data, "units"), labels= if(grpDta) attr(data, "labels")) } ## end{gnls} ### Auxiliary functions used internally in gls and its methods gnlsApVar <- function(gnlsSt, lsigma, conLin = attr(gnlsSt, "conLin"), .relStep = (.Machine$double.eps)^(1/3), minAbsPar = 0, natural = TRUE) { ## calculate approximate variance-covariance matrix of all parameters ## except the coefficients fullGnlsLogLik <- function(Pars, object, conLin, N) { ## logLik as a function of sigma and coef(glsSt) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixedSigma <- attr(object,"fixedSigma") npar <- length(Pars) if (!fixedSigma) { lsigma <- Pars[npar] Pars <- Pars[-npar] } else { lsigma <- log(conLin$sigma) } ####### coef(object) <- Pars conLin <- recalc(object, conLin) conLin[["logLik"]] - N * lsigma - sum(conLin$Xy^2)/(2*exp(2*lsigma)) } fixedSigma <- attr(gnlsSt,"fixedSigma") if (length(gnlsCoef <- coef(gnlsSt)) > 0) { cSt <- gnlsSt[["corStruct"]] if (!is.null(cSt) && inherits(cSt, "corSymm") && natural) { cStNatPar <- coef(cSt, unconstrained = FALSE) class(cSt) <- c("corNatural", "corStruct") coef(cSt) <- log((cStNatPar + 1)/(1 - cStNatPar)) gnlsSt[["corStruct"]] <- cSt gnlsCoef <- coef(gnlsSt) } dims <- conLin$dims N <- dims$N conLin[["logLik"]] <- 0 # making sure ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions Pars <- if(fixedSigma) gnlsCoef else c(gnlsCoef, lSigma = lsigma) # log(sigma) is used as input in contrast to gls val <- fdHess(Pars, fullGnlsLogLik, gnlsSt, conLin, N, .relStep = .relStep, minAbsPar = minAbsPar)[["Hessian"]] if (all(eigen(val, only.values=TRUE)$values < 0)) { ## negative definite - OK val <- solve(-val) ## ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions ## if(fixedSigma && !is.null(dim(val))){ ## Pars <- c(gnlsCoef, lSigma = lsigma) ## npars<-length(Pars) ## val<-cbind(val,rep(0,npars-1)) ## val<-rbind(val,rep(0,npars)) ## } nP <- names(Pars) dimnames(val) <- list(nP, nP) attr(val, "Pars") <- Pars attr(val, "natural") <- natural val } else { ## problem - solution is not maximum "Non-positive definite approximate variance-covariance" } } else { NULL } } ### ### function used to calculate the parameters from ### the params and random effects ### getParsGnls <- function(plist, pmap, beta, N) { pars <- array(0, c(N, length(plist)), list(NULL, names(plist))) for (nm in names(plist)) { pars[, nm] <- if (is.logical(p <- plist[[nm]])) beta[pmap[[nm]]] else p %*% beta[pmap[[nm]]] } pars } ### ### Methods for standard generics ### coef.gnls <- function(object, ...) object$coefficients formula.gnls <- function(x, ...) x$formula %||% eval(x$call[["model"]]) getData.gnls <- function(object) { mCall <- object$call data <- eval(mCall$data) if (is.null(data)) return(data) naPat <- eval(mCall$naPattern) if (!is.null(naPat)) { data <- data[eval(naPat[[2]], data), , drop = FALSE] } naAct <- eval(mCall$na.action) if (!is.null(naAct)) { data <- naAct(data) } subset <- mCall$subset if (!is.null(subset)) { subset <- eval(asOneSidedFormula(subset)[[2]], data) data <- data[subset, ] } data } logLik.gnls <- ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions function(object, REML = FALSE, ...) { if (REML) { stop("cannot calculate REML log-likelihood for \"gnls\" objects") } ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions fixSig <- attr(object[["modelStruct"]], "fixedSigma") fixSig <- !is.null(fixSig) && fixSig p <- object$dims$p N <- object$dims$N val <- object[["logLik"]] attr(val, "nobs") <- attr(val, "nall") <- N ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions attr(val, "df") <- p + length(coef(object[["modelStruct"]])) + as.integer(!fixSig) class(val) <- "logLik" val } nobs.gnls <- function(object, ...) object$dims$N predict.gnls <- function(object, newdata, na.action = na.fail, naPattern = NULL, ...) { ## ## method for predict() designed for objects inheriting from class gnls ## if (missing(newdata)) { # will return fitted values return(fitted(object)) } newdata <- data.frame(newdata, check.names = FALSE) mCall <- object$call ## use xlev to make sure factor levels are the same as in contrasts ## and to support character-type 'newdata' for factors contr <- object$contrasts dataMod <- model.frame(formula = asOneFormula(formula(object), mCall$params, naPattern, omit = c(names(object$plist), "pi", deparse(getResponseFormula(object)[[2]]))), data = newdata, na.action = na.action, drop.unused.levels = TRUE, xlev = lapply(contr, rownames)) N <- nrow(dataMod) ## ## evaluating the naPattern expression, if any ## naPat <- if (is.null(naPattern)) rep(TRUE, N) else as.logical(eval(asOneSidedFormula(naPattern)[[2]], dataMod)) ## ## Getting the plist for the new data frame ## plist <- object$plist pnames <- names(plist) if (is.null(params <- eval(object$call$params))) { params <- list(formula(paste0(paste(pnames, collapse = "+"), "~ 1"))) } else if (!is.list(params)) params <- list(params) params <- unlist(lapply(params, function(pp) { if (is.name(pp[[2]])) { list(pp) } else { ## multiple parameters on left hand side eval(parse(text = paste("list(", paste(paste(all.vars(pp[[2]]), deparse(pp[[3]]), sep = "~"), collapse = ","), ")"))) } }), recursive=FALSE) names(params) <- pnames prs <- coef(object) ## pn <- names(prs) for(nm in pnames) { if (!is.logical(plist[[nm]])) { form1s <- asOneSidedFormula(params[[nm]][[3]]) plist[[nm]] <- model.matrix(form1s, model.frame(form1s, dataMod), contr) } } modForm <- getCovariateFormula(object)[[2]] val <- eval(modForm, data.frame(dataMod, getParsGnls(plist, object$pmap, prs, N)))[naPat] names(val) <- row.names(newdata) lab <- "Predicted values" if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } attr(val, "label") <- lab val } #based on R's update.default update.gnls <- function (object, model., ..., evaluate = TRUE) { call <- object$call if (is.null(call)) stop("need an object with call component") extras <- match.call(expand.dots = FALSE)$... if (!missing(model.)) call$model <- update.formula(formula(object), model.) if(length(extras) > 0) { existing <- !is.na(match(names(extras), names(call))) ## do these individually to allow NULL to remove entries. for (a in names(extras)[existing]) call[[a]] <- extras[[a]] if(any(!existing)) call <- as.call(c(as.list(call), extras[!existing])) } if(evaluate) eval(call, parent.frame()) else call } #update.gnls <- # function(object, model, data = sys.frame(sys.parent()), params, start , # correlation = NULL, weights = NULL, subset, # na.action = na.fail, naPattern, control = list(), # verbose = FALSE, ...) #{ # thisCall <- as.list(match.call())[-(1:2)] # nextCall <- as.list(object$call)[-1] # if (!is.null(thisCall$model)) { # thisCall$model <- update(formula(object), model) # } else { # same model # if (is.null(thisCall$start)) { # thisCall$start <- coef(object) # } # } # if (is.na(match("correlation", names(thisCall))) && # !is.null(thCor <- object$modelStruct$corStruct)) { # thisCall$correlation <- thCor # } # if (is.na(match("weights", names(thisCall))) && # !is.null(thWgt <- object$modelStruct$varStruct)) { # thisCall$weights <- thWgt # } # nextCall[names(thisCall)] <- thisCall # do.call("gnls", nextCall) #} ###*### gnlsStruct - a model structure for gnls fits gnlsStruct <- ## constructor for gnlsStruct objects function(corStruct = NULL, varStruct = NULL) { val <- list(corStruct = corStruct, varStruct = varStruct) val <- val[!sapply(val, is.null)] # removing NULL components # attr(val, "settings") <- attr(val$reStruct, "settings") # attr(val, "resp") <- resp # attr(val, "model") <- model # attr(val, "local") <- local # attr(val, "N") <- N # attr(val, "naPat") <- naPat class(val) <- c("gnlsStruct", "glsStruct", "modelStruct") val } ##*## gnlsStruct methods for standard generics fitted.gnlsStruct <- function(object, ...) attr(object, "resp") - resid(object) Initialize.gnlsStruct <- function(object, data, ...) { if (length(object)) { object[] <- lapply(object, Initialize, data) theta <- lapply(object, coef) len <- lengths(theta) num <- seq_along(len) pmap <- if (sum(len) > 0) outer(rep(num, len), num, "==") else array(FALSE, c(1, length(len))) dimnames(pmap) <- list(NULL, names(object)) attr(object, "pmap") <- pmap if (needUpdate(object)) object <- update(object, data) } object } logLik.gnlsStruct <- function(object, Pars, conLin = attr(object, "conLin"), ...) { coef(object) <- Pars # updating parameter values conLin <- recalc(object, conLin) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions if(conLin$sigma == 0) { conLin[["logLik"]] - (conLin$dims$N * log(sum(conLin$Xy^2)))/2 } else { conLin[["logLik"]] - conLin$dims$N * log(conLin$sigma) - sum(conLin$Xy^2) / (2 * conLin$sigma^2) } } residuals.gnlsStruct <- function(object, ...) { c(eval(attr(object, "model")[[2]], envir = attr(object, "local"))) } gnlsControl <- ## Set control values for iterations within gnls function(maxIter = 50, nlsMaxIter = 7, msMaxIter = 50, minScale = 0.001, tolerance = 1e-6, nlsTol = 0.001, msTol = 1e-7, returnObject = FALSE, msVerbose = FALSE, apVar = TRUE, .relStep = .Machine$double.eps^(1/3), opt = c("nlminb", "optim"), optimMethod = "BFGS", ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions minAbsParApVar = 0.05, sigma=NULL) { ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions if(is.null(sigma)) sigma <- 0 else if(!is.finite(sigma) || length(sigma) != 1 || sigma < 0) stop("Within-group std. dev. must be a positive numeric value") list(maxIter = maxIter, nlsMaxIter = nlsMaxIter, msMaxIter = msMaxIter, minScale = minScale, tolerance = tolerance, nlsTol = nlsTol, msTol = msTol, returnObject = returnObject, msVerbose = msVerbose, apVar = apVar, opt = match.arg(opt), optimMethod = optimMethod, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions .relStep = .relStep, minAbsParApVar = minAbsParApVar, sigma=sigma) } ## Local Variables: ## ess-indent-offset: 2 ## End: nlme/R/newFunc.R0000644000176000001440000003015614630076362013202 0ustar ripleyusers### Functions that are used in several parts of the nlme library ### but do not belong to any specific part ### ### Copyright 2006-2022 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ### ### This program is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### This program is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### A copy of the GNU General Public License is available at ### http://www.r-project.org/Licenses/ svd.d <- function(x) La.svd(x, nu=0L, nv=0L)$d allCoef <- ## Combines different coefficient vectors into one vector, keeping track ## of which coefficients came from which object function(..., extract = coef) { dots <- list(...) theta <- lapply(dots, extract) len <- lengths(theta) num <- seq_along(len) which <- if (sum(len) > 0) outer(rep(num, len), num, "==") else array(FALSE, c(1, length(len))) cnames <- unlist(as.list(sys.call()[-1])) dimnames(which) <- list(NULL, cnames[cnames != substitute(extract)]) theta <- unlist(theta) attr(theta, "map") <- which theta } allVarsRec <- ## Recursive version of all.vars function(object) { if (is.list(object)) { unlist(lapply(object, allVarsRec)) } else { all.vars(object) } } asOneFormula <- ## Constructs a linear formula with all the variables used in a ## list of formulas, except for the names in omit function(..., omit = c(".", "pi")) { names <- unique(allVarsRec(list(...))) names <- names[is.na(match(names, omit))] if (length(names)) eval(parse(text = paste("~", paste(names, collapse = "+")))[[1]], .GlobalEnv) else evalq(~1, .GlobalEnv) } compareFits <- ## compares coeffificients from different fitted objects function(object1, object2, which = 1:ncol(object1)) { dn1 <- dimnames(object1) dn2 <- dimnames(object2) aux <- rep(NA, length(dn1[[1]])) if (any(aux1 <- is.na(match(dn2[[2]], dn1[[2]])))) { object1[,dn2[[2]][aux1]] <- aux } if (any(aux1 <- is.na(match(dn1[[2]], dn2[[2]])))) { object2[,dn1[[2]][aux1]] <- aux } dn1 <- dimnames(object1) c1 <- deparse(substitute(object1)) c2 <- deparse(substitute(object2)) if (any(sort(dn1[[1]]) != sort(dn2[[1]]))) { stop("objects must have coefficients with same row names") } ## putting object2 in same order object2 <- object2[dn1[[1]], dn1[[2]], drop = FALSE] object1 <- object1[, which, drop = FALSE] object2 <- object2[, which, drop = FALSE] dn1 <- dimnames(object1) dm1 <- dim(object1) out <- array(0, c(dm1[1], 2, dm1[2]), list(dn1[[1]], c(c1,c2), dn1[[2]])) for(i in dn1[[2]]) { out[,,i] <- cbind(object1[[i]], object2[[i]]) } class(out) <- "compareFits" out } fdHess <- function(pars, fun, ..., .relStep = .Machine$double.eps^(1/3), minAbsPar = 0) ## Use a Koschal design to establish a second order model for the response { pars <- as.numeric(pars) npar <- length(pars) incr <- pmax(abs(pars), minAbsPar) * .relStep baseInd <- diag(npar) frac <- c(1, incr, incr^2) cols <- list(0, baseInd, -baseInd) for ( i in seq_along(pars)[ -npar ] ) { cols <- c( cols, list( baseInd[ , i ] + baseInd[ , -(1:i) ] ) ) frac <- c( frac, incr[ i ] * incr[ -(1:i) ] ) } indMat <- do.call( "cbind", cols) shifted <- pars + incr * indMat indMat <- t(indMat) Xcols <- list(1, indMat, indMat^2) for ( i in seq_along(pars)[ - npar ] ) { Xcols <- c( Xcols, list( indMat[ , i ] * indMat[ , -(1:i) ] ) ) } coefs <- solve(do.call("cbind", Xcols), apply(shifted, 2, fun, ...)) / frac Hess <- diag( coefs[ 1 + npar + seq_along(pars) ], ncol = npar ) Hess[ row(Hess) > col (Hess) ] <- coefs[ -(1:(1 + 2 * npar)) ] list(mean = coefs[ 1 ], gradient = coefs[ 1 + seq_along(pars) ], Hessian = (Hess + t(Hess)) ) } gapply <- ## Apply a function to the subframes of a data.frame ## If "apply" were generic, this would be the method for groupedData function(object, which, FUN, form = formula(object), level, groups = getGroups(object, form, level), ...) { if (!inherits(object, "data.frame")) { stop(gettextf("object must inherit from class %s", '"data.frame"'), domain = NA) } ## Apply a function to the subframes of a groupedData object if (missing(groups)) { # formula and level are required if (!inherits(form, "formula")) { stop("'form' must be a formula") } if (is.null(grpForm <- getGroupsFormula(form, asList = TRUE))) { ## will use right hand side of form as groups formula grpForm <- splitFormula(asOneSidedFormula(form[[length(form)]])) } if (missing(level)) level <- length(grpForm) else if (length(level) != 1) { stop("only one level allowed in 'gapply'") } groups <- groups # forcing evaluation } if (!missing(which)) { switch(mode(which), character = { wchNot <- is.na(match(which, names(object))) if (any(wchNot)) { stop(sprintf(ngettext(sum(wchNot), "%s not matched", "%s not matched"), paste(which[wchNot], collapse = ",")), domain = NA) } }, numeric = { if (anyNA(match(which, 1:ncol(object)))) { stop(gettextf("'which' must be between 1 and %d", ncol(object)), domain = NA) } }, stop("'which' can only be character or integer") ) object <- object[, which, drop = FALSE] } val <- lapply(X = split(object, groups), FUN = FUN, ...) if (is.atomic(val[[1]]) && length(val[[1]]) == 1) { val <- unlist(val) } val } getCovariateFormula <- function(object) { ## Return the primary covariate formula as a one sided formula form <- formula(object) if (!(inherits(form, "formula"))) { stop("formula(object) must return a formula") } form <- form[[length(form)]] if (length(form) == 3 && form[[1]] == as.name("|")){ # conditional expression form <- form[[2]] } eval(call("~", form), .GlobalEnv) } getResponseFormula <- function(object) { ## Return the response formula as a one sided formula form <- formula(object) if (!(inherits(form, "formula") && (length(form) == 3))) { stop("'form' must be a two-sided formula") } eval(call("~", form[[2]]), .GlobalEnv) } gsummary <- ## Summarize an object according to the levels of a grouping factor ## function(object, FUN = function(x) mean(x, na.rm = TRUE), omitGroupingFactor = FALSE, form = formula(object), level, groups = getGroups(object, form , level), invariantsOnly = FALSE, ...) { if (!inherits(object, "data.frame")) { stop(gettextf("object must inherit from class %s", '"data.frame"'), domain = NA) } if (missing(groups)) { # formula and level are required if (!inherits(form, "formula")) { stop("'form' must be a formula") } if (is.null(grpForm <- getGroupsFormula(form, asList = TRUE))) { ## will use right hand side of form as groups formula grpForm <- splitFormula(asOneSidedFormula(form[[length(form)]])) } if (missing(level)) level <- length(grpForm) else if (length(level) != 1) { stop("only one level allowed in 'gsummary'") } } gunique <- unique(groups) firstInGroup <- match(gunique, groups) asFirst <- firstInGroup[match(groups, gunique)] value <- as.data.frame(object[firstInGroup, , drop = FALSE]) row.names(value) <- as.character(gunique) value <- value[as.character(sort(gunique)), , drop = FALSE] varying <- unlist(lapply(object, function(column, frst) { aux <- as.character(column) any(!identical(aux, aux[frst])) }, frst = asFirst)) if (any(varying) && (!invariantsOnly)) { # varying wanted Mode <- function(x) { aux <- table(x) names(aux)[match(max(aux), aux)] } if (is.function(FUN)) { # single function given FUN <- list(numeric = FUN, ordered = Mode, factor = Mode) } else { if (!(is.list(FUN) && all(sapply(FUN, is.function)))) stop("'FUN' can only be a function or a list of functions") auxFUN <- list(numeric = mean, ordered = Mode, factor = Mode) aux <- names(auxFUN)[is.na(match(names(auxFUN), names(FUN)))] if (length(aux) > 0) FUN[aux] <- auxFUN[aux] } for(nm in names(object)[varying]) { ## dClass <- data.class(object[[nm]]) ## The problem here is that dclass may find an irrelevant class, ## e.g. Hmisc's "labelled" dClass <- if(is.ordered(object[[nm]])) "ordered" else if(is.factor(object[[nm]])) "factor" else mode(object[[nm]]) if (dClass == "numeric") { value[[nm]] <- as.vector(tapply(object[[nm]], groups, FUN[["numeric"]],...)) } else { value[[nm]] <- as.vector(tapply(as.character(object[[nm]]), groups, FUN[[dClass]])) if (inherits(object[,nm], "ordered")) { value[[nm]] <- ordered(value[,nm], levels = levels(object[,nm]))[drop = TRUE] } else { value[[nm]] <- factor(value[,nm], levels = levels(object[,nm]))[drop = TRUE] } } } } else { # invariants only value <- value[, !varying, drop = FALSE] } if (omitGroupingFactor) { if (is.null(form)) { stop("cannot omit grouping factor without 'form'") } grpForm <- getGroupsFormula(form, asList = TRUE) if (missing(level)) level <- length(grpForm) grpNames <- names(grpForm)[level] whichKeep <- is.na(match(names(value), grpNames)) if (any(whichKeep)) { value <- value[ , whichKeep, drop = FALSE] } else { return(NULL); } } value } pooledSD <- function(object) { if (!inherits(object, "lmList")) { stop(gettextf("object must inherit from class %s", '"lmList"'), domain = NA) } aux <- apply(sapply(object, function(el) { if (is.null(el)) { c(0,0) } else { aux <- resid(el) c(sum(aux^2), length(aux) - length(coef(el))) } }), 1, sum) if (aux[2] == 0) { stop("no degrees of freedom for estimating std. dev.") } val <- sqrt(aux[1]/aux[2]) attr(val, "df") <- aux[2] val } splitFormula <- ## split, on the nm call, the rhs of a formula into a list of subformulas function(form, sep = "/") { if (inherits(form, "formula") || mode(form) == "call" && form[[1]] == as.name("~")) return(splitFormula(form[[length(form)]], sep = sep)) if (mode(form) == "call" && form[[1]] == as.name(sep)) return(do.call("c", lapply(as.list(form[-1]), splitFormula, sep = sep))) if (mode(form) == "(") return(splitFormula(form[[2]], sep = sep)) if (length(form) < 1) return(NULL) list(asOneSidedFormula(form)) } ##*## phenoModel - one-compartment open model with intravenous ##*## administration and first-order elimination for the Phenobarbital data phenoModel <- function(Subject, time, dose, lCl, lV) { .C(nlme_one_comp_first, as.integer(length(time)), resp = as.double(dose), as.double(cbind(Subject, time, dose, exp(lV), exp(lCl))), NAOK = TRUE)$resp } ##*## quinModel - one-compartment open model with first order ##*## absorption for the Quinidine data quinModel <- function(Subject, time, conc, dose, interval, lV, lKa, lCl) { .C(nlme_one_comp_open, as.integer(length(time)), resp = as.double(dose), as.double(cbind(Subject, time, conc, dose, interval, exp(lV), exp(lKa), exp(lCl - lV))), NAOK = TRUE)$resp } LDEsysMat <- function(pars, incidence) { tt <- incidence[, "To"] ff <- incidence[, "From"] pp <- pars[incidence[, "Par"]] n <- max(ff, tt) val <- array(double(n * n), c(n, n)) diag(val) <- - tapply(pp, ff, sum) val[incidence[tt > 0, c("To", "From"), drop = FALSE]] <- pp[tt > 0] val } nlme/R/nlme.R0000644000176000001440000014553114630076362012534 0ustar ripleyusers### Fit a general nonlinear mixed effects model ### ### Copyright 2006-2024 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates ### ### This program is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### This program is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### A copy of the GNU General Public License is available at ### http://www.r-project.org/Licenses/ nlme <- function(model, data = sys.frame(sys.parent()), fixed, random = fixed, groups, start, correlation = NULL, weights = NULL, subset, method = c("ML", "REML"), na.action = na.fail, naPattern, control = list(), verbose= FALSE) { UseMethod("nlme") } nlme.nlsList <- function(model, data = sys.frame(sys.parent()), fixed, random = fixed, groups, start, correlation = NULL, weights = NULL, subset, method = c("ML", "REML"), na.action = na.fail, naPattern, control = list(), verbose= FALSE) { ## control parameters controlvals <- nlmeControl() controlvals[names(control)] <- control thisCall <- as.list(match.call())[-1] ## checking the use of arguments defined within the function if (any(!is.na(match(names(thisCall), c("fixed", "data", "start"))))) { warning("'nlme.nlsList' will redefine 'fixed', 'data', and 'start'") } method <- match.arg(method) REML <- method == "REML" ## add model, data, and optionally groups from the call that created model last.call <- as.list(attr(model, "call"))[-1] last.call$control <- NULL last.call$pool <- NULL thisCall[names(last.call)] <- last.call thisModel <- eval.parent(last.call[["model"]]) # formula.nlsList() still evals thisCall[["model"]] <- eval.parent(call("~", getResponseFormula (thisModel)[[2]], getCovariateFormula(thisModel)[[2]])) ## create "fixed" and "start" cf <- na.omit(coef(model)) start <- list(fixed = unlist(lapply(cf, median, na.rm = TRUE))) pnames <- names(start$fixed) <- names(cf) thisCall[["fixed"]] <- lapply(as.list(pnames), function(el) eval(parse(text = paste(el, 1, sep = "~")))) if (missing(random)) { random <- thisCall[["fixed"]] } reSt <- reStruct(random, data = NULL) if (missing(groups)) { thisCall[["groups"]] <- groups <- getGroupsFormula(model) } if (length(reSt) > 1 || length(groups[[2]]) > 1) { stop("can only fit \"nlsList\" objects with single grouping variable") } ranForm <- formula(reSt)[[1]] if (!is.list(ranForm)) { ranForm <- list(ranForm) } mData <- thisCall[["data"]] if (is.null(mData)) { # will try to construct allV <- unique(unlist(lapply(ranForm, function(el) all.vars(el[[3]])))) if (length(allV) > 0) { alist <- lapply(as.list(allV), as.name) names(alist) <- allV alist <- c(as.list(quote(data.frame)), alist) mode(alist) <- "call" mData <- eval(alist, sys.parent(1)) } } else if (mode(mData) == "name" || mode(mData) == "call") { mData <- eval.parent(mData) } reSt <- reStruct(random, REML = REML, data = mData) names(reSt) <- deparse(groups[[2]]) ## convert list of "name" objects to "character" vector rnames <- sapply(lapply(ranForm, `[[`, 2L), deparse) ## if the random effects are a subset of the coefficients, ## construct initial estimates for their var-cov matrix if (all(match(rnames, pnames, 0))) { madRes <- mad(resid(model), na.rm = TRUE) madRan <- unlist(lapply(cf, mad, na.rm = TRUE)) madRan <- madRan[rnames] if (isInitialized(reSt)) { warning("initial value for 'reStruct' overwritten in 'nlme.nlsList'") } matrix(reSt) <- diag((madRan/madRes)^2, ncol = length(rnames)) } thisCall[["start"]] <- start thisCall[["random"]] <- reSt val <- do.call(nlme.formula, thisCall, envir = parent.frame()) val$origCall <- match.call() val } nlme.formula <- function(model, data = sys.frame(sys.parent()), fixed, random, groups, start, correlation = NULL, weights = NULL, subset, method = c("ML", "REML"), na.action = na.fail, naPattern, control = list(), verbose= FALSE) { ## This is the method that actually does the fitting finiteDiffGrad <- function(model, data, pars) { dframe <- data.frame(data, pars) base <- eval(model, dframe) nm <- colnames(pars) grad <- array(base, c(length(base), length(nm)), list(NULL, nm)) ssize <- sqrt(.Machine$double.eps) for (i in nm) { diff <- pp <- pars[ , i] diff[pp == 0] <- ssize diff[pp != 0] <- pp[pp != 0] * ssize dframe[[i]] <- pp + diff grad[ , i] <- (base - eval(model, dframe))/diff dframe[[i]] <- pp } grad } ## keeping the call Call <- match.call() ## control parameters controlvals <- nlmeControl() if (!missing(control)) { controlvals[names(control)] <- control } ## ## checking arguments ## if (!inherits(model, "formula")) stop("'model' must be a formula") if (length(model)!=3) stop("model formula must be of the form \"resp ~ pred\"") ## if (length(attr(terms(model), "offset"))) ## stop("offset() terms are not supported") method <- match.arg(method) REML <- method == "REML" if (missing(random)) { random <- fixed } reSt <- reStruct(random, REML = REML, data = NULL) if (missing(groups)) { groups <- getGroupsFormula(reSt) } if (is.null(groups)) { if (inherits(data, "groupedData")) { groups <- getGroupsFormula(data) namGrp <- rev(names(getGroupsFormula(data, asList = TRUE))) Q <- length(namGrp) if (length(reSt) != Q) { # may need to repeat reSt if (length(reSt) != 1) stop("incompatible lengths for 'random' and grouping factors") randL <- vector("list", Q) names(randL) <- rev(namGrp) for(i in 1:Q) randL[[i]] <- random reSt <- reStruct(randL, REML = REML, data = NULL) } } else { ## will assume single group groups <- ~ 1 names(reSt) <- namGrp <- "1" } } else { g.exp <- eval(parse(text = paste0("~1 |", deparse(groups[[2]])))) namGrp <- rev(names(getGroupsFormula(g.exp, asList = TRUE))) } names(reSt) <- namGrp ## ## checking if self-starting formula is given ## if (missing(start) && is.call(model[[3]]) && !is.null(attr(eval(model[[3]][[1]]), "initial"))) { nlmeCall <- Call nlsLCall <- nlmeCall[c("","model","data")] nlsLCall[[1]] <- quote(nlme::nlsList) nm <- names(nlmeCall) for(i in c("fixed", "data", "groups", "start")) if(i %in% nm) nlmeCall[[i]] <- NULL nlmeCall[[1]] <- quote(nlme::nlme.nlsList) ## checking if "data" is not equal to sys.frame(sys.parent()) if (is.null(dim(data))) { stop("'data' must be given explicitly to use 'nlsList'") } nlsLObj <- eval.parent(nlsLCall) nlmeCall[["model"]] <- nlsLObj val <- eval.parent(nlmeCall) val$origCall <- NULL return(val) } if (is.numeric(start)) { # assume it is the fixed effects start <- list(fixed = start) } nlmeModel <- call("-", model[[2]], model[[3]]) ## ## save writing list(...) when only one element ## if (!is.list(fixed)) fixed <- list(fixed) fixed <- do.call(c, lapply(fixed, function(fix.i) { if (is.name(fix.i[[2]])) list(fix.i) else ## multiple parameters on left hand side eval(parse(text = paste0("list(", paste(paste(all.vars(fix.i[[2]]), deparse (fix.i[[3]]), sep = "~"), collapse = ","), ")"))) })) fnames <- lapply(fixed, function(fix.i) { this <- eval(fix.i) if (!inherits(this, "formula")) stop ("'fixed' must be a formula or list of formulae") if (length(this) != 3) stop ("formulae in 'fixed' must be of the form \"parameter ~ expr\"") if (!is.name(this[[2]])) stop ("formulae in 'fixed' must be of the form \"parameter ~ expr\"") as.character(this[[2]]) }) names(fixed) <- fnames ranForm <- formula(reSt) # random effects formula(s) Q <- length(ranForm) # number of groups names(ranForm) <- namGrp rnames <- vector("list", Q) names(rnames) <- namGrp for(i in 1:Q) { rnames[[i]] <- character(length(ranForm[[i]])) for (j in seq_along(ranForm[[i]])) { this <- eval(ranForm[[i]][[j]]) if (!inherits(this, "formula")) stop ("'random' must be a formula or list of formulae") if (length(this) != 3) stop ("formulae in 'random' must be of the form \"parameter ~ expr\"") if (!is.name(this[[2]])) stop ("formulae in 'random' must be of the form \"parameter ~ expr\"") rnames[[i]][j] <- deparse(this[[2]]) } names(ranForm[[i]]) <- rnames[[i]] } ## all parameter names pnames <- unique(c(fnames, unlist(rnames))) ## ## If data is a pframe, copy the parameters in the frame to frame 1 ## Doesn't exist in R ## if (inherits(data, "pframe")) { ## pp <- parameters(data) ## for (i in names(pp)) { ## assign(i, pp[[i]]) ## } ## attr(data,"parameters") <- NULL ## class(data) <- "data.frame" ## } ## check if corStruct is present and assign groups to its formula, ## if necessary if (!is.null(correlation)) { if(!is.null(corGrpsForm <- getGroupsFormula(correlation, asList = TRUE))) { corGrpsForm <- unlist(lapply(corGrpsForm, function(el) deparse(el[[2]]))) corQ <- length(corGrpsForm) lmeGrpsForm <- unlist(lapply(splitFormula(groups), function(el) deparse(el[[2]]))) lmeQ <- length(lmeGrpsForm) if (corQ <= lmeQ) { if (any(corGrpsForm != lmeGrpsForm[1:corQ])) { stop("incompatible formulas for groups in \"random\" and \"correlation\"") } if (corQ < lmeQ) { warning("cannot use smaller level of grouping for \"correlation\" than for \"random\". Replacing the former with the latter.") frm <- paste("~", c_deparse(getCovariateFormula(formula(correlation))[[2]]), "|", deparse(groups[[2]])) attr(correlation, "formula") <- eval(parse(text = frm)) } } else { if (any(lmeGrpsForm != corGrpsForm[1:lmeQ])) { stop("incompatible formulas for groups in \"random\" and \"correlation\"") } } } else { ## using the same grouping as in random frm <- paste("~", c_deparse(getCovariateFormula(formula(correlation))[[2]]), "|", deparse(groups[[2]])) attr(correlation, "formula") <- eval(parse(text = frm)) corQ <- lmeQ <- 1 } } else { corQ <- lmeQ <- 1 } ## create an nlme structure containing the random effects model and plug-ins nlmeSt <- nlmeStruct(reStruct = reSt, corStruct = correlation, varStruct = varFunc(weights)) ## extract a data frame with enough information to evaluate ## form, fixed, random, groups, correlation, and weights mfArgs <- list(formula = asOneFormula(formula(nlmeSt), model, fixed, groups, omit = c(pnames, "pi")), data = data, na.action = na.action) if (!missing(subset)) { mfArgs[["subset"]] <- asOneSidedFormula(Call[["subset"]])[[2]] } mfArgs$drop.unused.levels <- TRUE dataMix <- do.call(model.frame, mfArgs) origOrder <- row.names(dataMix) # preserve the original order ## ## Evaluating the groups expression ## grps <- getGroups(dataMix, eval(parse(text = paste("~1", deparse(groups[[2]]), sep = "|")))) N <- dim(dataMix)[1] # number of observations ## ## evaluating the naPattern expression, if any ## if (missing(naPattern)) naPat <- rep(TRUE, N) else naPat <- as.logical(eval(asOneSidedFormula(naPattern)[[2]], dataMix)) origOrderShrunk <- origOrder[naPat] ## ordering data by groups if (inherits(grps, "factor")) { # single level ord <- order(grps) #"order" treats a single named argument peculiarly grps <- data.frame(grps) row.names(grps) <- origOrder names(grps) <- as.character(deparse((groups[[2]]))) } else { ord <- do.call(order, grps) ## making group levels unique for(i in 2:ncol(grps)) { grps[, i] <- as.factor(paste(as.character(grps[, i-1]), as.character(grps[,i]), sep = "/")) } } if (corQ > lmeQ) { ## may have to reorder by the correlation groups ord <- do.call(order, getGroups(dataMix, getGroupsFormula(correlation))) } grps <- grps[ord, , drop = FALSE] dataMix <- dataMix[ord, ,drop = FALSE] ## revOrder <- match(origOrder, row.names(dataMix)) # putting in orig. order naPat <- naPat[ord] # ordered naPat dataMixShrunk <- dataMix[naPat, , drop=FALSE] ## ordShrunk <- ord[naPat] grpShrunk <- grps[naPat,, drop = FALSE] revOrderShrunk <- match(origOrderShrunk, row.names(dataMixShrunk)) yShrunk <- eval(model[[2]], dataMixShrunk) ## ## defining list with parameter information ## contr <- list() plist <- vector("list", length(pnames)) names(plist) <- pnames for (nm in pnames) { this <- list(fixed = !is.null(fixed[[nm]]), random = as.list(lapply(ranForm, function(el, nm) !is.null(el[[nm]]), nm = nm))) if (this[["fixed"]]) { ## Peter Dalgaard claims the next line should be this[["fixed"]][[3]][[1]] != "1" ## but the current version seems to work ok. if (fixed[[nm]][[3]] != "1") { as1F <- asOneSidedFormula(fixed[[nm]][[3]]) this[["fixed"]] <- model.matrix(as1F, model.frame(as1F, dataMix)) auxContr <- attr(this[["fixed"]], "contrasts") contr <- c(contr, auxContr[is.na(match(names(auxContr), names(contr)))]) } } if (any(unlist(this[["random"]]))) { for(i in 1:Q) { wch <- which(!is.na(match(rnames[[i]], nm))) if (length(wch) == 1) { # only one formula for nm at level i if ((rF.i <- ranForm[[i]][[nm]][[3]]) != "1") { this[["random"]][[i]] <- model.matrix(asOneSidedFormula(rF.i), model.frame(asOneSidedFormula(rF.i), dataMix)) auxContr <- attr(this[["random"]][[i]], "contrasts") contr <- c(contr, auxContr[is.na(match(names(auxContr), names(contr)))]) } } else if (length(wch) > 0) { # multiple formulas this[["random"]][[i]] <- th.ran.i <- as.list(lapply(ranForm[[i]][wch], function(el, data) { if (el[[3]] == "1") TRUE else model.matrix(asOneSidedFormula(el[[3]]), model.frame(asOneSidedFormula(el[[3]]), data)) }, data = dataMix)) for(j in seq_along(th.ran.i)) { if (is.matrix(th.ran.i[[j]])) { auxContr <- attr(th.ran.i[[j]], "contrasts") contr <- c(contr, auxContr[is.na(match(names(auxContr), names(contr)))]) } } } } } plist[[nm]] <- this } ## Ensure that all elements of are matrices contrMat <- function(nm, contr, data) { ## nm is a term in a formula, and can be a call x <- eval(parse(text=nm), data) levs <- levels(x) val <- do.call(contr[[nm]], list(n = length(levs))) rownames(val) <- levs val } nms <- names(contr)[sapply(contr, is.character)] contr[nms] <- lapply(nms, contrMat, contr = contr, data = dataMix) if (is.null(sfix <- start$fixed)) stop ("'start' must have a component called 'fixed'") ## ## Fixed effects names ## fn <- character(0) currPos <- 0 fixAssign <- list() for(nm in fnames) { if (is.logical(f <- plist[[nm]]$fixed)) { currPos <- currPos + 1 currVal <- list(currPos) if (all(unlist(lapply(plist[[nm]]$random, is.logical)))) { fn <- c(fn, nm) names(currVal) <- nm } else { aux <- paste(nm, "(Intercept)", sep=".") fn <- c(fn, aux) names(currVal) <- aux } fixAssign <- c(fixAssign, currVal) } else { currVal <- attr(f, "assign") fTerms <- terms(asOneSidedFormula(fixed[[nm]][[3]]), data=data) namTerms <- attr(fTerms, "term.labels") if (attr(fTerms, "intercept") > 0) { namTerms <- c("(Intercept)", namTerms) } namTerms <- factor(currVal, labels = namTerms) currVal <- split(order(currVal), namTerms) names(currVal) <- paste(nm, names(currVal), sep = ".") fixAssign <- c(fixAssign, lapply(currVal, function(el) el + currPos )) currPos <- currPos + length(unlist(currVal)) fn <- c(fn, paste(nm, colnames(f), sep = ".")) } } fLen <- length(fn) if (fLen == 0L || length(sfix) != fLen) stop ("starting values for the 'fixed' component are not the correct length") names(sfix) <- fn ## ## Random effects names ## rn <- wchRnames <- vector("list", Q) names(rn) <- names(wchRnames) <- namGrp for(i in 1:Q) { rn[[i]] <- character(0) uRnames <- unique(rnames[[i]]) wchRnames[[i]] <- integer(length(uRnames)) names(wchRnames[[i]]) <- uRnames for(j in seq_along(rnames[[i]])) { nm <- rnames[[i]][j] wchRnames[[i]][nm] <- wchRnames[[i]][nm] + 1 r <- plist[[nm]]$random[[i]] if(is.list(r)) r <- r[[wchRnames[[i]][nm]]] if (is.logical(r)) { if (r) { rn[[i]] <- c(rn[[i]], if (is.logical(plist[[nm]]$fixed)) nm else paste(nm,"(Intercept)",sep=".")) } # else: keep rn[[i]] } else { rn[[i]] <- c(rn[[i]], paste(nm, colnames(r), sep = ".")) } } } Names(nlmeSt$reStruct) <- rn rNam <- unlist(rn) # unlisted names of random effects rlength <- lengths(rn) # number of random effects per stratum rLen <- sum(rlength) # total number of random effects pLen <- rLen + fLen # total number of parameters ncols <- c(rlength, fLen, 1) Dims <- MEdims(grpShrunk, ncols) if (max(Dims$ZXlen[[1]]) < Dims$qvec[1]) { warning(gettextf("fewer observations than random effects in all level %s groups", Q), domain = NA) } sran <- vector("list", Q) names(sran) <- namGrp if (!is.null(sran0 <- start$random)) { if (inherits(sran0, "data.frame")) { sran0 <- list(as.matrix(sran0)) } else { if (!is.list(sran0)) { if (!is.matrix(sran0)) { stop("starting values for random effects should be a list, or a matrix") } sran0 <- list(as.matrix(sran0)) } } if (is.null(namSran <- names(sran0))) { if (length(sran) != Q) { stop(gettextf("list with starting values for random effects must have names or be of length %d", Q), domain = NA) } names(sran0) <- rev(namGrp) # assume given in outer-inner order } else { if (any(noMatch <- is.na(match(namSran, namGrp)))) { stop(sprintf(ngettext(sum(noMatch), "group name not matched in starting values for random effects: %s", "group names not matched in starting values for random effects: %s"), paste(namSran[noMatch], collapse=", ")), domain = NA) } } } for(i in 1:Q) { if (is.null(sran[[i]] <- sran0[[namGrp[i]]])) { sran[[i]] <- array(0, c(rlength[i], Dims$ngrps[i]), list(rn[[i]], unique(as.character(grps[, Q-i+1])))) } else { if (!is.matrix(sran[[i]])) stop("starting values for the random components should be a list of matrices") dimsran <- dim(sran[[i]]) if (dimsran[1] != Dims$ngrps[i]) { stop(gettextf("number of rows in starting values for random component at level %s should be %d", namGrp[i], Dims$ngrps[i]), domain = NA) } if (dimsran[2] != rlength[i]) { stop(gettextf("number of columns in starting values for random component at level %s should be %d", namGrp[i], rlength[i]), domain = NA) } dnamesran <- dimnames(sran[[i]]) if (is.null(dnamesran[[1]])) { stop("starting values for random effects must include group levels") } else { levGrps <- unique(as.character(grps[, Q-i+1])) if(!all(sort(dnamesran[[1]]) == sort(levGrps))) { stop(gettextf("groups levels mismatch in 'random' and starting values for 'random' at level %s", namGrp[i]), domain = NA) } sran[[i]] <- sran[[i]][levGrps, , drop = FALSE] } if (!is.null(dnamesran[[2]])) { if(!all(sort(dnamesran[[2]]) == sort(rn[[i]]))) { ## first try to resolve it for(j in seq_len(rlength[i])) { if (is.na(match(dnamesran[[2]][j], rn[[i]]))) { if (!is.na(mDn <- match(paste(dnamesran[[2]][j], "(Intercept)", sep="."), rn[[i]]))) { dnamesran[[2]][j] <- rn[[i]][mDn] } else { if (!is.na(mDn <- match(dnamesran[[2]][j], paste(rn[[i]], "(Intercept)", sep = ".")))) { dnamesran[[2]][j] <- rn[[i]][mDn] } else { stop (gettextf("names mismatch in 'random' and starting values for 'random' at level %s", namGrp[i]), domain = NA) } } } } dimnames(sran[[i]]) <- dnamesran } sran[[i]] <- sran[[i]][, rn[[i]], drop = FALSE] } else { dimnames(sran[[i]])[[2]] <- rn[[i]] } sran[[i]] <- t(sran[[i]]) } } names(sran) <- namGrp nPars <- length(unlist(sran)) + fLen # total number of PNLS parameters ## ## defining values of constants used in calculations ## NReal <- sum(naPat) ## ## Creating the fixed and random effects maps ## fmap <- list() n1 <- 1 for(nm in fnames) { if (is.logical(f <- plist[[nm]]$fixed)) { fmap[[nm]] <- n1 n1 <- n1 + 1 } else { fmap[[nm]] <- n1:(n1+ncol(f) - 1) n1 <- n1 + ncol(f) } } rmap <- rmapRel <- vector("list", Q) names(rmap) <- names(rmapRel) <- namGrp n1 <- 1 startRan <- 0 for(i in 1:Q) { wchRnames[[i]][] <- 0 rmap[[i]] <- rmapRel[[i]] <- list() for(nm in rnames[[i]]) { wchRnames[[i]][nm] <- wchRnames[[i]][nm] + 1 r <- plist[[nm]]$random[[i]] if(is.list(r)) r <- r[[wchRnames[[i]][nm]]] if (is.logical(r)) { val <- n1 n1 <- n1 + 1 } else { val <- n1:(n1+ncol(r) - 1) n1 <- n1 + ncol(r) } if (is.null(rmap[[i]][[nm]])) { rmap[[i]][[nm]] <- val rmapRel[[i]][[nm]] <- val - startRan } else { rmap[[i]][[nm]] <- c(rmap[[i]][[nm]], list(val)) rmapRel[[i]][[nm]] <- c(rmapRel[[i]][[nm]], list(val - startRan)) } } startRan <- startRan + ncols[i] } ## ## defining the nlFrame, i.e., nlEnv, an environment in R : ## grpsRev <- rev(lapply(grps, as.character)) bmap <- c(0, cumsum(unlist(lapply(sran, function(el) length(as.vector(el)))))) nlEnv <- list2env( list(model = nlmeModel, data = dataMix, groups = grpsRev, plist = plist, beta = as.vector(sfix), bvec = unlist(sran), b = sran, X = array(0, c(N, fLen), list(NULL, fn)), Z = array(0, c(N, rLen), list(NULL, rNam)), fmap = fmap, rmap = rmap, rmapRel = rmapRel, bmap = bmap, level = Q, N = N, Q = Q, naPat = naPat, .parameters = c("bvec", "beta"), finiteDiffGrad = finiteDiffGrad)) modelExpression <- ~ { pars <- getParsNlme(plist, fmap, rmapRel, bmap, groups, beta, bvec, b, level, N) res <- eval(model, data.frame(data, pars)) if (!length(grad <- attr(res, "gradient"))) { grad <- finiteDiffGrad(model, data, pars) } for (nm in names(plist)) { gradnm <- grad[, nm] if (is.logical(f <- plist[[nm]]$fixed)) { if(f) X[, fmap[[nm]]] <- gradnm # else f == FALSE =^= 0 } else X[, fmap[[nm]]] <- gradnm * f for(i in 1:Q) { if (is.logical(r <- plist[[nm]]$random[[i]])) { if (r) Z[, rmap[[i]][[nm]]] <- gradnm # else r == FALSE =^= 0 } else { rm.i <- rmap[[i]][[nm]] if (!is.list(rm.i)) { Z[, rm.i] <- gradnm * r } else { for(j in seq_along(rm.i)) { Z[, rm.i[[j]]] <- if (is.logical(rr <- r[[j]])) gradnm else gradnm * rr } } } } } result <- c(Z[naPat, ], X[naPat, ], res[naPat]) result[is.na(result)] <- 0 result }## {modelExpression} modelResid <- ~ eval(model, data.frame(data, getParsNlme(plist, fmap, rmapRel, bmap, groups, beta, bvec, b, level, N)))[naPat] ww <- eval(modelExpression[[2]], envir = nlEnv) w <- ww[NReal * pLen + (1:NReal)] ZX <- array(ww[1:(NReal*pLen)], c(NReal, pLen), list(row.names(dataMixShrunk), c(rNam, fn))) w <- w + as.vector(ZX[, rLen + (1:fLen), drop = FALSE] %*% sfix) if (!is.null(start$random)) { startRan <- 0 for(i in 1:Q) { w <- w + as.vector((ZX[, startRan + 1:ncols[i], drop = FALSE] * t(sran[[i]])[as.character(grpShrunk[, Q-i+1]),,drop = FALSE]) %*% rep(1, ncols[i])) startRan <- startRan + ncols[i] } } ## creating the condensed linear model attr(nlmeSt, "conLin") <- list(Xy = array(c(ZX, w), dim = c(NReal, sum(ncols)), dimnames = list(row.names(dataMixShrunk), c(colnames(ZX), deparse(model[[2]])))), dims = Dims, logLik = 0, ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions sigma = controlvals$sigma, auxSigma = 0) ## additional attributes of nlmeSt attr(nlmeSt, "resp") <- yShrunk attr(nlmeSt, "model") <- modelResid attr(nlmeSt, "local") <- nlEnv attr(nlmeSt, "NReal") <- NReal ## initialization nlmeSt <- Initialize(nlmeSt, dataMixShrunk, grpShrunk, control = controlvals) parMap <- attr(nlmeSt, "pmap") decomp <- length(nlmeSt) == 1 && !needUpdate(nlmeSt) if(decomp) { # can do one decomposition ## need to save conLin for calculating updating between steps oldConLin <- attr(nlmeSt, "conLin") } numIter <- 0 # number of iterations pnlsSettings <- c(controlvals$pnlsMaxIter, controlvals$minScale, controlvals$pnlsTol, 0, 0, 0) nlModel <- nonlinModel(modelExpression, nlEnv) ##---------------------------------------------------------------------------- repeat { ## alternating algorithm numIter <- numIter + 1 ## LME step if (needUpdate(nlmeSt)) { # updating varying weights nlmeSt <- update(nlmeSt, dataMixShrunk) } if (decomp) { attr(nlmeSt, "conLin") <- MEdecomp(oldConLin) } oldPars <- coef(nlmeSt) if (controlvals$opt == "nlminb") { control <- list(trace = controlvals$msVerbose, iter.max = controlvals$msMaxIter) keep <- c("eval.max", "abs.tol", "rel.tol", "x.tol", "xf.tol", "step.min", "step.max", "sing.tol", "scale.init", "diff.g") control <- c(control, controlvals[names(controlvals) %in% keep]) optRes <- nlminb(c(coef(nlmeSt)), function(nlmePars) -logLik(nlmeSt, nlmePars), control = control) aConv <- coef(nlmeSt) <- optRes$par convIter <- optRes$iterations if(optRes$convergence && controlvals$msWarnNoConv) warning(paste(sprintf( "Iteration %d, LME step: nlminb() did not converge (code = %d).", numIter, optRes$convergence), if(convIter >= control$iter.max) "Do increase 'msMaxIter'!" else if(!is.null(msg <- optRes$message)) paste("PORT message:", msg))) } else { ## nlm(.) aNlm <- nlm(f = function(nlmePars) -logLik(nlmeSt, nlmePars), p = c(coef(nlmeSt)), hessian = TRUE, print.level = controlvals$msVerbose, gradtol = if(numIter == 1) controlvals$msTol else 100*.Machine$double.eps, iterlim = if(numIter < 10) 10 else controlvals$msMaxIter, check.analyticals = FALSE) aConv <- coef(nlmeSt) <- aNlm$estimate convIter <- aNlm$iterations if(aNlm$code > 2 && controlvals$msWarnNoConv) warning(paste(sprintf( "Iteration %d, LME step: nlm() did not converge (code = %d).", numIter, aNlm$code), if(aNlm$code == 4) "Do increase 'msMaxIter'!")) } nlmeFit <- attr(nlmeSt, "lmeFit") <- MEestimate(nlmeSt, grpShrunk) if (verbose) { cat("\n**Iteration", numIter) cat(sprintf("\nLME step: Loglik: %s, %s iterations: %d\n", format(nlmeFit$logLik), controlvals$opt, convIter)) print(nlmeSt) } ## PNLS step if (is.null(correlation)) { cF <- 1.0 cD <- 1 } else { cF <- corFactor(nlmeSt$corStruct) cD <- Dim(nlmeSt$corStruct) } vW <- if(is.null(weights)) 1.0 else varWeights(nlmeSt$varStruct) if (verbose) cat(" Beginning PNLS step: .. ") work <- .C(fit_nlme, thetaPNLS = as.double(c(as.vector(unlist(sran)), sfix)), pdFactor = as.double(pdFactor(nlmeSt$reStruct)), as.integer(unlist(rev(grpShrunk))), as.integer(unlist(Dims)), as.integer(attr(nlmeSt$reStruct, "settings"))[-(1:3)], as.double(cF), as.double(vW), as.integer(unlist(cD)), settings = as.double(pnlsSettings), additional = double(NReal * (pLen + 1)), as.integer(!is.null(correlation)), as.integer(!is.null(weights)), ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions as.double(controlvals$sigma), nlModel, NAOK = TRUE) if (verbose) cat(" completed fit_nlme() step.\n") if (work$settings[4] == 1) { ## convResult <- 2 msg <- gettext("step halving factor reduced below minimum in PNLS step") if (controlvals$returnObject) warning(msg) else stop(msg) } ## dim(work$pdFactor) <- dim(pdMatrix(nlmeSt$reStruct[[1]])) ## matrix(nlmeSt$reStruct[[1]]) <- crossprod(work$pdFactor) ## fix from Setzer.Woodrow@epamail.epa.gov for nested grouping factors i.pdF <- 1 for (i in seq_along(nlmeSt$reStruct)) { d.i <- dim(pdMatrix(nlmeSt$reStruct[[i]])) ni.pdF <- i.pdF + prod(d.i) pdF <- array(work$pdFactor[i.pdF:(ni.pdF -1)], dim = d.i) matrix(nlmeSt$reStruct[[i]]) <- crossprod(pdF) i.pdF <- ni.pdF } oldPars <- c(sfix, oldPars) for(i in 1:Q) sran[[i]][] <- work$thetaPNLS[(bmap[i]+1):bmap[i+1]] sfix[] <- work$thetaPNLS[nPars + 1 - (fLen:1)] if (verbose) { cat("PNLS step: RSS = ", format(work$settings[6]), "\n fixed effects: ") for (i in 1:fLen) cat(format(sfix[i])," ") cat("\n iterations:", work$settings[5],"\n") } aConv <- c(sfix, coef(nlmeSt)) # 2nd part added by SDR 04/19/2002 w[] <- work$additional[(NReal * pLen) + 1:NReal] ZX[] <- work$additional[1:(NReal * pLen)] w <- w + as.vector(ZX[, rLen + (1:fLen), drop = FALSE] %*% sfix) startRan <- 0 for(i in 1:Q) { gr.i <- as.character(grpShrunk[, Q-i+1]) w <- w + as.vector((ZX[, startRan + 1:ncols[i], drop = FALSE] * t(sran[[i]])[gr.i,, drop = FALSE]) %*% rep(1, ncols[i])) startRan <- startRan + ncols[i] } if (decomp) { oldConLin$Xy[] <- c(ZX, w) oldConLin$logLik <- 0 } else { attr(nlmeSt, "conLin")$Xy[] <- c(ZX, w) attr(nlmeSt, "conLin")$logLik <- 0 } conv <- abs((oldPars - aConv)/ ifelse(abs(aConv) < controlvals$tolerance, 1, aConv)) aConv <- c(fixed = max(conv[1:fLen])) conv <- conv[-(1:fLen)] for(i in names(nlmeSt)) { if (any(parMap[,i])) { aConv <- c(aConv, max(conv[parMap[,i]])) names(aConv)[length(aConv)] <- i } } if (verbose) { cat(sprintf("Convergence crit. (must all become <= tolerance = %g):\n", controlvals$tolerance)) print(aConv) } if ((max(aConv) <= controlvals$tolerance) || (aConv["fixed"] <= controlvals$tolerance && convIter == 1)) { ## convResult <- 0 break } if (numIter >= controlvals$maxIter) { ## convResult <- 1 msg <- gettextf( "maximum number of iterations (maxIter = %d) reached without convergence", controlvals$maxIter) if (controlvals$returnObject) { warning(msg, domain=NA) ; break } else stop(msg, domain=NA) } } ## end{ repeat } (nlme steps) ---------------------------------------------- ## wrapping up nlmeFit <- if (decomp) MEestimate(nlmeSt, grpShrunk, oldConLin) else MEestimate(nlmeSt, grpShrunk) ## degrees of freedom for fixed effects tests fixDF <- getFixDF(ZX[, rLen + (1:fLen), drop = FALSE], grpShrunk, attr(nlmeSt, "conLin")$dims$ngrps, fixAssign) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions attr(fixDF, "varFixFact") <- varFix <- nlmeFit$sigma * nlmeFit$varFix varFix <- crossprod(varFix) dimnames(varFix) <- list(fn, fn) ## ## fitted.values and residuals (in original order) ## Resid <- if (decomp) resid(nlmeSt, level = 0:Q, oldConLin)[revOrderShrunk, ] else resid(nlmeSt, level = 0:Q)[revOrderShrunk, ] Fitted <- yShrunk[revOrderShrunk] - Resid rownames(Resid) <- rownames(Fitted) <- origOrderShrunk grpShrunk <- grpShrunk[revOrderShrunk, , drop = FALSE] attr(Resid, "std") <- nlmeFit$sigma/(varWeights(nlmeSt)[revOrderShrunk]) ## inverting back reStruct nlmeSt$reStruct <- solve(nlmeSt$reStruct) attr(nlmeSt, "fixedSigma") <- (controlvals$sigma > 0) ## saving part of dims dims <- attr(nlmeSt, "conLin")$dims[c("N", "Q", "qvec", "ngrps", "ncol")] ## getting the approximate var-cov of the parameters apVar <- if (controlvals$apVar) lmeApVar(nlmeSt, nlmeFit$sigma, .relStep = controlvals[[".relStep"]], minAbsPar = controlvals[["minAbsParApVar"]], natural = controlvals[["natural"]]) else "Approximate variance-covariance matrix not available" ## putting sran in the right format sran <- lapply(sran, t) ## getting rid of condensed linear model, fit, and other attributes ###- oClass <- class(nlmeSt) attributes(nlmeSt) <- attributes(nlmeSt)[ c("names", "class", "pmap", "fixedSigma")] ##- class(nlmeSt) <- oClass ## ## creating the nlme object ## isGrpd <- inherits(data, "groupedData") structure(class = c("nlme", "lme"), list(modelStruct = nlmeSt, dims = dims, contrasts = contr, coefficients = list(fixed = sfix, random = rev(sran)), varFix = varFix, sigma = nlmeFit$sigma, apVar = apVar, logLik = nlmeFit$logLik, numIter = numIter, groups = grpShrunk, call = Call, method = method, fitted = Fitted, residuals = Resid, plist = plist, map = list(fmap=fmap,rmap=rmap,rmapRel=rmapRel,bmap=bmap), fixDF = fixDF , formula = model # => reliable formula.nlme() [PR#18599] ), ## saving labels and units for plots units = if(isGrpd) attr(data, "units"), labels = if(isGrpd) attr(data, "labels")) } ## {nlme.formula} ### ##' Calculate the parameters from the fixed and random effects getParsNlme <- function(plist, fmap, rmapRel, bmap, groups, beta, bvec, b, level, N) { pars <- array(0, c(N, length(plist)), list(NULL, names(plist))) ## for random effects below iQ <- if (level > 0) { Q <- length(groups) (Q - level + 1L):Q } else integer() # empty for (nm in names(plist)) { ## 1) Fixed effects if (is.logical(f <- plist[[nm]]$fixed)) { if (f) pars[, nm] <- beta[fmap[[nm]]] ## else pars[, nm] <- 0 (as f == FALSE) } else pars[, nm] <- f %*% beta[fmap[[nm]]] ## 2) Random effects for(i in iQ) if(!is.null(rm.i. <- rmapRel[[i]][[nm]])) { b.i <- b[[i]] b.i[] <- bvec[(bmap[i] + 1):bmap[i+1]] ## NB: some groups[[i]] may be *new* levels, i.e. non-matching: gr.i <- match(groups[[i]], colnames(b.i)) # column numbers + NA if (is.logical(r <- plist[[nm]]$random[[i]])) { if (r) pars[, nm] <- pars[, nm] + b.i[rm.i., gr.i] ## else r == FALSE =^= 0 } else if (!is.list(r)) { pars[, nm] <- pars[, nm] + (r * t(b.i)[gr.i, rm.i., drop=FALSE]) %*% rep(1, ncol(r)) } else { b.i.gi <- b.i[, gr.i, drop=FALSE] for(j in seq_along(rm.i.)) { if (is.logical(rr <- r[[j]])) { if(rr) pars[, nm] <- pars[, nm] + b.i.gi[rm.i.[[j]], ] ## else rr == FALSE =^= 0 } else pars[, nm] <- pars[, nm] + (rr * t(b.i.gi[rm.i.[[j]], , drop=FALSE])) %*% rep(1, ncol(rr)) } } } # for( i ) if(!is.null(rm.i. ..)) } pars } ### ### Methods for standard generics ### formula.nlme <- function(x, ...) x$formula %||% eval(x$call[["model"]]) predict.nlme <- function(object, newdata, level = Q, asList = FALSE, na.action = na.fail, naPattern = NULL, ...) { ## ## method for predict() designed for objects inheriting from class nlme ## Q <- object$dims$Q if (missing(newdata)) { # will return fitted values val <- fitted(object, level, asList) if (length(level) == 1) return(val) return(data.frame(object[["groups"]][,level[level != 0], drop = FALSE], predict = val)) } maxQ <- max(level) # maximum level for predictions nlev <- length(level) newdata <- as.data.frame(newdata) if (maxQ > 0) { # predictions with random effects whichQ <- Q - (maxQ-1):0 reSt <- object$modelStruct$reStruct[whichQ] ## nlmeSt <- nlmeStruct(reStruct = reSt) groups <- getGroupsFormula(reSt) if (anyNA(match(all.vars(groups), names(newdata)))) { ## groups cannot be evaluated in newdata stop("cannot evaluate groups for desired levels on 'newdata'") } } else { reSt <- NULL } ## use xlev to make sure factor levels are the same as in contrasts ## and to support character-type 'newdata' for factors contr <- object$contrasts dataMix <- model.frame(formula = asOneFormula( formula(object), object$call$fixed, formula(reSt), naPattern, omit = c(names(object$plist), "pi", deparse(getResponseFormula(object)[[2]]))), data = newdata, na.action = na.action, drop.unused.levels = TRUE, xlev = lapply(contr, rownames)) origOrder <- row.names(dataMix) # preserve the original order whichRows <- match(origOrder, row.names(newdata)) if (maxQ > 0) { ## sort the model.frame by groups and get the matrices and parameters ## used in the estimation procedures grps <- getGroups(newdata, # (unused levels are dropped here) eval(substitute(~ 1 | GRPS, list(GRPS = groups[[2]])))) ## ordering data by groups if (inherits(grps, "factor")) { # single level grps <- grps[whichRows] oGrps <- data.frame(grps) ## checking if there are missing groups if (any(naGrps <- is.na(grps))) { grps[naGrps] <- levels(grps)[1L] # input with existing level } ord <- order(grps) #"order" treats a single named argument peculiarly grps <- data.frame(grps) row.names(grps) <- origOrder names(grps) <- names(oGrps) <- as.character(deparse((groups[[2L]]))) } else { grps <- oGrps <- grps[whichRows, ] ## checking for missing groups if (any(naGrps <- is.na(grps))) { ## need to input missing groups for(i in names(grps)) { grps[naGrps[, i], i] <- levels(grps[,i])[1L] } naGrps <- t(apply(naGrps, 1, cumsum)) # propagating NAs } ord <- do.call(order, grps) ## making group levels unique for(i in 2:ncol(grps)) { grps[, i] <- as.factor(paste(as.character(grps[, i-1]), as.character(grps[, i ]), sep = "/")) } } ## if (match(0, level, nomatch = 0)) { ## naGrps <- cbind(FALSE, naGrps) ## } ## naGrps <- as.matrix(naGrps)[ord, , drop = FALSE] naGrps <- cbind(FALSE, naGrps)[ord, , drop = FALSE] grps <- grps[ord, , drop = FALSE] dataMix <- dataMix[ord, ,drop = FALSE] revOrder <- match(origOrder, row.names(dataMix)) # putting in orig. order } ## restore contrasts for the below model.matrix() calls (which may use ## different factor variables, so we avoid passing the whole contr list) for(i in intersect(names(dataMix), names(contr))) { attr(dataMix[[i]], "contrasts") <- contr[[i]] } N <- nrow(dataMix) ## ## evaluating the naPattern expression, if any ## naPat <- if(is.null(naPattern)) rep(TRUE, N) else as.logical(eval(asOneSidedFormula(naPattern)[[2]], dataMix)) ## ## Getting the plist for the new data frame ## plist <- object$plist fixed <- eval(object$call$fixed) if (!is.list(fixed)) fixed <- list(fixed) fixed <- do.call(c, lapply(fixed, function(fix.i) { if (is.name(fix.i[[2]])) list(fix.i) else ## multiple parameters on left hand side eval(parse(text = paste0("list(", paste(paste(all.vars(fix.i[[2]]), deparse (fix.i[[3]]), sep = "~"), collapse = ","), ")"))) })) fnames <- unlist(lapply(fixed, function(el) deparse(el[[2]]))) names(fixed) <- fnames fix <- fixef(object) ## fn <- names(fix) for(nm in fnames) { if (!is.logical(plist[[nm]]$fixed)) { oSform <- asOneSidedFormula(fixed[[nm]][[3]]) plist[[nm]]$fixed <- model.matrix(oSform, model.frame(oSform, dataMix)) } } if (maxQ > 0) { grpsRev <- lapply(rev(grps), as.character) ranForm <- formula(reSt)[whichQ] namGrp <- names(ranForm) rnames <- lapply(ranForm, function(el) unlist(lapply(el, function(el1) deparse(el1[[2]])))) for(i in seq_along(ranForm)) { names(ranForm[[i]]) <- rnames[[i]] } ran <- ranef(object) ran <- if(is.data.frame(ran)) list(ran) else rev(ran) ## rn <- lapply(ran[whichQ], names) ran <- lapply(ran, t) ranVec <- unlist(ran) for(nm in names(plist)) { for(i in namGrp) { if (!is.logical(plist[[nm]]$random[[i]])) { wch <- which(!is.na(match(rnames[[i]], nm))) plist[[nm]]$random[[i]] <- if (length(wch) == 1) { # only one formula for nm oSform <- asOneSidedFormula(ranForm[[i]][[nm]][[3]]) model.matrix(oSform, model.frame(oSform, dataMix)) } else { # multiple formulae lapply(ranForm[[i]][wch], function(el) { if (el[[3]] == "1") { TRUE } else { oSform <- asOneSidedFormula(el[[3]]) model.matrix(oSform, model.frame(oSform, dataMix)) } }) } } } } } else { namGrp <- "" grpsRev <- ranVec <- ran <- NULL } val <- vector("list", nlev) modForm <- getCovariateFormula(object)[[2]] omap <- object$map for(i in 1:nlev) { val[[i]] <- eval(modForm, data.frame(dataMix, getParsNlme(plist, omap$fmap, omap$rmapRel, omap$bmap, grpsRev, fix, ranVec, ran, level[i], N)))[naPat] } names(val) <- c("fixed", rev(namGrp))[level + 1] val <- as.data.frame(val) if (maxQ > 0) { val <- val[revOrder, , drop = FALSE] if (any(naGrps)) { val[naGrps] <- NA } } ## putting back in original order if (maxQ > 1) { # making groups unique for(i in 2:maxQ) oGrps[, i] <- as.factor(paste(as.character(oGrps[,i-1]), as.character(oGrps[,i ]), sep = "/")) } if (length(level) == 1) { val <- val[,1] ## ?? not in predict.lme() if (level > 0) { # otherwise 'oGrps' are typically undefined grps <- as.character(oGrps[, level]) if (asList) { val <- split(val, ordered(grps, levels = unique(grps))) } else { names(val) <- grps } } lab <- "Predicted values" if (!is.null(aux <- attr(object, "units")$y)) { lab <- paste(lab, aux) } attr(val, "label") <- lab val } else { data.frame(oGrps, predict = val) } } ## based on R's update.default update.nlme <- function (object, model., ..., evaluate = TRUE) { if (is.null(call <- object$call)) stop("need an object with call component") extras <- match.call(expand.dots = FALSE)$... if (!missing(model.)) call$model <- update.formula(formula(object), model.) if(length(extras) > 0) { existing <- !is.na(match(names(extras), names(call))) ## do these individually to allow NULL to remove entries. for (a in names(extras)[existing]) call[[a]] <- extras[[a]] if(any(!existing)) { call <- c(as.list(call), extras[!existing]) call <- as.call(call) } } if(evaluate) eval(call, parent.frame()) else call } ## update.nlme <- ## function(object, model, data, fixed, random, groups, start, correlation, ## weights, subset, method, na.action, naPattern, control, ## verbose, ...) ## { ## thisCall <- as.list(match.call())[-(1:2)] ## if (!is.null(thisCall$start) && is.numeric(start)) { ## thisCall$start <- list(fixed = start) ## } ## if (!is.null(nextCall <- object$origCall) && ## (is.null(thisCall$fixed) && !is.null(thisCall$random))) { ## nextCall <- as.list(nextCall)[-1] ## } else { ## nextCall <- as.list(object$call)[-1] ## if (is.null(thisCall$fixed)) { # no changes in fixef model ## if (is.null(thisCall$start)) { ## thisCall$start <- list(fixed = fixef(object)) ## } else { ## if (is.null(thisCall$start$fixed)) { ## thisCall$start$fixed <- fixef(object) ## } ## } ## } ## if (!is.null(thisCall$start$random)) { # making start random NULL ## thisCall$start$random <- NULL ## } ## if (is.null(thisCall$random) && is.null(thisCall$subset)) { ## ## no changes in ranef model and no subsetting ## thisCall$random <- object$modelStruct$reStruct ## } ## } ## if (!is.null(thisCall$model)) { ## thisCall$model <- update(formula(object), model) ## } ## if (is.na(match("correlation", names(thisCall))) && ## !is.null(thCor <- object$modelStruct$corStruct)) { ## thisCall$correlation <- thCor ## } ## if (is.na(match("weights", names(thisCall))) && ## !is.null(thWgt <- object$modelStruct$varStruct)) { ## thisCall$weights <- thWgt ## } ## nextCall[names(thisCall)] <- thisCall ## do.call(nlme, nextCall) ## } ###*### nlmeStruct - a model structure for nlme fits nlmeStruct <- ## constructor for nlmeStruct objects function(reStruct, corStruct = NULL, varStruct = NULL)#, resp = NULL, ## model = NULL, local = NULL, N = NULL, naPat = NULL) { val <- list(reStruct = reStruct, corStruct = corStruct, varStruct = varStruct) structure(val[!vapply(val, is.null, NA)], # removing NULL components settings = attr(val$reStruct, "settings"), ## attr(val, "resp") <- resp ## attr(val, "model") <- model ## attr(val, "local") <- local ## attr(val, "N") <- N ## attr(val, "naPat") <- naPat class = c("nlmeStruct", "lmeStruct", "modelStruct")) } ##*## nlmeStruct methods for standard generics fitted.nlmeStruct <- function(object, level = Q, conLin = attr(object, "conLin"), ...) { Q <- attr(object, "conLin")$dims[["Q"]] attr(object, "resp") - resid(object, level, conLin) } residuals.nlmeStruct <- function(object, level = Q, conLin = attr(object, "conLin"), ...) { Q <- conLin$dims[["Q"]] stopifnot(length(level) >= 1) loc <- attr(object, "local") oLev <- get("level", envir = loc) on.exit(assign("level", oLev, envir = loc)) dn <- c("fixed", rev(names(object$reStruct)))[level + 1] val <- array(0, c(attr(object, "NReal"), length(level)), list(dimnames(conLin$Xy)[[1]], dn)) for(i in seq_along(level)) { assign("level", level[i], envir = loc, immediate = TRUE) val[, i] <- c(eval(attr(object, "model")[[2]], envir = loc)) } val } nlmeControl <- ## Set control values for iterations within nlme function(maxIter = 50, pnlsMaxIter = 7, msMaxIter = 50, minScale = 0.001, tolerance = 1e-5, niterEM = 25, pnlsTol = 0.001, msTol = 0.000001, returnObject = FALSE, msVerbose = FALSE, msWarnNoConv = TRUE, gradHess = TRUE, apVar = TRUE, .relStep = .Machine$double.eps^(1/3), minAbsParApVar = 0.05, opt = c("nlminb", "nlm"), natural = TRUE, sigma = NULL, ...) { if(is.null(sigma)) sigma <- 0 else if(!is.finite(sigma) || length(sigma) != 1 || sigma < 0) stop("Within-group std. dev. must be a positive numeric value") list(maxIter = maxIter, pnlsMaxIter = pnlsMaxIter, msMaxIter = msMaxIter, minScale = minScale, tolerance = tolerance, niterEM = niterEM, pnlsTol = pnlsTol, msTol = msTol, returnObject = returnObject, msVerbose = msVerbose, msWarnNoConv = msWarnNoConv, gradHess = gradHess, apVar = apVar, .relStep = .relStep, minAbsParApVar = minAbsParApVar, opt = match.arg(opt), natural = natural, sigma=sigma, ...) } nonlinModel <- function(modelExpression, env, paramNames = get(".parameters", envir = env)) { modelExpression <- modelExpression[[2]] thisEnv <- environment() offset <- 0 ind <- vector("list", length(paramNames)) names(ind) <- paramNames for( i in paramNames ) { v.i <- get(i, envir = env) ind[[ i ]] <- offset + seq_along(v.i) offset <- offset + length(v.i) } modelValue <- eval(modelExpression, env) rm(i, offset, paramNames) function (newPars) { if(!missing(newPars)) { for(i in names(ind)) assign( i, unname(newPars[ ind[[i]] ]), envir = env) assign("modelValue", eval(modelExpression, env), envir = thisEnv) } modelValue } } ## Local Variables: ## ess-indent-offset: 2 ## End: nlme/R/reStruct.R0000644000176000001440000003217114632316272013406 0ustar ripleyusers### Methods for the class of random-effects structures. ### ### Copyright 2006-2020 The R Core team ### Copyright 1997-2003 Jose C. Pinheiro, ### Douglas M. Bates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # http://www.r-project.org/Licenses/ # ##*## Generics that should be implemented for any reStruct class ###*# Constructor reStruct <- function(object, pdClass = "pdLogChol", REML = FALSE, data = sys.frame(sys.parent())) { ## object can be: ## 1) a named list of formulas or pdMats with grouping factors as names ## (assume same order of nesting as order of names) ## 2) a formula of the form ~ x | g or ~ x | g1/g2/../gn ## 3) a list of formulas like ~x | g ## 4) a formula like ~x, a pdMat object, or a list of such ## formulas or objects . In this case, the data used to ## initialize the reStruct will be required to inherit from class ## "groupedData" ## 5) another reStruct object ## parametrization specifies the pdMat constructor to be used for all ## formulas used in object if (inherits(object, "reStruct")) { # little to do, return object if (!missing(REML)) attr(object, "settings")[1] <- as.integer(REML) object[] <- lapply(object, pdMat, data=data) return(object) } plen <- NULL if (inherits(object, "formula")) { # given as a formula if (is.null(grpForm <- getGroupsFormula(object, asList = TRUE))) { object <- list( object ) } else { if (length(object) == 3) { # nlme type of formula object <- eval(parse(text = paste(deparse(getResponseFormula(object)[[2]]), deparse(getCovariateFormula(object)[[2]], width.cutoff=500), sep = "~"))) } else { object <- getCovariateFormula(object) } object <- rep( list(object), length( grpForm ) ) names( object ) <- names( grpForm ) } } else if (inherits(object, "pdMat")) { # single group, as pdMat if (is.null(formula(object))) { stop("\"pdMat\" element must have a formula") } object <- list(object) } else { if(!is.list(object)) stop("'object' must be a list or a formula") ## checking if nlme-type list - unnamed list of 2-sided formulas if (is.null(names(object)) && all(vapply(object, function(el) inherits(el, "formula") && length(el) == 3, NA))) { object <- list(object) } else { ## checking if elements are valid object <- lapply(object, function(el) { if (inherits(el, "pdMat")) { if (is.null(formula(el))) { stop("\"pdMat\" elements must have a formula") } return(el) } if (inherits(el, "formula")) { grpForm <- getGroupsFormula(el) if (!is.null(grpForm)) { el <- getCovariateFormula(el) attr(el, "grpName") <- deparse(grpForm[[2]]) } return(el) } else { if (is.list(el) && all(vapply(el, function(el1) { inherits(el1, "formula") && length(el1) == 3 }, NA))) { return(el) } else { stop("elements in 'object' must be formulas or \"pdMat\" objects") } } }) } if (is.null(namObj <- names(object))) { namObj <- rep("", length(object)) } aux <- unlist(lapply(object, function(el) { if (inherits(el, "formula") && !is.null(attr(el, "grpName"))) { attr(el, "grpName") } else "" })) auxNam <- namObj == "" if (any(auxNam)) { namObj[auxNam] <- aux[auxNam] } names(object) <- namObj } ## converting elements in object to pdMat objects object <- lapply(object, function(el, pdClass, data) { # if (data.class(el) == "pdSymm") # warning("class pdSymm may cause problems if using analytic gradients") pdMat(el, pdClass = pdClass, data = data) }, pdClass = pdClass, data = data) object <- rev(object) # inner to outer groups if (all(vapply(object, isInitialized, NA))) { plen <- unlist(lapply(object, function(el) length(coef(el)))) } pC <- unlist(lapply(object, data.class)) ## FIXME! Wrong by design pC <- match(pC, c("pdSymm", "pdDiag", "pdIdent", "pdCompSymm", "pdLogChol"), 0L) - 1L # if (any(pC == -1)) { # multiple nesting # pC <- -1 # } ## at this point, always require asDelta = TRUE and gradHess = 0 attr(object, "settings") <- c(as.integer(REML), 1L, 0L, pC) attr(object, "plen") <- plen class(object) <- "reStruct" object } ###*# Methods for pdMat generics corMatrix.reStruct <- function(object, ...) { if (!isInitialized(object)) { stop("cannot access the matrix of uninitialized objects") } as.list(rev(lapply(object, corMatrix))) } pdFactor.reStruct <- function(object) { unlist(lapply(object, pdFactor)) } pdMatrix.reStruct <- function(object, factor = FALSE) { if (!isInitialized(object)) { stop("cannot access the matrix of uninitialized objects") } as.list(rev(lapply(object, pdMatrix, factor))) } ###*# Methods for standard generics as.matrix.reStruct <- function(x, ...) pdMatrix(x) coef.reStruct <- function(object, unconstrained = TRUE, ...) { unlist(lapply(object, coef, unconstrained)) } "coef<-.reStruct" <- function(object, ..., value) { if (is.null(plen <- attr(object, "plen"))) { stop("cannot change the parameter when length of parameters is undefined") } if (length(value) != sum(plen)) { stop("cannot change parameter length of initialized objects") } ends <- cumsum(plen) starts <- 1 + c(0, ends[-length(ends)]) for (i in seq_along(object)) { coef(object[[i]]) <- value[(starts[i]):(ends[i])] } object } formula.reStruct <- function(x, asList = FALSE, ...) { as.list(lapply(x, formula, asList)) } getGroupsFormula.reStruct <- function(object, asList = FALSE, sep) { if (is.null(val <- rev(formula(object)))) { stop("cannot extract groups formula without a formula") } if (is.null(nVal <- names(val))) return(NULL) if (asList) { for(i in nVal) { val[[i]] <- eval(parse(text = paste("~",i))) } } else { val <- eval(parse(text = paste("~",paste(nVal, collapse = "/")))) } val } isInitialized.reStruct <- function(object) all(unlist(lapply(object, isInitialized))) Initialize.reStruct <- function(object, data, conLin, control = list(niterEM = 20), ...) { ## initialize reStruct object, possibly getting initial estimates seqO <- seq_along(object) ## check if names are defined lNams <- unlist(lapply(object, function(el) length(Names(el)))) == 0 if (any(lNams)) { # need to resolve formula names aux <- seqO[lNams] object[aux] <- lapply(object[aux], function(el, data) { pdConstruct(el, el, data = data) }, data = data) } ## obtaining the parameters mapping plen <- unlist(lapply(object, function(el) { if (isInitialized(el)) { length(coef(el)) } else { matrix(el) <- diag(length(Names(el))) length(coef(el)) } })) if (!all(plen > 0)) { stop("all elements of a \"reStruct\" object must have a non-zero size") } attr(object, "plen") <- plen ## checking initialization isIni <- vapply(object, isInitialized, NA) if (!all(isIni)) { # needs initialization dims <- conLin$dims Q <- dims$Q qvec <- dims$qvec[1:Q] auxInit <- lapply(split(0.375^2 * colSums((conLin$Xy[, 1:sum(qvec), drop = FALSE])^2) / rep(dims$ngrps[1:Q], qvec), rep(1:Q, qvec)), function(x) diag(x, length(x))) } for(i in seqO) { if (isIni[i]) { object[[i]] <- solve(object[[i]]) #working with precisions } else { matrix(object[[i]]) <- auxInit[[i]] } NULL } MEEM(object, conLin, control$niterEM) # refine initial estimates with EM } logDet.reStruct <- function(object, ...) vapply(object, logDet, numeric(1)) logLik.reStruct <- function(object, conLin, ...) { if(any(!is.finite(conLin$Xy))) return(-Inf) ## 17-11-2015; Fixed sigma patch; SH Heisterkamp; Quantitative Solutions dims <- conLin$dims settings <- as.integer(attr(object, "settings")) REML <- settings[[1L]] val <- .C(mixed_loglik, as.double(conLin$Xy), as.integer(unlist(conLin$dims)), as.double(pdFactor(object)), settings, ## == c(REML, asDelta {= 1L}, gradHess {= 0L}, pdClass {= pC}) loglik = double(1), lRSS = double(1), as.double(conLin$sigma)) if (conLin$sigma > 0 && REML == 1) { ## nc <- dims$ncol; p <- nc[dims$Q + 1] N <- dims$N aux <- N * log(conLin$sigma) - exp(val[["lRSS"]]) / (2*conLin$sigma) val[["loglik"]] + aux } else { val[["loglik"]] } } "matrix<-.reStruct" <- function(object, value) { if (data.class(value) != "list") value <- list(value) if (length(value) != length(object)) { stop("cannot change the length of 'object'") } value <- rev(value) # same order as object for(i in seq_along(object)) { matrix(object[[i]]) <- value[[i]] } object } model.matrix.reStruct <- function(object, data, contrast = NULL, ...) { if (is.null(form <- formula(object, asList = TRUE))) { stop("cannot extract model matrix without formula") } form1 <- asOneFormula(form) if (length(form1) > 0) { data <- model.frame(form1, data = data) } else { data <- data.frame("(Intercept)" = rep(1, nrow(data))) } any2list <- function( object, data, contrast ) { form2list <- function(form, data, contrast) { if (length(asOneFormula( form )) == 0) {# the ~ 1 case return(list("(Intercept)" = rep(1, dim(data)[1]))) } as.data.frame(unclass(model.matrix(form, model.frame(form, data), contrast))) } if (inherits( object, "formula" )) { return( form2list( object, data, contrast ) ) } if (is.list( object ) ) { return( unlist(lapply(object, form2list, data = data, contrast = contrast), recursive = FALSE ) ) } return( NULL) } value <- as.list(lapply(form, any2list, data = data, contrast = contrast)) ## save the contrasts currently in effect for later predictions contr <- as.list(lapply( as.data.frame(data), function(x) if( inherits( x, "factor" ) && length(levels(x)) > 1) contrasts(x) else NULL )) contr[names(contrast)] <- contrast ncols <- lengths(value) nams <- if (length(value) == 1) { names(value[[1]]) } else { paste(rep(names(value), ncols), unlist(lapply(value, names)), sep = ".") } structure(matrix(unlist(value), nrow = nrow(data), dimnames = list(row.names(data), nams)), ncols = ncols, nams = lapply(value, names), contr = contr) } Names.reStruct <- function(object, ...) { as.list(lapply(object, Names)) } "Names<-.reStruct" <- function(object, ..., value) { if (length(object) != length(value)) { stop("incompatible lengths for object names") } for(i in seq_along(object)) { Names(object[[i]]) <- value[[i]] } object } needUpdate.reStruct <- function(object) FALSE print.reStruct <- function(x, sigma = 1, reEstimates, verbose = FALSE, ...) { ox <- x if (isInitialized(x)) { nobj <- length(x) if (is.null(names(x))) names(x) <- nobj:1 aux <- t(array(rep(names(x), nobj), c(nobj, nobj))) aux[lower.tri(aux)] <- "" x[] <- rev(x) names(x) <- rev(apply(aux, 1, function(x) paste(x[x != ""], collapse = " %in% "))) cat("Random effects:\n") for(i in seq_along(x)) { print(summary(x[[i]]), sigma, Level = names(x)[i], resid = (i == length(x)), ...) if (verbose) { cat("Random effects estimates:\n") print(reEstimates[[i]]) } cat("\n") } } else { cat("Uninitialized random effects structure\n") } invisible(ox) } recalc.reStruct <- function(object, conLin, ...) { conLin[["logLik"]] <- conLin[["logLik"]] + logLik(object, conLin) conLin } solve.reStruct <- function(a, b, ...) { a[] <- lapply(a, solve) a } summary.reStruct <- function(object, ...) object update.reStruct <- function(object, data, ...) object "[.reStruct" <- function(x, ...) { val <- NextMethod() if (length(val)) class(val) <- "reStruct" val } nlme/LICENSE.note0000644000176000001440000000245214251721455013217 0ustar ripleyusersCopyrights ========== The bulk of this code is: Copyright (C) 1997-2005 Jose C. Pinheiro and Douglas M. Bates Copyright (C) 2005-2022 The R Core Team Some of the code contains different copyright statements. A not-necessarily-complete list is: src/chol.f Copyright (C) 1996, 1997 Robert Gentleman and Ross Ihaka src/base.h src/matrix.h src/nlmefit.h Copyright 1999-2001 Saikat DebRoy Authors of 'fixed sigma option' of Nov. 2015: Siem Heisterkamp Bert van Willigen Paul Matthias Diderichsen (sponsor) Copyright (C) 2015 Quantitative Solutions, a Certara company License ======= This software is distributed under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A copy of the GNU General Public License version 2 is in file share/licenses/GPL-2 in the R (source or binary) distribution and is also available at https://www.R-project.org/Licenses/. nlme/data/0000755000176000001440000000000014251721455012154 5ustar ripleyusersnlme/data/Fatigue.rda0000644000176000001440000000326514251721455014236 0ustar ripleyusersy\edJ%(>Qx(jX2ƆӱୡEjyfZbykiGjJf!϶y[O/zg߳g,<4O!D"H$vDObulx+kZ<Hlh#'Imllb١ۡ١Z-mWkjJdmJϚ}YY!zB +B0+K~Kԃy)y9|tRhY+h5g>FWзR\aQWd޴3ܦuCMMI=<Aߐ#㑽zU\r]7'I~C< yXn i3}Sc# Rې8v y}<ք"Eυ9MyTNJaisI=w|5y@0445R+yR|hqHIa۷;֖O:G~(7&h~\O%^URRv~;eNmunm}<<7Y~lqp^Sư+W""oiƔ%Y )KZ] ztxCz!M3i?e~n$7z1)!3x7)x|:x|:|ywQNRHN7FLJ}ǁVyh{y;u7_x92"ʺ1w>7Z[QerQnPs^o{+ ~fy<`y:Bk]Xou/=*?6PBZ7ov߲@[ח]߬U׼`ty 쾲98l^XpB+S =8\nvmSS ;R3D5EKaj \vF&ad;l.O@+xZC-< 3:B' ^`gYx7@7=  zB/x^4"K2B_a A0Pa0F@8Q0^W!^1 cuxA!JPA,`EjAq$0mRaLEHDH)0t3ă9&$\-X mxR]Xa RXaUӆRa-1| 6§& [`+|d6_ `7 `? p7-p 8 4dp#9p.% ? 7 ~,<n O0-G i.#A9T*ĸ˯I_CREG%Uiu ʘPAN6Ѫ6:$AG$J%hPQ"L-fJO6MTu8Pu4kՋf|au.DVhSZ!i+3;2\ԉJO^詩x;VUR[q +LN Ze yũ5N;S4 F@Q_xxnlme/data/Oxboys.rda0000644000176000001440000000376714251721455014144 0ustar ripleyusers\WLfMm4Z)",-K}GҔHdew&ƍbXG J)HEQmEC!1At(J~޼=ٷVɽ{߹sy{6^wk00jƱm\z ctC(kgLWudCp@iV rqiTZl   d\TA. WV ry\ZA6Vz9ͳt6͍|٭i#Sj(J5O,'LQ Ѳ䡨)ݫCeKOhDLي]r̺x6~h4N/YL6މcY>O^œ_[~vdym:Oێm8jm~C'y_[sZ;g_imh;+~gmSy~>Gn|lo_ ~_sVF߱ Vx``pe+V[Vڿm~קk=?u#/K.'}?OΧK"/z?thdo;_ޯwa]8c:~wŽV B )g[nؗp7=W {żWӗZAܶqmg}-_`t<8w ī#MEx~C-_w"$q%_+t~x@F䢍 #B}?p^a}gVq b߲./0?|#Ǹw1KqO sMGx ^ނ`<9E/o8sW,q l?W+dzl4!y &HW7#G-ڮ^Bb_7~sB|#%ocߒopO%qƒhu^XG} qCVRo^>KPy N :tk:5rrՌ8]"V7(eTxuùTm1|/z;u==E;8uKF/L>wyjRp)%N1PEΡ:&K C* K0,aX°a % K0la°a - [0lap# G0a8p+ W0\ap + O088OGO83T38gN뜙娟W=|{ܼ݇s|^yq^|0W9xf/.a?P}]Pg~__]J׹0qq^g.;t,'3?~S=3۵[YwzsWY~}[9u>f>Ԯ>}AI,[~iyU>=:ڒOb^Q;y]yzY*w+W#կ_^~am-;]cn^.ϼ_+sANr}ݗgՓ|zڗE'屵y}O4vsf׾~nr2<ƙy}Of>+WgՎq~5z;ߌ'Omܞ8vk=o;7Ky8O 7Vooʟcq"C9'f{~;vE|x=~=Q׷TV~sZKZ5Ω=ɫsͧTުgڑ+*_}o OuިvUW_]|UZ^|yA2ݷ\{+:Z/(O 6Z/ݗvv;MOT^rIotrƳehz}rV:_-[^cZ,P9eqܷx_+YjzWOST{^2_O>y:V=XyߜT=-u<-QۧYi@,Aj7\Su]^^2ցrA~sve.Kdo|vrV;|@微_ϭUӺUk:foƛW9]QnQZ/WjOU9jyI[,7'ծeSy_yS k(*OwVGtW?\R~/nϟTZwscG䧭m~rUY9kCfS*/mR/|M_3cY}i\3O>-㫭D/Z8mk\y-~+VHϫf{RhY'@y2վ_: ?KPyWxlZց{О qL~Cv=Uy,|R?{ܾnߛ~rqPΪm8Ϭ^y'gz̺P\cgAkzFw~~d[:9yuBžgo%ڿXi\[G/]{8rMO|8O`sr'gƝe_؞(?jK?4W} ?{Cjo'_P˼uDZvjoE٧\ڕswG7_Gsz0_|5=|Ӗml(?)͗w{<ݞ~Ӗ'_ow\hqnmޙږS|>߳))m9MwI}l{1_r.SW#rowͯLCږ|}agţL'7Nl(]`cKJP L9ccON=a`zf6o(~+LWm0y[LaSc_` _@O3} 6;fS>fJJJ_` `:`3 n( ?Ac/#3'HuO'L ?` 8fӧlϏ)ڿu[7n~+Kѧ{9v8:5ϧ;Ų?}񁿦ϛKs=Jpڣ,%G!Q.{|z.RUGIQ0{ձGiQ{ջGi=8;Otꜻw|WtGcljiiiiii+鸿M۴M۴M.KG;?{ n|g'nۯ{w{N}t3Woh3kwܻq|{nzc}η7o[.wo.yJ'7|B'!}B'|B'|B['t]ۯ޵]ی޵]ۇߵm]ۦߵM]ߵ]kߵm]ߵGk{GkbD,Fb$,Fb$,Fbd-Fbd-FbdQ,FbQ,FbQ,FbTQ-FbTQ-FbT,Fb4,Fb4,Fbt-Fbt-Fbt1,ưb 1,ưb 1,ưUa0q9,VC*+*+--|.8+@,$.-P.@,x6-.,@,DE%%%%%%%%%%eeeeeeeeeeUUUUUUUUUU5555555555uuuuuuuuuu aIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"D,X$bIĒ%K"$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aI’% K$,IX$aIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2d,X$cIƒ%K2,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`I%K ,)XR`IŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*T,XRbIŒ%K*4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIÒ% K4,iXҰaIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K:t,XұcIǒ%K: ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d`%K ,X2d%'Áartqtgw\quww7 .npq\7ō.ntq]F7ō.nrq\&7M.nrq]f7.nvq]-.nqq[\ŭ.nuq[]Vŭ.nsq\6m.nsq]v.nwq]w.pq;\yWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWyWK_wx/^w}~z+o7ѹG_~W߸uĽ+[Ny^oݼ{7n߻v<8?}?s>ÿ}M{{7pOM1o]?#wk߼ҍk/]_>k/ݹ}~]ʵWoׯڭY/'];ouoܾyqY:ܷo/=`VBnlme/data/Tetracycline1.rda0000644000176000001440000000136014251721455015353 0ustar ripleyusersUML@. ˏ? UY.@dG\Jw 5]5e}o~8^C܇ ZQ?Opm$?p rH#v3ÁwJCb($CZH $L5V -P*~*{ v$aI'}e_Yf!%`,@)T =8,LLYw͐N1϶k,30:CTdGE%x'އCQxcqNN=pp  ˜u+hnfbe @&RKPrG*.lM6P ;jm_zZh5}| JKlҦ+taF#բuҌlEU왨t8sK*1_ppA(Cba/qG97%3}mi&㺦Tُ߰d{Onlme/data/Glucose.rda0000644000176000001440000000470114251721455014247 0ustar ripleyusers;ldg׏y9ǏbYvι"AKEifbgY;&u((utHPЀUZ E Ds,H^HXͽ=|ݛ}wdB0^*& ~9lݯU|~}ƯggƮ`^Ih0\cU*j*M#1[O,8Zt{^_[^E?.}(?Cp>{ eeJ^׻W%ͼxW%yJ7j]oƻ*y~g ~q~;w'?o~VVzQ鳯fV׬K.UVAYxxaOAAee8E/~V|6fo˵A/-+/+ oee׻YqK8_u ,g_϶SG?W3~ ny4U-/k"oaxsoוя]w't<+"򵸋^6.} QBG롄Jmlrp}¸8y>6 M[hg<+!,Z?q 㴍~]^Ez,?cYyG\u~8onf뭑l /Kge ![aWg _:}eG |_xWg0_ G5%փg_?y_f%p06okX7i |uqZO/c0o,`cx|Űޏ9a1/+Nm'mz:}:ws1w/ ^x%c$VIQoZk5Zkb%^s8C!g3 q8CPg3 u:CPg8#pF3g:#tF3Bg:#tF3"gDΈ9#rF3bgΈ;#vF3bg$H8#qF3g$H:#uF3RgH:#5D}V jjjjj*iMҚ5Ik$IZ&iMҚ iB& iB& iB)iJ)iJEEEEEEEEEEŤŤŤŤŤŤŤŤŤŤ%%%%%%%%%%%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%B]"t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]t%J(]C0S ΃^qi G;/C^k?:NΎ 'GcM.\9w+zIsQ!,4v?m?pOM'-ǭ 0]/ `=i';SwL v/ '6s#$KtU-tZZZ렝f:hwЎA+:@wut}tk;:]::AOc4k:zzzZw;)tu;t;uГ:;:};=;}:;hA:tc=>ngwws:;::;zwгھcpf㞍3;=\{ŵ74/ѼxjX35?i^6?ζm=NnfnǶ}n֞4/mhXǶtc{߆6 nщfK͖56jasL͑6jlܰ9 f 3lٽæ C?l9Xh3l۰1%?n<^qsM7tܴqM#7mglلqM;7=nvx[v0n/Q}=1m:'(sNn\8N?q~z w-щ֟k&#]|^C''?I_Ͻtyh:I}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9}9Ox9NxUOnyhϿz畣ey[ʓ|~5?_hFkw}hht^O糙܃[%-|npIǞ=Z:gt0?)y,.˟{Yߥn󹕭[ռs5oU~4/\g/fy[|h1۽rw%a9ۿ\u\_ZYWe{ֲY|=]qryI|WO9>kY̯2?Ԯy_濬qW>9޵<]g~km6߯.dy/{v%{_QgWr֣IYe?e;d}V:ͥ(=f^aYŴ鼞˾g}k(/ޗ3Y{!c1Żs)?_~#u{%15j99>K.kd?GW|nF Үz!?__3ߪߕe:qre3y_l׼y1s^O+\w>۱4Uv{W8L{3}y/?ߓLߧhgL_xAgW~Ҹg-k*Q|1Og~d7s*_{iܔKwmǚdWɵoqjOvy!͏/K']g}_^s_dj|XT?*QӬjC>hQ?|ͯ?5mկڣهSyF~ADswE*/_իU+G)hY%W-ǣ#79>ʭ,EK޴ސS?{WuWLgg5.U<)?yT^iZ:-߫iޯv*yY٣1qLSq1uOZw(8ɏij?CD~M_ͮ|nJq}qſ5>X׊c_Wi~~OvZg)Zjwj!;:RLez Ӄ8*oo俴? 1պCک[qAW(ӫ_)T{f:6Q:v󚿔Ne}/ z_v~Rܢٹ1}'.8 ~e|>D7eu_HYK~Xgٷ+e_/ۥo }'s+;$g G[~E֑u<ŏ9W?}+뾟U~XGk+~n~g.^//U/WޖTFII֝Wօ.z$ۣu[Z?Oo?Zk|/]ѲOZ~(P$!eJ/?o3S;wAZh=C-{dZjGA(;S<ݮ_Sκ?|.{G~KqAu*?-Vߧ٣xV\'ε~-gW_|}sȟs7oe{ߟָ@Ev},G~7:q_ى_{781z^z T#{zUN$Cu9utCӹv;6xk'9n\|;nOb̹o;}_sZp(斆\|iZ 0q`674/o(_xRUb)-äR`,Qelb]6sʉDrZ}9=`rz2]Ne/'rQN'/ir:|9` ʩr Tru9I\N.'W9v{`r"m9aW'zup9}\N- wr ݆nG>}}$(N1cǡq\tD }<:>}":΢MtGCx>AG/@ ыЋ'eG/A/E/C@> }: gA^>}>/A_ }9 WA_ }=7oAߊ };z}N]E߇z !GЏC?^~$)gϢC?~"%WЯ_C~&zm;wGz1П@ 5z#zߣ@ 3z *п@khʚ /o%NooooooooooooooooooooooooooG۱-ζb mBooooooooooooooooooooooooooooooo#77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777ru^Bwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww/K6GYp ;lIPmOhK͛/|~M/ϻ7O]ysWܚ:לpFk3bs^>SymoYpnƊFv5u{W-&[.[hv9ܭ_Vknֶ~Ƒ7Ol9ӛwC厖]^pU޷R˛/xk5Fj- cwnlme/data/Rail.rda0000644000176000001440000000071414251721455013535 0ustar ripleyusersTN04U EgpeB@l74M$~c'&e<-8jBC%=y-TSb*URI)9);89g{Wէ-6 henL&^.B*hfn…DߒI+lj>GZ> %7Z_[x~O _xŪS*wT Xi ><âX IB_ȩ J܈LVU熛ZN,?^;mv 5,jZԲhݢ 6-ڲhۢe$jyͪ0/SW#.tIz)~[/[Y/+~}Y8XO؊L?JAa&x;98bOY"/={ݛ^EfTDCblKߊc"nlme/data/Assay.rda0000644000176000001440000000221414251721455013723 0ustar ripleyusersݖLek`25daq?#`![{fm] LQ\ t Y˖l#8t9 3 *[:Q"{y'ܻ3)!BC: )ERADR벝NMQK#JZ_XFL &T 6b]Xd%i,A4xzz(I0-%JD9j"EEQ.BGh+]f0PzNX#,,/ZjB֭ Mf`MXw~,/n{J?C#}v_ASdwA#M[PgՁtn]<<<ߟ[w[g>?#$V=W8l$ŢCHNǍn|/Ox Msft h2ۍtLa9xr}bp[H]Vo35X]J[6@qUCbdT e;_R$C΢=,ܑU`hx@0o.qcCܺХ¹|. fn nlme/data/BodyWeight.rda0000644000176000001440000000247714251721455014723 0ustar ripleyusersWWGGaD N/V:$Mc;ibY# +VBH+=!<1y#srl? ;B9qg޹s Bp5uKMpH$6v,#Dcm+!S!ʵL:5B\RE8㴏i ڙd?D;ڛ\K+^=n/JhSZX4iy3vn͏&~S:iq)?ݚ|H$OQ.mV ^/k8ܴjWjjS]!n͎qy]d<ÔxE.n#\"^TPkyn~gWrqѾ4:`w@V6>/?_<2O@JG5vإ7^UpﲬoTVjZ{ի07&Tn5&H:/jfiNmZNc8)agN\u=U+ҶjaQ}IF"W) Dmπab) *מsj^r+|%*ZUYd)Q xj;8Bp\. .W+Ujp t.p7yo3L L@mTBn*Pj@@n4A .tOn<~xM`<x[18x< Og0Q0 P%1 cYy'ߒ@~˃,3x" &90@~ȃY 6J`,EK _o;=3Og ~߯}$&㫱t"7~-~s2N)(/EKN\]jZx9N5T$gd j[hyJ mn)6om]*$eos=J*զD23 Dh&4; cszg4D`_`p`sxR&CこJ 8/6z--YRnlme/data/Glucose2.rda0000644000176000001440000000254214251721455014332 0ustar ripleyusersMoUqi>ڴV"P-PK7Ein] Fq a%}'u.@93s`9*Q]xx9aEب4}_#篛ۦ}mǻۖߺ!Z_9ǯJHm/u\5n~.9o59uO-ip˴~c>s$ufn-3?uݷ 2M篮qz:^}/X8sюֻqܑ:WLz?\}siU3NZNվW}3|]y*ӖO]k'LKe_$$d?@#sd!Y,A"`8`8`8F#`0F#a0B!F#`D0"F#`0b1F #Èa0b F#H`$0 F #Ha0R)F #`d02 F#(L}i4d1&LS|j>5OͧS|j>5GQs5GQs5GQ jZ@-P Bj!ZH-R Bj!ZD-QE"jZD-Sbj1ZL-SK%j ZB-PK%Rj)ZJ-RKRj)ZF-Q˨e&?HYS[~>uT`4ɅCGEotF8waT6rsQe^&ߵ|go%np|۟L[yI-/\m7O_ť՝rj#vwm4tk4GʹoBy_NXڥ{;kN36;v58m=xNe꓿͹ҙ&?V[Z{=;\ݓGͼOyxßw{6/}]e;|oL^s<Իg{nlz??}ўK.uW Ot>jͫ]Ҭzk{bT⎛\ڛÿ~qq#/Ef.[FP;>D<=uh;~Gs䍮kc{ljxpm'T}/{r7k5Y:ýO?}q\+~jI=gu@nqT}D[i^CV?Q?/GO~m_h{~7Yǥ?@+ ߸6יv]!^soUKD~t/[:^Rqj{suI_t^Qak?>8/:N_oа7#|.i79UG#<Ï+OoƟgXEp.8Bp@YKerp\׀Zpn7-V,Nprp<#QXO'Si x<+ Ex^`X o;]x|րC|>K|߀ow{փ/Wlꬭz d[xu2:3VWmjmx} u('q8F^}"ڄY|?7i׳gلd"Kdgyow3˫ݾ"ak_坂tx :3>05%G\S$FahKc"ztmo(Sca~'[ҍ[R?tiIaHsS鎎Anlme/data/Dialyzer.rda0000644000176000001440000000360314251721455014431 0ustar ripleyusersYlTUtBhXA%.pNu SH"> RoghۃqyRL$1<WE(iT:޹3Snts9KNŻ+IRh$]M$u':8%i<F}(6iSmצMؔ&)nSڔrM)lܦtٔۗy%ݟO骵6(9\PB\pAFCwMJ?$)$IRII82咱%e7bLRuMUDs*|;US48y/BU~O'=787|w;7_2 ڙVNzǻ^N jיc2e3ȝBoe;mvt(x\r9z7޴9_\<]Ӟx7sME<_ݽ̅zșEX\ bny/\{y<ø0 B9 I<'=wyB%g~B ?<]Ul5x9';qƅwO#w!pyg!b^s`P<=j&LB^i=_>_yquC.}'ic,~.?1GtikG E׀_},0!7wZ`+ c ^E~3, Я<8Z!p,q`O;쟬:E@cz3,n|o]U`j?9ǻ!G*}A{-/xu{I~gQas^+z>}o08.u#u 'rO\񇑗z6}~⥽; ïs;${ mMc~F0~= -Y6Fp,l S^N 7+\eX`?cG0K zO헬`"&uϩs{1y{)~ @\Syc}+/ºYq?$myK +>:ޢޢޢ[1So[}2+A3g''+z]zXv2|^zqᮃJ膄[Ei(f Ee> KbK 1b(PC:PC%J *1TbPC%F 14bhЈC#F >b#>b#>b'~b'~b'b Fb Fb$FAb$FAb$F!b"F!b"F!b8)K_"DU}B 1 ĠM4YdAM4YdAM4YASM4EASM4EASM4UTASM4UTASM4U4덛 _-- TȎE3 sK44y /4`pJz7::[/Dym}qT,d %ݒ@z8$U#oClkc6]&hN*m* X]' nvvz&7^[/`f*uLq4W3VHtxJCL*RZm@pw ӝְO*5*Q3=S݅TԺbO/to޾uGx2\Ko|Y?M `gg9ĭ6'>sqL6"nlme/data/MathAchieve.rda0000644000176000001440000010262014251721455015023 0ustar ripleyusers7zXZi"6!XnR])TW"nRʟX\qjnj-&_ȎMɣ 8i`]*_ixN_t v4c\x\mvѻpXvhT3fi po))6D* An'fﮎ)20 G ~WUəמQ716hM.79?#6ҭDxlNGBЂ)ԌjK\v$-2w DKD)T!gTműxgHI0T}H$]TO;h옔QBE P90ߵȜP- ۇ]L;=t~jŪ<%5VA@MU/i*NU?V>m)=eQma6*ggx*u3~H}/,;hXv73.;Z2Ahq35Z{uC{$uFz|Gtq``Ks%̴x䜟Ux._xt urR,F韌ٙEFt'c!N ԃytrmL7F abz6HfQH|@l%M3V6 aK%F&sN%NAnDVZ1;":Dі. "A_]~tn45CuA%$p<Ȯ.4"zBu!6tU>A!ƫ8Ko.MF rP\3M]ӕd?Q{MED|]=Ji|7>v ߫d'BnCA8Bgz6ۑ7e6|3c6/ S挷R$>J;e [(N1#.R53c, B@̪HwZDSqG k{~1P˕r$ՀA "bW5_^pb)t:>@\w ڟC89BΙwz1KGm-K[ Mg$ Z*f:IS+&++T嵄-)dXť5BK͒w=?[v&7E.58+T㍜܄Y'iGh;"?= B.Ս`>1㘙RZM|%8B3Ezt9 ,։W&}0v2J։n-0<:4$QќoM“9w,C 9fVs6ғކ  g @k0B r4U6wiV ?Ǹ_{LЁ>3Og|qA5I?Y ,%s3,>U _=4Mܲg$v>qp;D޶+T]$wJN>ڍ;sKA!|O}m% 7E/ͤC;w&O):T.Kk&v*c;ʢ 4x7ɼfDh6tB- mb*jRRw5֒UӘ8c`N_ W7u2:Ԃb[%^ڒ")lb>e$*#nYXc_j |T7čuHv|dUKCkHFNomCTmϡnzk_jhȘ$*x}Bѻ!l,vN,-htKDԝ}\Wy;enIvɺ}yh g 210-SR.#~;c33[hChTnȩz -薤Kg^,\^ 95]+vExxcr2˪vqQۮJ 8{u*yӂ3HʝQ^qe*=svT[{ d&f׋5bsM!Gr`$KPڃ676\ѫ| ]y?Ǐ8KdT $63`\ !o=Jb)+r[WLѤˤ^#V`r]Ά8hyo""%5\W!>7i[.P毥4ϣ#ѧade)'.=F&4P#l:[oCsMf=rI+8jg07~,%\v7+/f8m+]߉fbUӞ [$9/Dm.-6 P{]{se1xfn!ޗ5zY(k B?E×(KcS^(#夨I|&V_|qs ήSO#F<Y fyWlZrU#*&F21ܭpd,1b6A#`0$%xFf?&exJcwgKd_og/N#'Q1 VR$s0$h7N'UQɝq; i9 Q1n&_ mr:(#:?J.} jXcjd ~>A8tu6;E,ԬlN|nL^?<#HpeOCо>//t#2mxyQ p^ Mvi:>g esKbC!`f!^Ys)b`kQk7/c|/^p@uV >POJ߾ۈ -m|60XMgI 95>Ƈv1=l=9qfdn,d-nlIֶb ,#pΚfS߉ưsc"g`1!|ӃNyƫ5 郯ikރ]A)iYѸU .:)!a";B@=!a$uѤ?ߣxDaC$_Ji ǤpNM +,|Vߌzº a۫r2gԦ0 j0zR{j[t\iH|y~mWR]9Og#JN}(<8g<r'3TPqfeSO5w1CT n*8WP:$)8.UqxlXMg*P 'q.JM!+j8*`y^KɃI0%kjQvt{KnVw h<& 0aщ>>$U-''j8G2;)̒'ˣ[/".bf.$Ћ87Es^8$s3YrMJȑ!T$ȉ_z-.Fu7[Iq`ܗ '^"a)W.Lcm sR*8*j,J[bb xaR~-I6杙#IהU] Hvaf4 sc ~":ݬ(/LK#bMp+zۃ*Wm1 Gj\M;||LOlͥbM\ʟ y33Ņe _tXOYxX|7rv2ƅխ]ύG"6OziTU91)V$ @WQ-ǁ̡E\^D^CK-`#C<> MH|80JM{Lhպ4#ʬ lۼJ&uF91\v&İ '(c\]\ eʺp!M 'L%=8!ÑuI^1ekƙٶ_&7Eq [ALJ*Ӹѳ,ٔy7Ize_Z17 AKy[9ǯB##YD Xcwk/A*ȊI(l%Seh{/=3WDZ+?*lWNcG7A {6]A7G'+AK xyea`wx;}6p;kFџ n_0b<ƒ@PgBGzzSuCG>'tٸ[Yeʉ܏6k@v8%]Cw X8f9|–7%j$om"} \@"J&IS];O04AFR]G7od]'j+d)!RHHiس|Y)S{"`;Q:FnMŔ#mGO}4n։]%ai3)ߛ񰲕gÖ.5gۥ pJ"!1Iw:G{*{ (mMD6ܞ_d EG/,T7&\/Dw9<ߦ ]C4Ȧ7wy {`H,'*[Q u#`Z;7W}[27 ="uun|}4Rhm1& G Il͌<ļK̚a:S\QGoJ݌lOaG. k$ĕk$KT+x2wJc-w:IzF`j;iADznɷxq~Lm~ n*+wX$:SZfZ$=_\@ e,iGwKim+vi]Y0ur(Lr5GBy\FyNփMl@KR`kſN΁sפT8Frq۷l=f:n0,qᐚY6C` 5! }Bz`dr=vܭU\Jq4|=7H/IlaѐZ 3+5-IipqoSf= =`{T.% աsj"͠Ddb((>!@|TAS:t5|x481f*(_hEn=ekaH IsuhL,-^g+IibPž4Ǩ:>> c3S_үyA@;Ju |+]+Y:5o0 :5/H7LuKOi]ΠShk.¥Arq%|F`kb!Rxl:DU$~9S[zz\.h;{*tPHH;Ȭ !ͱoyqD. iYlEt/l[] \I4~S`p0@c[l72x X.v-H2Iuc?_7#'2S;,$N{Pl]Ni(d"lj5G9 bm˨DRKbnKaZtn_-(NW ]IP'.kbXdxJ9nw:wsunkfM73;=sy]E3 4T;\j$2q)Zj}ךO#C&G82-jox Б*e+-wEA_ɶdRN=Ѧz.^d`hpu6Zq=sVb*3L7UF#?WKIxQ"ul: GX>1+o8ȑ2ŤLI?d/Jk@I^qQU4UxUKJ-i#p-V"f2'řTRt*8lcap*|I{.?RoGr]}RZ\ގgoVJvT>UG &cFNI;Min;-WiCl ų/W", HIr;IALm13@ؚpKmZ>ZJ' [oȫ`%0& 3X. v _R8^'^TN#8L+G.1bÁኚ<{|2cu~[6 E6()h *3I_+eq!QW E/AߋAB}RX~' 4sش 8Gp5\kЖ W{OaqγFqZبZfM12nWA\@RS?Tsmhxl@IUԓcθ0WDD9|m&v|uLx٤ʤuJnQ*Q#Ή |6Dيp'Y6,YFuK߫-*x-\U_&]4ܢ- |ِ=>g<!Pzz.}G4_$H/(mn[&2 ( ^FRnug@z\'WoɾV5d64!r0-b HH@4cд)dI{2e]GBM q\B)ȎҶVr\DM:"ܪq 9{L3+mX]:SuַZ%@K<~!en?VZ&{ 0V-a& (C!]/oOK|<v\4J&XIZۘ%ng7v,qdOcU)@{J42zaksR=*2v?D}j.<S˱u4J Y|23hpKܗqJ_Po{J)NEpm{\Q ami:3V=ƅl㼻Ht(}?kl8ƣ&ik+hz^Dӹ4蛕rHCB~)'ªW?̧dfЌ)~-uF׾^W͎6ǚ/8by5Ѕ/\u{x["[eCd9$azJqp<{TK@x&xJsV(i IadF6] Rj`A% H`7}kJYŹnOYZ*=fB /hL;S_sCe;p= ܔpӋCw?$'HS5b`6GI(ɨ[IbJlmqc jMiK$)%#S81r f8Yܩ3p;5aisڹxU"{V8hF q/.1Q{<(x ( ?9Rvi.fnr2ۊ7/ &b; p'618"dh(|c)FIOO+ʄs''fU|)_=}5[M+\ԡ,rb3Y;XGiP}=b.n[Cx\-2yXVɴQGQL8_l?!Η=|W2 O` /|wJIQ6뫝u~Dv@*ޚC,)TZUCBf!,Sq{~+oс#!eWEB[+29{H/[x {(Ub>N~z;ˆMWl$ލџ5d|֥pBeHd7 ✇Ma!>dndepm`YL ÿC J$jKwo !C9"}Ը/IGA@-\ii-Ӣ:@i0Q8V1 u{Rf/ r?f #+>aey}QK'~ M{z+NjHb c3ӻTLzp 8퉇lK; k &$'=R%/%UB hcS6-T%m֙IPRLnDJcF+8qBho:u +Z?/ V_t,fAwg=2!Ձm>#Z !B1"o3p/űJ_ְG0i!xE>J/tӬP`JІ{ 55W)1x{2)<)5Sq91 "?aS+Itn8OU!}+EJ叆cfzTKg( RyU3 g]oƢ>$H% RKcV LC4(tM&K9?pʦ^ΐVN')Y!@?CyXnmsE(ɋz֙yԢ/.Uk K𝏈QYeJɞ'&Ru8gj@ΏZ-A5dfG{8tx_֙]&G1d~ nd<*;؈_- ^\aɨck+DTs==R{-e@vk`.v<_u2IO ,l#R~]쩑߂ʵɿ '(L TM6Cjwd?.ETpx"*@~RAfx9D&_ACCF5|9tIpD!K!Z3$C cGk>ϱ.=7ʤ?z{sL 04F0FPUPXh-7Kg@,\3=帔4_qe1t >@#χž`mf0PbN%?$}$1b"t x{"*nV4=YsP_üDRDzI1dhՋ'?*+ިņ?5\_iۻ;,O_ 83Z7>L8O$ςE ᩈ|Гw8:}x md~Š0GqH /vBάi2oYhZ:3]ڧ@`exD)>LE`T|ٙU8rSL]_C1=RxQ KJd/M~@AtpLөčJռP= E>ޓ+L |(ǔª@/UBKuA8ϲ#C{zxīZy#OP`ayaм+Q̽x8^`p ]mU>p*T69:wzlZ=geڌFгAh+ۂI QnzcJXp+'?ݓ'<]gK@fsg(M4Re2J┡%.wc#1ߦ ~`!IIBƪ}ZGoIY0V"~F'8 xVPvF,GНrz{^Ry3ũa$q|=T^TgNmlL40L ?w\xQVa)Ek4-Du!ntA9o|3[CjzYx>ְ7fpBGB‡p=XQ 7Y3-?ތG ɚ(ݰfdsj xgf5ZpCȽ*0Tq5ۣWx9sJ<&[QEu|])_0]ăf=WRUħ8L&_ lY%Wp*Gc+Ks<@h_ {_FxG0 s"&Q _0ԀJϦ<@儩L42 t jBCdOswږNm㠁%>YwtQāY_Scq$[;`Δx21yLMpf/(T/kU//s(vgd%n\g{EЫ}mSicؙ,^"/,JB!e}4Lӵ/c"Z6^#`r<6_y,_H?$oOzi߱=S#9,Xbl;k#xSl6p ?גkS&#=;w[`4[lϧ  ZK@"򢥅3'}cUUז|#ܳ) uEY0x=;#"-@#^[f0ߨkdEU.3;5m*lF3~!G+0SBC"?Dhˆɶ xJOɧWc)S^ptgZm1ƄD؊\b*=:[ٙ3bH0z~pEJ*0}{a#Y'!^;SJy9(i(Qׂ>n$˿Qd_Qn_,¸d&ܗGs'@Rt0R!0_8=T23vr]SͣI>ap%d}tPmPl5B2sֿZL5 ORti Q=244t^EzօcUӷC<" ˩N&I+__{o{HU>Կ#%82 7BU+p%S^%gH$*ߛT>镭$̣+ڻ1;FZi0:彁z9Y!$'I∘ݽ&N|sB˨G5h 7NyqA3I\pB').3"%,,n,rzxSUvn/x`P&3ƍ#Xv3]}>QՔ*1/R^W2aXk( 2ylS2 *7'O7c6\䯈fZ;SȄ9&:L%E#zcuYTpF0FM6>Ϸk[% X;,WŮG(L* I(ӹ]=ox${蟯_PטNqs(n㟧!|4+{MJn_R=|T39}ˏ4 ?oƲo}"p@{pfėpj ߞX/rG\ĤA\;'jvt:%-/{Z ЋGGN<}\]/fNjU)k"4?.ڃҵj$渭k MʉIkRm+ %װ [+e#Do&m1PƞJ[kbʛ@?Ú ؿ7kB|A.z_NA\bdm׵DI̴g[+yrstIV-ԃhhE'?0KO; #M0ɷɌ֊LZe:#_Yh ] u)~E4i Z2a)XG31WO"Ŧ?zBS k*٠ru'!xWY7.ˍT T@=|}fzP*`?#NXIEe64`S.ŏF%JkrRIs@7#VP]Z ")?0ѼC8"Zؤ1ֹQr\$:16'k|dۭd~)ōZ:[t'd5h~8nݗً`}G CRl׳IaQLvUT'ާN/= ŀU`PgC Z-!e[}rw J;IF !T$LR o2Eէm3TG +K? /hލXoF<]cU|/b:E_:u@D& (%R)yV.\&eOL_6Z^ަ^I]wlA9RNF*8V"`(K- m@ #ml #I֢7=t0щ+SG8DGWVFm@p%xtLLB1^"F3@X?_"{qirlW.g>pڨ8AX $84X2* Ǽ Pq ! xBLeDz!6ḏkU^vX;؜+Lu'CܒU2FutmH2яձCl7s(#44a0ӍShd~u8=XuTRQLuY }#sme6yt9ֶF-@{]3h |J$d]U4'( ۘj?)g)^񌇱 3ܕC2\UԒBh_l@kaP\sU?`|:kڗ@je8|ӠR! Riѣ6u;Rj$3h~K? ?mQL_G BbN<} Ϧ3O{6ו:T)@6Fopx9/=τy|nT3SLj[xYIUXHsaSduv/q#6I{5f@Fq "VzY/e:~aLY@ &xEoC?* d> i-\<LSLq 垶iqo 9U9ےˆy ^*F:#<``}PkK͊KL(;/" &d"TG/"%D_\}kx!ecʋ]*W~.$#NuO/ާhΣʍO!Nl8^{X0SZ@=b佒=IЪb-w#rKO BKn oZfWFi^I =J#쳲F5sQm"oꨡ7m8xr v@WR|0Eʂ,c{],G;=ܒJ4B#" ׏ Bv]:*#!)/%szEΞgJ8+/0 + 'Z="%_O-7`H9|Nuz@ >%E<)A.u. TЕ-F4TڠT{m4bm̡mBNȅ{]ٶM<,yCV_y>HF׸|)I0}$1C2!tR~Ҥuu]DmHw4."4K@`b*]d-Aٿs͹u5o9,-pܥk#'¶N+u,c-%!(d8C&LT <d$}3,6L R_ph}D gٞ;d!!HwyKI$?{m70H4tf{V8&~ Yx}Za&)s0t|'Q d>2DfM$`-EW jX~4TX}M40h?j&N{_C1Fg0IB=`gh`IOCM/. ԑ4GɎO"Nboow_c"nN3 -Eл$S,7Ba4/ĝCJC 2&?+Ҷ3j __{`\ߣtk~iB.=Q|UjQT,M:E]+xH p|~4*+2[0uu8lD]Mި6nIpYS}xy\EoJ7˩pDxM!kU?@[il9uSi[U`ħ #5+կbwT~F(ױJ6zk3xIJhWx69 rEV";B[,9yݮtcZ`٧#}.4]ɶPm10 qKvM?Av"M)HI?1St F~I=ERf.*8rIc"Ã&Ľ  ETb% *U=2e^@mM6K[|Ź!e_isP7yth"ИP&p0 1].bH`=IWF"6E#}F!mVv={x"A$#HNJ#-87M}ex WiAsDOd6L]2]Hr.y?GÑ9jVD̞,5v8*}Yho5孀+fu3e .hE B~nҀ \81Q=TR=^+=a.\`~C'';sy‚n(%(ǩV#v-#U< SRQ4^K_ƾ~}||THdlcȍ=6-/(Q#'Ey0B.J6B=j}G%k殥'(zSzS/;xIUJUOZD9Zd FV kAo:*.i 04u}w]LэatK&0}iP+q kT`i4;Fie6/?|3zI_1}t㥭҂MU[8;<)&@x)PmJ&b&_>NqNq)w7PčAeR*oڛ">\eIQMa02yI4Z'[S=Saq~m(BMS7LJp-le5g0+e)8yPFWc8O{tILGJcq4zz޸_ڜEasyl'[Gn,; _"tMou6%^YvP#-Ma KX{R#Y)!NjT1`]gl"Vq.Ŵ,+9d=js3bpsɮeH591Gl6x5&tYK5RMN{&,/RkI.Ў{l: L#W*a>6zC@sb\~Q_f_;᭲oCW~{sn16b91\ GI|"XTsw#]F?6r %;itİ)]ɬ*H僨n_k>K:um"LEtDiVRX%xaILhg}~sH!&{?Ȣ R neA&w:uM2֏ٳ~.ҪבYzU2Wwз?] *$p^| E[FÄ>)X@]R0RLzox}8u#!Ӌaؗe /#/dҤ)VMleMX0cEvF%K3?Tf&m ^NW] me9!<&1Fؓ@9Gu%bٷ0ewnby+i M!JƅN_XPZG% ПH_~.5ܮV`A*6mk*D53{70VRu< b&=&1)YSU> oFdwV*u{Greu n$\RkQE{8 l ^|IRZb}$|j},]텂[MtË)~='EMXY}sB6yA~<eD$XYy=r?T!&}PBYD&IܒKƘBPzKBg8ܤ4R摪Z#Tf_ ʂ<ogglUYNXna P}S"gI#mV*~yob}]9&T(%oP>܏3fPd3zY\&8 ';%`g>5 K 6pA̎|:R]ADˢ~HWcSC#Ei6a.>T,3+,|h-KLOAB*]+SGJM#X%_Z7qwwB[ONcbOlwbfFJAaGPJ$u}|.)sܷ^j"h#S"`NXbʿNm7'kEQxtTo3czuek$P&Mu_2 !?yS4=;)! `VZg_zey=# wG_"5 N~ C);/:Q B4 ,,c[@m ,HU:}gQMs]G4:놠|0c}lA@ `-{N*rAG&@V12 ԧ<]ncx[UffI%kcp:hfO lst;Z!Te]GF!rHYA@GalE睛}duwC<+;ANR8?(&փ8aowiYۅ!dHf_X7[LC9˺("rEٌn@o2#-!W=pϦt IYW2A9L X (J1 k0 hP9X O‘rK%p}7OXm&sfroJ@ng$6_wMZ nVG >l1& | Ci0`)Ks!VlfLWPAMv>L `F.Q .:  8VrA':b˃dٍҵf0} І`O^'@RkE拾a?A>DƐolPIS'W<_)8tZIfGْܜ$E!o8Ok37:sΰ<]4/Ս7}KŖ+Б0`D'&膞n,%y.ސFKP}0(X).s[r":;?1)3$huWQPzMS҈q4^q=3Ii/JV7Z})˪&yY%#rQÂN۴M7/vG -ԟ>A:e+u|EUa qCD(Vb pˇ紝 vCGihM9Xp"xvڿu%gL8oZB)=hS5 6(e1ܪz.S8iqOh,4Ԟ*MbH+n(XYg=}-n.tf>M^aFVEo$i68xN.cU؏V %xء?]3A(IwMܕ"'m˼cy>5jʅZJ#Bp{gLt63]^'(k-'ǀcVBiOCޕ)FJoKl'Sa7n%RY%߲6W?}Do++XoG)W+ Ǻ22qƭ~n|&HE]癩cKѻ VJ!j*|\f`3"*w:=F \QHX/$biBPm[Y[:-4bK^;X{vH?=z<&֖z6\d {.ml굴N^g=m'v`}L4Ԝgi:+qmY+:~ᵬMlǸHq @uzCB{RgɸX2_ǵ͢dtM%]/&r°2*5'\%UjϟӇK`)Pe :vJ)wYM 6~ 1%qITv?񁦦GܥS+W㹑z)HE'Az%"+ةhnn/$}?\wrgM8_kjϮ"SUbv5 +R+6 AI_2珬~qCS!HsZ9X1*-i I $ʨ!]zu|'"2Q 3 zbz$%@au,".$6DŊ,! c(:vy}i 5X@}ڗ;r Eݒ}N$ޠ8HsCS;V9IkDMg5G:n?*Gza:Ǣ^+ѧPZm;iyC Z^uuys_! !Ӵd^=`}F)yr̫71; T+% [@u5 ?^I.'jio Xbײ٢'[]:ftmح},># (Ĉ>UρiBE`EO@}XMҘXjV9z tM`cz 3cs<6[Mq7xx>&o8t73`l!ԃŇ1Zbw731XBʕP! =9q23d.Z9ǎԼ; C N paY`N賋!?JȆɘ bbptxLB2%!  Ľ,D=~BpcXxP9赞HL ҚnLƈ3| KAt׊?ޞKATu4_ahwӳdm/@ܓ(ύҀ^"w ~.2}ÿ:''/&vcK2b"Vx$Lp=(@~h ?w4ޒCMAPz.eG9f Y|6 R^Jw'7A0S!=K~m>q·:Vn6oZ:f)tNkvhp&/5X޳H`Xӿ`Er⌎+bCn8[r!62ab1v-E@JP>3^QΩkS#'))/Q-Y]U%?E~1=3UA>̍Ձr?_uZ{_A[+Ѷ4[~TjCiBQښWH%n+InG9b5j&=͚nn NJBlTu~&<bFh7 `J7M6@+PkQ ՍCN:@^oG)@8xD W66z偲. V퓬Q\/0D)l]12q4O'P1J Wbff }r͙c`:d7,t 4qF;"x\Ts$Gg(ykUQ;z>V f.^5 XHf|N^Xܔ{w.6x(ݠkGkV,ŭK0*!"|̟iD1E'u5Bqַ9).ѻf#$e,ugN 3Z9rᱭ%5|ԬB8Ml wWcOU& o)W]k7 SDf%gyEIMRBMCټEaBa6FO hӞTJqq(zRdڃ RbCiф %{ \v=HY|SLaRXIe1X5C-B03놊udv+Y5c"%/k}Ÿg٢-Z|hm1 5%  ~~EFjqߙ%=ޤJ`۾>}GR4W)Q)`F~%NFG_\8<I~"r(y>^V=>?wE%MT8ژSS@qv PC[ 68a x|* Fq!F9`ExƇD-HZpA1ovj{,JwxvoAuzN{i]l`v4T;8tꎸtKU*kNv*ز EpVc"iKF4MȚ$G3PvFޤK⬢"2QJ^CgZ{+dži7}m`هg!Ry,[jmɞ+W P>8kWp#30"?CFEgNi&LP=˵ S`Y5: |@Is@m)eiuKLcb#*BS&8&]`Ƙ`|}L؞ucuBjsY~xHd);| \&ٸ["L*}T~M:';)x pKA8r*m BfmF!S(W̜k;pp")dfM>77W<* !'fj$z VdN$&g^ Ug񱀲GYd8PX }rX3X/MFIiqHG|Bݸpc"~ 5ʰ7H}Cf6s5r0>21AU,WP\p}0+o1da._\HސuSfJb} - SԴưlyt'DRG8N7`BFQpQL5q_6&I1tWnUĐ-t rRNMM(o~"%K$zF0#s;`eR~T2F6Iԇ$̚mЉqu>.?茦s$fh)ҎXM&rBIt[!jꨝ%yҪУm6d@& def-8i\. }1w ͿՏ(7I,"闬G`*of/r t#.H]TrPCs4@%8*SN*`֚u.1n)EE<5LXr[[ڐ q{MpÃdk8Z%ֈ|*y.:q8pdK]+%$REL!}َynRs1鑜IOґA?#nO6+vmA.Aڔg_\i,TkS@0vIz6bNA `gdMl ґ^it4ǭ ?i m?I2xXXVD} o̙ʚZ*WZt0@[Yќyux<SK' kqYQ965Kk# (` w0v!C\#g1*{iFzi%uj$%UO&QTvF;́⡺3{bdsfχ~pR#9B4\$㜠|rR)5*D2x䮭&~NJ |CC\ σ0gZK&W@ $j K)NiWzi;Tpv(t):}6LKҦJ-8μ"863}8lў@ox[sSU`M'bk4M^MxH,4;= Ira0/r9Bvxkx\1B5>b+TR$}P>fPb8SgHI$1N<ϭ$`_;\BwAUh j`!abg#rwC`$A[\'l=zxɤ*F YU\%ITW:FO'A@o' erىToOZ4jO$+<[ҸYmU1j}Ñ285-agРDP:~x,&Vr$Vt XCܔK0K{`2YVL ?c+U @I#SR7ЗzAP7B /yO}|i#ա+TzP3CVdIgil׉D=7;) ?)/֕Q7[+J5y&~(7~ݓfn!O "Wyd A[iangu{ +%'0}V+j}UX }^ <:8)\^r+.%`朌f ]JKP舤/eM0~^Y!V Dںp}G.lC?rfGxj3P!JȚ] $XX8(oŬm7wm]$wwFC,uNK|y`Wi#.OBV/yV+ҷBDkumNʫ;@ݤWcFZⲀ_ڜr  X:ĢIT39 iH 9ȁO-ɔSv% \`[z#F:, ŴRgq'ڋl 7T5[0ٜkJ [ۡ+@/.&f٣0[١6_S},ٶF̃%k#'qFKVm紭:f;ff2 Z43&*ȿfatC%/094@zA γ)5|(=T»o\_LixE •f3=)ȕKM tTE5АX`|".g#S_T~ J2MpWF蟛 w.ح!t>qDT8jƗ6O^q)As#TCa7AMR["rm ih_zmPf@IJ"d?$$QzʬMI]֝b24j7zn9 ו"GELUz)/u:[`J߳ٱC-x9ߕc#cCмcjQ΁G9 _>nD090$:`Ԫ$r țxGLߵ6EE%0Z-$rʓy͖conoQof: I5.?Y1Po}AZ(#w6cjھ˧ЃᘘeS{;a>Qmï %)8]F"W#7np4Q2 [S}+Kzr (0{> Ei|lURǝתJdM۾ -Z %{]-u K*5f9խ>>H&w c0xYiDk񟳫tqTʝPRp0 bya]4Nܕ/4a#(eٞ-H䠘7|D&D5 ROM음3,=DOa "bv+&oVϓ~9'/db>*e6xIU}MsunR Ŝh=R(ҳOuJw+o)ʙE Dxb8S#65nV-'$c"ae $|@񈳈9Q+ +[ mi7a]C{Ny%23DK` )@9#$/ʪ*AWť[b:8hEU-(W2"M&[RdI_Ҙ{Q4X.XV8U4a kŰיR[;QDMFs/-nr9DLeTqz)l;͇Wnu]:CHGU: Y6)x!1%[YZh8kV,JJ(HkQ&FtAd]͹8@x)p9xnG= w$?ïM+:%[}??_^b(sdYZV"IHARo կȒ VmP"u'** :O+(HڌJzLQ^f VckIE!ID@kK0J[e`@;lÃZ+]z*[%G|,1 8h|>0 YZnlme/data/Wheat2.rda0000644000176000001440000000433514251721455014003 0ustar ripleyusersWp[/X"LI&-Y%"U D% )AYLI@fBHt$NTiNszuzuzӛS% )hM0iq"=v~0l&|mj?6چ~0Z!aHK'j5N5N5FKrsK+lI|#_]y~)" 8XZȕr jokQ_zlvv$`*/;M` ~U=`/`?8 n}vRwW}Ndhwqfκ軟ߛ_?8܌as<8IPoΝd.uҗܴ17f m3n#@?lGs3^sîcV[/sAD}{[uwmhlVcO+]]w󻉹|m̹y3[Qu94I޸AީtD*Iy$=;%BiGәtb%N*F'si4>q6:$cdr&u{%٧ӣɴTF\hN>OM] hף`qW_s~fV/X=ܺŀ.4ѣ_5Zep3Y}9 C bH}\[hC*J`GjkD.uQ3dVeN'jM'P-RWDF-͌f3lK͞a$+U>NXTS=Np>9c}yG{`<.2%Z޼8/q8Μ} 0`^ZrqK_}?$zy=wk|C Q9o2E?̼ɼ 1O0gqc;uIXrDVxh? y?!Fߌ3~j>\Q˺#/"@;>^!(f=Y_!zɺ:9ndEX:GO?0/ACO?^_yHHAd=/ԣϼ8Yp.K^\\7?8n2d`9$u&5mWg ^/~_S[;^^Q>6ɺvϝ:i+A/co7ȶ)pN;}#puz^^)zL]əbt,Gt[Kݵ[Zк]]\][Qn[*NC3V*Sr*NR䄨2_>YQ7ԧذNe W}jN_ɋ:Q-rZNpjO%kO"~('pI.)uNT@TUoP+2`1`O`  nOi02``< <<<< <<dm``E ,0N"x.@%K`@Իv ip'X(n"bpx)xx9xgk-m,x < >>ρσ////ooGwwO9)9%5 -=x ( ϏkwƲYv.ӹ%] ̗pl-biym fc6Ù,^, ˹'NMq*wګG]3rckp+x8aﶦi14YNIndk_^YZ7Vk\Za~uXp :82 zF]x:gPbKPvcW/w,ʥczo&nlme/data/Orthodont.rda0000644000176000001440000000211614251721455014624 0ustar ripleyusersMoF,يu}al $~3pSZ i\rUPAQ w+i]rENjïf8gf{BhKmC{RV"ZGb4RL'z+#vM~5Xs  8*~JERP>Twu>'~Xq)NxC>Xlei^xȏX;O4pY灺a<o$ζC| u[:mZ3KſWXه޵ߵߵt|ȏLSd:`a0cfec13Ldϙ`3OmEol.U*z><ںPGutmF:Zrܸb=BouAN=ֵźXWuieɜfTE9Nt.;dT6_L7꩛7A'YJO9Ng+ڢƇ@s,Vt^%(U׭śQE-/%,GTmAܠ5n1h U m4ı`bӛ&mn16666666666..........>>>>>>>>>>!!!!!!!!!!^v@CujӮ@!?E3ru'E9[d o,;-|/"mA9k45:*i+a>*e:>ODEཋ[XI)HN_Vؽް"jg:ީW'x}7B_Oot \hsc#֏!\cMbf]NŴJ+*K\.Yf*6RMPۤ$,i-Uyr+6|YZ|nŢ nGմȭ%k=^>_ά3~dž[ Vؒlr=ᓰX{Bﯿ(kt~x)qnlme/data/Meat.rda0000644000176000001440000000117014251721455013531 0ustar ripleyusersUYo@^MҤPoD8тP!? !@Q_d]E86Z'$f㙵!"}og3;oǽq1f2a̰&65gy;l3igz39Gz.8wPo1?qږZsbb=(vH?<;8ȱf^*\1.(R4YM}QS Gښ잡#G&@[d]->{EM3@Y&xHK֗w 8[[Ų]z{7huwNz;K[x\=Pkr=RYk83N}K,_k;_ד-H>P7*5l,wG,_MܺP<=_!vJr%Z J|ȮXp>!ӦÏԸ?}N(`[aXvŕw<Urky\>{sBW}cg쇉Щ}vߊg֗r p:+fO `dܚoEGurg~Gf_ZFBVUBƑEgv=0J?^# }tmhD4ceȥ+g) {>;ׄ-\/۰Kl#Jud01ש-/ӫ8)}|9Oyxgy3>XJoleye_ŸGK*p~k~w^3WQC]U备a}ho7{Yoeؘ9]]w_eb+&O1>ꫠ`9>yK,OwbPDQo8Iob=][Z:2~r;Ac5/:bV8l=]}RWǩHu7ń6{2r\;yC̸m؝!FVmVmӞ+szl,c,ߴɔ-q9+֥1'@[ׯ9veJ/wN54/)uR0ߊ[ܳlrQffLθe%>`r>bٍfgqO_ƩW+s?:m, [&cuLwܱYI}e<|q@?jod^ЛI·.g?C;Uwk?nͲߙKkNfr<0 J+^} ^k?ѳ.\ * q6OJQu~-Plaa\'&3X>+c㘵܍ X4m?F﹡gjRӾܐoV9%cfgweW_qqfT qx v.GYƊexV}?kxvL8m{hov[JA/!/z|7s~IlstD:>9d;yH}hrL8L-aybI=].mJ1HˎNҬ35;$9QuyӺ2M\rjӓ2>n`Z:4!oWr/:%EFcqXt/EbX/~ J)s@ݴ޴\,j m[, bo [ra%1bX,-ŷbqX ,^*˥XP,@(exHJnėQ&bx!4MxQ 4-@ h bxim@G ^`u]@W to;x t.@d @ T CP0 Tt#{} F` 8 @>D&)`* 0%+5X` X `X ߂U;=X ր`X2`&l[6;.{`Ap # 98N pWp\e \ p6 ;.!xc:忑u:C#,O? 7īO? 'O? 'O'O? 'O? 'O? 'O?'O?? 'OX~F? 'O? 'O? 'O? 'O? 'O?4 'O? 'O? 'O?|Y`#88S%i/V0&}P>د/?oSS'Dk?X[͕CS) ƌ֘>M+yW9j[_9UNc٫3-{ z/*eR.~L񽔟غWi &j=(;;-9ޘd).F+w)S-0kƤ?*m`jr:omK/f.:nlme/data/Machines.rda0000644000176000001440000000127314251721455014376 0ustar ripleyusers͕n1ǽٴLj޴hZd $( pƉSynx xlġ,Mw0Q^&bԉ0s@l8 Qwē7a80my6U ]%"LIZ^{swa59TH T%TCQʨQBEEEEEEEEEECCCCCCCCCCGGGGGGGGGG .2\dFy2n+ģ$_OzjBqݖzGuaݻ}tO%~-%+ɛ_%%*wW>H! }N\_W;x!#vt,0hCq=W_ Ϛ":@}Ǘ~4:Pԫ=LЛz  }D!XSauÀ R%~4 e P Jq6oL41=yU7weW;O^8Z>z؋o&jn |\@\fȯ)zthcwQwupTq\@^.ø Z;u:9zx /u`| ^ a\e=ʕṃ Q }Zg?E\ bY?m 湔;4g[Kg8ۨ NmY?xuJf\wz7__׻/x8}NO(kwv ݅C^GήΚOu ]}zڧt\)W8o*~v; ﶍ~cF麳\9@vN %.Cv6e;#7a^ގ8v3Y?qzGo6 xY z:֩# {e\w[Bö޾e1䍺q nț M h+cacoxh_oXrO7٧< GvUHجD-oٙ{L+Jo^Ĺ :{8'k}taqqy~qRީ__}K9 b~Jvi܁{ɻ?nEjp-yuJFyv~š̩lXW/v_//Y]glp,?BNyTMN֣w I?=^:~z _Q(mNxÔ߁Q4a Q:q3)0¦tҍH7*ݘt-ƥn$$]CE-"hkI[bܳ _-,=NqpcS gclLR$5ƒXbגXK,A4KEnTFnTFnLn~v$S&,^㹊\Jy\ }"%Ĉb4/ub!n)Kx4$h^ CH8D9.F` )[N億C~HI!ӐSH)$d4C A34C A34CLA34SLA34SLA3-,ha%?4b$@ʔc39pJ`%+ޏo*"Rb[XF+FQ^/ūEbQVxQ(yo<**/cO& IN Sq)*GU\x\L5ν=B2"ݘfV$Ӎ}-*i<6_ܘɶh {^WNIlfҭtp_/Y5ﯽ3\fQjfJo xqq> ϥuth^Aɲl,\o<R+u}LeL({]EOƐ\^_Z/( }z"nlme/data/Cefamandole.rda0000644000176000001440000000167014251721455015046 0ustar ripleyusersILAkvWDe@@Q43fL7 xѓOx23/^lZqx_$" 8>GTBO-ls -n-4>q]zUȲ'4xֲQRN3nΣ6϶=\{&Xb`df}xuz~nmBڝynhУnd})[ԕG.)ҟ~syI?;1<&G5Ǎpy ?V>;B(#>t+/{?^O)swm+?QW5&YzKvY x(?zBk8;e{bc?d\+O)o9V-g}鷗ǭa?f5JrI+ȪVNsHplq\wB^ZZwwc#CxdZwqˌK_wr0lkdXOkY1W,0G 'PFr,17Oا+stuqI@A ^hu"`!+J kZ@Kjm5A QPh n[MmE8GLAIAS' {^֥܂v:A8O(8zA8!3oCeGR_`=kfYMږM,1%#<ݾf'G nx\y:uLϹhC%X!_A992٭ +[9YE9?MZ w&|-\C*3[&h:itxe}*|eՄ߆w nlme/data/Ovary.rda0000644000176000001440000000423114251721455013744 0ustar ripleyusers{tlB@XcjZlA«eRK [aM$VkPiTT(+X!T1MFRږ_Ժ|ܹ33s;3`nΰ H0Da | H tc#PiC.D&r8!=dH@ bHRr < ~^Y,vdl-JX" Z5^'tbN6f,Չ |-8$pR6( HfaxWxm Mkl]xcLT.^6P~ZmIȦq5˓i937oTb^=`t?guduxZA?7|1ɜ8zs|y|s=or>ux}.=_?W>_㙝ٟ U}KQL}%^{z|z^>K$zGs^{<O٭ o=:O=GVgUw 9 u9zsoF_~tvu稆"msjqr ٣21MkS$m};A]u}̙s.Nj!UfuΥ@RkI%lܻ]V#vfSYVf-uc@=X ڏe:QQ< & nlme/data/Quinidine.rda0000644000176000001440000003326114251721455014576 0ustar ripleyusers ]U@@VEE(%b" u a'+P$UI%$yDCP@Ա;:ݍvӣoGeƞ H9yur}R?l2ɇ,>R S Ur*c mmMhn.oޟɮ"n좔6lb`F&np d>l}}ؤvk=luFm{e 9ڪ6T bx)mfζ"MSyJ4g_-'MmVkikNSէ5 d՛%ni~斓Gim͛BNm6AOoynSvӘ|r󆧛Ok^Yۉ(iuft+60%u2sif4\xr.2btƈ6'O2xTSͮ4b4ǔ]iưf{4kl7c]];qͮ6%:ft&nvfGh~rs7)o3ٮӛcl3F G S +Κ~SF\{)Cy5]R(4N5Wj.2\dR >fNnpJ5oZsxL:ekWC}6 ՟=OpqIHj_At"i-t\? ҕNsɄgcw_ߕ{dҙIn"F+ԯseOJt.߻HO'=*L~|\xSIITC]DF'<0b"]Bv u]wPO$⫡CP ?fL L:wlZsIz.FcEh`[鼭th[' ?tGq7čsH%="KIFm%֐?q~~9s#rvTgg(:T;}g f7 H/&K:ʳe}9m_AW ~Ly]OH Hhr/ Hz+zIג+Fa\y{ziX\C_H}և߼ǂ3il,9 BGX@˻B?.z.yTstuNs1[$ܞC/ tp>PBھuG7WBw'H?PSnͿn4έПZԏvL@;Ǿn< hPs}f~~urVRWv *hjھ{{C uK'vX`yZNϵZI:R:ns=}>_Cc ]tZڿZ+QuO:r=&%/ՆK۟mʭ9"tq~-]T]4>]ϟ~:FAab*yD?Sy]M|vdp$,R5qj~}mSmkiԬaÙu_Cz|;4>%%﨑REJNh=?"jzu˞Py۾[e^gj߫uz|}=]H|oǍ6Ҽ|]xj5ďAh* _EJǯ}!?{js6|}FA/ҼE _r~1 (?;m) zھXO^=Z.G͸2yIBghwk{Z:[zm IS{^6Z^]T/=~湝$1;DJFo]ZEJoooR|GGS\0zt除g6TwsH2ٴ}1 B^~8?vri8 tj w4mZh[煖Oq+մx58'ڏ-*hJ~ư}M^5*vOdd^w`!_먾h^G077|KxBLmoh&~ȟ'mWS?r4~xYH>g/o~3>23F?}g}<]^iSHK!y$/$_'T!]Dz9^'Z>w|LFZ7@qMYEOqUTnmhtV߷."8mg߅z+wk@JJѴltv:n:!;N'yyk5[Yw߽73}3?')ȟ-Gz<mۨp^Jt Ov?wxh/Hy?0g+[joi|2yE*,渷h>Ut6ZGlY/ۨ?zیOVt:~G蒃hMpQ8ͧzT u3}۩<}>οsW)ww]H|wg?~Dǧ&Yͳqf{-Z'${{"1;jﴮjswuX`^ݸ8Ss6)Zn3y{3q1.wW&ޤ0N47zXM3?$/$5F_S?t746s|~#!RݻI c]Fou~^hsJ_n@4nf_K@J󦎃2B:~zAҍP?@&BM '!WR_0)1P6'z|O?3M?O'=tf@'CKh{^h&u>_ǻz}=(tߛ_K۽}P_G-eM>U?^L׭)դא^H4o94z]-P}[:%\s@#9gw=eW0]ѸOGFq$=ƻHOa;Z]y; Z^=09zº},~srMt}4^oY tIzƧ=.&oDkzC:6 q/ qݡ6ŭ 4hF@Ǜy7q7&Cu^fa"eUh^I3 &PLih1mjHH{5_'mhɃBDˡo#]O.ѕlsȷnkZ4Ss~#k;c_~E]ϒ. }o+Hoq0ouMF3=Kߘ-#\T<ο=];! g}Ƭ#yܬDylF=uckj>yB縤}y2S-Jyж~_T)l?].z?s}~vҝdCsCy=+_jk7:)Gjt5̼# UǑ:Gq~{k'<|x/n35W엣O|}WG뙾}u|p+~_=t\}cZkF-άz0zyb.oPg7~Qw:9Ie߽&~~y8c{[2qŅQV;gSc?kpk\5 W<`sr?+mP~nhy\3桞gYn^[̓=ރ,?8k̎]w7y+&NBkyy/.KN oso-v+mo9̚/8o)y._|Q~YL9Z慘{Z;5^>u{;no;]߼Uq2o$7|DKl:צŶ5o⩼Sq}#tƃw\95oq3n_{}舋Sk^m>[8WӒo=y#'ӞoԮwe뵬Cbyv0}C[պٯ9)-W6f\$Ǿp+)Jھi[ΔpgOs[p&mei[ruS'u.bϛ<=_YǷ'$I#u_~:&w}j%mZqmJ.~yu؏fs$m|ݎy8,igj9S-m:/Ļ[o:"m놼ʛqi9LdIQ\1G0W~E\ѷ}-goweNz\jv9W'?#u;uvɫ_sU]{q:.nƍ_{ nӖ׻ri^wHr%)\"k;J-]~q;olx+wh(tl̟<SN]'?e5V8*[Ź+w{/;^Tyn}wOeun綷[W]ּzY>u3Ku/b)9NR?S)9@^;glWS۵/vɄyNY;?u(l\'浓gߗҹ^^ŞziB󃂴jieza=:+녖^TW/8jK }j2_+WWjyJhL E5q~nWvp@ۣ]ɴcSjҼʋhµ:Ob9ѼRVÎNNk4N%ռ׳I߉Zz|y|o2jvOY{^?QuZ4q;k=ڮtUiqԮxƎ^IN?asRwyZ1Zv>Q:Z[[R}kٜZ燉T2j5-_ 5j^rYU:,w3cJ{ޯSX-{Į_:DnSNʼnV;?T6uN_a5 :&ӲSh`i-VۣyD^ZvirVvE}~T/8 :Sˎ [VjOs_w$-gF-k%[GsXͦԷ|~e'SVi˺66u%HqךsZ6WNˎK׊d[|fcķ+ei<4f]G%iHR/oki!֧οsmϩC;P]=ƝI9]|~q~.k5ZV2z~OE2i+˲, ?c:ϲ7eSQe*ӟ|D' )_1jU0IsS~ae~Y}Vxt:c=.{5.\/q>JcȃӷqYAڡ.0`6f[v}xЧ2p܊e+9&숲O96Kǚ3qYqeף0i+Me뜎֖e%ﳲv m[v}o{5[ujw{'c͏tBO;:E;ЦcײpWp1gY hHSobsDSVC8wFVܐfv_^&y{}̥2]'O=WVN)o練=W+'(GW2ڥ)Ni<ګ{N4g m7rph~lp@^?zcC1["#4Ԋ꟱4E[Qnֱ?NI>uNw㬓k|1QDt7Y1X3cŊñbe},WIzvgH<}O'[YɳcӤUdʬsxϷ\Y[g~FMd=^N]<oθ[Cp[S;K2N_\I+:w$*e E2Y+BsJNh2ڬ{yve;ycS}Xݎew,[;ڳ m[T]Dz۵|nܱy'CF2)wufG㇆/-.g{~v{|șo߹d³IT?:'<0K .Y>Q!Nx.>1[s_@V_i\b-}Y=֪3zkPyѡ=~F75~=/Z:ƍO=.l}zO,\^18rk[MMh}1F=>E9Ej߬jg5H\ ~i74oh}]Wk㲏ü%VݫϬJh}1|9'Ij@ԃCcU󁭱Wrk}|RyC}>C$Oo_'U[.[yqTOKCt?vMȥyjW^5k?~ZM'o?j|b7}E:>~yj_[՞OIKBm%bcYf|dWTyGqbn:>w^zYOc% i˺Xyơv|keF)j9^qV_ .H yƻֺ `wYGsrZoS_գB~nxkZm˜XygK.WV}Z[?.uo;ίĩ7؟I- 8=ZIՎ\ϹԎGZJ\y[! j7:n ;kc ۴<ͣZqiՕ_=[]|hտqO}1?!㫾TOGjm\=qo4-~Zk}jZz_!i,.+g>i='{~jNqOkZ&ʛy眿=mY_Z<™"ǑeRuGV/0?`ߚ+Z{p9~ƥ/@r~eC7з+GXJ_l#e8`zc y}C0080hN]z!jxF~ldzס~R6K嵰z ; v4ر^;ao{3؉.[`'N6aM;Nػ`{l"ll2v:l l*ll:l {a ;>*᣼a3aff΅́;vBEa.͇̓ͅ---]vJU%a`KaC0`c 6v= _Ys+ka`c@V0*a7nmmm~`[aU-m[aa;`}vlv؇av죰a} }GO> cg` Oaay`_Gؗ`2aK} +_`_:}_` ocooþ;a'{ `?o?쇰cO`? asؿ?lA/` aدaoa=qؿISau,9zEKzJo^*?? 3? 3? 3? 3? 3? 3? 3? 3Ϻ`gggggggY 3? 3? 3? 3? 3? 3? 3? 3zagggggggYgggggggggggggggggggggggggggggggg?u999999999999999999999999999999999999999999999999999999999999999%m+,6_______________EP_ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / // %_CüAkK/K/K/K/K/K/K/K/%_ %_ %Y K/K/K/K/K/r^=gK/K/K/K/H}_ %_ e=%ө}_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ %_ֿaOW_a + +yeW_W_W_W_W_W_W_W_W_W_W_ՙ/ W_W_ͩXa_W_W_ͯja_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W_W࿞|QL}\18gxh6W|ʖ],吝[Cnpo\e|o9f00<4߳ Ω<I4ysȾ棎M^ 3nulOԠk!.صbxhMھ (oW1ʮ6.lt808|`^r1[_Vce(T6ʧ&>k kVS|ڿUWnlme/data/Alfalfa.rda0000644000176000001440000000200214251721455014164 0ustar ripleyusersMpFWPڤ i)IhK[wH:tj˩dҏ3ڞ9s̹g'I[;43L?ݷo{!-^^2t T c{P͸U ?DQEeRK,׾ju^ܓ~n%1}ƪXJ,Xޢ$ˮUWf4Z lshTlqYU)e8{6G:?jhh*"l%ǓHNI[ eRSy&UeJUU嘪|0(iso\u{୅v'[\D+xKygRb񇢸{?% t;0-^7%xT_+JE(ioЅo|ŀKzoͷ>%!sk=Sqm5_U>|U-Jv| 坷6?N_&)7h均~UʛQ~> ޔ6ɭs5Z]Y5[ņz_~iDcjJ닻>rl'qu|bٳ9 ^y8^/+U87-6x@ G&Mp0e8 "e) b'I0 )0'vՋuԫ~sɮ 5,4e+RAB1F-yWj׀܍^}Ķll1IiPq"iZ5?D S뙱30a$?}aQC ןt*vP;ޏȲ޻-VR.uDMp|-͚[>bzV!EŹ<-U7aN[:un ) o,:~Ƶ2IZcrg=>=mV}9ޢ *&ΓmUl4Dk7h/'/v.L̔;/##C nlme/data/bdf.rda0000644000176000001440000006273414251721455013413 0ustar ripleyusers7zXZi"6!Xe])TW"nRʟX\qjnj-& iyU D1>SݟIh[;8 7lDYOR=nuΧǨӈeݺ}B' tdD[\yasd \)&2T$-8 _B/9b$ V5O%x b!-H5*_@ תژ1= bWWvCAA9$ (6/_B Z*̾"]}5eO<1v5CK"ڑbF ɤOS"` kGL0YOΠm&!)kQ;A=ljP/@Ԃeɹ%: k{, AS|BEs95`̆L9BL5ɉba)%xQV2KBquU }!W;wPևǸ5u'l/Ev04pYxZ`%&afv-# BKt޸%hb<ȑ\I?_QfѾ9U#ː|! W.B^mB7ͱZ)c-y;bqȂ@BDT^ִ*Mdu!qi௤x㌸=b<.a~cd%Inc~H[k 񛟥df/jYq@n_l2dK|Ob [KV^Tg*3uTnF|fSicnJ!zSyڢG%J(cubIқ%~ߓ*.&o[4؍~)}hՒ#F! 2*Fl*(9棢W+6`_S}D|`rC&MbüSrvuBBʅf–Q'`_[ ;ѺS^HMn;[ XϙhOJRV4)2ori.{L|Eh@Y$}"T1? UBw eTkRPĒR+ !b-kfD[zvԲbb|άciPw26G^5hhUα6.:m ȟgȚȕ[46ibcE;'ϞhwobvHr`6ȧl8^Jg5&ڶvX30L9uϦ5h=vH kU|$qUv/ԓ,xOj+*G)ܝT{;|lA G#*LTƋ-dӬ)h2>"w]pox0چEm r#t^% Pfۻ(Eq{o=3*$t(8 H:~LA\&P6O{j0T,TWPF@]htJS=]dP C':װ~"'+۬: 꼻[=u7$!h,:r =1.a]?*7Ϭ6 zh@70W+3\ Gaݦ7`Z-D "D*/VbLy sA+&iŗ J>CZetg<3BXEC+Vr8xdۋxJ*P7& aK9L]Y^׻$}s jSf$XseSXiYje: F;l @C Q`@A,;߳ʊ4`QǬa#}M4"`*)vF݂/Mn݉2S$#s]Et#A9}$, 6'oc=w*̆I,o @Nr5,b$P49q5tݡIB[@fBE:S&0u5ia"TY3pQxKFIE:mReI^.Icrt5ɬǧ≧@9݈`waƅ|sK W@"vI`XKN3d p;[,u@aQR\Ǣ?ey/yUCaTE' d?vdyn8h4gpcƞs/{Fj;R]IL~'++)P6C^@¨ E\HNimwG 3h3/LkrIC)F\[Y5"1â)U?Om(Q#1F]U?=` 1E3hKnQe`>n6\@b0w{Zq.B5t9[FMvhr|[Ipw~ G1 L\j$O:~TQ"N~ohfȍUڠŗM"7ߖ~)N+w7 _Sk2X 1D~A*^qk@zV?Tmn{NwQ?B.Ͳ2ړrE:;4z!_Ǟ9*dB`.mÌD|V݃olпDZ dl,p޸кO$x&زWz0WFP%0x|}˖ NC ;ED MH58sgPraR 3ͥu Qc+?Mf\w X5D$1uE"^_mqjg  ~]-n{So3al.mdm]j5@!Yn5u@Tz3. !lE8HVs+IRZme;Z9| \ Ro6(a_^4:&&> a@}+=/٤,>)_Zwي)?U_UV=\B;q̾+9r&W|n\(`|% kMB)h$M䛗e2ES# I?tuEXvt?íT|\aPaJD8b"wwt6Z|tW:x&D ã $]Fp@Oyn"1)줫Զv+r3ŏã9$K<;a'QPFtkT<\bM +E t2"yLy'e\ XSMWwe-#"߮$u@jfs]y䑀N,4սف.'ٕ@BE?PuꜘYSn65E0!;JD ^x5[.p@. k96{)lLL70Ɋ/'i}@NA\P:X>WYUH{=uuڻ9$ 2 h(.fo"h@8stj׭} $Q#=*ChC|Kܹ.t<fT8w__?>cxiYkGcItZ\tYrjP)ӔMʶTCՉnQS fJ?i>n#@5pٔ 2ғh"ֵ(&Zr|k(D`)K=BJXD*R Ex8 ` lּL-AE(J~-`FruhmD-دu 7L1;b8gSL~Pѧ4݃CVGk~|4J7^H4RB:|`q*A*kApZG}}|olw~\hI2o;DxcRq4mcn0 UȦ$E=qZ^.53R9{u֒ۿHG𐔕Ę Vd0CKe@f\ 5fm꣪G5=:(jQnO`Nw#ZD{"NmzдR9q42 Pr(~8؅O,7 WbH ;޵4$PsGd)B2+7aN| ASv`=ݷ&%o#([BwT2צ(w߃-;P}Hg>wX夫ƴ73$IOzz.W_ ?X>69?+r(#sA d"4U:a6Ԙ\Λi̶XHWveY?i;D,e*a;0[oS!$A`zƀټnZ3yg)6*.gB;|.߰Um0Kꧏt1q$zEC9N} z> Ԉz[7'hK 5g2$ | Yz:x2wrKUV4%@M`#Ϡ"s޴ifCAi_t3;Cփl`Yjx}•GMSNO2rv[;JcFBU86/־Kw+5G\:4g WF.Hg\ M9KyӍ02o74J}7Qq1̇>lʛֶ (jthLZH[r?RĒtN(n+b8P] #E$ޤq P2J/u${BtF%o{);UG}P ԝrPr69葒iVy~NX0FH(׌^F{qDs>2ٰ_cȀ>;Vm)|`gxRCh[uo0-K;1 h,#u+Ѻu*/rBw%:ԨVBoHTTbOr%[#eE n:Sdݷ0 ;p=*BR–CMfpXFp92CӉvO5:ev\?'wiyж$X{".Wstxssw=RY=|󂯅Wr奴c$AXEd!;LE2{_/zG:fvb2^6uHj$]QS.`|R O8iU "Lr3/Gf]/n* z[dAzA6M5UD;M&6_TRpgI#ߝ]!_ecH:@c 0ʭ$$LUu+*9o tXwb|xAPKԎ<hBT_kކd'[sVhm eRY iNNOTbIBusnb#vi%1;LЊA|ZT.t\Ou$y}ZJPO>@--j,%{ $8ѐb)dQ6rnuާG% `#FؤMtI|YwSٜ?!sPlu^_S)<kΣ객H6>l*>{@-jͰQI-]` zMmjX{,Im;]H(X+gKhӑ㋳w)Mv MB]V\_w6`i٭()ʈeːy6WIxV5̏5b' z{ Ӊ-w%e4)`x3w#0@=tx=]"$,6]+ ~%Cʢ 5(|xTV0y F*omn61 ~Ws qgx^KS-ALNW= x݃ -W7ss\-}&9,_xVekd g )%Ome15ḞPfjlO׏5NbFb!8VƑߌM+eTc8k01wIB^ΡYSeW[,0֔(Mu }h`ɨP /+' D+nȭ$*okDKřƩ3rPfs7P oǶNXKy/ȿqVS%ա3+~\gWw҃ Jh9RtU<G Ebcr!CP]) dÌc=|V-,ìRHd "K;LUR.8ɄjI\ZҾ!=l nI .Inf{`2U<4i{eް԰pn+m)n>xP-=hԱu> VjwnQ3M9Eu1'xn MB"g\Nrՙ%P?>). q+ F)IP@16 PU9f;NDSlo8݊]NKh^ْyMS@7@akdΥ.a_e {r&Hwns٨?Ce 'Ew/Ͱկ~ yD"Etհ Y@;l`I* \>n-MAr1ö́2q%oU=śܘqt(RuX9;k;ަ!,CwV, |L1na3-m3HJ 2<*CSYp̯wG#DC'7a<'U\\]OnꍷrJ7ٸ!Mె[پ?AD!ދڤ8X??s :cm )͇7I(NzĨ[CgkwkI^2t?}e9 ӑaZdi0+G<Ιg"3a]|EP9Cl GGe[%:)OCDإ2$g8jⒼ A]}@;3ީz}:gQ@Ck¿V'F|a/2q] ^G%=`,/*^ ‘ 8,fJØw0QA;1%$UȜl--gn+sLΐSb,6G Tyzz+qd-W曭2ټbT w3S3:/Eзa)ew!;8Ow.0تN ՠ|߂"\p# xݩo?s{f[$#e7sPn}#IhV*BHvB/l$\,~^йSR }fP>7z`M`]'4M|qeL2|yGZ)DB[9 m "0Ab$oqHc=i\PZݨU_,fٛjW"†#/8G7T+a|B2ws`YC~!)aCkeB s/TKP-˿w!"A>Y8/FҶLv|De/2\*K9\ IΜuU_AQhjGLN w,Z Qiabrb.5=T7|@E<%t?Uè{SozP,L\nUE# բޕۍF!հy_ e5&ˏ&[-^.'T]8,#f, %3,/yFk;HAc\B;6i;x ;T#"Kx7+a1RLaN ea Afw3oi$NaI<]-f8~Ņ9B}u .İ.' aM6BΆԭ5 ›.G)'1ߥēV@:wANe7 JS̈:Rnb6GPN~a1+~ʺ۞FRh5 hx+Y1Gj`JHKj51C6=Z^xE]Yg79}x+x}ភD3rqESƻQs ƍwoWYHN]"*/;Z8Kv\jK_rh\x̐?[̔3 l$8f}i ۺڋݯ*dv|׽woχx/wԪ*kpdQF8J/O} DK:  *k4٭-CK]֕)1rD* ݂SҤ>Bx:2qߥxW_Cz1"KClz p"~dNUKͬIۺO/7E+6-M`YhA  @Ƥ-ğ;m':鿞^'uyj:45 *E⾏Wsl=1<ѳw//K,ԝkJpᆏ@8wA=ja篪auAo][ ˲K pE68yyg*Σabal'ə1unRqP#YGC^dP ̛yb_M*9&uK`RњmɀjUH.\>c!0 RF޺u8Ur.d|!oYY6Vn'8??fǽ PMSi!1"f1+Cssxp'у*x/- gkGuFTD6r7%N|KlHGBo0\gg $Vy(ܒ%rZhOn٩؏,!l_v1 ZF,~p"q"&<cr Q]Lvש=sU DDJS/=lkr݉dA}.%*d"mGph7$4m'5s.HQT~i:(6ubb~ҁοމb>(; Z`LoeBL -D4\v&Մn9 k\{d˹!ȅ(&6׸*[ qrm @d0!QB`;y.pcn?%h[͗8"EDzЙdW] qkREs8bXʣkt"+?yVdK)[ϱ d؎E6n*v~X#Z# F"/1~nIᏏrzi"\IPR-1im׉]vm 0F WSm \1io *RQ. CqO%i_4-9)+lZT𸫧Yh?Q, /yvɩ'ew{o&ÚQD۬/%DsM_4*/k{2.ZnOO)h pj_4:G WwmOERjy&4*vHˡj>Yn;9 \v-3~]*:U.Ɂ8 vf%!B1NlSv xc%UO"3׿ƏRF ǽ6(2ia!%X@e2ߡ0 O!Pl>2=3< !H!SŽTrn Fo-p˭S"=۞^bc^!-jJTiZ+@ v& %ٴ0Na *th뗖h ZMdiS>pzV"XS 51&Sh^ޘ5~e;iҧ b[mbG8 ]- agb8nD6iXS x=NYeVɕYP/Y|Z_;;<+kwa5'&-!D l֍'p("nĐVA ;/P8(DDxoӯf8>PBD8N\ꘂ3ܳo%tCV6`TG:K+]%:|9P Q)]ucOG =K 5/C7zŧ;J@a}Q Ies'MMNP*[!s|!̂=`@AW⬘B$Qi#ft˄k?p0ONӥJ,{j5=Q_&g}d6+>n%OWrS`P3$*4oK o cizZv؇FVXB? >޸{&gCz+1֨^yR֭]m5IT,غU1OStؽ _g":;j(; ^h^ɶ^{{#[ƽ|<_58igfӐRR\2H۷ђ=?$.P~<@Qri {"wqU2@e)ۨtݝ/nnQ $gR {QS.4s1z/c@OE0_)7q&{E?q :uw[lkũѡi}qWCEvh?{O0%~l9 K R!u ^7Q9n[ P)':IGO6y*N|uWܢ[8u H⤿@COe][= RYYӇ}tQu@Wobf@y46ye{+Wm'rᶾˀ1"8(l .Hg?H02̳jJ9쎨|`q C\,l{qB(:ς=jƄgLgS%й֘KQEaPXə t>J QU#ulQQ\yAŤg6 5[fy7A_JK|ڦP5A*$1]S՗>V 07HNw /_NF]Ta/Ce~T1H_fX1UWN(ha-aұ[LIj-W@Κ͉x̸WCM4-3Ϩ; B **Hxg y'9Ezr[SU=0'Vc]n4f,PA3~3E/7Ɯej£cNa{B!)M<#a:O%d6Z<H5mʲq}. 'D{)R6j Z+aF:&X(\B` e[9,-q4bai_ME-hOMqYtDCݤ4/|cmjOK|\d0{A2, a\ sCNMi L>D;ly&/oJVz1^A45x٨@1=,QT[ęBbnX8a3@(_ ZOd9HLJU}SV9~@:W5:_u]LnE|PG֌ ؀p.F&xHnR?`v%ͻƘW8:G{^* p'^( QmZ,E;ɩH7|̻L3G%~dz}({Tpjpi;5NCV2=բXr\_d -? a0N% JqO^:@hmQ s“#24!}=%Nx -s㺡4|34 B~j4ѫ\pn~c_ (3! 4[OOh"8u5ȡR.;hܨ&4R%)KTdK{Z%3ii m2i Vl!Qk@UQܹڬQ=AX̣OY-#l9jIdmq׵V7=6{Ϳ x2%&ϪF,)7,cD!S:ETfn#-rk=O% 3F姍&.?һ?/7;vSvXJF^<{.#Gߞ@5qbH7XQ[<-G͓|4Ir!8{ 3i!5蘪.He2Zfҋp=\$( a `+ujL?@x!!dL}~^آ5jیxQlŲ+,(C{OqSk BB2ߥ}෇ @f(E90sZ*cxP35o&pެ&3T^hB4B{tŁvr'X6@UX nTKԇ[ ,.CzX9BϺ6*mp6M@H? ZH mO}9 (8# 0}=qbnrf=ճk(-4hΞVH8t5d<Z]2Aʵh;: ~3"Vg?E;I&[tT@_AQ+V*ŭl(G9rވq1&d7\ >FGzBlzrUlO@{e}mH|6"߱w \&FkN[kw3߼deѢ'|U;du3Ruz'ʄhud Z~66'Fz/PMG@?xo| {f >Uע4@9^&x*G_f\%9褴o{ uŅ͵bn]p: ǗCxcAι):G"DHuuA4*(̧52w.g5 _[TyX~$#jvG|^(7L띊Cp&5<\ ~܊SEP1[}iS2 Z&)w)fD5VQ יgٶcZVuJJeٳ QќUGj ֝@'uNJ}1}6S"G-0rrM= VO{zzPG۰3 6X)9g;-F>bq8 K?S^kM.DN7nRJSragEb5P+كm fXV?) %D:KG5qc].Ihl=Lt#;BMQ*݉=LjԱNߗ3O6 uWRKgrwto#% {n v&.4 ]],)Y*F( d=Y[.,T:nISyՉlHx7f+$<BN[w`3RC_%qߵeǬ0ހX[үY}G~}p'N, =`.YYd jwܛ9 ygaEU' K|X =i`\^ְ*t>(7 xVe&1,CpWj(zdL>ka64q(3j][ta2d$h.!+leʽkʼnsA.\_ml"{([=zTȰJ(!ot EO'\s쇵gA D;Jj;H+d^&'y?#!u(_gH̆D$_y 2=fIaքѐJ^{0-p |lA+/ %x9w5݆Vu AI0C4E#f]shaH_Ghqº^V΍sR gV ҭIr0/%"~99д|VFc 0MV#':JxeDFtvj9{8_/~::_4~Rs~E ()0uYYKdXr4X;<[K6H:KR1FbqYϾ)@XCsP%֎З3{!EY>k& ϖnCjf߭E噺]BRJ$5/JY 5YNᄴw`Tu 7c!Ev6Xyq{5z5|[ۏHDEb/j5LCP h0 >ʑ#tZi_3^wid\P7C'x0DʹU[iCr,bUH3a .L̥ӭ vcc""C ܇*jl>#xS.{{!ߦ#XKI^A=K~|Tǎwv XV۝`2c{KpC'N'ySL(Gܘ3AMh3wj"8Hku$rC{ 7dla,$4/KRiWϕV_R.w '.n FOGvln8MM5k4#Lu+j4~Fwi /0U$13kPs0q)y^T3ҏC^C~PgisՌv#nLg4Qlb{]rwm9FI6}驀 S)+ }˖ )? S;Ql/:\Wa{uH&S4 j`i[zKcJ|nlpo7 AJ1TM?mdo]VWHSb!?Co:e5C[ C8I e`L:U9Qї'JK0oG2=!H";Xo@Y 4d>r.b6ĩxFkm\?Eq._w0~#6Θ#˜h]YN\n\jݻl*gwRj:Jz'-,F"ABE>)*'3?f脗#D[vtܬAKyM!4%3t$Q姆Cw 2{"Gx"}pc2q?F.pP#>Hu 1gX06vxn* %z 4zb*壘<{ KrO(*P lI|8'.dE-w3r1Tl<~׼np>ІSwk ̟%$PjXXMg-8q+iFx=WëFrM3w8t.ʔ\Mco胴Mץ / ?ڷ -ofk& H>.5ϞZjҁW# v!FoS:Ն֊ˇ,0_#'ӊ90G{Z!NPqK2i{*"k^ P۔Ȗ1 Fi'y=..A|eD.Uԇ+hkct!T,mh Fu}qs&SQ_1R\PB$~jzhuS1=C %JXLNL hA9E0Mln[H<( m^<}r}F<^S_Cǹ8*=(q-@//2pNWۛ@n E5 "{\ z*d j賧OYj~iDrnħn]/3)%:ħI㣚:d[nEt gYYsI.RY8r[AoÞ<DuJS )W5 WAkR+6AT#="\ڃrSW.tJ6&Jvr K4% .a)z^QT( \\r30nU_t UA?`YZd@Br>еg3BiaR85 ޮG`͠?lZVJAs(ݻ#;:2-CJ چ+v[T]~7q'BZH3#n h:ņcM3>נ7嶡51 H@>} 0ZDUf 7xbQ)u}ӖLooק58}A %aVYS[9!*VL2JNl6/1cJJ zǿJ #4n6t!\wJ>_0tzhNĸK,[zbNW\;hdGBqEB'Ŀ?!+*nkÉ?3,f 6KZc݇azVp~7^;;Ģ)Y8Ly2CgpH( ¸doa㋵Gv2?-*wM h /FO^R7 5_p .`_&ь}s沄`[ LZ&c32lX޻˟/DPDDȋ;d()BiGϺd56F_TgCl/dM:YP3F$*fK\Fpg6R%꘯~j^ػ3Ȁe}`] 㜹O|ؾLJݶ\LƛT^h-Q!7(jfKt v%L1kˬ)D4gh?Q!&H,g7{S2V a-qLq3v

uVrX2, ;QI DX.YbNY@w@Y6{ (9y*g,ZT|DDϙօBKۂұ|r !p7a;,][ qܨ_fc`;*ʹh|s6_@5D> 1Q! $l[knNz53B@%X$r00"q7FGO{fazH%'0HVe;? UTC .ⷔ&5a!gUC*pV ;Sm~'՛Uv"a6.77l ~l}RZ[{L{䶍0 ÉFP޴_Os7c-͊icϫ2VJĒLr0 +(V1j΀>Х!^b1Q+]eƴS#VgR'~>Z}i'wk&\fYF+øY!sGXmr)` :+17_G&+4,}du[&N֋,bDsF2tD6kȖGoV̽芭-.α'\YfRXvYZ`㢸0 YZnlme/data/Tetracycline2.rda0000644000176000001440000000133114251721455015352 0ustar ripleyusersUO@҅Xrz$1(zT tXm8EAͳ9s֫c$Hd3-5^87|7kwF&YV4HCIC(k89G B.nXxm(rvx%^_]=_`_nJ5.Wn}޻T@nЎ'b3&0ߺҔy]Ar mr=9eLyhi&К@ ,K/]QUE *"RZ.)KʄH)ʭN2 k?>QT`{9l?Sb-JE)Q; *udNHE{tf3Z7籃oiŸVW񹻐s5^zvcO+7ӧ m.ɄMUO 6:ӝ>ϟ:IUQ]x @Sg0P:*# 39 奦HpF1`,PfPxD> =Ot>/3@9QP]  9`.B` (e@m=7, x@ XjA +Ahjp 5gi6p@`PStnF lw`  `x<`x18 Oς}9'8 _u^ 2fi8k-vzYf{\۫ފt?{i]8ڒbKKp L55EE /Dʒv1(&^75 CEh ζg5ia`TJy;"W1I^'6\CRbٗls` '؞ ||X nlme/data/RatPupWeight.rda0000644000176000001440000000463314251721455015235 0ustar ripleyusersx[Wl'v4մeC1<[ИCu$W`K,'nZ6aCвI†eӲ!lZ6)1߹>D{?ձȶh,RMmleYKrՋG/.Z֢Cehr'Qp?NUsbz;;nqR<֡+:MmIu'y<Ȧa'?{lvn &eN܏yzڣ;IIƉt6rDe|SveV-.D;KW,'J{=&9ǵYO_r_؏r?ώ"ΈKc?'2yC^}|+i"?43qǗq)e{J0~p|/p~/?& >N~> 3< 2F~it]/S=g>tyAc2ѝʹ1.p^#_pnrrch4dƀu\]knp"r$ ;<ϒ<9+ Kf KpY0 7c&%b3fiȬfUnfzcl[crS=zMiex3Jf雙o[kr&)Hg whRRY_W{}>_y+s-kk\4-dno[Ҹ'g=nOǓ\փ `#6-B`p C6< \ vGGQ1 .vaAV U6k@ˀ Ԃ­q-u9 W''''}Y9y`?x!xx1x x)xx9xx% \ ^^ ^^ ^^k[m xx7xx/xx? 8> >> >>>> >> ׃πςρσ////+k[;0.>!1 )8~~~~ ~~ ~~ ~n7߃????wO/opFkRvQ?u WWWW:nC++++++++J+++++++Ku}׮廾R׷F^_zWWWkqpZnT(lG9]ZZw!U n5&V<' p JT F|cOgy85,X495ITrkR]Ywmϴ<Em]ûyHrEGr!]Uӣ㣾Hr c7 `RiMڸOsȿEc`79`X.;&:#ҥ\We$.m`N[}é | aQjM}q}reֱ-YK0nlme/data/Oats.rda0000644000176000001440000000145314251721455013555 0ustar ripleyusers[S@Ǔ4m\xWxR:#(M3IS'> ~m)$c}8={Ζɑ`"$I$*?$u΄U$)%ڐ/@IMiI&#Øe, ISKP#NNIg_:8[Z*wܒ%ʚ9.Z[N_x g"%6BlsaNjM+Ei-ZgLe?Fc;UCjԿ}'_7ߞ}gR3uT!K}ŗ󤟭Kɮ=OR'9N2CחzC꿧~gYOry<$gIuq_}j&CHՂV +iN:ȏ'9Œx}$'jyfx>>оHyur8^$!|ڂwa?R'\LulV)uo"˗Ń!Z (mqbiA (p pA/8΂s<.K $ 0 x !z g``OQT?Ha+淩%e(^v܅Hl l%0=9j/c/TvxGH]%I*Xd}{K+[.X`ͭʞq1}kXajӶ ,UF(ś?oNg0 nlme/data/MathAchSchool.rda0000644000176000001440000000663714251721455015335 0ustar ripleyusersZyx*ޛ7ofj  KRK 4BdEBXAZa?ťdO&@63sg@h'swТS~P(1pi(DlR"'!jx+R7랞=_P/i. yjb]p@RBuԜP=+U3@•~AmHj5Fk '@pfBc¯ n%FpNB]&Cp~B!D !F0 qE ᷄#4% Ʉf --  u _kFm&9XXfױ2-miHoiM;bx+4} HLG,: q#׼eƴ X|<൮^[-ny"oqF|V`OYF,_Vbŵ-y;`euϤ575ox܎}mCe5fmo[a=nlulیx=fvQ'BN'8_[7811wL۵3x:_=#m XWZ iq/y{ݮRtvEvUtx9]F>@GM$E) 謘SPљ6SM;gVtt=sy@xE_b./&þJEWnSE;xݙ1ӂEbE_O ?B9ix*hox?m&]3is:GdclLegkF"p糽Ka}b9iM&9dlitFgm]XM1?g\~dGmu+5KTwO8n?[Fx-o=(>sŁBo@l_mu[1>(abOw] \׳ُkGyGg+_p\:jJ'nkI|5[֕'4E|v͐;-$dӲ;{,x;S,I QTɢހ(JUIyf1_9q WO]{QF'}<;V[H%rjr98_}_ձ<PVyPu!Cɓ^Qn)STՅ8}Q}?[BT5aV_xnֆnGaje9;S仪eA8 xI׋9RAd 7Qn&"K;{RɓuT㫰?!O@E٠[;y voq_D|+.OB.!C]^VamuӶlw7t}09qZ?BR})\Tq'QGmU@]:k=W+~7*o>#N!G_@I;@lF>lK)`G}B֣oTO"r Qyn̿D|t?|r?߷ϹjU[556c6^H/@YsLF&SSz(j9YQ9{.RR8{eA{ 2Ymv[D/D;"gb;Yɛvج|G#kdze[֋ rĿa>R׌ 8 )wk׈j؍fcz'eJoz]>Jܝ ^R<밉m}R؇3TǾ6܉`\^[twQwCϲJw.׌cKħlUZXnq]Gn|Lݩ ǿ]c!=˓둿'bܵ6,Y;^x' ;X?˗Umnrř4;gL vmWzxIř~Wd1(;buqVoU| yy7SO~C][+e'>վ8ez!?߭7w%pwoCAQR|=Փɧ.JK=%S5TԾCZn֩۶NVSZ{q~Li٬]j:ui՟fe /he _0W#W#_Ո_aՈ9:6R,nlme/data/Muscle.rda0000644000176000001440000000150414251721455014074 0ustar ripleyusersVnPoZZ*X.(PѦ"VMnbrB|||g4*4י37\=8 I$W%IV0#K ׵EJR}{n 3%-I$YR) Hd^IJ~A rd|WzeػQ2VTLLMͥGFªdIk  &-]/0ZxM{zv4[vܺmi_/~u=~ZiX7綼}ʼ7rSs߆wH?xSԃ) M3-C mQ}#M 'umN?G|.[A-I '[G7]XXqp%WcCR|{xǦAC1 *"xspviƧYc&M5<-#om[ ' ùp1 g-Ap 2 p2L +t1M8@fM̚laB>Ƭl䳱|8z.n2{yX*:6x:itjt$itiZIk dZG8R qIy9q4=5:nF)Kx=JǁZ,PU5_Ǘ4aq?IA5ZWs,&ݼPpՖGec`uUAM$Z{z vtYw!hGݓ6M;ĺ 5kn6mIdFܞ1 nlme/data/Wafer.rda0000644000176000001440000000770614251721455013722 0ustar ripleyusersytU; 0.t5B^u,*)#!$!fA\PTAPpPAx]EeQC6YD wgsGJnWߪ]~4; bRm6[-q6[wy%6[rKw f}7# h~$7i?RڰKLRA܂RT?Xc@BB8V QWg7ΪSV`?Rz|5'Z<7iw}SJr~&c\b3MHƽ[WoojUe=*csU$o{3.)S938辙R(c&K|[!5o5_^>uAr3)ӷdk(c̸i_)9j;${=n"9K s{zHX a׼~dעWT%y0'e_t19g>@Hnw!RzA=>C{q;J3tЇ2qw9ǯ&(-mʨYjd|!m@"{Gc=׺'el]X=:j{Kg}!Qw |u^uu\?Ж0y,eE^!^k[ _Cs9'!?M Ҿǟr-%něZqy[:U]uMV*"')%Vj9U!У^exd뾊9/jM+ 9{¬&$ 4?ɚ%cZRQ>DNJ}e~V;b>*5:䞡ɌJEijڙ\VO0H=gPqŶ{jk L?WToyhu\I]yso#ɮ/ȵC_~1;\xNSdž-yԗS!{|VGrmU+orl>6U:`$2jeȩ ]+S7:o׿IݜJʟ/d֑t@bZ[ez ݾ$}=A^˓D=ϪUr'zʧ23?) ̮VYyaE8e6zZy65r־ZWIJҺ_{qQ9G_K}z6~H3N|cROޢߟɽ02˯ԮKlUZ>8g9u, 5G6/aRVoerdID$[ Ŝgc粵P4&Bv;'c\Wv$Rfj7&\KoiR5Mk]ޭo_RHb)iڝ2N=ؠQI )3ܟxliͺA΍GN'< 77g<]zhSFkrI:Eop"^0B !l7ɖ}boLyͦ) s]x5Ojmn9Jg;@5}8Uw㻡Q޻l|ЌS܏U66a(7ܰ]PKZ}oQhCLitK$Z$|`'O;̗} R[7+J7Qf dw @^j_354iI8fX9AZm6&inʎ)W@^ߤ3Ok+"<3JWkڭMjaJ?(\Iզw~UΘWk{"rjU+Ho:lI1[Ğy3$ޙ_kGe'攗ջgJIYW|%&J\(E)"J  &L0`0`  .\0`p  .F@0`# FP0`#(A FP0`#$! FH0B`#,a FX0‚`#,FD0"`D#"FT0`D#*Q FT01F_QPP(P B1bEA4?h~Ac1h 4@c18h4Aq8hh@ -ZhЂA -Z hAЂA -Zh!B@ - Z0ha A - Zh"E@-ZhТEA- Z(hQТ% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\0% .ap K\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p%.p K8\p% iQ%]mlv߯NYy%مK.I+.),/*&$.<+\reEK /allGm3%1N']\wl⻞_']c}Wd4:.ip3jmHji^\.6GhQ&..7aURA0wbwfnukQYnQi~CRqt_qc.oR^_?zNԼdxnISmK&tKB.-./ɩ?yE9eE<+fGJ R;wZx[^ M&?ƍ/'_Q:O<nlme/data/Oxide.rda0000644000176000001440000000153314251721455013716 0ustar ripleyusersWKSAn6_":Pj(9xYZ *ʳG,s'x'S8Zv$IAB=R;dUѕ(tyg{q` (G6$/.~g r>+ _ڝ7}wK#3:Uv+}+S/کiuo);m+\꼒w@v@nC<ggmo6UUْ_k),#?̧-وBD;j ډB=; # 4,4a`a`a.K~4ry"7 6v3m 63m顤4¨"ک\TH?S;SE~*+bᐹ`۸0myմQ@IGlx@ʟ17z2LsZ(:2sr#? yțʐn|lؐU1|R8(|gOh 75 l)T@[m 4ihPDMD[Zڈ"E9(rPA"E9pA9pZ=@|7].T88\\֜nѧqp"+,d+ܲ6yvbU};^W§g34^̻C?Vu\xK|3;oV>"Dx['Nv{m Z3 nlme/data/Phenobarb.rda0000644000176000001440000001336614251721455014555 0ustar ripleyusersKyg%)R,Y#)z"%کW!6(:|Kvv.H@:'!|Sn tM@!|p XrmLsgf9J_WMU䡳j-Zm]mdC62|9n#ӛޛ_i-jZشcczև{bnc>S}t;ڧs}o}G y>ݟ ҇q܇= vUt/pmHG]ܳ%Oz[%HIYwpUtV' \7ާ3@BwqG]垩5ss]_Z}"{W.W#6|t]'Az*UCمMP cB!̒]NeCb,ī⍄h6|h}H(fȶ%:ubz$Äh:\YZZчLu)݆\LP!?; [K~h-]ƫ[ W_-<~Fr_][3?'~Z_l+FwXvXAfϟ}>yaaʸq?>vs6~sYRnZ#+Ӷk;yCҭ2>lVx1dJ~l{Zd4+۲A2d~O:**iz8y5~ˏ跟]ٴVvhZBV/bQn]e E2trAA~j7qyϕ}~n}xqDƝ^lq׊?U-A͟~ ֻN/ӕuYo?s+3e ~ð7u{WoޖY{yAfK>Qx?(1DZQx *!y1g*.NԺ} îZasnaoZiu3?>Cca}+VG__;bc:}sV^ ?!v\(̾%Sb{NEMN7DDs@?,VI'~?I~7oeʗiv8don^HO=#KbB=b}d- lٗPiI~VY|[\m^WuBgۤ?|'%d eg^|9B?r{Y&gψ=/roәWl/?lr8?{sfO\H{Iֿ4K?ʷ54簔ؓbϋ$vZmk]ѻqƋ |2~*ϋvI_ H6NNb'NI ϴwf,evn,Nq`ӈC7|2+ovr8' 2_}9N8+ߔ?+ Xa8y!j]Ro+#|CQwT'O=#Kb,mgv<1S~UOgx=:)ǝyA\__o'Sco .jv(xi?<Hya:}B{L5{GĞ{JRs(GͲ~I7Oψ0_;r'_mb=CeLKGb?͏Ϣv~r_纔SRnǖZ {Ǐz['2O¼}Oǥ~=eh_άg-_"h}e/?}\(l+-h#}܎ӗ{"͕7gĿ[~P'N ϦĞr_{Y§fqm~^S/Zm2}[,ܗu`}!]bt؃RDznfĞm-u0߅RN}gb[4ON*_랿_Ί/K%+ZO=#6d^}_UKWr0bb'o=.vR?%߹୴eO~Oa<<.OD|xi+ϝ~}m_"%>'uѯga.z?&E#'=!NRCSbϊi~:nF6<70y{4pqRĆcq=zy~~%۞>/tv^_x.烅c?3D?{M0zVߖHσj_E~+eQltHs5|]l+{PP~tqrTA %kw"sO~sچ]Tz+ ߝot?u{{TZ#N_'!#n?:W.I>KkݷnN.6m|}X~ϋȆϏGK.jtJ٢X:]nGYrwQ_jy>_M{2.=7=r|=d'\kـǫ㿞;05љ{^Wu1x?'z5j'5|*ݏq?uv?-}JU:9둗[_V.wp%~/O*_h(}9~uyc<ʃb.?=mϗ]mge(>uucɺ 397{^w[ydsdZk7p=0?n^\]ZevNp-'r.'{W\IÜY97h(N z̹ʜpƜƜ"Ŝebpv3(sP(hN`usWn$큏V ח#X|0 Qr)oZrrM|ojٹ8>@EX ۸:_ra"UT[3sח/j0z:{;buoLkqڭ{%\bֵLb4>gal=Va9# ۸ѓ7/>nۋmz{~^ƶcFoZ1ovH.^jWwL>V2^R [WN<ݵ2\־?䕢nlme/data/Nitrendipene.rda0000644000176000001440000000205314251721455015270 0ustar ripleyusersݗoegv# " 1nBg/^ȴ3k{32{!A (323O?zJ HD(G>˾]nglQ)U2a.(X/bC7k#wCC>'tnNї [<o_MB ) w ix{~4^-UB'7 O~&tB_u&t}I.̇ Eݳk4~Ǡw/+P QM}uM =?s7w<Q6ǛBGp<cC~+sߣн'\R^Jߝ^uݝs;:{cIҲW;/~3)}/o?1S'vO7~ݟ3~yW<%}wSz.Ӗ<[2_&j-.GB6`X SdѫFy.v\8(]'ĭZIzs]AvO7~7+eJI-VrI|~o_5<RmХQXi[SS:m LX2eAvx0#Hgd02YlFdddddddddddhdhdhdhdhdhdhdhdhdhdddddddddddddddddddddddddddddddXdXdXdXdXdXdXdXdXdXddddddddddĊ'*Q#NA?˶R}n*Q+P F5ؓO3. ,|=]PZ]gTV9ŝw&:;W[wby~_!kQ"?֋0(Ǟ#A1C^4ۆªG7fdNNWV tI)^%1t&1B-nlme/data/Pixel.rda0000644000176000001440000000215714251721455013732 0ustar ripleyusersKoUǯq'i i8uIBP4@ -y4{&۩#!V++U7H7`S*g[U~9{9̦Kq!DXzE1'$Ď>ȞUwH@BCG"]v ݀-I. ֊U(]yF54Ax9m׃ =x^ zփU)%o^);.FQ>[ǐ 7I=UFG23y[vݔ#6?ccԡ{[w]~7|RY5_rO}* *}qEDe*k\ii{O{ssg{!U/RG.:2 :$4]r'ѥGul\cm^9rOx:׳eZ\չLiQuX%'f =9ӒґeZRzV1Bet|UtLT'gگZiit@t˴_ϴ_4ȴ_4̴_5t4δ_ujEeگ:=~:{Wd?8@t>0߃RON>6%I>8)؇d?!)ُI~lJCS}Pϻ?hwh1@={x6@ڇ ~~Sx?h?ish?k {O>ih?j^{q膎K;6lz5wJ9o_Ul_E^Ծ٫ʾ۫x6 ϳ9w}gߦګS~ ::umsƷuum??j4}&4}z!>yt"|i|:tƙ]^k=Y|WAge8}GY3.Í==- ]l}RhXctgJ=r|m9dk>: >}讫l>+WrypgFbOuA{3[g^9Ì]梼l9(ʁj]~go7 ??^~XO?l~dck7?#O&]r־=Ư]\Hw;[#L!7zђ۟{?w"Og띋c{|τZWp\~[)ix}m=?;@ܡrHփ$w@ s^9}*ؽ`9L6|NvP9$3;qrzm1.s XV~GK }՗=-FSc>:N$KI^Mum}u cKpLŖ0xSKcxg=zk?_'ة `o߳Av_TO8z3W`J\זOe&~=I}0otS. oz C2nqz`ϳpmG(nBz,I~Q{>ʁe'K^{zǶo}{;8^|W(W~l{q qy^\cmyWPyP{WNYԖ)Yvki7Oda(e'^@vDL}p/$9V qloˋ*/])T^Ԯx<`%Tn?7|ܷ-Bq2H)fs][N/y2q4*'C[NuqHx7 OS(}~8_2ܗɏ ~y>QrvBt̩:gkG[^?/Nj _߰X|>? ^ p}pR;C } >1M??ïh˝a>wޙOy<_ E~uްw}ȳ7P%ܗh߭yW= }1+W~гq}k?#ZEWQ}zN)ŗ+Q-w_XEɸ3qOJ}ɸ(1gOqe2OEhoT#1y8n}wb¼q2D~m?ex'!?_IqO2~Σq4k?k[,Sx7-ώF~ #dU!{s=)81G叉`?Ti|G0>'=#?T?a/oxyANR?j@%u2Ma/si^Ƕ}I&ّ5Fc_#o98\cxgO#ovhmP-5a(N^{柬HBF6G'gOoIM_;@\'9`|.Bn8?!_}"^l|7 wv&Lq$O&2vN?d';~&9JR]q']co%{Sn9Lړֵ>9@L-q8vPٓxJbaIӴ{a/8f_;MH1i_ɸ39VQτF{<.q}kԾxی?y4/4Ts٨szO9 }"4e8 '?y1흂MC?<`= A>h:4v,4Zi'@E]?giP?Gri=t"~8S`W`n8nd?P=%y}-dw(0&d_qYgR>π욜qҮS;I+.uK[~|Ktv%Hڵ?nUo5Poݙ'w zGNc N#Jm\0+Qt뷈+~Կ:㖻{qy-{]e<)/hԻ<.D'=m2x`ۑmG^0ؽMQ~a<coÔy{8v {jZx2 7v9yo6QϨ_I''A\>cg}vT}kWy$)8kA8#߶z[h~Ǎn$ =P}+࿓voB~_'Y^Epύ%^08ɻwy2?>^x xRAHI΍1y_sԞX3J?͂&ABht?I?D$j׵GQvZ(n>v(7~ێ@}8iۿw3#|®kQ~{SێC_umǿ݇__=ɯ? ;絇kp~6\q^G>m;&򭐏Ӊ(Y898n~_9GąP\%Hm5Ȯ8Nu}^ׯqr^mj q\H~Zp '7j9⌼vq\71k9ksd~mJ7%QSak7N|S\.wū_Sy~Qgy~p`cOl}?{i~k0oA|S;S?I $k)4"yG|Ӹ"шc/;[ϼaңa)]QZP~ysѮNwN983|w98|F#g IhwFO?p7ǬWbb^ų&T;㦾U?ܹM^=gO0~`oNs-xo5x!eǽR}!fsP\\C>|ǫIJ|^ {OAi^ʕ)Oܩߧy#cGG oPU\oic6?PiS2s@8tQ޶}Gx&_/KOr1*dڏuKI!x4dix?";i8Fm~]QѺ4m*7+q\,؟ڍ~~*+>)G ]_D7s^hW~gxG"β?>?a_W|hy3༵ﯯ7bc {6?J\w9H\X-8֡۳([u#ʅ~xy6ʯvc'yx Gq6էሓaS\]5~zx9>o5zsyը//P? J-y#(r__c}1gf`~]wt(?2^=jDpAS<{~8XaњL7E/0u1q#q9z"⧳aѸ(uK[99s}g`{Pu {́7\1Cvc_NEƮ0o܀qY׫4w+ox%ɦ~CM`ruwePg>`ϣ!.}' *?O?NeƸJ74޴ az.m{OɟM_Luә_|ؓح2V7ͳ#qW(FЎq a_0}UҺ5Z~GiѼ~#ڱf'6;Ue7nPh*;FAkΟm)tCc:3+o`7ƾoh=KdGSP~i}/g?xzU\(C`E')8w[>>j['co04r.77¿P kMAyNļ͇Pty:90ԇ!hW؋ S)D=IF(B ☺M9F7l+Zl.s~;&اqFo*>B툂?#}zh&:4~IB"^ Pp\4";ġ_΁ϡBoB q;{ qOܪ|ڴ3NC;3g}xA5i℩EO z>'M;H\q,l!=44N9t}8JOzg0$xIОS{SQ."_}zpk6YU[O4|w ]L*+s;?rs( όESa`C3VvQ,q08HϽƯ}z?Ng>+?;|"sՈ\fRb~N)3P|Cv*mz>E9GCs~a?jO߶qiѩ]+Q}PĭF|%S7E;pM9冇زOPi|hW&hledG)(4/l}Tɞ4/D8YQ*jku}5wc}W*4^T ;>޻XGR>ێPTg~sЯ8pS8.ډ&͕9Ҍ\c> a7qQ A΁ơ=E<K?C"Ǥyg)zNJ^U#_i\y=Q>7k 9.V9< *c?c<2qgEyOGy{ vw>v05O(x@q9w!;'%OQѸp,{Ls ;FJGf~N4o.~Xj#`??I8Y?AKⵈg~Kq?IߤQ;8*_98DWXWxHC!8Pxv{Fq/?ےH7YŃ1̀cKil:c_ ?>ctiPNXkZ8/>Odq\cX7ls[$hϟnMls3h9h@=:kl?C~2tQOjByM}m7|8{H`hށxSp:2ז)?PHn0o4﫽Pc޸rrqg߇#"i/p!{8M+#Lz-OlD_ dC"^Sg?A>O[gftPY X5TkSDp,Գi_?c&c.io;_B]q ?]׉|' GTcYl{MoO5hg1vOL8 =8o`GԻ8hCE=wە:s!@WǨo vhފϣ~Ѻw4@5wljyc`"]s01>î8,G|0: ~Ać %G)Tb.4&طˁLĩh}99~=ƹQ;Cx]W|l;c;|sAyz cPZ2 JqV+v2Ofk.3-rIWூCp;N,޾%z۱6ڇݦ`3QF!_G ?4/LO~i">,uC\ӈqzT; &kΌHN7H-M}wI=igvIqaap 7 aC7gR9q_X}^:_g[?uąnQ(A)IN n\~ڈtzTg.7~AT;/ zv6JQ}Lk~W'?aҝw_[b~a)Yo5oźͩk?Q{8vǑP{M05`Vh37[?ڻݮ~:=Y(ĩvP1 hʹuKq8=oAQ6zqiKA2h<Ək a/>lQqHַh=SO8E8M_Ez<ՉO6zn)=z$ҧ= 8-Y Zsaf/ʹ|N'> ^O1qFWqI%܂q|xnu=;ҼDţSQώ&~.Tޅ3Q-X]~KZ"%v'z[Ta?)pE8<8kM`%;F0;YsƋw8_~G Z74 !ϗaO3ؙ^P|Th<橛Fj?OZc= ^IEߐXp4/j^ ~ I?/4.P:`< G _v~0AÑ#Ѿ BSϨov$jzN$7V# U菔]xoO~1> yvDo!Nր݈]=o\~EMD|;:[Erq-H7>>s}|,2[>u.\Ю8˱ #h?(}GgaDNp&`ܻ̬|Ouq⾎iy}/?ܭ8Oo@:M/yk(x,tL㵔߿ ?jEAfYm庤`.%7&^+-= @ThQMIkSRmzoRRm|늣iElzC~u[?ebg6awyb@oz˖C}^n9Л^yb@oz=b6˦W=P7eX8Z,;n6ksmz_žρL\3ZMw_6}ᮽRG{[.+-Mo'mz >Mo@ hGHwV䦷|~X޸_jmi?jѽbozK?R5|P_Rg+M|MZ*^{?Rڝ{ZѶT޴wZ*[U6s6<;?žiEHKm6vC-z~ה핖Ά;,yϥ5 ?3篺]e3Mڜ >a%>_뮨?j_?,5E#^:?Ie>DW eq{l_oq˳O~~N.z씎su 7ףϗ &ΏG|sbamw[0i7[޷P:o9~sh[pf|E6Wߛz1G1~gǽx^X fMҋ|ƃJ/s_]s︳v~qOS>_wU?~I_97bۣX~}/i˺8skN{㋓]ϘryYs.[oo8a+u|;qφ|%ŶG7&cf=a{vd3_W^ ֛͏L[pMM;7:S?Ql{kkns0@:Bġtl~`A7yo_cڃe#uw.f&|ףc y^[1mQ ~ mx¶eO03}Z|fߌoVk:r7\R{c9u}ϧ[Moit~%|)t!||]zeFw_ދw^7XӼa}(}|S?\_ZM_uk%އ?8w~Q|&[un+<ze]st#}zF\gyl+Ϻw˫Jiù[^9Л7@}szx?yx"wu=ϻwVͶCԮP{DqRv]:X7}F t|ry!{M?7m~o7y Kv{/~?,PSw=aݧ&v>z[1vZ05 }(=a&ZSzžρzZ;|;KN2~"~/צ7|NDOnֹUJ|oUGJb%TOjlcy_4w*W.֡>?d~c w~j[oGay8o=Ouu?>yYwD_p0}=KWܾ6[v>ߌ8>7OYMolX޶wg5B|ړ?6bk~#}^_= ]x^j'zR=a{Kg^ewM9l) 3\A}c̼w;ǰ:Sf^}W{¼;zg9Л2h;_>k{w5{nQ遽׸qu3Mz!C^8ȴ˗n*v~ַ=j~$֫rD({oˬsSWxpO3vZIݬGsx|ʦMo{=PWy''m*L 2}.^2> wTW;>_`]'~_yy-_&?-JjTo\n`Ĺ~rO{WȞqb6gzÎN3lqrYx~c~cG!vWݨSOV6ts:l-|w1}{ }/^.7?tU_Aolu 3;M_yi71y/n.7}U9=!Won3%2k㳆#\|^riC3i8iq5z܌{dt殞ZivCEժ?LK[2- 2- Miihr4:c?\3K~Uݙht uF.Egfگ:3ӁԊ\{JJ-v|{hzLUE]o4-v@8~Q tkC:Z2IVD[ijyښ2LUڊI~vnmLti뮔ig}WkgtNLҩnw_6v[.6uKtk{.Й.-k\cbpg{g{g{g{g{g{gke{g{g{{Zbٞg{aazm^5C=.fa]zhm:p4ɼt9\b[^bcy{˴Ⱥ,sS]ЙA'֎G3- ݙi)iLӠk;3}-&.룙=²LC_p3P}4=Ѣ ,~fZzjW;3O-v{wh@Ӣ -v{x΃TRɥ[;Rkҥ)ӵthMwv)}jоtgJ?ӃCsX2ͥ[^Ubן=g:]za.ZZ̃DK]3өŎ;25Z_>شEgZL]ԙi)LSL{kLKBsw3;]ؙitq.ע-m3}mLRvfڟZl(h2Hm->uWMum?txh}.~/cMkɴ?uޣ/3Xm2wO g-Ӫ%MΫoR Ny_vKjtѦ].u]]hs?^ږr]xhףUM'~{^U(m%cީќi]%ҶCMԵf/=g6-zy nRb׫mhSmGQZ;eJwؽE-δغeKWߔt?>>jSGo-yj7dZd͍<|DgZZʅi.u:;b}ƫgZ*zmӠÙCK/g>i3at/5w G ՠLv ר󋆭l2/=7wxuF{Wf'ɴ?5)N7/ޗ3'}w~LQ_s?r]3Wu 4n]w~?>g\۝Ӄ㽴j'{ak]MZT.?]۱BZT3:J^3z3Vr_{m'2{DZUGG扃x凇]Ge%/lc/<:}i>I0Ejݣ'Z}aГo~G%˥Ew/|KKTpEjſ"C>ծTjo{%W;Eu[/,M6չ~+5J~kV~#+^9W/u`S/Mt~[o?oBEֆ+:Z3OZ_nwiqљY߾톭6z#=ihՏLs[.3_ʹT/N:6Ӕh; m+M6~?dtUd33mvLI/,]X>>ii?ioj>4`2>qՊzG3GQݻotʿe:;Wd__}+3}Z5ʹ˙6Tt`8ɴo_t_x2GYe~:EVRyK{)іy/m>mi2hۛ?[mk럻kˏn[)Ym/ңW;EՖ7!54cڑco,Y9n]hTnOOV?|s 5:kθoKn5uZjz&f\;-:珓]0jOoYZ_h[{[F[.n:Nُ|R-=vJğWo鞎ZSL>prkji?K/q΍њ_}MrCrA܉Gt!Vl氮j:l%+wڎá6vU7m+C*7n/wu젫Ϧ/gVͫUMLueEF֥ r腢.O/zҋ^x1)JW}W}W}W6 eP6 eP6 eP6 eP6 eP6 צ4\kpmMõi6 צ4gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>gY3K|f,%>g̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %$`̒Y0KfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$d̒Y2KBfI, %!$dD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%$bD̒Y1K"fI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$f̒Y3KbfI,%1$,[tvk%^'^u ^u$^t#uDH:"]Gt#U"]%U"]%U"]%U"]%U"]%uEH"]Wt]+uEHz"]Ot='DHz"]_t}/EH"]_tn DH7"@tn EH7"PtCn( EH7F"Ht#n$ҍDH7F"Xtcn,ҍEH7"X+x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#x^9W#xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRWJJ ^)+%xRW+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W+x ^W'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW'x ^yW/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^W/x ^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU x^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU(x ^WU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU$x ^EWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^łWU,x ^JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەX߮v%ַ+]JoWb}ەY/ޱ5r`ȫ9Aak6oxɆ=fӥn޴c]+AWw_0>u{^5ޡ27W%O4D@ϝ$sz+;6lz1|W&`ٚ7XnӦu֖m^SnӚKۼ)qY]ۻ>>qkukYiP2`C.ٴn;eoP"Co\iB⺃u.7vܮ IZaKH\5lZs'wL(۸bmZ1yƲemk&I%|(KlHḘ5y=zHfϞћ:y͗l^N6wp5OX]b {̦5o6#Wwf=#:nlme/data/ergoStool.rda0000644000176000001440000000122414251721455014620 0ustar ripleyusersUo0v~S=XM0Uh8IT=Tk b q$S9>A:];5_ !6*X!kjq9!#pÁZgRzz5m={P 4@Q*(HLKya0MTq/ԐxH$6 * [|μ3F00CLYSL,&p U!g\پJ Kn 3a(d-׸z|O?{ۑ{3-fSFG*v h>PZ?thp0` 8p0`>p8 JyZی(_wT½PsD[U"x ƥe7RK![{zۮn̒nӠ nw/ n;Ӳf&?͸HJ#[Ѣ\$V]pox<,D|rNi. o+ꛊ]'"SXZaOӅigեKĝ1\Otrq5*>xm>"7ݛFEV:\xǿ{Rnlme/src/0000755000176000001440000000000014772475054012043 5ustar ripleyusersnlme/src/pdMat.h0000644000176000001440000000176414251721455013260 0ustar ripleyusers/* header file for the nlme package Copyright 1999 Saikat DebRoy Copyright 2007-2016 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #ifndef NLME_PDMAT_H #define NLME_PDMAT_H #include "base.h" extern void compSymm_pd(double *, int *, double *); extern void matrixLog_pd(double *, int *, double *); extern void logChol_pd(double *, int *, double *); #endif /* NLME_BASE_H */ nlme/src/chol.f0000644000176000001440000000444714251721455013137 0ustar ripleyusersc----------------------------------------------------------------------- c c R : A Computer Langage for Statistical Data Analysis c Copyright (C) 1996, 1997 Robert Gentleman and Ross Ihaka c Copyright (C) 2001 The R Core Team c c This program is free software; you can redistribute it and/or modify c it under the terms of the GNU General Public License as published by c the Free Software Foundation; either version 2 of the License, or c (at your option) any later version. c c This program is distributed in the hope that it will be useful, c but WITHOUT ANY WARRANTY; without even the implied warranty of c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the c GNU General Public License for more details. c c You should have received a copy of the GNU General Public License c along with this program; if not, a copy is available at c http://www.r-project.org/Licenses/ c c----------------------------------------------------------------------- c c chol performs the choleski decomposition of a symmetric c positive-definite matrix. this is just a wrapper for the c linpack routine dpofa. c c on entry c c a double precision(lda,n) c the upper triangle of the matrix to be factorized c is contained in the upper triangle of a. c c lda integer c the leading dimension of a. c c n integer c the number or rows and columns of the matrix c to be factorized. c c on return c c v double precision(n,n) c the square-root (choleski) factor. c c info integer c the error indicator from dpofa. this will be c zero unless the matrix being factorized is c not positive definite. c c this version dated aug 25, 1996. c ross ihaka, university of auckland. c subroutine chol(a, lda, n, v, info) c implicit none integer n, lda, info double precision a(lda, n), v(n,n) integer i, j c do 20 i = 1,n do 10 j = 1,n if(i .gt. j) then v(i,j) = 0.0d0 else v(i,j) = a(i,j) end if 10 continue 20 continue call dpofa(v, n, n, info) return end nlme/src/gnls.c0000644000176000001440000001355514251721455013152 0ustar ripleyusers/* Routines for fitting gnls models Copyright 1997-2005 Douglas M. Bates , Jose C. Pinheiro, Saikat DebRoy Copyright 2007-2022 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include // for DBL_EPSILON #include "nlOptimizer.h" #include "matrix.h" #include "nlmefit.h" extern void corStruct_recalc(double *, int *, int *, double *); /* gnls functions and variables */ typedef struct gnls_struct { /* Generalized nonlinear least squares structure */ double *residuals, *gradient, *corFactor, *varWeights, minFactor, tolerance, *newtheta, *theta, *incr, *add_ons, new_objective, objective; double *result[1]; int corOpt, varOpt, npar, ncol, N, nrdof, maxIter, *corDims; SEXP model; int conv_failure; } *gnlsPtr; static gnlsPtr gnls_init(double *ptheta, int *dims, double *corFactor, double *varWeights, int *corDims, double *settings, double *additional, int corOpt, int varOpt, SEXP model) { int nResult, npar = dims[0], // == p = pLen N = dims[1]; // == NReal == length(additional) gnlsPtr gnls = R_Calloc(1, struct gnls_struct); gnls->theta = ptheta; gnls->corFactor = corFactor; gnls->varWeights = varWeights; gnls->corDims = corDims; gnls->npar = npar; gnls->N = N; gnls->nrdof = N - npar; gnls->ncol = npar + 1; gnls->maxIter = (int) settings[0]; gnls->minFactor = settings[1]; gnls->tolerance = settings[2]; gnls->newtheta = R_Calloc(npar, double); gnls->incr = R_Calloc(npar, double); gnls->varOpt = varOpt; gnls->corOpt = corOpt; gnls->add_ons = additional; gnls->model = model; gnls->result[0] = DNULLP; nResult = evaluate(ptheta, npar, model, gnls->result); gnls->result[0] = R_Calloc(nResult, double); return gnls; } static void gnlsFree( gnlsPtr gnls ) { R_Free(gnls->newtheta); R_Free(gnls->incr); R_Free(gnls->result[0]); R_Free(gnls); } static double gnls_objective(gnlsPtr gnls) { int i, j; if(gnls->varOpt) { /* variance function correction */ for(i = 0; i < gnls->N; i++) { for(j = 0; j < gnls->ncol; j++) { *(gnls->result[0] + i + j * gnls->N) *= gnls->varWeights[i]; } } } if(gnls->corOpt) { /* correlation structure correction */ corStruct_recalc(gnls->result[0], gnls->corDims, &gnls->ncol, gnls->corFactor); } gnls->residuals = gnls->result[0] + gnls->npar * gnls->N; gnls->gradient = gnls->result[0]; return(d_sum_sqr(gnls->residuals, gnls->N)); } static double gnls_increment(gnlsPtr gnls) { if (sqrt_eps == 0.0) sqrt_eps = sqrt(DBL_EPSILON); double* auxRes = R_Calloc(gnls->N, double); Memcpy(auxRes, gnls->residuals, gnls->N); QRptr aQR = QR(gnls->gradient, gnls->N, gnls->N, gnls->npar); QRsolve(aQR, gnls->residuals, gnls->N, 1L, gnls->incr, gnls->npar); QRqty(aQR, auxRes, gnls->N, 1L); double regSS = 0.; for(int i=0; i < gnls->npar; i++) { regSS += auxRes[i] * auxRes[i]; } QRfree(aQR); R_Free(auxRes); return(sqrt(((double) gnls->nrdof) * regSS / ((double) gnls->npar) * (gnls->new_objective - regSS))); } static int gnls_iterate(gnlsPtr gnls) { double factor, criterion; int iteration; SEXP model = gnls->model; Memcpy(gnls->newtheta, gnls->theta, gnls->npar); evaluate(gnls->theta, gnls->npar , model, gnls->result); gnls->new_objective = gnls->objective = gnls_objective(gnls); gnls->conv_failure = 0; for (factor = 1.0, iteration = 1; iteration <= gnls->maxIter; iteration++) { /* outer iteration loop */ /* increment and convergence criterion */ criterion = gnls_increment(gnls); if (gnls->conv_failure) return(iteration); /* Unable to make increment */ if (criterion < gnls->tolerance) return(iteration); /* successful completion */ do { /* inner loop for acceptable step size */ if (factor < gnls->minFactor) { gnls->conv_failure = 1; return(iteration); } Memcpy(gnls->newtheta, gnls->theta, gnls->npar); d_axpy(gnls->newtheta, factor, gnls->incr, gnls->npar); evaluate(gnls->newtheta, gnls->npar , model, gnls->result); gnls->new_objective = gnls_objective(gnls); if (gnls->conv_failure) return(iteration); /* unable to evaluate objective */ factor /= 2.0; } while (gnls->new_objective >= gnls->objective); factor *= 4.0; if (factor > 1.0) factor = 1.0; gnls->objective = gnls->new_objective; Memcpy(gnls->theta, gnls->newtheta, gnls->npar); } gnls->conv_failure = 2; /* Maximum number of iterations exceeded */ return(iteration - 1); } static void gnls_wrapup(gnlsPtr gnls) { SEXP model = gnls->model; evaluate(gnls->theta, gnls->npar , model, gnls->result); Memcpy(gnls->add_ons, gnls->result[0] + gnls->npar * gnls->N, gnls->N); gnls->objective = gnls_objective(gnls); } void fit_gnls(double *ptheta, int *pdims, // = Dims double *pcorFactor, double *pvarWeights, int *pcorDims, double *settings, double *additional, int *pcorOpt, int *pvarOpt, SEXP model) { gnlsPtr gnls; PROTECT(model); if(sqrt_eps == 0.0) sqrt_eps = sqrt(DBL_EPSILON); gnls = gnls_init(ptheta, pdims, pcorFactor, pvarWeights, pcorDims, settings, additional, *pcorOpt, *pvarOpt, model); settings[4] = (double) gnls_iterate(gnls); gnls_wrapup(gnls); settings[3] = gnls->conv_failure; settings[5] = gnls->objective; gnlsFree(gnls); UNPROTECT(1); } nlme/src/nlmefit.h0000644000176000001440000000772114251721455013650 0ustar ripleyusers /* header file for the nlme package Copyright 2007-2018 The R Core Team Copyright 1999-2001 Saikat DebRoy, Douglas Bates This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #ifndef NLME_NLMEFIT_H #define NLME_NLMEFIT_H #include "base.h" #include // for nlm internals #include // for R_CheckUserInterrupt() typedef struct dim_struct { int N, /* number of observations in original data */ ZXrows, /* number of rows in ZXy */ ZXcols, /* number of columns in ZXy */ Q, /* number of levels of random effects */ Srows, /* number of rows in decomposition */ *q, /* dimensions of the random effects */ *ngrp, /* numbers of groups at each level */ *DmOff, /* offsets into the DmHalf array */ *ncol, /* no. of columns decomposed at each level */ *nrot, /* no. of columns rotated at each level */ **ZXoff, /* offsets into ZXy */ **ZXlen, /* groups lengths */ **SToff, /* offsets into storage */ **DecOff, /* offsets into decomposition */ **DecLen; /* decomposition group lengths */ } *dimPTR; typedef struct state_struct { dimPTR dd; double *ZXy; int *pdClass, *RML; double *sigma; // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions } *statePTR; extern dimPTR dims(int *); extern dimPTR dimS(SEXP); extern int count_DmHalf_pars(dimPTR, int *); extern double * generate_theta(double *, dimPTR, int *, double *); extern double * generate_DmHalf(double *, dimPTR, int *, double *); extern void dimFree(dimPTR); extern void mixed_decomp(double *, int *); extern void mixed_fcn(int, double *, double *, void *); extern void mixed_grad(int, double *, double *, void *); extern void internal_decomp(dimPTR, double *); extern void mixed_loglik(double *, int *, double *, int *, double *, double *, double *); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions extern double internal_loglik(dimPTR, double *, double *, int *, double *, double *, double *); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions extern void mixed_estimate(double *, int *, double *, int *, double *, double *, int *, double *); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions extern void internal_estimate(dimPTR, double *); extern void mixed_EM(double *, int *, double *, int *, int *, int *, double *, double *, double *, double *); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions extern void internal_EM(dimPTR, double *, double *, int, int *, int *, double *, double *, double *, double *); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions extern void mixed_combined(double *, int *, double *, int *, int *, int *, double *, double *, double *, int *, double *); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions extern void mixed_calcf(int *, double *, int *, double *, int *, double *, void (*)(void)); extern void mixed_calcgh(int *, double *, int *, double *, double *, int *, double *, void (*)(void)); extern void gls_loglik(double *, int *, double *, double *, double *); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions extern void gls_estimate(double *, int *, double *, double *, double *, double *, int *, int *); #endif /* NLME_NLMEFIT_H */ nlme/src/matrix.h0000644000176000001440000000357614364664010013520 0ustar ripleyusers/* header file for the nlme package Copyright 1999-2001 Saikat DebRoy Copyright 2007-2016 The R Core Team This file is part of the nlme package for S and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #ifndef NLME_MATRIX_H #define NLME_MATRIX_H #include "base.h" void F77_NAME(chol)(double *a, int *lda, int *n, double *v, int *info); void F77_NAME(rs)(int *nm, int *n, double *a, double *w, int *matz, double *z, double *fv1, double *fv2, int *ierr); #include typedef struct QR_struct { double *mat, *qraux; int *pivot, rank, ldmat, nrow, ncol; } *QRptr; extern void d_axpy(double *, double, double *, int); extern double d_dot_prod(double *, int, double *, int, int); extern double d_sum_sqr( double *, int); extern double *copy_mat(double *, int, double *, int, int, int); extern double *copy_trans(double *, int, double *, int, int, int); extern double *mult_mat(double *, int, double *, int, int, int, double *, int, int); extern QRptr QR(double *, int, int, int); extern void QRfree(QRptr); extern int QRqty(QRptr, double *, int, int); extern int QRsolve(QRptr, double *, int, int, double *, int); extern double QRlogAbsDet(QRptr); extern void QRstoreR(QRptr, double *, int); extern int QR_and_rotate(double *, int, int, int, double *, int, int, double *, double *, int); #endif /* NLME_MATRIX_H */ nlme/src/corStruct.c0000644000176000001440000006436114660073244014200 0ustar ripleyusers/* Routines dealing with correlation structures. Copyright 1997-2005 Douglas M. Bates , Jose C. Pinheiro, Saikat DebRoy Copyright 2007-2024 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include "matrix.h" #include #include // for DBL_EPSILON /* Factor list and Recalc for general corStruct object */ void corStruct_factList(double *mat, int *pdims, double *FactorL, double *logdet) { int i, j, M = pdims[1], *len = pdims + 4, job = 11L, info; double *work, *work1; for(i = 0; i < M; i++) { int li = len[i], lisq = li * li, lip1 = li + 1; work = R_Calloc(li, double); work1 = R_Calloc(lisq, double); F77_CALL(chol) (mat, &li, &li, mat, &info); for(j = 0; j < li; j++) { work1[j * lip1] = 1; F77_CALL(dtrsl) (mat, &li, &li, work1 + j * li, &job, &info); *logdet -= log(fabs(mat[j * lip1])); } Memcpy(FactorL, work1, lisq); R_Free(work); R_Free(work1); FactorL += lisq; mat += lisq; } } void corStruct_recalc(double *Xy, int *pdims, int *ZXcol, double *Factor) { int N = pdims[0], M = pdims[1], *len = pdims + 4, i; // cannot use 'start' to loop over Xy here: // for spatial correlation structures 'start' indexes the distance vector for(i = 0; i < M; i++) { mult_mat(Xy, N, Factor, len[i], len[i], len[i], Xy, N, *ZXcol); Xy += len[i]; Factor += (len[i] * len[i]); } } /* symm class - unstructured correlation - based on spherical parametrization */ void symm_fullCorr(double *par, int *maxC, double *crr) /* calculates full correlation structure */ { double *work, aux, aux1, *src = par, *src1, *dest; int i, j, n = *maxC; /* first get upper-triangular factor */ dest = work = R_Calloc(n * (n + 1) / 2, double); for(i = 0; i < n; i++) { aux = 1.0; for(j = 0; j < i; j++) { aux1 = exp(*src); aux1 = M_PI * aux1/(1 + aux1); /* untransforming */ *dest = aux * cos(aux1); aux *= sin(aux1); dest++; src++; } *dest = aux; dest++; } /* getting the correlations */ for(i = 0, dest = crr, src = work; i < n - 1; i++) { int ip1 = i + 1; src += i; for(j = ip1, src1 = src; j < n; j++) { src1 += j; *dest = d_dot_prod(src, 1L, src1, 1L, ip1); dest++; } } R_Free(work); } static void symm_mat(double *crr, int *time, int *n, int *maxC, double *mat) { int i, j, k, np1 = *n + 1, n1, n2; for(i = 0; i < *n; i++) { mat[i * np1] = 1.0; for(j = i + 1; j < *n; j++) { n1 = (time[i] < time[j]) ? time[i] : time[j]; n2 = time[i] + time[j] - 2 * n1 - 1; k = n1 * *maxC - n1 * (n1 + 1) / 2 + n2; *(mat + i + j * (*n)) = *(mat + j + i * (*n)) = crr[k]; } } } void symm_matList(double *pars, int *time, int *maxC, int *pdims, double *mat) { double *crr = R_Calloc(*maxC * (*maxC - 1) / 2, double); int i, M = pdims[1], *len = pdims + 4; /* parameters assumed in unconstrained form */ symm_fullCorr(pars, maxC, crr); for(i = 0; i < M; i++) { symm_mat(crr, time, &len[i], maxC, mat); mat += len[i] * len[i]; time += len[i]; } R_Free(crr); } static void symm_fact(double *crr, int *time, int *n, int *maxC, double *mat, double *logdet) { int job = 11L, info, i, nsq = *n * (*n), np1 = *n + 1; double *work = R_Calloc(*n, double), *work1 = R_Calloc(nsq, double); symm_mat(crr, time, n, maxC, mat); F77_CALL(chol) (mat, n, n, mat, &info); for(i = 0; i < *n; i++) { work1[i * np1] = 1; F77_CALL(dtrsl) (mat, n, n, work1 + i * (*n), &job, &info); *logdet -= log(fabs(mat[i * np1])); } Memcpy(mat, work1, nsq); R_Free(work); R_Free(work1); } void symm_factList(double *pars, int *time, int *maxC, int *pdims, double *FactorL, double *logdet) { double *crr = R_Calloc(*maxC * (*maxC - 1L) / 2L, double); int i, M = pdims[1], *len = pdims + 4; /* parameters assumed in unconstrained form */ symm_fullCorr(pars, maxC, crr); for(i = 0; i < M; i++) { symm_fact(crr, time, &len[i], maxC, FactorL, logdet); FactorL += len[i] * len[i]; time += len[i]; } R_Free(crr); } void symm_recalc(double *Xy, int *pdims, int *ZXcol, double *pars, int *time, int *maxC, double *logdet) { int N = pdims[0], M = pdims[1], *len = pdims + 4, *start = len + M, i; double *crr = R_Calloc(*maxC * (*maxC - 1) / 2, double); /* parameters assumed in unconstrained form */ symm_fullCorr(pars, maxC, crr); for(i = 0; i < M; i++) { double *Factor = R_Calloc((len[i] * len[i]), double); symm_fact(crr, time + start[i], &len[i], maxC, Factor, logdet); mult_mat(Xy + start[i], N, Factor, len[i], len[i], len[i], Xy + start[i], N, *ZXcol); R_Free(Factor); } R_Free(crr); } /* nat class - unstructured correlation - natural parametrization */ void nat_fullCorr(double *par, int *maxC, double *crr) /* calculates full correlation structure */ { double aux; int i, npar = *maxC * (*maxC - 1) / 2; for(i = 0; i < npar; i++) { aux = exp(par[i]); crr[i] = (aux - 1)/(aux + 1); } } void nat_matList(double *pars, int *time, int *maxC, int *pdims, double *mat) { double *crr = R_Calloc(*maxC * (*maxC - 1) / 2, double); int i, M = pdims[1], *len = pdims + 4; /* parameters assumed in unconstrained form */ nat_fullCorr(pars, maxC, crr); for(i = 0; i < M; i++) { symm_mat(crr, time, &len[i], maxC, mat); mat += len[i] * len[i]; time += len[i]; } R_Free(crr); } void nat_factList(double *pars, int *time, int *maxC, int *pdims, double *FactorL, double *logdet) { double *crr = R_Calloc(*maxC * (*maxC - 1L) / 2L, double); int i, M = pdims[1], *len = pdims + 4; /* parameters assumed in unconstrained form */ nat_fullCorr(pars, maxC, crr); for(i = 0; i < M; i++) { symm_fact(crr, time, &len[i], maxC, FactorL, logdet); FactorL += len[i] * len[i]; time += len[i]; } R_Free(crr); } void nat_recalc(double *Xy, int *pdims, int *ZXcol, double *pars, int *time, int *maxC, double *logdet) { int N = pdims[0], M = pdims[1], *len = pdims + 4, *start = len + M, i; double *crr = R_Calloc(*maxC * (*maxC - 1) / 2, double); /* parameters assumed in unconstrained form */ nat_fullCorr(pars, maxC, crr); for(i = 0; i < M; i++) { double *Factor = R_Calloc((len[i] * len[i]), double); symm_fact(crr, time + start[i], &len[i], maxC, Factor, logdet); mult_mat(Xy + start[i], N, Factor, len[i], len[i], len[i], Xy + start[i], N, *ZXcol); R_Free(Factor); } R_Free(crr); } /* AR1 class */ static void AR1_mat(double *par, int *n, double *mat) { int i, j; double aux; for(i = 0; i < *n; i++) { *(mat + i * (*n + 1)) = 1.0; for(j = i + 1; j < *n; j++) { aux = pow(*par, j - i); *(mat + i + j * (*n)) = *(mat + j + i * (*n)) = aux; } } } static double safe_phi(double x) /* returns (exp(x) - 1)/(exp(x) + 1), x < 0 */ { /* or (1 - exp(-x))/(1 + exp(-x)), x > 0 */ double ex; if (x < 0.0) { ex = exp(x); return (ex - 1.0)/(ex + 1.0); } ex = exp(-x); return (1.0 - ex)/(1.0 + ex); } void AR1_matList(double *par, int *pdims, double *mat) { int i, M = pdims[1], *len = pdims + 4; /* par assumed in unconstrained form */ *par = safe_phi( *par ); for(i = 0; i < M; i++) { AR1_mat(par, &len[i], mat); mat += len[i] * len[i]; } } static void AR1_fact(double *par, int *n, double *mat, double *logdet) { int i, np1 = *n + 1; double aux = sqrt(1 - *par * (*par)), aux1 = - (*par)/aux; *logdet -= (*n - 1) * log(aux); aux = 1/aux; mat[0] = 1; for(i = 1; i < *n; i++) { mat[i * np1] = aux; mat[i + *n * (i - 1)] = aux1; } } void AR1_factList(double *par, int *pdims, double *FactorL, double *logdet) { int i, M = pdims[1], *len = pdims + 4; /* par assumed in unconstrained form */ *par = safe_phi( *par ); for(i = 0; i < M; i++) { AR1_fact(par, &len[i], FactorL, logdet); FactorL += len[i] * len[i]; } } void AR1_recalc(double *Xy, int *pdims, int *ZXcol, double *par, double *logdet) { int N = pdims[0], M = pdims[1], *len = pdims + 4, *start = len + M, i; double *Factor; /* par assumed in unconstrained form */ *par = safe_phi( *par ); for(i = 0; i < M; i++) { Factor = R_Calloc(len[i] * len[i], double); AR1_fact(par, &len[i], Factor, logdet); mult_mat(Xy + start[i], N, Factor, len[i], len[i], len[i], Xy + start[i], N, *ZXcol); R_Free(Factor); } } /* Continuous AR1 class */ static void CAR1_mat(double *par, double *time, int *n, double *mat) { int i, j; double aux; for(i = 0; i < *n; i++) { *(mat + i * (*n + 1)) = 1.0; for(j = i + 1; j < *n; j++) { aux = pow(*par, fabs(time[j] - time[i])); *(mat + i + j * (*n)) = *(mat + j + i * (*n)) = aux; } } } void CAR1_matList(double *par, double *time, int *pdims, double *mat) { int i, M = pdims[1], *len = pdims + 4; double aux = exp(*par); /* parameter assumed in unconstrained form */ *par = aux / (1.0 + aux); for(i = 0; i < M; i++) { CAR1_mat(par, time, &len[i], mat); mat += len[i] * len[i]; time += len[i]; } } static void CAR1_fact(double *par, double *time, int *n, double *mat, double *logdet) { int job = 11L, info, i, nsq = *n * (*n), np1 = *n + 1; double *work = R_Calloc(*n, double), *work1 = R_Calloc(nsq, double); CAR1_mat(par, time, n, mat); F77_CALL(chol) (mat, n, n, mat, &info); for(i = 0; i < *n; i++) { work1[i * np1] = 1; F77_CALL(dtrsl) (mat, n, n, work1 + i * (*n), &job, &info); *logdet -= log(fabs(mat[i * np1])); } Memcpy(mat, work1, nsq); R_Free(work); R_Free(work1); } void CAR1_factList(double *par, double *time, int *pdims, double *FactorL, double *logdet) { int i, M = pdims[1], *len = pdims + 4; double aux = exp(*par); /* parameter assumed in unconstrained form */ *par = aux / (1.0 + aux); for(i = 0; i < M; i++) { CAR1_fact(par, time, &len[i], FactorL, logdet); FactorL += len[i] * len[i]; time += len[i]; } } void CAR1_recalc(double *Xy, int *pdims, int *ZXcol, double *par, double *time, double *logdet) { int N = pdims[0], M = pdims[1], *len = pdims + 4, *start = len + M, i; double aux = exp(*par); /* parameter assumed in unconstrained form */ *par = aux / (1.0 + aux); for(i = 0; i < M; i++) { double *Factor = R_Calloc(len[i] * len[i], double); CAR1_fact(par, time + start[i], &len[i], Factor, logdet); mult_mat(Xy + start[i], N, Factor, len[i], len[i], len[i], Xy + start[i], N, *ZXcol); R_Free(Factor); } } /* ARMA class */ static void ARMA_transPar(int N, double *pars, double sgn) { int i, j, n, n2; double ps, D, aux; for(n = N - 1; n > -1; n--) { if ((ps = pars[n] * pars[n]) >= 1.0) error(_("All parameters must be less than 1 in absolute value")); if (n) { D = 1 - ps; n2 = (n - 1)/2; for(i = 0; i <= n2; i++) { if ((j = n - i -1) > i) { aux = (pars[i] + sgn * pars[j] * pars[n])/D; pars[j] = (pars[j] + sgn * pars[i] * pars[n])/D; pars[i] = aux; } else { pars[i] /= (1 - sgn * pars[n]); } } } pars[n] = log((1 + pars[n])/(1 - pars[n])); } } void ARMA_unconstCoef(int *p, int *q, double *pars) { ARMA_transPar(*p, pars, 1.0); ARMA_transPar(*q, pars + *p, -1.0); } static void ARMA_untransPar(int N, double *pars, double sgn) { int i, j; double *aux; if (N) { aux = R_Calloc(N, double); for(i = 0; i < N; i++) { pars[i] = exp(-pars[i]); aux[i] = pars[i] = (1 - pars[i])/(1 + pars[i]); if (i) { for(j = 0; j < i; j++) { pars[j] = aux[j] + sgn * pars[i] * aux[i - j - 1]; } Memcpy(aux, pars, i); } } R_Free(aux); } } void ARMA_constCoef(int *p, int *q, double *pars) { ARMA_untransPar(*p, pars, -1.0); ARMA_untransPar(*q, pars + *p, 1.0); } static void ARMA_cross(int *p, int *q, double *pars, double *psi) { int i, j, M = *q + 1, PM; M = (*p > M ? *p : M); psi[0] = 1; for(i = 1; i < M; i++) { psi[i] = ((*q < i) ? 0 : pars[*p + i - 1]); PM = (*p < i ? *p : i); for(j = 0; j < PM; j++) { psi[i] += pars[j] * psi[i - j - 1]; } } } static void ARMA_corr(int *p, int *q, int *maxlag, double *pars, double *psi, double *crr) { int P = *p + 1, Pp1 = P + 1, i, j, k, minPQ, Mlag, maxPQ, *pivot = R_Calloc(P, int); double *coef = R_Calloc(P * P, double), *src, *qraux = R_Calloc(P, double), *work = R_Calloc(P * P, double), *work1; if (sqrt_eps == 0.0) sqrt_eps = sqrt(DBL_EPSILON); if ((maxPQ = ((*p > *q) ? *p : *q))) { for(i = 0, src = coef; i < P; i++, src += Pp1) { crr[i] = 0; *src = 1; } Mlag = ((*maxlag > *q) ? *maxlag : *q); Mlag = ((Mlag > *p) ? Mlag : *p) + 1; work1 = R_Calloc(Mlag, double); for(i = P; i < Mlag; i++) { crr[i] = 0; } crr[0] = 1; for(i = 1, src = pars + *p; i <= *q; i++, src++) { crr[0] += (*src) * psi[i]; } if (*p) { if ((minPQ = ((*p < *q) ? *p : *q))) { for(i = 1, src = pars + *p - 1; i <= minPQ; i++) { for(j = i; j <= *q; j++) { crr[i] += *(src + j) * psi[j - i]; } } } for(i = 0, src = coef; i < P; i++, src++) { for(j = 0; j < *p; j++) { k = i - j - 1; k = ((k > 0) ? k : -k); *(src + (k * P)) -= pars[j]; } } /* F77_CALL(dqrdca) (coef, &P, &P, &P, qraux, pivot, work, &i, &sqrt_eps); */ F77_CALL(dqrdc2) (coef, &P, &P, &P, &sqrt_eps, &i, qraux, pivot, work); if (i < P) error(_("Coefficient matrix not invertible" )); i = 100L; F77_CALL(dqrsl) (coef, &P, &P, &P, qraux, crr, DNULLP, crr, work1, DNULLP, DNULLP, &i, &j); Memcpy(crr, work1, Mlag); } for(i = P; i <= *q; i++) { for(j = 0; j < *p; j++) { crr[i] += pars[j] * crr[i - j - 1]; } for(j = i, src = pars + i - 1; j <= *q; j++, src++) { crr[i] += *src * psi[j - i]; } } for(i = maxPQ + 1; i < Mlag; i++) { for(j = 0; j < *p; j++) { crr[i] += pars[j] * crr[i - j - 1]; } } for(i = 1; i < Mlag; i++) { crr[i] /= crr[0]; } R_Free(qraux); R_Free(work); R_Free(coef); R_Free(pivot); R_Free(work1); } crr[0] = 1; } static void ARMA_fullCorr(int *p, int *q, int *maxlag, double *pars, double *crr) { int M = *q + 1; double *psi; M = ((M < *p) ? *p : M); psi = R_Calloc(M, double); ARMA_cross(p, q, pars, psi); ARMA_corr(p, q, maxlag, pars, psi, crr); R_Free(psi); } static void ARMA_mat(double *crr, int *time, int *n, double *mat) { int i, j, k; for(i = 0; i < *n; i++) { for(j = i; j < *n; j++) { k = time[j] - time[i]; k = ((k < 0) ? -k : k); *(mat + i + j * (*n)) = *(mat + j + i * (*n)) = crr[k]; } } } void ARMA_matList(double *pars, int *p, int *q, int *time, int *maxlag, int *pdims, double *mat) { double *crr = R_Calloc(*maxlag + 1L, double); int i, M = pdims[1], *len = pdims + 4; /* parameters assumed in unconstrained form */ ARMA_constCoef(p, q, pars); ARMA_fullCorr(p, q, maxlag, pars, crr); for(i = 0; i < M; i++) { ARMA_mat(crr, time, &len[i], mat); mat += len[i] * len[i]; time += len[i]; } R_Free(crr); } static void ARMA_fact(double *crr, int *time, int *n, double *mat, double *logdet) { int job = 11L, info, i, nsq = *n * (*n), np1 = *n + 1; double *work = R_Calloc(*n, double), *work1 = R_Calloc(nsq, double); ARMA_mat(crr, time, n, mat); F77_CALL(chol) (mat, n, n, mat, &info); for(i = 0; i < *n; i++) { work1[i * np1] = 1; F77_CALL(dtrsl) (mat, n, n, work1 + i * (*n), &job, &info); *logdet -= log(fabs(mat[i * np1])); } Memcpy(mat, work1, nsq); R_Free(work); R_Free(work1); } void ARMA_factList(double *pars, int *p, int *q, int *time, int *maxlag, int *pdims, double *FactorL, double *logdet) { double *crr = R_Calloc(*maxlag + 1L, double); int i, M = pdims[1], *len = pdims + 4; /* parameters assumed in unconstrained form */ ARMA_constCoef(p, q, pars); ARMA_fullCorr(p, q, maxlag, pars, crr); for(i = 0; i < M; i++) { ARMA_fact(crr, time, &len[i], FactorL, logdet); FactorL += len[i] * len[i]; time += len[i]; } R_Free(crr); } void ARMA_recalc(double *Xy, int *pdims, int *ZXcol, double *pars, int *p, int *q, int *time, int *maxlag, double *logdet) { int N = pdims[0], M = pdims[1], *len = pdims + 4, *start = len + M, i; double *crr = R_Calloc(*maxlag + 1L, double); /* parameters assumed in unconstrained form */ ARMA_constCoef(p, q, pars); ARMA_fullCorr(p, q, maxlag, pars, crr); for(i = 0; i < M; i++) { double *Factor = R_Calloc(len[i] * len[i], double); ARMA_fact(crr, time + start[i], &len[i], Factor, logdet); mult_mat(Xy + start[i], N, Factor, len[i], len[i], len[i], Xy + start[i], N, *ZXcol); R_Free(Factor); } } /* Compound symmetry */ static void compSymm_mat(double *par, int *n, double *mat) { int i, j; for(i = 0; i < *n; i++) { mat[(*n + 1) * i] = 1.0; for(j = i + 1; j < *n; j++) { *(mat + i + j * (*n)) = *(mat + j + i * (*n)) = *par; } } } void compSymm_matList(double *par, double *inf, int *pdims, double *mat) { int i, M = pdims[1], *len = pdims + 4; /* parameter assumed in unconstrained form */ double aux = exp(*par); *par = (aux + *inf)/(aux + 1.0); for(i = 0; i < M; i++) { compSymm_mat(par, &len[i], mat); mat += len[i] * len[i]; } } static void compSymm_fact(double *par, int *n, double *mat, double *logdet) { int i, j, np1 = *n + 1, nsq = *n * (*n); double aux, aux1, *work = R_Calloc(nsq, double); aux = 1 + (*n - 1) * (*par); *logdet -= log(aux)/2; aux = 1/sqrt(aux * (*n)); for(i = 0; i < nsq; i += *n) { work[i] = aux; } aux = 1 - (*par); *logdet -= (*n - 1) * log(aux)/2; for(i = 1; i < *n; i++) { aux1 = -1/sqrt(aux * i * (i + 1)); for(j = 0; j < i; j++) { work[i + j * (*n)] = aux1; } work[i * np1] = -i * aux1; } Memcpy(mat, work, nsq); R_Free(work); } void compSymm_factList(double *par, double *inf, int *pdims, double *FactorL, double *logdet) { int i, M = pdims[1], *len = pdims + 4; /* parameter assumed in unconstrained form */ double aux = exp(*par); *par = (aux + *inf)/(aux + 1.0); for(i = 0; i < M; i++) { compSymm_fact(par, &len[i], FactorL, logdet); FactorL += len[i] * len[i]; } } void compSymm_recalc(double *Xy, int *pdims, int *ZXcol, double *par, double *inf, double *logdet) { int N = pdims[0], M = pdims[1], *len = pdims + 4, *start = len + M, i; double aux = exp(*par); /* parameter assumed in unconstrained form */ *par = (aux + *inf)/(aux + 1.0); for(i = 0; i < M; i++) { double *Factor = R_Calloc(len[i] * len[i], double); compSymm_fact(par, &len[i], Factor, logdet); mult_mat(Xy + start[i], N, Factor, len[i], len[i], len[i], Xy + start[i], N, *ZXcol); R_Free(Factor); } } #if 0 // corHF() is not implemented /* Huyn-Feldt class */ static void HF_mat(double *par, int *time, int *n, double *mat) { int i, j, np1 = *n + 1; for(i = 0; i < *n; i++) { mat[i * np1] = par[time[i]]; for(j = i + 1; j < *n; j++) { *(mat + i + j * (*n)) = *(mat + j + i * (*n)) = 0.5 * (par[time[i]] + par[time[j]]) - 1.0; } } } void HF_matList(double *par, int *maxC, int *time, int *pdims, double *mat) { int i, M = pdims[1], *len = pdims + 4; /* parameter assumed in unconstrained form */ double inf = -1.0/(2.0 * ((double) *maxC)); for(i = 0; i < *maxC; i++) { par[i] = 2.0 * (exp(par[i]) + inf) + 1.0; } for(i = 0; i < M; i++) { HF_mat(par, time, &len[i], mat); mat += len[i] * len[i]; time += len[i]; } } static void HF_fact(double *par, int *time, int *n, double *mat, double *logdet) { int job = 11L, info, i, nsq = *n * (*n), np1 = *n + 1; double *work = R_Calloc(*n, double), *work1 = R_Calloc(nsq, double); HF_mat(par, time, n, mat); F77_CALL(chol) (mat, n, n, mat, &info); for(i = 0; i < *n; i++) { work1[i * np1] = 1; F77_CALL(dtrsl) (mat, n, n, work1 + i * (*n), &job, &info); *logdet -= log(fabs(mat[i * np1])); } Memcpy(mat, work1, nsq); R_Free(work); R_Free(work1); } void HF_factList(double *par, int *maxC, int *time, int *pdims, double *FactorL, double *logdet) { int i, M = pdims[1], *len = pdims + 4; /* parameter assumed in unconstrained form */ double inf = -1.0/(2.0 * ((double) *maxC)); for(i = 0; i < *maxC; i++) { par[i] = 2.0 * (exp(par[i]) + inf) + 1.0; } for(i = 0; i < M; i++) { HF_fact(par, time, &len[i], FactorL, logdet); FactorL += len[i] * len[i]; time += len[i]; } } void HF_recalc(double *Xy, int *pdims, int *ZXcol, double *par, int *time, int *maxC, double *logdet) { int N = pdims[0], M = pdims[1], *len = pdims + 4, *start = len + M, i; double inf = -1.0/(2.0 * ((double) *maxC)); /* parameter assumed in unconstrained form */ for(i = 0; i < *maxC; i++) { par[i] = 2.0 * (exp(par[i]) + inf) + 1.0; } for(i = 0; i < M; i++) { double *Factor = R_Calloc(len[i] * len[i], double); HF_fact(par, time + start[i], &len[i], Factor, logdet); mult_mat(Xy + start[i], N, Factor, len[i], len[i], len[i], Xy + start[i], N, *ZXcol); R_Free(Factor); } } #endif // corHF() /* Spatial correlation structures */ /* Spherical class */ static double spher_corr(double val) { if (val < 1) return(1.0 - 1.5 * val + 0.5 * pow(val, 3)); else return(0.0); } /* Exponential class */ static double exp_corr(double val) { return(exp(-val)); } /* Gaussian class */ static double Gaus_corr(double val) { return(exp(-(val * val))); } /* Linear class */ static double lin_corr(double val) { if (val < 1) return(1.0 - val); else return(0.0); } /* Rational class */ static double ratio_corr(double val) { double val2 = val * val; return(1/(1+val2)); } /* Dummy class */ static double dummy_corr(double val) { error(_("Unknown spatial correlation class")); return(0.0); /* -Wall */ } /* methods for the virtual class */ static void spatial_mat(double *par, double *dist, int *n, int *nug, double (*corr)(double ), double *mat) { int i, j, np1 = *n + 1; double aux, *sdist, ratio = 1.0; sdist = dist; if (*nug) ratio = par[1]; for(i = 0; i < *n; i++) { mat[i * np1] = 1.0; for(j = i + 1; j < *n; j++, sdist++) { aux = *sdist / *par; *(mat + i + j * (*n)) = *(mat + j + i * (*n)) = ratio * corr(aux); } } } void spatial_matList(double *par, int *nug, double *dist, int *pdims, double *minD, double *mat) { int i, M = pdims[1], spClass = pdims[2], *len = pdims + 4, *start = len + M; double aux, (*corr)(double ) = dummy_corr; /* parameter assumed in unconstrained form */ par[0] = exp(par[0]); if (*nug == 1) { aux = exp(par[1]); par[1] = 1 / (1.0 + aux); /* 1 - nugget */ } switch(spClass) { case 1: /* spherical */ corr = spher_corr; par[0] += *minD; break; case 2: /* exponential */ corr = exp_corr; break; case 3: /* Gaussian */ corr = Gaus_corr; break; case 4: /* linear */ corr = lin_corr; par[0] += *minD; break; case 5: /* rational quadratic */ corr = ratio_corr; break; default: error(_("Unknown spatial correlation class")); break; } for(i = 0; i < M; i++) { spatial_mat(par, dist + start[i], &len[i], nug, corr, mat); mat += len[i] * len[i]; } } static void spatial_fact(double *par, double *dist, int *n, int *nug, double (*corr) (double ), double *mat, double *logdet) { int job = 11L, info, i, nsq = *n * (*n), np1 = *n + 1; double *work = R_Calloc(*n, double), *work1 = R_Calloc(nsq, double); spatial_mat(par, dist, n, nug, corr, mat); F77_CALL(chol) (mat, n, n, mat, &info); for(i = 0; i < *n; i++) { work1[i * np1] = 1; F77_CALL(dtrsl) (mat, n, n, work1 + i * (*n), &job, &info); *logdet -= log(fabs(mat[i * np1])); } Memcpy(mat, work1, nsq); R_Free(work); R_Free(work1); } void spatial_factList(double *par, int *nug, double *dist, int *pdims, double *minD, double *FactorL, double *logdet) { int i, M = pdims[1], spClass = pdims[2], *len = pdims + 4, *start = len + M; double aux, (*corr)(double ) = dummy_corr; /* parameter assumed in unconstrained form */ par[0] = exp(par[0]); if (*nug == 1) { aux = exp(par[1]); par[1] = 1 / (1.0 + aux); /* 1 - nugget */ } switch(spClass) { case 1: /* spherical */ corr = spher_corr; par[0] += *minD; break; case 2: /* exponential */ corr = exp_corr; break; case 3: /* Gaussian */ corr = Gaus_corr; break; case 4: /* linear */ corr = lin_corr; par[0] += *minD; break; case 5: /* rational quadratic */ corr = ratio_corr; break; default: error(_("Unknown spatial correlation class")); break; } for(i = 0; i < M; i++) { spatial_fact(par, dist + start[i], &len[i], nug, corr, FactorL, logdet); FactorL += len[i] * len[i]; } } void spatial_recalc(double *Xy, int *pdims, int *ZXcol, double *par, double *dist, double *minD, int *nug, double *logdet) { int N = pdims[0], M = pdims[1], spClass = pdims[2], *len = pdims + 4, *start = len + M, i; double aux, (*corr)(double ) = dummy_corr, *sXy; /* parameter assumed in unconstrained form */ par[0] = exp(par[0]); if (*nug == 1) { aux = exp(par[1]); par[1] = 1 / (1.0 + aux); /* 1 - nugget */ } switch(spClass) { case 1: /* spherical */ corr = spher_corr; par[0] += *minD; break; case 2: /* exponential */ corr = exp_corr; break; case 3: /* Gaussian */ corr = Gaus_corr; break; case 4: /* linear */ corr = lin_corr; par[0] += *minD; break; case 5: /* rational quadratic */ corr = ratio_corr; break; default: error(_("Unknown spatial correlation class")); break; } for(i = 0, sXy = Xy; i < M; i++) { double *Factor = R_Calloc(len[i] * len[i], double); spatial_fact(par, dist + start[i], &len[i], nug, corr, Factor, logdet); mult_mat(sXy, N, Factor, len[i], len[i], len[i], sXy, N, *ZXcol); sXy += len[i]; R_Free(Factor); } } nlme/src/rs.f0000644000176000001440000005107514251721455012635 0ustar ripleyusers DOUBLE PRECISION FUNCTION EPSLON (X) DOUBLE PRECISION X C C ESTIMATE UNIT ROUNDOFF IN QUANTITIES OF SIZE X. C DOUBLE PRECISION A,B,C,EPS C C THIS PROGRAM SHOULD FUNCTION PROPERLY ON ALL SYSTEMS C SATISFYING THE FOLLOWING TWO ASSUMPTIONS, C 1. THE BASE USED IN REPRESENTING FLOATING POINT C NUMBERS IS NOT A POWER OF THREE. C 2. THE QUANTITY A IN STATEMENT 10 IS REPRESENTED TO C THE ACCURACY USED IN FLOATING POINT VARIABLES C THAT ARE STORED IN MEMORY. C THE STATEMENT NUMBER 10 AND THE GO TO 10 ARE INTENDED TO C FORCE OPTIMIZING COMPILERS TO GENERATE CODE SATISFYING C ASSUMPTION 2. C UNDER THESE ASSUMPTIONS, IT SHOULD BE TRUE THAT, C A IS NOT EXACTLY EQUAL TO FOUR-THIRDS, C B HAS A ZERO FOR ITS LAST BIT OR DIGIT, C C IS NOT EXACTLY EQUAL TO ONE, C EPS MEASURES THE SEPARATION OF 1.0 FROM C THE NEXT LARGER FLOATING POINT NUMBER. C THE DEVELOPERS OF EISPACK WOULD APPRECIATE BEING INFORMED C ABOUT ANY SYSTEMS WHERE THESE ASSUMPTIONS DO NOT HOLD. C C THIS VERSION DATED 4/6/83. C A = 4.0D0/3.0D0 10 B = A - 1.0D0 C = B + B + B EPS = DABS(C-1.0D0) IF (EPS .EQ. 0.0D0) GO TO 10 EPSLON = EPS*DABS(X) RETURN END c Use a wrapper for C99 hypot, which is guaranteed to handle special values c such as NaN. DOUBLE PRECISION FUNCTION PYTHAG(A,B) DOUBLE PRECISION A,B,P CALL HYPOT(A,B,P) PYTHAG = P RETURN END C$$$ DOUBLE PRECISION FUNCTION PYTHAG(A,B) C$$$ DOUBLE PRECISION A,B C$$$C C$$$C FINDS DSQRT(A**2+B**2) WITHOUT OVERFLOW OR DESTRUCTIVE UNDERFLOW C$$$C C$$$ DOUBLE PRECISION P,R,S,T,U C$$$ P = DMAX1(DABS(A),DABS(B)) C$$$c 'nan' did lead to infinite loop before 2018-02: C$$$ IF ((risfinite(P) .ne. 0) .and. (P .NE. 0.0D0)) THEN C$$$ R = (DMIN1(DABS(A),DABS(B))/P)**2 C$$$ 10 CONTINUE C$$$ T = 4.0D0 + R C$$$ IF (T .EQ. 4.0D0) GO TO 20 C$$$ S = R/T C$$$ U = 1.0D0 + 2.0D0*S C$$$ P = U*P C$$$ R = (S/U)**2 * R C$$$ GO TO 10 C$$$ END IF C$$$ 20 PYTHAG = P C$$$ RETURN C$$$ END SUBROUTINE RS(NM,N,A,W,MATZ,Z,FV1,FV2,IERR) C INTEGER N,NM,IERR,MATZ DOUBLE PRECISION A(NM,N),W(N),Z(NM,N),FV1(N),FV2(N) C C THIS SUBROUTINE CALLS THE RECOMMENDED SEQUENCE OF C SUBROUTINES FROM THE EIGENSYSTEM SUBROUTINE PACKAGE (EISPACK) C TO FIND THE EIGENVALUES AND EIGENVECTORS (IF DESIRED) C OF A REAL SYMMETRIC MATRIX. C C ON INPUT C C NM MUST BE SET TO THE ROW DIMENSION OF THE TWO-DIMENSIONAL C ARRAY PARAMETERS AS DECLARED IN THE CALLING PROGRAM C DIMENSION STATEMENT. C C N IS THE ORDER OF THE MATRIX A. C C A CONTAINS THE REAL SYMMETRIC MATRIX. C C MATZ IS AN INTEGER VARIABLE SET EQUAL TO ZERO IF C ONLY EIGENVALUES ARE DESIRED. OTHERWISE IT IS SET TO C ANY NON-ZERO INTEGER FOR BOTH EIGENVALUES AND EIGENVECTORS. C C ON OUTPUT C C W CONTAINS THE EIGENVALUES IN ASCENDING ORDER. C C Z CONTAINS THE EIGENVECTORS IF MATZ IS NOT ZERO. C C IERR IS AN INTEGER OUTPUT VARIABLE SET EQUAL TO AN ERROR C COMPLETION CODE DESCRIBED IN THE DOCUMENTATION FOR TQLRAT C AND TQL2. THE NORMAL COMPLETION CODE IS ZERO. C C FV1 AND FV2 ARE TEMPORARY STORAGE ARRAYS. C C QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW, C MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY C C THIS VERSION DATED AUGUST 1983. C C ------------------------------------------------------------------ C IF (N .LE. NM) GO TO 10 IERR = 10 * N GO TO 50 C 10 IF (MATZ .NE. 0) GO TO 20 C .......... FIND EIGENVALUES ONLY .......... CALL TRED1(NM,N,A,W,FV1,FV2) CALL TQLRAT(N,W,FV2,IERR) GO TO 50 C .......... FIND BOTH EIGENVALUES AND EIGENVECTORS .......... 20 CALL TRED2(NM,N,A,W,FV1,Z) CALL TQL2(NM,N,W,FV1,Z,IERR) 50 RETURN END SUBROUTINE TQL2(NM,N,D,E,Z,IERR) C INTEGER I,J,K,L,M,N,II,L1,L2,NM,MML,IERR DOUBLE PRECISION D(N),E(N),Z(NM,N) DOUBLE PRECISION C,C2,C3,DL1,EL1,F,G,H,P,R,S,S2,TST1,TST2,PYTHAG C C THIS SUBROUTINE IS A TRANSLATION OF THE ALGOL PROCEDURE TQL2, C NUM. MATH. 11, 293-306(1968) BY BOWDLER, MARTIN, REINSCH, AND C WILKINSON. C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 227-240(1971). C C THIS SUBROUTINE FINDS THE EIGENVALUES AND EIGENVECTORS C OF A SYMMETRIC TRIDIAGONAL MATRIX BY THE QL METHOD. C THE EIGENVECTORS OF A FULL SYMMETRIC MATRIX CAN ALSO C BE FOUND IF TRED2 HAS BEEN USED TO REDUCE THIS C FULL MATRIX TO TRIDIAGONAL FORM. C C ON INPUT C C NM MUST BE SET TO THE ROW DIMENSION OF TWO-DIMENSIONAL C ARRAY PARAMETERS AS DECLARED IN THE CALLING PROGRAM C DIMENSION STATEMENT. C C N IS THE ORDER OF THE MATRIX. C C D CONTAINS THE DIAGONAL ELEMENTS OF THE INPUT MATRIX. C C E CONTAINS THE SUBDIAGONAL ELEMENTS OF THE INPUT MATRIX C IN ITS LAST N-1 POSITIONS. E(1) IS ARBITRARY. C C Z CONTAINS THE TRANSFORMATION MATRIX PRODUCED IN THE C REDUCTION BY TRED2, IF PERFORMED. IF THE EIGENVECTORS C OF THE TRIDIAGONAL MATRIX ARE DESIRED, Z MUST CONTAIN C THE IDENTITY MATRIX. C C ON OUTPUT C C D CONTAINS THE EIGENVALUES IN ASCENDING ORDER. IF AN C ERROR EXIT IS MADE, THE EIGENVALUES ARE CORRECT BUT C UNORDERED FOR INDICES 1,2,...,IERR-1. C C E HAS BEEN DESTROYED. C C Z CONTAINS ORTHONORMAL EIGENVECTORS OF THE SYMMETRIC C TRIDIAGONAL (OR FULL) MATRIX. IF AN ERROR EXIT IS MADE, C Z CONTAINS THE EIGENVECTORS ASSOCIATED WITH THE STORED C EIGENVALUES. C C IERR IS SET TO C ZERO FOR NORMAL RETURN, C J IF THE J-TH EIGENVALUE HAS NOT BEEN C DETERMINED AFTER 30 ITERATIONS. C C CALLS PYTHAG FOR DSQRT(A*A + B*B) . C C QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW, C MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY C C THIS VERSION DATED AUGUST 1983. C C ------------------------------------------------------------------ c c unnecessary initialization of C3 and S2 to keep g77 -Wall happy c C3 = 0.0D0 S2 = 0.0D0 C IERR = 0 IF (N .EQ. 1) GO TO 1001 C DO I = 2, N E(I-1) = E(I) end do C F = 0.0D0 TST1 = 0.0D0 E(N) = 0.0D0 C DO 240 L = 1, N J = 0 H = DABS(D(L)) + DABS(E(L)) IF (TST1 .LT. H) TST1 = H C .......... LOOK FOR SMALL SUB-DIAGONAL ELEMENT .......... DO M = L, N TST2 = TST1 + DABS(E(M)) IF (TST2 .EQ. TST1) GO TO 120 C .......... E(N) IS ALWAYS ZERO, SO THERE IS NO EXIT C THROUGH THE BOTTOM OF THE LOOP .......... end do C 120 IF (M .EQ. L) GO TO 220 130 IF (J .EQ. 30) GO TO 1000 J = J + 1 C .......... FORM SHIFT .......... L1 = L + 1 L2 = L1 + 1 G = D(L) P = (D(L1) - G) / (2.0D0 * E(L)) R = PYTHAG(P,1.0D0) D(L) = E(L) / (P + DSIGN(R,P)) D(L1) = E(L) * (P + DSIGN(R,P)) DL1 = D(L1) H = G - D(L) IF (L2 .GT. N) GO TO 145 C DO I = L2, N D(I) = D(I) - H end do C 145 F = F + H C .......... QL TRANSFORMATION .......... P = D(M) C = 1.0D0 C2 = C EL1 = E(L1) S = 0.0D0 MML = M - L C .......... FOR I=M-1 STEP -1 UNTIL L DO -- .......... DO 200 II = 1, MML C3 = C2 C2 = C S2 = S I = M - II G = C * E(I) H = C * P R = PYTHAG(P,E(I)) E(I+1) = S * R S = E(I) / R C = P / R P = C * D(I) - S * G D(I+1) = H + S * (C * G + S * D(I)) C .......... FORM VECTOR .......... DO 180 K = 1, N H = Z(K,I+1) Z(K,I+1) = S * Z(K,I) + C * H Z(K,I) = C * Z(K,I) - S * H 180 CONTINUE C 200 CONTINUE C P = -S * S2 * C3 * EL1 * E(L) / DL1 E(L) = S * P D(L) = C * P TST2 = TST1 + DABS(E(L)) IF (TST2 .GT. TST1) GO TO 130 220 D(L) = D(L) + F 240 CONTINUE C .......... ORDER EIGENVALUES AND EIGENVECTORS .......... DO 300 II = 2, N I = II - 1 K = I P = D(I) C DO 260 J = II, N IF (D(J) .GE. P) GO TO 260 K = J P = D(J) 260 CONTINUE C IF (K .EQ. I) GO TO 300 D(K) = D(I) D(I) = P C DO 280 J = 1, N P = Z(J,I) Z(J,I) = Z(J,K) Z(J,K) = P 280 CONTINUE C 300 CONTINUE C GO TO 1001 C .......... SET ERROR -- NO CONVERGENCE TO AN C EIGENVALUE AFTER 30 ITERATIONS .......... 1000 IERR = L 1001 RETURN END SUBROUTINE TQLRAT(N,D,E2,IERR) C INTEGER I,J,L,M,N,II,L1,MML,IERR DOUBLE PRECISION D(N),E2(N) DOUBLE PRECISION B,C,F,G,H,P,R,S,T,EPSLON,PYTHAG C C THIS SUBROUTINE IS A TRANSLATION OF THE ALGOL PROCEDURE TQLRAT, C ALGORITHM 464, COMM. ACM 16, 689(1973) BY REINSCH. C C THIS SUBROUTINE FINDS THE EIGENVALUES OF A SYMMETRIC C TRIDIAGONAL MATRIX BY THE RATIONAL QL METHOD. C C ON INPUT C C N IS THE ORDER OF THE MATRIX. C C D CONTAINS THE DIAGONAL ELEMENTS OF THE INPUT MATRIX. C C E2 CONTAINS THE SQUARES OF THE SUBDIAGONAL ELEMENTS OF THE C INPUT MATRIX IN ITS LAST N-1 POSITIONS. E2(1) IS ARBITRARY. C C ON OUTPUT C C D CONTAINS THE EIGENVALUES IN ASCENDING ORDER. IF AN C ERROR EXIT IS MADE, THE EIGENVALUES ARE CORRECT AND C ORDERED FOR INDICES 1,2,...IERR-1, BUT MAY NOT BE C THE SMALLEST EIGENVALUES. C C E2 HAS BEEN DESTROYED. C C IERR IS SET TO C ZERO FOR NORMAL RETURN, C J IF THE J-TH EIGENVALUE HAS NOT BEEN C DETERMINED AFTER 30 ITERATIONS. C C CALLS PYTHAG FOR DSQRT(A*A + B*B) . C C QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW, C MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY C C THIS VERSION DATED AUGUST 1983. C C ------------------------------------------------------------------ c c unnecessary initialization of B and C to keep g77 -Wall happy c B = 0.0D0 C = 0.0D0 C IERR = 0 IF (N .EQ. 1) GO TO 1001 C DO I = 2, N E2(I-1) = E2(I) end do C F = 0.0D0 T = 0.0D0 E2(N) = 0.0D0 C DO 290 L = 1, N J = 0 H = DABS(D(L)) + DSQRT(E2(L)) IF (T .GT. H) GO TO 105 T = H B = EPSLON(T) C = B * B C .......... LOOK FOR SMALL SQUARED SUB-DIAGONAL ELEMENT .......... 105 DO 110 M = L, N IF (E2(M) .LE. C) GO TO 120 C .......... E2(N) IS ALWAYS ZERO, SO THERE IS NO EXIT C THROUGH THE BOTTOM OF THE LOOP .......... 110 CONTINUE C 120 IF (M .EQ. L) GO TO 210 130 IF (J .EQ. 30) GO TO 1000 J = J + 1 C .......... FORM SHIFT .......... L1 = L + 1 S = DSQRT(E2(L)) G = D(L) P = (D(L1) - G) / (2.0D0 * S) R = PYTHAG(P,1.0D0) D(L) = S / (P + DSIGN(R,P)) H = G - D(L) C DO I = L1, N D(I) = D(I) - H end do C F = F + H C .......... RATIONAL QL TRANSFORMATION .......... G = D(M) IF (G .EQ. 0.0D0) G = B H = G S = 0.0D0 MML = M - L C .......... FOR I=M-1 STEP -1 UNTIL L DO -- .......... DO 200 II = 1, MML I = M - II P = G * H R = P + E2(I) E2(I+1) = S * R S = E2(I) / R D(I+1) = H + S * (H + D(I)) G = D(I) - E2(I) / G IF (G .EQ. 0.0D0) G = B H = G * P / R 200 CONTINUE C E2(L) = S * G D(L) = H C .......... GUARD AGAINST UNDERFLOW IN CONVERGENCE TEST .......... IF (H .EQ. 0.0D0) GO TO 210 IF (DABS(E2(L)) .LE. DABS(C/H)) GO TO 210 E2(L) = H * E2(L) IF (E2(L) .NE. 0.0D0) GO TO 130 210 P = D(L) + F C .......... ORDER EIGENVALUES .......... IF (L .EQ. 1) GO TO 250 C .......... FOR I=L STEP -1 UNTIL 2 DO -- .......... DO 230 II = 2, L I = L + 2 - II IF (P .GE. D(I-1)) GO TO 270 D(I) = D(I-1) 230 CONTINUE C 250 I = 1 270 D(I) = P 290 CONTINUE C GO TO 1001 C .......... SET ERROR -- NO CONVERGENCE TO AN C EIGENVALUE AFTER 30 ITERATIONS .......... 1000 IERR = L 1001 RETURN END SUBROUTINE TRED1(NM,N,A,D,E,E2) C INTEGER I,J,K,L,N,II,NM,JP1 DOUBLE PRECISION A(NM,N),D(N),E(N),E2(N) DOUBLE PRECISION F,G,H,SCALE C C THIS SUBROUTINE IS A TRANSLATION OF THE ALGOL PROCEDURE TRED1, C NUM. MATH. 11, 181-195(1968) BY MARTIN, REINSCH, AND WILKINSON. C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 212-226(1971). C C THIS SUBROUTINE REDUCES A REAL SYMMETRIC MATRIX C TO A SYMMETRIC TRIDIAGONAL MATRIX USING C ORTHOGONAL SIMILARITY TRANSFORMATIONS. C C ON INPUT C C NM MUST BE SET TO THE ROW DIMENSION OF TWO-DIMENSIONAL C ARRAY PARAMETERS AS DECLARED IN THE CALLING PROGRAM C DIMENSION STATEMENT. C C N IS THE ORDER OF THE MATRIX. C C A CONTAINS THE REAL SYMMETRIC INPUT MATRIX. ONLY THE C LOWER TRIANGLE OF THE MATRIX NEED BE SUPPLIED. C C ON OUTPUT C C A CONTAINS INFORMATION ABOUT THE ORTHOGONAL TRANS- C FORMATIONS USED IN THE REDUCTION IN ITS STRICT LOWER C TRIANGLE. THE FULL UPPER TRIANGLE OF A IS UNALTERED. C C D CONTAINS THE DIAGONAL ELEMENTS OF THE TRIDIAGONAL MATRIX. C C E CONTAINS THE SUBDIAGONAL ELEMENTS OF THE TRIDIAGONAL C MATRIX IN ITS LAST N-1 POSITIONS. E(1) IS SET TO ZERO. C C E2 CONTAINS THE SQUARES OF THE CORRESPONDING ELEMENTS OF E. C E2 MAY COINCIDE WITH E IF THE SQUARES ARE NOT NEEDED. C C QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW, C MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY C C THIS VERSION DATED AUGUST 1983. C C ------------------------------------------------------------------ C DO 100 I = 1, N D(I) = A(N,I) A(N,I) = A(I,I) 100 CONTINUE C .......... FOR I=N STEP -1 UNTIL 1 DO -- .......... DO 300 II = 1, N I = N + 1 - II L = I - 1 H = 0.0D0 SCALE = 0.0D0 IF (L .LT. 1) GO TO 130 C .......... SCALE ROW (ALGOL TOL THEN NOT NEEDED) .......... DO K = 1, L SCALE = SCALE + DABS(D(K)) end do C IF (SCALE .NE. 0.0D0) GO TO 140 C DO J = 1, L D(J) = A(L,J) A(L,J) = A(I,J) A(I,J) = 0.0D0 end do C 130 E(I) = 0.0D0 E2(I) = 0.0D0 GO TO 300 C 140 DO K = 1, L D(K) = D(K) / SCALE H = H + D(K) * D(K) end do C E2(I) = SCALE * SCALE * H F = D(L) G = -DSIGN(DSQRT(H),F) E(I) = SCALE * G H = H - F * G D(L) = F - G IF (L .EQ. 1) GO TO 285 C .......... FORM A*U .......... DO J = 1, L E(J) = 0.0D0 end do C DO 240 J = 1, L F = D(J) G = E(J) + A(J,J) * F JP1 = J + 1 IF (L .LT. JP1) GO TO 220 C DO K = JP1, L G = G + A(K,J) * D(K) E(K) = E(K) + A(K,J) * F end do C 220 E(J) = G 240 CONTINUE C .......... FORM P .......... F = 0.0D0 C DO J = 1, L E(J) = E(J) / H F = F + E(J) * D(J) end do C H = F / (H + H) C .......... FORM Q .......... DO J = 1, L E(J) = E(J) - H * D(J) end do C .......... FORM REDUCED A .......... DO J = 1, L F = D(J) G = E(J) C DO K = J, L A(K,J) = A(K,J) - F * E(K) - G * D(K) end do C end do C 285 DO J = 1, L F = D(J) D(J) = A(L,J) A(L,J) = A(I,J) A(I,J) = F * SCALE end do C 300 CONTINUE C RETURN END SUBROUTINE TRED2(NM,N,A,D,E,Z) C INTEGER I,J,K,L,N,II,NM,JP1 DOUBLE PRECISION A(NM,N),D(N),E(N),Z(NM,N) DOUBLE PRECISION F,G,H,HH,SCALE C C THIS SUBROUTINE IS A TRANSLATION OF THE ALGOL PROCEDURE TRED2, C NUM. MATH. 11, 181-195(1968) BY MARTIN, REINSCH, AND WILKINSON. C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 212-226(1971). C C THIS SUBROUTINE REDUCES A REAL SYMMETRIC MATRIX TO A C SYMMETRIC TRIDIAGONAL MATRIX USING AND ACCUMULATING C ORTHOGONAL SIMILARITY TRANSFORMATIONS. C C ON INPUT C C NM MUST BE SET TO THE ROW DIMENSION OF TWO-DIMENSIONAL C ARRAY PARAMETERS AS DECLARED IN THE CALLING PROGRAM C DIMENSION STATEMENT. C C N IS THE ORDER OF THE MATRIX. C C A CONTAINS THE REAL SYMMETRIC INPUT MATRIX. ONLY THE C LOWER TRIANGLE OF THE MATRIX NEED BE SUPPLIED. C C ON OUTPUT C C D CONTAINS THE DIAGONAL ELEMENTS OF THE TRIDIAGONAL MATRIX. C C E CONTAINS THE SUBDIAGONAL ELEMENTS OF THE TRIDIAGONAL C MATRIX IN ITS LAST N-1 POSITIONS. E(1) IS SET TO ZERO. C C Z CONTAINS THE ORTHOGONAL TRANSFORMATION MATRIX C PRODUCED IN THE REDUCTION. C C A AND Z MAY COINCIDE. IF DISTINCT, A IS UNALTERED. C C QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW, C MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY C C THIS VERSION DATED AUGUST 1983. C C ------------------------------------------------------------------ C DO I = 1, N DO J = I, N Z(J,I) = A(J,I) end do D(I) = A(N,I) end do C IF (N .EQ. 1) GO TO 510 C .......... FOR I=N STEP -1 UNTIL 2 DO -- .......... DO 300 II = 2, N I = N + 2 - II L = I - 1 H = 0.0D0 SCALE = 0.0D0 IF (L .LT. 2) GO TO 130 C .......... SCALE ROW (ALGOL TOL THEN NOT NEEDED) .......... DO K = 1, L SCALE = SCALE + DABS(D(K)) end do C IF (SCALE .NE. 0.0D0) GO TO 140 130 E(I) = D(L) C DO J = 1, L D(J) = Z(L,J) Z(I,J) = 0.0D0 Z(J,I) = 0.0D0 end do C GO TO 290 C 140 DO K = 1, L D(K) = D(K) / SCALE H = H + D(K) * D(K) end do C F = D(L) G = -DSIGN(DSQRT(H),F) E(I) = SCALE * G H = H - F * G D(L) = F - G C .......... FORM A*U .......... DO J = 1, L E(J) = 0.0D0 end do C DO 240 J = 1, L F = D(J) Z(J,I) = F G = E(J) + Z(J,J) * F JP1 = J + 1 IF (L .LT. JP1) GO TO 220 C DO K = JP1, L G = G + Z(K,J) * D(K) E(K) = E(K) + Z(K,J) * F end do C 220 E(J) = G 240 CONTINUE C .......... FORM P .......... F = 0.0D0 C DO J = 1, L E(J) = E(J) / H F = F + E(J) * D(J) end do C HH = F / (H + H) C .......... FORM Q .......... DO J = 1, L E(J) = E(J) - HH * D(J) end do C .......... FORM REDUCED A .......... DO 280 J = 1, L F = D(J) G = E(J) C DO K = J, L Z(K,J) = Z(K,J) - F * E(K) - G * D(K) end do C D(J) = Z(L,J) Z(I,J) = 0.0D0 280 CONTINUE C 290 D(I) = H 300 CONTINUE C .......... ACCUMULATION OF TRANSFORMATION MATRICES .......... DO 500 I = 2, N L = I - 1 Z(N,L) = Z(L,L) Z(L,L) = 1.0D0 H = D(I) IF (H .ne. 0.0D0) then DO K = 1, L D(K) = Z(K,I) / H end do C DO J = 1, L G = 0.0D0 DO K = 1, L G = G + Z(K,I) * Z(K,J) end do C DO K = 1, L Z(K,J) = Z(K,J) - G * D(K) end do end do end if C 380 DO K = 1, L Z(K,I) = 0.0D0 end do C 500 CONTINUE C 510 DO I = 1, N D(I) = Z(N,I) Z(N,I) = 0.0D0 end do C Z(N,N) = 1.0D0 E(1) = 0.0D0 RETURN END nlme/src/nlmefit.c0000644000176000001440000011315414661543635013650 0ustar ripleyusers/* Routines for calculation of the log-likelihood or restricted log-likelihood with mixed-effects models. Copyright (C) 2007-2024 The R Core Team Copyright (C) 1997-2005 Douglas M. Bates , Jose C. Pinheiro, Saikat DebRoy This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include // for DBL_EPSILON #include #include "nlmefit.h" #include "matrix.h" #include "pdMat.h" // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions static double *_sigma_; /* This to provide msmnh out-of-band the sigma. */ extern void F77_NAME(msmnh)(void); static int ** setOffsets(int ** base, int * ngrp, int Qp2) { int i, **ptrVec = R_Calloc((size_t) Qp2, int *); for (i = 0; i < Qp2; i++) { ptrVec[i] = *base; *base += ngrp[i]; } return ptrVec; } dimPTR dims(int *pdims) { /* constructor for a dims object */ dimPTR value = R_Calloc((size_t) 1, struct dim_struct); int *base, Qp2, *ngrp; value->N = (int) pdims[0]; value->ZXrows = pdims[1]; value->ZXcols = pdims[2]; value->Q = pdims[3]; Qp2 = (value->Q) + 2; value->Srows = pdims[4]; value->q = pdims + 5; ngrp = value->ngrp = value->q + Qp2; value->DmOff = value->ngrp + Qp2; value->ncol = value->DmOff + Qp2; value->nrot = value->ncol + Qp2; base = value->nrot + Qp2; value->ZXoff = setOffsets(&base, ngrp, Qp2); value->ZXlen = setOffsets(&base, ngrp, Qp2); value->SToff = setOffsets(&base, ngrp, Qp2); value->DecOff = setOffsets(&base, ngrp, Qp2); value->DecLen = setOffsets(&base, ngrp, Qp2); return value; } SEXP getListElement(SEXP list, char *str) { SEXP elmt = R_NilValue, names = getAttrib(list, R_NamesSymbol); int i; for (i = 0; i < length(list); i++) if(strcmp(CHAR(STRING_ELT(names, i)), str) == 0) { elmt = VECTOR_ELT(list, i); break; } return elmt; } dimPTR /* create a dimensions object directly */ dimS(SEXP d) /* from an SEXP */ { int i, Qp2; SEXP tmp; dimPTR value = R_Calloc((size_t) 1, struct dim_struct); value->N = INTEGER(coerceVector(getListElement(d, "N"), INTSXP))[0]; value->ZXrows = INTEGER(coerceVector(getListElement(d, "ZXrows"), INTSXP))[0]; value->ZXcols = INTEGER(coerceVector(getListElement(d, "ZXcols"), INTSXP))[0]; value->Q = INTEGER(coerceVector(getListElement(d, "Q"), INTSXP))[0]; value->Srows = INTEGER(coerceVector(getListElement(d, "Srows"), INTSXP))[0]; Qp2 = value->Q + 2; value->q = INTEGER(coerceVector(getListElement(d, "q"), INTSXP)); value->ngrp = INTEGER(coerceVector(getListElement(d, "ngrp"), INTSXP)); value->DmOff = INTEGER(coerceVector(getListElement(d, "DmOff"), INTSXP)); value->ncol = INTEGER(coerceVector(getListElement(d, "ncol"), INTSXP)); value->nrot = INTEGER(coerceVector(getListElement(d, "nrot"), INTSXP)); value->ZXoff = R_Calloc(Qp2, int *); PROTECT(tmp = coerceVector(getListElement(d, "ZXoff"), VECSXP)); for (i = 0; i < Qp2; i++) { (value->ZXoff)[i] = INTEGER(coerceVector(VECTOR_ELT(tmp, i), INTSXP)); } UNPROTECT(1); value->ZXlen = R_Calloc(Qp2, int *); PROTECT(tmp = coerceVector(getListElement(d, "ZXlen"), VECSXP)); for (i = 0; i < Qp2; i++) { (value->ZXlen)[i] = INTEGER(coerceVector(VECTOR_ELT(tmp, i), INTSXP)); } UNPROTECT(1); value->SToff = R_Calloc(Qp2, int *); PROTECT(tmp = coerceVector(getListElement(d, "SToff"), VECSXP)); for (i = 0; i < Qp2; i++) { (value->SToff)[i] = INTEGER(coerceVector(VECTOR_ELT(tmp, i), INTSXP)); } UNPROTECT(1); value->DecOff = R_Calloc(Qp2, int *); PROTECT(tmp = coerceVector(getListElement(d, "DecOff"), VECSXP)); for (i = 0; i < Qp2; i++) { (value->DecOff)[i] = INTEGER(coerceVector(VECTOR_ELT(tmp, i), INTSXP)); } UNPROTECT(1); value->DecLen = R_Calloc(Qp2, int *); PROTECT(tmp = coerceVector(getListElement(d, "DecLen"), VECSXP)); for (i = 0; i < Qp2; i++) { (value->DecLen)[i] = INTEGER(coerceVector(VECTOR_ELT(tmp, i), INTSXP)); } UNPROTECT(1); return value; } void dimFree(dimPTR this) { R_Free(this->DecOff); R_Free(this->DecLen); R_Free(this->SToff); R_Free(this->ZXlen); R_Free(this->ZXoff); R_Free(this); } int count_DmHalf_pars( dimPTR dd, int *pdClass ) { int i, result; for ( i = 0, result = 0; i < dd->Q; i++ ) { switch( pdClass[ i ] ) { case 0: case 4: result += ( (dd->q)[ i ] * ( (dd->q)[ i ] + 1 ) ) / 2; break; case 1: result += (dd->q)[ i ]; break; case 2: result += 1; break; case 3: result += 2; } } return result; } double * generate_DmHalf( double *DmHalf, dimPTR dd, int *pdClass, double *pars ) { /* Expand parameters to DmHalf arrays */ int i, j, q, Q = dd->Q; double diag; for (i = 0; i < Q; i++) { q = (dd->q)[ i ]; switch (pdClass[i]) { case 0: /* default: unstructured */ matrixLog_pd( DmHalf + (dd->DmOff)[ i ], dd->q + i, pars ); pars += (q * (q + 1))/2; break; case 1: /* diagonal */ for (j = 0; j < q; j++) { DmHalf[ (dd->DmOff)[i] + j * (q + 1) ] = exp( *pars++ ); } break; case 2: /* multiple of identity */ diag = exp( *pars ); for (j = 0; j < q; j++) { DmHalf[ (dd->DmOff)[i] + j * (q + 1) ] = diag; } pars++; break; case 3: /* compound symmetry */ compSymm_pd( DmHalf + (dd->DmOff)[ i ], dd->q + i, pars ); pars += 2; break; case 4: /* unstructured with log-cholesky parametrization */ logChol_pd(DmHalf + (dd->DmOff)[ i ], dd->q + i, pars ); pars += (q * (q + 1))/2; break; } } return DmHalf; } #ifdef Debug static void print_mat( char *msg, double *x, int ldx, int nrow, int ncol ) { /* print matrix and message */ int i, j; printf( "%s\n", msg ); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) { printf( " %10.5g", x[i + j * ldx ] ); } printf( "\n" ); } printf( "\n" ); } #endif /* Debug */ static double * scale_mat(double *y, int ldy, double a, double *x, int ldx, int nrow, int ncol) { /* y <- a * x */ int i, j; double * ret = y; for (j = 0; j < ncol; j++) { for (i = 0; i < nrow; i++) { y[i] = a * x[i]; } y += ldy; x += ldx; } return ret; } static double * plus_equals_mat(double *y, int ldy, double *x, int ldx, int nrow, int ncol) { /* y <- y + x */ double * ret = y; int i, j; for (j = 0; j < ncol; j++) { for (i = 0; i < nrow; i++) { y[i] += x[i]; } y += ldy; x += ldx; } return ret; } static int /* backsolve and update */ backsolve(double *mat, int ldmat, int nupdate, int ncol, int nrot, int ny) { int i, j, ONE = 1, info; double *y = mat + (int) ((ncol + nrot - ny) * ldmat); mat = mat - (int) nupdate; for (i = 0; i < ny; i++) { /* usually ny = 1 but just in case ... */ F77_CALL(dtrsl) (mat + (int) nupdate, &ldmat, &ncol, y, &ONE, &info); if (info != 0) { return info; } for (j = 0; j < ncol; j++) { d_axpy(y - (int) nupdate, - y[j], mat + (int) (j * ldmat), nupdate); } y += (int) ldmat; } return info; } static int /* invert an upper-triangular matrix in place*/ invert_upper(double *mat, int ldmat, int ncol) { int i, j, ONE = 1, info = 0; double *b = R_Calloc((size_t) ncol, double); for (i = ncol; i > 1; i--) { for (j = 0; j < (i - 1); j++) { b[j] = 0.0; } b[((int) i) - 1] = 1.0; F77_CALL(dtrsl) (mat, &ldmat, &i, b, &ONE, &info); if (info != 0) { R_Free(b); return info; } Memcpy(mat + (i - 1) * ldmat, b, (int) i); } if (*mat == 0.0) { R_Free(b); return 1; } *mat = 1.0 / (*mat); R_Free(b); return 0; } static int /* invert a block in the virtual R array */ invert_block(double *mat, int ldmat, int nabove, int ncol, int nright) { double * tpblk = mat - (int) nabove; int info = invert_upper(mat, ldmat, ncol); if (info != 0) return info; if (nright > 0) { double *ntri = R_Calloc((size_t) (ncol * ncol), double), *rtblk = mat + ncol * ldmat; scale_mat(ntri, ncol, -1.0, mat, ldmat, ncol, ncol); mult_mat(rtblk, ldmat, ntri, ncol, ncol, ncol, rtblk, ldmat, nright); R_Free(ntri); if (nabove > 0) { double *tmp = R_Calloc((size_t)(nabove * nright), double); plus_equals_mat(rtblk - (size_t)nabove, ldmat, mult_mat(tmp, nabove, tpblk, ldmat, nabove, ncol, rtblk, ldmat, nright), nabove, nabove, nright); R_Free(tmp); } } if (nabove > 0) { mult_mat(tpblk, ldmat, tpblk, ldmat, nabove, ncol, mat, ldmat, ncol); } return 0; } void /* return the decomposition for ZXy */ mixed_decomp(double *ZXy, int *pdims) { dimPTR dd = dims(pdims); /* Create a dimensions structure */ internal_decomp(dd, ZXy); dimFree(dd); } void internal_decomp(dimPTR dd, double *ZXy) { /* decompose ZXy and re-write the dims */ int i, j, Qp2 = (dd->Q) + 2; double *dc; if ((dd->Srows) >= (dd->ZXrows)) /* decomposition is not worthwhile */ return; dc = R_Calloc((size_t) ((dd->Srows) * (dd->ZXcols)), double); for (i = 0; i < Qp2; i++) { for(j = 0; j < (dd->ngrp)[i]; j++) { QR_and_rotate(ZXy + (dd->ZXoff)[i][j], dd->ZXrows, (dd->ZXlen)[i][j], (dd->ncol)[i] + (dd->nrot)[i], DNULLP, 0, (dd->ncol)[i], DNULLP, dc + (dd->SToff)[i][j], dd->Srows); } } Memcpy(ZXy, dc, dd->Srows * dd->ZXcols); for (i = 0; i < Qp2; i++) { /* re-write the offsets and lengths */ for (j = 0; j < (dd->ngrp)[i]; j++) { (dd->ZXoff)[i][j] = (dd->DecOff)[i][j]; (dd->ZXlen)[i][j] = (dd->DecLen)[i][j]; } } dd->ZXrows = dd->Srows; /* and the total number of rows */ R_Free(dc); } double /* evaluate the log-likelihood pieces */ internal_loglik(dimPTR dd, double *ZXy, double *DmHalf, int *RML, double *dc, double *lRSS, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Sol. double *sigma) { int Q = dd->Q, Qp2 = Q + 2; double *lglk = R_Calloc( Qp2, double ); for (int i = 0; i < Qp2; i++) { int qi = (dd->q)[i]; // we could pull things out of this loop, but assume // optimizing compiler can do that for us. for (int j = 0; j < (dd->ngrp)[i]; j++) { int ldstr; double *store; /* if dc is NULL, don't attempt storage */ if (dc != DNULLP) { ldstr = dd->Srows; store = dc + (dd->SToff)[i][j]; } else { ldstr = 0; store = DNULLP; } if (qi > QR_and_rotate(ZXy + (dd->ZXoff)[i][j], dd->ZXrows, (dd->ZXlen)[i][j], (dd->ncol)[i] + (dd->nrot)[i], DmHalf + (dd->DmOff)[i], qi, (dd->ncol)[i], lglk + i, store, ldstr)) { warning("Singular precision matrix in level %ld, block %ld", (long int) (i - Q), (long int) (j + 1)); return -DBL_MAX; } } } double accum = 0; for(int i = 0; i < Q; i++) { int qi = (dd->q)[i]; double *dmHlf = R_Calloc( (size_t) qi * qi, double ); QRptr dmQR = QR( copy_mat( dmHlf, qi, DmHalf + (dd->DmOff)[i], qi, qi, qi ), qi, qi, qi); accum += (dd->ngrp)[i] * QRlogAbsDet( dmQR ) - lglk[i]; QRfree( dmQR ); R_Free( dmHlf ); } // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions if (*sigma > 0) { // Fixed sigma double h = 0; if (*RML == 1) { h += (lglk[Q] - dd->ncol[Q]*lglk[Q+1]) - 1; } accum -= pow(exp(lglk[Q+1]),2)/(2*pow(*sigma,2)); accum -= (dd->N - dd->ncol[Q]) * log(*sigma); accum -= h; } else { // Free sigma accum -= *RML * lglk[Q] + (dd->N - *RML * dd->ncol[Q]) * lglk[Q + 1]; } if (lRSS != DNULLP) { *lRSS = lglk[Q+1]; } R_Free(lglk); return accum; } void internal_estimate(dimPTR dd, double *dc) { /* solve for Beta and b_i estimates */ int Qp1 = (dd->Q) + 1; for (int i = (dd->Q); i >= 0; i--) { for (int j = 0; j < (dd->ngrp)[i]; j++) { if (backsolve(dc + (dd->SToff)[i][j], dd->Srows, (dd->SToff)[i][j] - (dd->DecOff)[i][j], (dd->ncol)[i], (dd->nrot)[i], (dd->ncol)[Qp1]) != 0) { error(_("Singularity in backsolve at level %ld, block %ld"), (long int) (i - (dd->Q)), (long int) (j + 1)); } } } } static void internal_R_invert(dimPTR dd, double *dc) { /* Invert the virtual R matrix in place */ int i, j; for (i = (dd->Q); i >= 0; i--) { for (j = 0; j < (dd->ngrp)[i]; j++) { invert_block(dc + (dd->SToff)[i][j], dd->Srows, (dd->SToff)[i][j] - (dd->DecOff)[i][j], (dd->ncol)[i], (dd->nrot)[i] - 1); } } } static double cube_root_eps = 0.; static void pt_prod( double *prod, double *a, double *b, size_t len ) { /* prod <- a * b */ for (int i = 0; i < len; i++) { *prod++ = *a++ * *b++; } } static void finite_diff_Hess(double (*func)(double*,double*), double *pars, int npar, double *vals, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Sol. double *sigma) { /* use Koshal design for finite-differences */ double nT = 1 + npar + (npar * ((double) npar + 1)) / 2;// against integer overflow if((nT * nT) > (double) SIZE_MAX) error(_("Too many parameters for finite-difference Hessian; npar = %d, nTot = %g."), npar, nT); size_t nTot = (size_t) nT; double *ppt, *xpt, *dpt, *incr = R_Calloc( npar, double), *parray = R_Calloc( nTot * npar, double), /* array of parameters */ *div = R_Calloc( nTot, double), /* divisors */ *Xmat = R_Calloc( nTot * nTot, double); /* regressor matrix */ QRptr xQR; if (cube_root_eps == 0.0) cube_root_eps = exp( log( DBL_EPSILON ) / 3.); div[ 0 ] = 1.0; ppt = parray + npar * ( 2 * npar + 1 ); /* location of first cross term */ xpt = Xmat + nTot * ( 2 * npar + 1 ); /* location of first cross column */ dpt = div + 2 * npar + 1; size_t np_i = npar; for (int i = 0; i < npar; i++, np_i++) { // np_i === npar + i size_t np1 = (size_t) npar + 1; incr[i] = (pars[ i ] != 0.0) ? cube_root_eps * pars[ i ] : cube_root_eps; div[ i + 1 ] = 1.0 / incr[ i ]; div[ np_i + 1 ] = 2.0 / ( incr[ i ] * incr[ i ] ); parray[ npar + i * np1 ] = 1.; parray[ np_i * np1 ] = -1.; for (int j = i + 1; j < npar; j++) { ppt[ i ] = ppt[ j ] = 1; ppt += npar; } for (size_t j = 0; j < nTot; j++) { Xmat[ j + (i + 1) * nTot ] = parray[ i + j * npar ]; } pt_prod( Xmat + (np_i + 1) * nTot, Xmat + (i + 1) * nTot, Xmat + (i + 1) * nTot, nTot ); for (int j = 0; j < i; j++) { pt_prod( xpt, Xmat + (i + 1) * nTot, Xmat + (j + 1) * nTot, nTot ); xpt += nTot; *dpt++ = 1.0 / ( incr[ i ] * incr[ j ] ); } } #ifdef Debug print_mat( "parray", parray, npar, npar, nTot ); #endif /* Debug */ vals[ 0 ] = (*func)( pars, sigma ); // 17-11-2015; Fixed sigma patch ... Xmat[ 0 ] = 1.0; for (size_t i = 1; i < nTot; i++) { Xmat[i] = 1.0; /* column of 1's for constant */ Memcpy( parray, pars, npar ); for (int j = 0; j < npar; j++) { parray[ j ] += parray[ j + i * npar ] * incr[ j ]; } vals[i] = (*func)( parray, sigma ); // 17-11-2015; Fixed sigma patch ... } #ifdef Debug print_mat( "Xmat", Xmat, nTot, nTot, nTot ); #endif /* Debug */ xQR = QR( Xmat, (int) nTot, (int) nTot, (int) nTot ); QRsolve( xQR, vals, (int) nTot, 1, vals, (int) nTot ); pt_prod( vals, vals, div, nTot ); /* re-arrange the Hessian terms */ xpt = vals + npar + 1; Memcpy( div, vals + npar + 1, nTot - ( npar + 1 ) ); dpt = div + npar; /* first off-diagonal */ for (int i = 0; i < npar; i++) { xpt[ i * ( npar + 1 ) ] = div[ i ]; /* diagonals */ for (int j = 0; j < i; j++) { xpt[ i + j * npar ] = xpt[ j + i * npar ] = *dpt++; } } QRfree( xQR ); R_Free( incr ); R_Free( parray ); R_Free( div ); R_Free( Xmat ); return; } /* objective function for optif9(), itself called from * nlme_increment() [../nlme.c] and mixed_combined() below */ void mixed_fcn(int n, double *pars, double *g, void *state) { statePTR st = (statePTR) state; double *zxcopy = R_Calloc(st->dd->ZXrows * st->dd->ZXcols, double), *Delta = R_Calloc(st->dd->DmOff[st->dd->Q], double); Memcpy(zxcopy, st->ZXy, st->dd->ZXrows * st->dd->ZXcols); *g = -internal_loglik(st->dd, zxcopy, generate_DmHalf(Delta, st->dd, st->pdClass, pars), st->RML, DNULLP, DNULLP, st->sigma);// 17-11-2015; Fixed sigma .. if (!R_FINITE(g[0])) { // guard optif9 against NaN etc (PR#18433) #ifdef Debug Rprintf("Parameters:"); for (int i = 0; i < n; i++) Rprintf(" %#8g", pars[i]); Rprintf("\nFunction Value: %g\n", g[0]); #endif warning("Non-finite log-likelihood replaced by maximally negative value"); *g = DBL_MAX; } R_Free(Delta); R_Free(zxcopy); } void // gradient for optif9() of objective function mixed_fcn() see above mixed_grad(int n, double *pars, double *g, void *state) { statePTR st = (statePTR) state; double *zxcopy = R_Calloc(st->dd->ZXrows * st->dd->ZXcols, double), *Delta = R_Calloc(st->dd->DmOff[st->dd->Q], double), *dc = R_Calloc((size_t) ((st->dd->Srows) * (st->dd->ZXcols)), double), *DmHalf, sigmainv, *pt, *res; double sqrtDF = sqrt((double) (st->dd->N - *(st->RML)*(st->dd->ncol[st->dd->Q]))); int i, j, offset; DmHalf = generate_DmHalf(Delta, st->dd, st->pdClass, pars), Memcpy(zxcopy, st->ZXy, st->dd->ZXrows * st->dd->ZXcols); /* needed ? */ internal_loglik(st->dd, zxcopy, DmHalf, st->RML, dc, DNULLP, st->sigma);// Fixed sigma internal_estimate(st->dd, dc); internal_R_invert(st->dd, dc); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions if (*st->sigma > 0) { sigmainv = 1.0/(*st->sigma); } else { sigmainv = *(dc + (size_t)((st->dd->Srows) * (st->dd->ZXcols)) - 1)/sqrtDF; if (sigmainv == 0) { error(_("Overfitted model!")); } else { sigmainv = 1.0/((sigmainv < 0.0) ? - sigmainv : sigmainv); } } offset = ((st->dd->ZXcols) - 1) * (st->dd->Srows); for (i = 0; i < (st->dd->Q); i++) { int ncol = (st->dd->q)[i], nright = (st->dd->nrot)[i] - (st->dd->nrot)[(st->dd->Q) - ( (*(st->RML)) ? 0 : 1 )]; int nrow = (ncol + nright + 1) * (st->dd->ngrp)[i]; QRptr qq; pt = res = R_Calloc((size_t) (ncol * nrow), double); for (j = 0; j < (st->dd->ngrp)[i]; j++) { copy_trans(pt, nrow, dc + (st->dd->SToff)[i][j], st->dd->Srows, ncol, ncol + nright); pt += ncol + nright; scale_mat(pt++, nrow, sigmainv, dc + offset + (st->dd->SToff)[i][j], 1, 1, ncol); } offset -= (st->dd->Srows) * ncol; qq = QR(res, nrow, nrow, ncol); QRstoreR(qq, res, ncol); QRfree(qq); switch (st->pdClass[i]) { case 0: /* unstructured with matrix-logarithm parametrization */ error(_("analytic gradient is not available with matrix logarithm")); break; case 1: /* diagonal */ for (j = 0; j < ncol; j++) { double tmp = DmHalf[ (st->dd->DmOff)[i] + j * (ncol + 1)]; *g++ = st->dd->ngrp[i] - tmp*tmp*d_sum_sqr(res + j * ncol, j + 1); } break; case 2: /* multiple of identity */ { double tmp = 0.0; for(j = 0; j < ncol; j++) { tmp += d_sum_sqr( res + j * nrow, j + 1 ); } *g = tmp; tmp = DmHalf[ (st->dd->DmOff)[i] + j * (ncol + 1)]; *g *= tmp * tmp; *g = ncol*st->dd->ngrp[i] - *g; g++; break; } case 3: /* compound symmetry */ { error(_("analytic gradient is not available with compound symmetry")); break; } case 4: /* unstructured with log-cholesky parametrization */ { int j1; double *col_j = R_Calloc(ncol, double); for (j1 = 0; j1 < ncol; j1++) { int i1; for(i1 = 0; i1 < j1; i1++) col_j[i1] = d_dot_prod(res + i1*ncol, 1, res + j1*ncol, 1, 1+i1); for(i1 = j1; i1 < ncol; i1++) col_j[i1] = d_dot_prod(res + i1*ncol, 1, res + j1*ncol, 1, 1+j1); for (i1 = 0; i1 <= j1; i1++) { int k1; double sum = 0.0; for (k1 = i1; k1 < ncol; k1++) { sum += DmHalf[(st->dd->DmOff)[i] + i1*ncol + k1] * col_j[k1]; } if (i1 == j1) *g++ = st->dd->ngrp[i] - sum*DmHalf[(st->dd->DmOff)[i] + i1*(ncol + 1)]; else *g++ = -sum; } } break; } } R_Free(res); } R_Free(dc); R_Free(Delta); R_Free(zxcopy); } /* In gcc we can use nested function definitions but not for other compilers */ static double *zxcopy, *zxcopy2, *Delta, *values; static dimPTR dd; static int *setngs, *pdC; size_t zxdim; static double logLik_fun( double *pars, double *sigma) // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions { /* defined for finite differences */ Memcpy( zxcopy2, zxcopy, zxdim ); return internal_loglik(dd, zxcopy2, generate_DmHalf( Delta, dd, pdC, pars ), setngs, DNULLP, DNULLP, sigma ); // 17-11-2015; Fixed sigma ... } static double negLogLik_fun( double *pars, double *sigma) // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions { /* defined for finite differences */ Memcpy( zxcopy2, zxcopy, zxdim ); return - internal_loglik(dd, zxcopy2, generate_DmHalf( Delta, dd, pdC, pars ), setngs, DNULLP, DNULLP, sigma ); // 17-11-2015; Fixed sigma ... } void mixed_loglik(double *ZXy, int *pdims, double *pars, int *settings, double *logLik, double *lRSS, double *sigma) // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions { /* evaluate the log-likelihood */ dd = dims(pdims); /* settings gives RML, asDelta, gradHess, and pdClass in that order */ if (settings[ 1 ]) { /* gradHess not used and pdClass ignored */ *logLik = internal_loglik( dd, ZXy, pars, settings, DNULLP, lRSS, sigma); // 17-11-2015; ... } else { /* generate the Delta arrays from pars */ setngs = settings; pdC = setngs + 3; // pointer to pdClass (integer code) Delta = R_Calloc( (dd->DmOff)[ dd->Q ], double ); if (settings[ 2 ] == 0) { /* no gradient or Hessian */ *logLik = internal_loglik( dd, ZXy, generate_DmHalf( Delta, dd, pdC, pars ), settings, DNULLP, lRSS, sigma ); // 17-11-2015; ... } else { int npar = count_DmHalf_pars( dd, pdC ); zxdim = (dd->ZXrows) * (dd->ZXcols); zxcopy = R_Calloc( zxdim, double ); zxcopy2 = ZXy; Memcpy( zxcopy, ZXy, zxdim ); finite_diff_Hess( logLik_fun, pars, npar, logLik, sigma); // 17-11-2015; ... R_Free( zxcopy ); } R_Free( Delta ); } dimFree( dd ); } void /* loglikelihood and parameter estimates */ mixed_estimate(double *ZXy, int *pdims, double *DmHalf, int *RML, double *logLik, double *dc, int *invert, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Sol.: double *sigma) { /* dc receives the decomposed ZXy array */ dimPTR dd = dims(pdims); *logLik = internal_loglik(dd, ZXy, DmHalf, RML, dc, DNULLP, sigma); internal_estimate(dd, dc); if (*invert != 0) { internal_R_invert( dd, dc ); } dimFree(dd); } void /* EM iterations for mixed-effects models */ internal_EM(dimPTR dd, double *ZXy, double *DmHalf, int nn, int *pdClass, int *RML, double *logLik, double *Ra, double *lRSS, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions: double *sigma) { double sigmainv, *res, *pt, *dc = R_Calloc((size_t) ((dd->Srows) * (dd->ZXcols)), double), *zxcopy = R_Calloc((size_t) ((dd->ZXrows) * (dd->ZXcols)), double); double sqrtDF = sqrt((double) (dd->N - *RML * (dd->ncol[dd->Q]))); int i, j, k, offset; while (nn-- > 0) { copy_mat(zxcopy, dd->ZXrows, ZXy, dd->ZXrows, dd->ZXrows, dd->ZXcols); *logLik = internal_loglik(dd, zxcopy, DmHalf, RML, dc, DNULLP, sigma); internal_estimate( dd, dc ); internal_R_invert( dd, dc ); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions if (*sigma > 0) { sigmainv = 1.0/(*sigma); } else { sigmainv = *(dc + (size_t)((dd->Srows) * (dd->ZXcols)) - 1)/sqrtDF; if (sigmainv == 0.) { error(_("Overfitted model!")); } else { sigmainv = 1.0/((sigmainv < 0.0) ? - sigmainv : sigmainv); } } offset = ((dd->ZXcols) - 1) * (dd->Srows); for (i = 0; i < (dd->Q); i++) { int ncol = (dd->q)[i], nright = (dd->nrot)[i] - (dd->nrot)[(dd->Q) - ( (*RML) ? 0 : 1 )]; int nrow = (ncol + nright + 1) * (dd->ngrp)[i]; QRptr qq; pt = res = R_Calloc((size_t) (ncol * nrow), double); for (j = 0; j < (dd->ngrp)[i]; j++) { copy_trans(pt, nrow, dc + (dd->SToff)[i][j], dd->Srows, ncol, ncol + nright); pt += ncol + nright; scale_mat(pt++, nrow, sigmainv, dc + offset + (dd->SToff)[i][j], 1, 1, ncol); } offset -= (dd->Srows) * ncol; qq = QR(res, nrow, nrow, ncol); QRstoreR(qq, Ra + (dd->DmOff)[i], ncol); QRfree(qq); scale_mat(res, nrow, sqrt(1.0/((dd->ngrp)[i])), Ra + (dd->DmOff)[i], ncol, ncol, ncol); switch (pdClass[i]) { case 0: case 4: /* default: unstructured */ invert_upper(res, nrow, ncol); copy_trans(DmHalf + (dd->DmOff)[i], ncol, res, nrow, ncol, ncol); break; case 1: /* diagonal */ for (j = 0; j < ncol; j++) { DmHalf[ (dd->DmOff)[i] + j * (ncol + 1)] = 1. / sqrt( d_sum_sqr( res + j * nrow, j + 1 ) ); } break; case 2: /* multiple of identity */ { double aux = 0.0; for(j = 0; j < ncol; j++) { aux += d_sum_sqr( res + j * nrow, j + 1 ); } aux = sqrt(ncol / aux); for(j = 0; j < ncol; j++) { DmHalf[(dd->DmOff)[i] + j * (ncol + 1)] = aux; } } break; case 3: /* compound symmetry */ { double trA = 0.0, trAJ = 0.0, *auxRes; int l; for(j = 0; j < ncol; j++) { for(k = 0; k <= j; k++) { trA += res[k + j * nrow] * res[k + j * nrow]; for(l = j + 1; l < ncol; l++) { trAJ += res[k + j * nrow] * res[k + l * nrow]; } } } trAJ = 2 * trAJ + trA; trA = (ncol - 1) / (ncol * trA - trAJ); trAJ = 1/trAJ - trA; trA = ncol * trA + trAJ; auxRes = DmHalf + (dd->DmOff[i]); for(j = 0; j < ncol; j++) { auxRes[j * (ncol + 1)] = trA; for(k = (j + 1); k < ncol; k++) { auxRes[j * ncol + k] = auxRes[j + k * ncol] = trAJ; } } F77_CALL(chol)(auxRes, &ncol, &ncol, auxRes, &l); } break; } R_Free(res); } } copy_mat(zxcopy, dd->ZXrows, ZXy, dd->ZXrows, dd->ZXrows, dd->ZXcols); *logLik = internal_loglik(dd, zxcopy, DmHalf, RML, dc, lRSS, // 17-11-2015; Fixed sigma patch : sigma); R_Free(dc); R_Free(zxcopy); } void mixed_EM(double *ZXy, int *pdims, double *DmHalf, int *nIter, int *pdClass, int *RML, double *logLik, double *Ra, double *lRSS, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions double *sigma) { dimPTR dd = dims(pdims); internal_EM(dd, ZXy, DmHalf, *nIter, pdClass, RML, logLik, Ra, lRSS, sigma); dimFree(dd); } void /* to be called by Fortran msmnh */ mixed_calcf(int *n, double *theta, int *nf, double *f, int *uiparm, double *urparm, void (*ufparm)(void)) { Memcpy( zxcopy2, zxcopy, zxdim ); *f = - internal_loglik(dd, zxcopy2, generate_DmHalf( Delta, dd, pdC, theta ), setngs, DNULLP, DNULLP, // 17-11-2015; Fixed sigma patch; E van Willigen; Quant.Sol. _sigma_ ); } void /* to be called by Fortran msmnh */ mixed_calcgh(int *n, double *theta, int *nf, double *g, double *h, int *uiparm, double *urparm, void (*ufparm)(void)) { int i, nn = *n; double *hpt = values + nn + 1; finite_diff_Hess(negLogLik_fun, theta, (int) nn, values, // 17-11-2015; Fixed sigma patch; E van Willigen; Quant.Sol. _sigma_ ); Memcpy( g, values + 1, nn ); for( i = 1; i <= nn; i++ ) { /* copy upper triangle of Hessian */ Memcpy( h, hpt, i ); h += i; hpt += nn; } } static double * crossprod_mat(double *y, int ldy, double *x, int ldx, int nrow, int ncol) /* y <- t(x) %*% x */ { int i, j; for( i = 0; i < ncol; i++ ) { y[ i * ldy + i ] = d_dot_prod( x + i * ldx, 1, x + i * ldx, 1, nrow ); for( j = 0; j < i; j++) { y[ i * ldy + j ] = y[ j * ldy + i ] = d_dot_prod( x + i * ldx, 1, x + j * ldx, 1, nrow ); } } return y; } /* Forming the parameter structure from the Delta matrix */ /* Not sure if these will ever be called from S. */ /* Will leave open the possibility. */ static void Delta2MatrixLog( double *theta, int *q, double *Delta ) { int i, j, qq = *q, one = 1, info = 0; if ( qq == 1 ) { *theta = log(*Delta * *Delta)/2.; } else { double *vectors = R_Calloc((size_t) qq * qq, double), *DtransD = R_Calloc((size_t) qq * qq, double), *workmat = R_Calloc((size_t) qq * qq, double), *work2 = R_Calloc((size_t) qq, double), *values = R_Calloc((size_t) qq, double), *pt; crossprod_mat(DtransD, qq, Delta, qq, qq, qq); /* form t(Delta) %*% Delta */ F77_CALL(rs) (q, q, DtransD, values, &one, vectors, workmat, work2, &info); if (info != 0) { error(_("Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]"), info); } copy_mat(workmat, qq, vectors, qq, qq, qq); for(i = 0; i < qq; i++) { values[i] = log(values[i])/2; for(j = 0; j < qq; j++) { workmat[i * qq + j] *= values[i]; } } copy_trans(DtransD, qq, workmat, qq, qq, qq); mult_mat(workmat, qq, vectors, qq, qq, qq, DtransD, qq, qq); for( i = 0, pt = theta; i < qq; i++ ) { for( j = 0; j <= i; j++ ) { *pt++ = workmat[ i * qq + j ]; } } R_Free(vectors); R_Free(DtransD); R_Free(workmat), R_Free(work2); R_Free(values); } } static void Delta2LogCholesky(double *theta, int *q, double *Delta ) { int i, qq = *q, info = 0; if ( qq == 1 ) { *theta = log(*Delta * *Delta)/2.; } else { double *ll = theta + qq, *DtransD = R_Calloc((size_t) qq * qq, double); crossprod_mat(DtransD, qq, Delta, qq, qq, qq); /* form t(Delta) %*% Delta */ F77_CALL(chol) (DtransD, &qq, &qq, Delta, &info); /* re-writes Delta */ if (info != 0) error(_("Unable to form Cholesky decomposition: the leading minor of order %d is not pos.def."), info); *theta = log(Delta[0]); for(i = 1; i < qq; i++) { theta[i] = log(Delta[i * (qq + 1)]); Memcpy(ll, Delta + i * qq, i); ll += i; } R_Free(DtransD); } } double * generate_theta( double *theta, dimPTR dd, int *pdClass, double *DmHalf ) { /* Expand parameters to DmHalf arrays */ int i, j, q, Q = dd->Q; for (i = 0; i < Q; i++) { q = (dd->q)[ i ]; switch (pdClass[i]) { case 0: /* default: unstructured */ Delta2MatrixLog( theta, dd->q + i, DmHalf + (dd->DmOff)[ i ] ); theta += (q * (q + 1))/2; break; case 1: /* diagonal */ for (j = 0; j < q; j++) { *theta++ = log( DmHalf[ (dd->DmOff)[i] + j * (q + 1) ] ); } break; case 2: /* multiple of identity */ *theta++ = log( DmHalf[(dd->DmOff)[i]] ); break; case 3: /* compound symmetry */ error(_("Haven't written the compound symmetry case for this yet")); break; case 4: /* default: unstructured */ Delta2LogCholesky( theta, dd->q + i, DmHalf + (dd->DmOff)[ i ] ); theta += (q * (q + 1))/2; break; } } return theta; } // This is called _only_ from R's nlme :: simulate.lme(): void /* both EM and Newton-Raphson iterations */ mixed_combined(double *ZXy, int *pdims, double *DmHalf, int *nIter, int *pdClass, int *RML, double *logLik, double *R0, double *lRSS, int *info, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions double *sigma) { int i, j; double *Ra, *dc, *work; dd = dims(pdims); /* Using global dd, pdC, setngs, and Delta */ pdC = pdClass; setngs = RML; dc = R_Calloc((size_t) ((dd->Srows) * (dd->ZXcols)), double); Ra = R_Calloc( dd->DmOff[dd->Q], double); internal_decomp( dd, ZXy ); /* take decomp if useful */ /* check for non-zero entries in DmHalf */ if ( d_sum_sqr( DmHalf, dd->DmOff[ dd->Q ]) == 0. ) { work = ZXy; /* create starting estimates */ Delta = DmHalf; for( i = 0; i < dd->Q; i++ ) { for ( j = 0; j < (dd->q)[i]; j++ ) { *Delta = 0.375 * sqrt( d_sum_sqr( work, dd->ZXrows ) / (dd->ngrp)[i]); Delta += (dd->q)[i] + 1; work += dd->ZXrows; } Delta -= (dd->q)[i]; /* have moved too far - step back */ } } internal_EM(dd, ZXy, DmHalf, *nIter, pdClass, RML, logLik, Ra, lRSS, sigma); // 17-11-2015; Fixed sigma patch ... { statePTR st = R_Calloc(1, struct state_struct); int ntheta = count_DmHalf_pars( dd, pdC ), itrmcd, itncnt, p = dd->ncol[dd->Q], iagflg; double *theta = R_Calloc(ntheta, double), *typsiz = R_Calloc(ntheta, double), *grad = R_Calloc(ntheta, double), *newtheta = R_Calloc(ntheta, double), *a = R_Calloc(ntheta * ntheta, double), *work = R_Calloc(ntheta * 9, double); st->dd = dd; st->ZXy = ZXy; st->pdClass = pdClass; st->RML = RML; st->sigma = sigma; // 17-11-2015; Fixed sigma patch; ... generate_theta(theta, dd, pdClass, DmHalf); *info = 9; /* don't inhibit checks but suppress output */ for (i = 0; i < ntheta; i++) { typsiz[i] = 1.0; } /* iagflg = 1; */ iagflg = 0; for (i = 0; i < dd->Q; i++) { if (pdClass[i] < 1 || pdClass[i] == 3 || pdClass[i] > 4) { iagflg = 0; break; } } optif9(ntheta, ntheta, theta, (fcn_p) mixed_fcn, (fcn_p) mixed_grad, (d2fcn_p) 0, st, typsiz, 1.0 /*fscale*/, 1 /*method*/,1 /*iexp*/, info, -1 /*ndigit*/, 50 /*itnlim*/, iagflg, 0 /*iahflg*/, 1. /*dlt*/, pow(DBL_EPSILON, 0.25) /*gradtl*/, 0. /*stepmx*/, sqrt(DBL_EPSILON) /*steptl*/, newtheta, logLik, grad, &itrmcd, a, work, &itncnt); if (*info == 0) { *logLik = internal_loglik( dd, ZXy, generate_DmHalf( DmHalf, dd, pdC, theta ), setngs, dc, lRSS, // 17-11-2015; Fixed sigma patch ... : sigma ); copy_mat(R0, p, dc + (dd->SToff)[(dd->Q)][0], (dd->Srows), p, p + 1); } R_Free(work); R_Free(a); R_Free(newtheta); R_Free(grad); R_Free(typsiz); R_Free(theta); R_Free(st); } dimFree( dd ); R_Free( dc ); R_Free( Ra ); } /* functions for calculating df's for fixed effects tests */ static double inner_perc(double *x, int *grp, int n) /* percentage of groups for which x is inner */ { /* x - column of X matrix to be assessed grp - integer vector with groups n - length of x and grp data are assumed to be ordered by grp */ int currGrp, nn = 0, isInner; double nInner = 0., nGrp = 0., currVal; while (nn < n) { currGrp = grp[nn]; currVal = x[nn]; nGrp++; isInner = 0; do { if (isInner == 0 && x[nn] != currVal) { nInner++; isInner = 1; } nn++; } while (nn < n && currGrp == grp[nn]); } return(nInner/nGrp); } void inner_perc_table(double *X, int *grps, int *p, int *Q, int *n, double *pTable) /* constructs an p x Q "inner-percentage" table for a fixed effects matrix X and a set of grouping vectors grps */ { int i, j, pp = *p, nn = *n, ipp = 0, inn = 0; for(i = 0; i < *Q; i++) { for(j = 0; j < pp; j++) { pTable[j + ipp] = inner_perc(X + j * nn, grps + inn, nn); } ipp += pp; inn += nn; } } /* gls functions */ void gls_loglik(double *Xy, int *pdims, double *logLik, double *lRSS, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions double *sigma) { int i, N = pdims[0], p = pdims[1], RML = pdims[2], Np1 = N + 1, Nr = N - RML * p, rnkm1; QRptr dmQR; dmQR = QR(Xy, N, N, p + 1); rnkm1 = (dmQR->rank) - 1; if(rnkm1 != p) { *logLik = -DBL_MAX; } else { // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions double f; *lRSS = log(f=fabs (dmQR->mat[p * Np1])); if (*sigma > 0) { // fixed sigma double h = 0; if (RML == 1) { for(i = 0; i < p; i++) { h += log(fabs(dmQR->mat[i * Np1])); } } *logLik -= pow(f,2)/(2*pow(*sigma,2)); *logLik -= Nr * log(*sigma); *logLik -= h; } else { // estimated sigma (default) *logLik -= (((double)Nr) * (*lRSS)); if (RML == 1) { for (i = 0; i < p; i++) { *logLik -= log(fabs(dmQR->mat[i * Np1])); } } } } QRfree(dmQR); } #if 0 /* gls functions */ void gls_loglik(double *Xy, int *pdims, double *logLik, double *lRSS) { int i, N = pdims[0], p = pdims[1], RML = pdims[2], Np1 = N + 1, Nr = N - RML * p; QRptr dmQR; dmQR = QR(Xy, N, N, p + 1); *lRSS = log(fabs(dmQR->mat[p * Np1])); *logLik -= Nr * (*lRSS); if (RML == 1) { for(i = 0; i < p; i++) { *logLik -= log(fabs(dmQR->mat[i * Np1])); } } QRfree(dmQR); } #endif void gls_estimate(double *Xy, int *pdims, double *beta, double *sigma, double *logLik, double *varBeta, int *rank, int *pivot) { int i, N = pdims[0], p = pdims[1], RML = pdims[2], pp1 = p + 1, Nr = N - RML * p, rk, rkm1, rkp1; QRptr dmQR; double *R = R_Calloc((size_t) (pp1 * pp1), double); dmQR = QR(Xy, N, N, pp1); *rank = rk = dmQR->rank; rkm1 = rk - 1; rkp1 = rk + 1; Memcpy(pivot, dmQR->pivot, pp1); for(i = 0; i < rk; i++) { Memcpy(R + i * rk, dmQR->mat + i * N, i + 1); } // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions if (*sigma > 0) { // fixed sigma double h = 0; *logLik = fabs(R[rk * rk - 1]); if (RML == 1) { // RML for(i=0; i, Jose C. Pinheiro, Saikat DebRoy Copyright 2007-2022 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include "pdMat.h" #include "matrix.h" /* Positive definite matrices */ static void Chol_pd(double *L, int *q, double *l) { int i, qq = *q; for(i = 0; i < qq; i++) { Memcpy(L + i * qq, l, i + 1); l += i + 1; } } void /* general pd, logChol parametrization */ logChol_pd(double *L, int *q, double *l) { int i, qq = *q; double *ll = l + qq; L[0] = exp(*l); for(i = 1; i < qq; i++) { L[i * (qq + 1)] = exp(l[i]); Memcpy(L + i * qq, ll, i); ll += i; } } void matrixLog_pd(double *L, int *q, double *l) { int i, j, qq = *q, one = 1L, info = 0L; if ( qq == 1 ) { *L = exp( *l ); } else { double *vectors = R_Calloc((size_t) qq * qq, double), *work1 = R_Calloc((size_t) qq, double), *work2 = R_Calloc((size_t) qq, double), *values = R_Calloc((size_t) qq, double); Chol_pd(L, q, l); for(i = 0; i < qq - 1; i++) { copy_mat(L + (i * (qq + 1) + 1), 1L, L + i * (qq + 1) + qq, qq, 1L, qq - (i + 1)); } F77_CALL(rs) (q, q, L, values, &one, vectors, work1, work2, &info); for(i = 0; i < qq; i++) { values[i] = exp(values[i]); for(j = 0; j < qq; j++) { vectors[i * qq + j] *= values[i]; } } copy_trans(L, qq, vectors, qq, qq, qq); R_Free(vectors); R_Free(work1); R_Free(work2); R_Free(values); } } void natural_pd(double *L, int *q, double *l) /* natural parametrization */ { int i, j, qp1 = *q + 1, info; double *std = l, *corr = l + *q, *work = R_Calloc(*q, double); for(i = 0; i < *q; i++) std[i] = exp(std[i]); for(i = 0; i < *q; i++) { L[i * qp1] = std[i] * std[i]; for(j = i + 1; j < *q; j++) { *corr = exp(*corr); *corr = (*corr - 1)/(*corr + 1); L[i * (*q) + j] = L[j * (*q) + i] = std[i] * std[j] * (*corr); corr++; } } F77_CALL(chol) (L, q, q, L, &info); R_Free(work); } void compSymm_pd(double *L, int *q, double *l) /* compound symmetry */ { int i, j, qp1 = *q + 1; double aux = exp(l[0]), aux1 = exp(l[1]), aux2; aux1 = (aux1 - 1.0/((double) *q - 1.0))/(aux1 + 1.0); aux2 = aux * sqrt(1.0 - aux1); aux1 = aux * sqrt((1.0 + (*q - 1.0) * aux1) / ((double) *q)); for(i = 0; i < *q; i++) { L[i * (*q)] = aux1; } for(i = 1; i < *q; i++) { aux = -aux2/sqrt(i * (i + 1)); for(j = 0; j < i; j++) { L[i + (j * (*q))] = aux; } L[i * qp1] = -aux * i; } } nlme/src/matrix.c0000644000176000001440000001430014251721455013500 0ustar ripleyusers/* Basic matrix manipulations and QR decomposition Copyright 1997-2005 Douglas M. Bates , Jose C. Pinheiro, Saikat DebRoy Copyright 2007-2022 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include // for DBL_EPSILON #include "matrix.h" /* find qr decomposition, dqrdc2() is basis of R's qr(), also used by nlme */ void F77_NAME(dqrdc2)(double *x, int *ldx, int *n, int *p, double *tol, int *rank, double *qraux, int *pivot, double *work); void F77_NAME(dqrls)(double *x, int *n, int *p, double *y, int *ny, double *tol, double *b, double *rsd, double *qty, int *k, int *jpvt, double *qraux, double *work); void d_axpy(double *y, double a, double *x, int n) { /* y <- a * x + y */ while (n-- > 0) { *y++ += a * *x++; } } double d_sum_sqr( double *x, int n ) { /* sum(x * x) */ double accum = 0.0; while (n-- > 0) { accum += *x * *x; x++; } return accum; } double d_dot_prod( double *x, int incx, double *y, int incy, int n ) { /* sum(x * y) */ double accum = 0.0; while (n-- > 0) { accum += *x * *y; x +=incx; y += incy; } return accum; } double * copy_mat(double *y, int ldy, double *x, int ldx, int nrow, int ncol) { /* y <- x */ double * ret = y; while (ncol-- > 0) { Memcpy(y, x, nrow); y += ldy; x += ldx; } return ret; } double * copy_trans(double *y, int ldy, double *x, int ldx, int nrow, int ncol) /* y <- t(x) */ { double * ret = y; int i, j; for (i = 0L; i < nrow; i++) { for (j = 0L; j < ncol; j++) { y[j] = x[i + j * ldx]; } y += ldy; } return ret; } double * mult_mat(double *z, int ldz, double *x, int ldx, int xrows, int xcols, double *y, int ldy, int ycols) { /* z <- x %*% y */ double *t, *tmp = R_Calloc((size_t)(xrows * ycols), double); int i, j; /* use tmp so z can be either x or y */ t = tmp; for (i = 0; i < ycols; i++) { for (j = 0; j < xcols; j++) { d_axpy(t, y[j], x + j * ldx, xrows); } t += xrows; y += ldy; } copy_mat(z, ldz, tmp, xrows, xrows, ycols); R_Free(tmp); return z; } static void zero_mat(double *y, int ldy, int nrow, int ncol) { /* y[,] <- 0 */ while (ncol-- > 0) { int i; for (i = 0; i < nrow; i++) { y[i] = 0.0; } y += ldy; } } QRptr QR(double *mat, int ldmat, int nrow, int ncol) { /* Constructor for a QR object */ QRptr value = R_Calloc((size_t) 1, struct QR_struct); int j; double *work; if (sqrt_eps == 0.) { sqrt_eps = sqrt(DBL_EPSILON); } value->mat = mat; value->ldmat = ldmat; value->nrow = nrow; value->ncol = ncol; value->qraux = R_Calloc((size_t) ncol, double); value->pivot = R_Calloc((size_t) ncol, int); for (j = 0; j < ncol; j++) { (value->pivot)[j] = j; } work = R_Calloc( 2 * ncol, double ); F77_CALL(dqrdc2) (mat, &ldmat, &nrow, &ncol, &sqrt_eps, &(value->rank), value->qraux, value->pivot, work); R_Free(work); return value; } void QRfree(QRptr this) { /* destructor for a QR object*/ R_Free(this->pivot); R_Free(this->qraux); R_Free(this); } int QRqty(QRptr this, double *ymat, int ldy, int ycol) { /* ymat <- qr.qty(this, ymat) */ int j, info, task = 1000L; for (j = 0; j < ycol; j++) { double *col = ymat + j * ldy; F77_CALL(dqrsl) (this->mat, &(this->ldmat), &(this->nrow), &(this->ncol), this->qraux, col, DNULLP, col, DNULLP, DNULLP, DNULLP, &task, &info); } return info; } int QRsolve( QRptr this, double *ymat, int ldy, int ycol, double *beta, int ldbeta ) { /* beta <- qr.beta(this, ymat) */ int j, info, task = 1100L; double *qty = R_Calloc( this->nrow, double ), *bb = R_Calloc( this->ncol, double ); for (j = 0; j < ycol; j++) { Memcpy( qty, ymat, this->nrow ); F77_CALL(dqrsl) (this->mat, &(this->ldmat), &(this->nrow), &(this->ncol), this->qraux, qty, DNULLP, qty, bb, DNULLP, DNULLP, &task, &info); Memcpy( beta, bb, this->ncol ); ymat += ldy; beta += ldbeta; } R_Free( qty ); R_Free( bb ); return info; } double QRlogAbsDet(QRptr this) { /* log(abs(det(upper triangle))) */ int j; double accum = 0.0; for (j = 0; j < this->rank; j++) accum += log(fabs(this->mat[j * (this->ldmat + 1L)])); return accum; } void QRstoreR(QRptr this, double *dest, int ldDest) { /* store the R part into dest */ int i; for (i = 0; i < this->ncol; i++) { Memcpy(dest + this->pivot[i] * ldDest, this->mat + i * this->ldmat, ((i + 1) > this->rank) ? this->rank : i + 1); } } int QR_and_rotate(double *mat, int ldmat, int nrow, int ncol, double *DmHalf, int qi, int ndecomp, double *logdet, double *store, int ldstr) /* Append DmHalf to the bottom of mat and take a QR decomposition of the first ndecomp columns. Apply the rotations to the other columns. Return the rank and increment log(abs(det(R11))). */ { int rank, arow = nrow + qi, /* number of rows in augmented matrix */ ndrow = ((arow > ndecomp) ? ndecomp : arow); double *aug = R_Calloc((size_t) arow * ncol, double); QRptr aQR; copy_mat(aug, arow, mat, ldmat, nrow, ncol); copy_mat(aug + nrow, arow, DmHalf, qi, qi, qi); aQR = QR(aug, arow, arow, ndecomp); if (logdet != DNULLP) { *logdet += QRlogAbsDet(aQR); } QRqty(aQR, aug + ndecomp * arow, arow, ncol - ndecomp); if (ldstr > 0) { QRstoreR(aQR, store, ldstr); copy_mat(store + ndecomp * ldstr, ldstr, aug + ndecomp * arow, arow, ndrow, ncol - ndecomp); } if (qi < ndecomp) { zero_mat(mat, ldmat, nrow, ncol); } copy_mat(mat + ndecomp * ldmat, ldmat, aug + ndecomp * (arow + 1L), arow, arow - ndrow, ncol - ndecomp); rank = aQR->rank; QRfree(aQR); R_Free(aug); return rank; } nlme/src/init.c0000644000176000001440000001357214251721455013151 0ustar ripleyusers/* Copyright 2005-2018 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include #include #include #include #include "nlmefit.h" #include "nlOptimizer.h" #include "pdMat.h" extern void corStruct_factList(double *, int *, double *, double *); extern void corStruct_recalc(double *, int *, int *, double *); extern void symm_fullCorr(double *, int *, double *); extern void symm_matList(double *, int *, int *, int *, double *); extern void symm_factList(double *, int *, int *, int *p, double *, double *); extern void symm_recalc(double *, int *, int *, double *, int *, int *, double *); extern void nat_fullCorr(double *, int *, double *); extern void nat_matList(double *, int *, int *, int *, double *); extern void nat_factList(double *, int *, int *, int *, double *, double *); extern void nat_recalc(double *, int *, int *l, double *, int *, int *, double *); extern void AR1_matList(double *, int *, double *); extern void AR1_factList(double *, int *, double *, double *); extern void AR1_recalc(double *, int *, int *, double *, double *); extern void CAR1_matList(double *, double *, int *, double *); extern void CAR1_factList(double *, double *, int *, double *, double *); extern void CAR1_recalc(double *Xy, int *pdims, int *ZXcol, double *par, double *time, double *logdet); extern void ARMA_constCoef(int *, int *, double *); extern void ARMA_unconstCoef(int *, int *, double *); extern void ARMA_matList(double *, int *, int *, int *, int *, int *, double *); extern void ARMA_factList(double *, int *, int *, int *, int *, int *, double *, double *); extern void ARMA_recalc(double *, int *, int *, double *, int *, int *, int *, int *, double *); extern void compSymm_matList(double *, double *, int *, double *); extern void compSymm_factList(double *, double *, int *, double *, double *); extern void compSymm_recalc(double *, int *, int *, double *, double *, double *); extern void spatial_matList(double *, int *, double *, int *, double *, double *); extern void spatial_factList(double *, int *, double *, int *, double *, double *, double *); extern void spatial_recalc(double *, int *, int *, double *, double *, double *, int *, double *); extern void fit_nlme(double *, double *, int *, int *, int *, double *, double *, int *, double *, double *, int *, int *, double *, SEXP model); extern void nlme_one_comp_first (int *, double *, double *); extern void nlme_one_comp_open (int *, double *, double *); extern void inner_perc_table(double *, int *, int *, int *, int *, double *); extern void natural_pd(double *, int *, double *); R_CMethodDef CEntries[] = { {"corStruct_factList", (DL_FUNC) &corStruct_factList, 4}, {"corStruct_recalc", (DL_FUNC) &corStruct_recalc, 4}, {"symm_factList", (DL_FUNC) &symm_factList, 6}, {"symm_matList", (DL_FUNC) &symm_matList, 5}, {"symm_fullCorr", (DL_FUNC) &symm_fullCorr, 3}, {"symm_recalc", (DL_FUNC) &symm_recalc, 7}, {"nat_factList", (DL_FUNC) &nat_factList, 6}, {"nat_matList", (DL_FUNC) &nat_matList, 5}, {"nat_fullCorr", (DL_FUNC) &nat_fullCorr, 3}, {"nat_recalc", (DL_FUNC) &nat_recalc, 7}, {"AR1_factList", (DL_FUNC) &AR1_factList, 4}, {"AR1_matList", (DL_FUNC) &AR1_matList, 3}, {"AR1_recalc", (DL_FUNC) &AR1_recalc, 5}, {"CAR1_factList", (DL_FUNC) &CAR1_factList, 5}, {"CAR1_matList", (DL_FUNC) &CAR1_matList, 4}, {"CAR1_recalc", (DL_FUNC) &CAR1_recalc, 6}, {"ARMA_constCoef", (DL_FUNC) &ARMA_constCoef, 3}, {"ARMA_unconstCoef", (DL_FUNC) &ARMA_unconstCoef, 3}, {"ARMA_factList", (DL_FUNC) &ARMA_factList, 8}, {"ARMA_matList", (DL_FUNC) &ARMA_matList, 7}, {"ARMA_recalc", (DL_FUNC) &ARMA_recalc, 9}, {"compSymm_factList", (DL_FUNC) &compSymm_factList, 5}, {"compSymm_matList", (DL_FUNC) &compSymm_matList, 4}, {"compSymm_recalc", (DL_FUNC) &compSymm_recalc, 6}, {"spatial_factList", (DL_FUNC) &spatial_factList, 7}, {"spatial_matList", (DL_FUNC) &spatial_matList, 6}, {"spatial_recalc", (DL_FUNC) &spatial_recalc, 8}, {"gls_loglik", (DL_FUNC) &gls_loglik, 5}, // 17-11-2015; Fixed sigma ... {"gls_estimate", (DL_FUNC) &gls_estimate, 8}, {"fit_gnls", (DL_FUNC) &fit_gnls, 10}, {"inner_perc_table", (DL_FUNC) &inner_perc_table, 6}, {"mixed_loglik", (DL_FUNC) &mixed_loglik, 7}, // 17-11-2015; Fixed sigma ... {"mixed_decomp", (DL_FUNC) &mixed_decomp, 2}, {"mixed_EM", (DL_FUNC) &mixed_EM, 10}, // 17-11-2015; Fixed sigma ... {"nlme_one_comp_first", (DL_FUNC) &nlme_one_comp_first, 3}, {"nlme_one_comp_open", (DL_FUNC) &nlme_one_comp_open, 3}, {"fit_nlme", (DL_FUNC) &fit_nlme, 14}, // 17-11-2015; Fixed sigma ... {"matrixLog_pd", (DL_FUNC) &matrixLog_pd, 3}, {"logChol_pd", (DL_FUNC) &logChol_pd, 3}, {"natural_pd", (DL_FUNC) &natural_pd, 3}, {"compSymm_pd", (DL_FUNC) &compSymm_pd, 3}, {"mixed_estimate", (DL_FUNC) &mixed_estimate, 8}, // 17-11-2015; Fixed sigma ... {"mixed_combined", (DL_FUNC) &mixed_combined, 11}, {NULL, NULL, 0} }; void #ifdef HAVE_VISIBILITY_ATTRIBUTE __attribute__ ((visibility ("default"))) #endif R_init_nlme(DllInfo *dll) { R_registerRoutines(dll, CEntries, NULL, NULL, NULL); R_useDynamicSymbols(dll, FALSE); R_forceSymbols(dll, TRUE); } nlme/src/nlOptimizer.c0000644000176000001440000000253614251721455014520 0ustar ripleyusers/* Implementation of eval_model() and spread() for R. Copyright 1999 Saikat DebRoy Copyright 2007-2016 The R Core Team This file is part of the nlme package for S and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include "nlOptimizer.h" int evaluate(double *param, int nParam, SEXP model, double **value) { SEXP newPars, call, result; int i, nResult; PROTECT(newPars = allocVector(REALSXP, nParam)); PROTECT(model); for(i = 0; i < nParam; i++) REAL(newPars)[i] = param[i]; PROTECT(call = lang2(model, newPars)); PROTECT(result = eval(call, R_GlobalEnv)); nResult = LENGTH(result); if(value[0] == (double *) 0) { UNPROTECT(4); return(nResult); } double *res = REAL(result); for(i = 0; i < nResult; i++) value[0][i] = res[i]; UNPROTECT(4); return(-1); } nlme/src/Makevars0000644000176000001440000000003414251721455013523 0ustar ripleyusersPKG_CFLAGS=$(C_VISIBILITY) nlme/src/base.h0000644000176000001440000000225414251721455013120 0ustar ripleyusers/* header file for the nlme package Copyright 1999-2001 Saikat DebRoy, Douglas Bates Copyright 2007-2013 The R Core Team This file is part of the nlme package for S and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #ifndef NLME_BASE_H #define NLME_BASE_H #include #include // for memcpy #include #include #include #ifdef ENABLE_NLS # include # define _(String) dgettext ("nlme", String) #else # define _(String) (String) #endif #define DNULLP (double *) 0 extern double sqrt_eps; extern double xlower; #endif /* NLME_BASE_H */ nlme/src/nlOptimizer.h0000644000176000001440000000206514251721455014522 0ustar ripleyusers/* header file for the nlme package Copyright 1999 Saikat DebRoy Copyright 2007-2016 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #ifndef NLME_NLOPTIMIZER_H #define NLME_NLOPTIMIZER_H #include "base.h" #include "Rinternals.h" extern int evaluate(double *, int, SEXP model, double **); extern void fit_gnls(double *, int *, double *, double *, int *, double *, double *, int *, int *, SEXP model); #endif /* NLME_NLOPTIMIZER_H */ nlme/src/nlme.c0000644000176000001440000003567314271005035013136 0ustar ripleyusers/* Routines for fitting nlme models Copyright 2007-2022 The R Core Team Copyright 1997-2001 Douglas M. Bates , Jose C. Pinheiro, Saikat DebRoy This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ #include // for DBL_EPSILON #include "nlOptimizer.h" #include "matrix.h" #include "nlmefit.h" extern void corStruct_recalc(double *, int *, int *, double *); #define is_na_DOUBLE(x) ISNA(*(x)) /* nlme functions and variables */ typedef struct nlme_struct { /* Nonlinear mixed-effects structure */ double *residuals, *gradient, *DmHalf, *corFactor, *varWeights, *newtheta, *theta, *incr, *add_ons, new_objective, objective, RSS, *sigma; // <- 17-11-2015; Fixed sigma patch; E van Willigen; Quant.Sol. int corOpt, varOpt, nparTot, ngrpTot, nrdof, *sgroups, *corDims, *npar, *pdClass, *pdims, *ZXoff, *ZXlen; double *result[1]; dimPTR dd, d1; SEXP model; int conv_failure; } *nlmePtr; double sqrt_eps = 0.0; static int * make_sequential(int *dest, int *src, int n) { /* copy the pattern from src to dest */ /* but in sequential values starting */ /* from 0 */ int val = 0, *ret = dest, sval; if (n <= 0) return dest; sval = *src++; *dest++ = val; while (--n) { if (*src != sval) {sval = *src; val++;} src++; *dest++ = val; } return ret; } static nlmePtr nlme_init(double *ptheta, double *pDmHalf, int *pgroups, int *pdims, int *pdClass, double *pcorFactor, double *pvarWeights, int *pcorDims, double *additional, int *pcorOpt, int *pvarOpt, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions double *sigma, SEXP model) { int i, *src, nResult; nlmePtr nlme = R_Calloc(1, struct nlme_struct); nlme->pdims = pdims; nlme->DmHalf = pDmHalf; nlme->pdClass = pdClass; nlme->corFactor = pcorFactor; nlme->varWeights = pvarWeights; nlme->corDims = pcorDims; nlme->dd = dims(pdims); nlme->npar = R_Calloc(nlme->dd->Q + 1, int); nlme->sigma = sigma; // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions for(i = 0, nlme->nparTot = 0; i <= nlme->dd->Q; i++) { nlme->npar[i] = (nlme->dd->ncol)[i] * (nlme->dd->ngrp)[i]; nlme->nparTot += nlme->npar[i]; } nlme->nrdof = nlme->dd->N - nlme->nparTot; nlme->sgroups = pgroups; for(i = 0, src = nlme->sgroups; i < nlme->dd->Q; i++) { make_sequential(src, src, nlme->dd->N); src += nlme->dd->N; } nlme->corOpt = *pcorOpt; nlme->varOpt = *pvarOpt; nlme->theta = ptheta; nlme->add_ons = additional; nlme->ngrpTot = 0; for (i = 0; i < (nlme->dd->Q + 2); i++) { nlme->ngrpTot += nlme->dd->ngrp[i]; } nlme->ZXoff = R_Calloc(nlme->ngrpTot, int); Memcpy(nlme->ZXoff, nlme->dd->ZXoff[0], nlme->ngrpTot); nlme->ZXlen = R_Calloc(nlme->ngrpTot, int); Memcpy(nlme->ZXlen, nlme->dd->ZXlen[0], nlme->ngrpTot); nlme->newtheta = R_Calloc(nlme->nparTot, double); nlme->incr = R_Calloc(nlme->nparTot, double); nlme->model = model; nlme->result[0] = DNULLP; nResult = evaluate(ptheta, nlme->nparTot, model, nlme->result); nlme->result[0] = R_Calloc(nResult, double); return(nlme); } static void nlmeFree(nlmePtr nlme) { R_Free(nlme->newtheta); R_Free(nlme->incr); R_Free(nlme->npar); R_Free(nlme->ZXoff); R_Free(nlme->ZXlen); R_Free(nlme->result[0]); R_Free(nlme); } static void /* undo changes in dd from internal_decomp */ restore_dims(nlmePtr nlme) { nlme->dd->ZXrows = nlme->dd->N; Memcpy(nlme->dd->ZXoff[0], nlme->ZXoff, nlme->ngrpTot); Memcpy(nlme->dd->ZXlen[0], nlme->ZXlen, nlme->ngrpTot); } static void nlme_wtCorrAdj(nlmePtr nlme) { int i, j; if(nlme->varOpt) { /* variance function adjustment */ for(i = 0; i < nlme->dd->N; i++) { for(j = 0; j < nlme->dd->ZXcols; j++) { *(nlme->result[0] + i + j * nlme->dd->N) *= nlme->varWeights[i]; } } } if(nlme->corOpt) { /* correlation structure adjustment */ corStruct_recalc(nlme->result[0], nlme->corDims, &nlme->dd->ZXcols, nlme->corFactor); } } static double nlme_RSS(nlmePtr nlme) { nlme->residuals = nlme->result[0] + (nlme->dd->ZXcols - 1) * nlme->dd->N; nlme->gradient = nlme->result[0]; nlme->RSS = d_sum_sqr(nlme->residuals, nlme->dd->N); return(nlme->RSS); } static double nlme_objective(nlmePtr nlme) { int i; double RSS, *srcB; RSS = nlme->RSS; for(i = 0, srcB = nlme->newtheta; i < nlme->dd->Q; i++) { double *work = R_Calloc(nlme->npar[i], double); mult_mat(work, (nlme->dd->ncol)[i], nlme->DmHalf + (nlme->dd->DmOff)[i], (nlme->dd->ncol)[i], (nlme->dd->ncol)[i], (nlme->dd->ncol)[i], srcB, (nlme->dd->ncol)[i], (nlme->dd->ngrp)[i]); RSS += d_sum_sqr(work, nlme->npar[i]); srcB += nlme->npar[i]; R_Free(work); } return(RSS); } static void nlme_workingRes(nlmePtr nlme) { int i, j, k; double *theta = nlme->theta; for(j = 0; j < nlme->dd->Q; j++) { int nb = nlme->dd->ncol[j]; double *res = nlme->gradient + nlme->dd->ZXrows * (nlme->dd->ZXcols - 1); for(k = 0; k < nlme->dd->ngrp[j]; k++) { double *Zjk = nlme->gradient + nlme->dd->ZXoff[j][k]; for(i = 0; i < nlme->dd->ZXlen[j][k]; i++) { *res += d_dot_prod(Zjk + i, nlme->dd->ZXrows, theta, 1, nb); res++; } theta += nb; } } } static double nlme_increment(nlmePtr nlme) { double predObj, *dest, *src, logLik, lRSS, *Ra = R_Calloc(nlme->dd->DmOff[nlme->dd->Q], double), *dc = R_Calloc(nlme->dd->Srows * nlme->dd->ZXcols, double) /* , *auxGrad = R_Calloc(nlme->dd->N * (nlme->dd->ZXcols - 1), double) */ ; double *incr = nlme->incr; double *theta = nlme->theta; int i, j, start, RML = 0; if (sqrt_eps == 0.0) sqrt_eps = sqrt(DBL_EPSILON); /* Memcpy(auxGrad, nlme->gradient, (nlme->dd->ZXcols - 1) * nlme->dd->N); */ internal_decomp(nlme->dd, nlme->gradient); nlme_workingRes(nlme); internal_EM(nlme->dd, nlme->gradient, nlme->DmHalf, 20, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions nlme->pdClass, &RML, &logLik, Ra, &lRSS, nlme->sigma); { statePTR st = R_Calloc(1, struct state_struct); int ntheta = count_DmHalf_pars( nlme->dd, nlme->pdClass ), itrmcd, itncnt, msg, iagflg; double epsm, *theta = R_Calloc(ntheta, double), *typsiz = R_Calloc(ntheta, double), *grad = R_Calloc(ntheta, double), *newtheta = R_Calloc(ntheta, double), *a = R_Calloc(ntheta * ntheta, double), *work = R_Calloc(ntheta * 9, double); st->dd = nlme->dd; st->ZXy = nlme->gradient; st->pdClass = nlme->pdClass; st->RML = &RML; st->sigma = nlme->sigma; // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions generate_theta(theta, nlme->dd, nlme->pdClass, nlme->DmHalf); epsm = DBL_EPSILON; msg = 9; /* don't inhibit checks but suppress output */ for (i = 0; i < ntheta; i++) { typsiz[i] = 1.0; } /* iagflg = 1; */ /* for (i = 0; i < nlme->dd->Q; i++) { */ /* if (nlme->pdClass[i] < 1 || nlme->pdClass[i] == 3 || nlme->pdClass[i] > 4) { */ /* iagflg = 0; */ /* break; */ /* } */ /* } */ iagflg = 0; /* temporary modification */ // Call the documented C API interface to R's nlm() : optif9(ntheta, ntheta, theta, (fcn_p) mixed_fcn, (fcn_p) mixed_grad, /* no hessian: */ (d2fcn_p) 0, st, typsiz, 1.0 /*fscale*/, 1 /*method*/, 1 /*iexp*/, &msg, -1 /*ndigit*/, 20 /*itnlim*/, iagflg, 0 /*iahflg*/, -1. /*dlt*/, pow(epsm, 1.0/3.0) /*gradtl*/, 0. /*stepmx*/, sqrt(epsm) /*steptl*/, newtheta, &logLik, grad, &itrmcd, a, work, &itncnt); if (msg == 0) { generate_DmHalf(nlme->DmHalf, nlme->dd, nlme->pdClass, theta); } R_Free(work); R_Free(a); R_Free(newtheta); R_Free(grad); R_Free(typsiz); R_Free(theta); R_Free(st); } nlme->objective = nlme_objective(nlme); // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions internal_loglik(nlme->dd, nlme->result[0], nlme->DmHalf, &RML, dc, DNULLP, nlme->sigma); internal_estimate(nlme->dd, dc); src = dc + (nlme->dd->ZXcols - 1) * nlme->dd->Srows; dest = incr; for(i = 0, start = 0; i <= nlme->dd->Q; i++) { for(j = 0; j < (nlme->dd->ngrp)[i]; j++) { Memcpy(dest, src + ((nlme->dd->SToff)[i][j] - start), (nlme->dd->ncol)[i]); dest += (nlme->dd->ncol)[i]; } start += (nlme->dd->ncol)[i] * nlme->dd->Srows; } for(i = 0; i < (nlme->nparTot - nlme->npar[nlme->dd->Q]); i++) { incr[i] -= theta[i]; } predObj = dc[nlme->dd->ZXcols * nlme->dd->ZXrows - 1]; predObj = predObj * predObj; /* regSS = nlme_RegSS(nlme, auxGrad); */ /* Regression Sum of Squares */ R_Free(Ra); R_Free(dc); /* R_Free(auxGrad); */ return(sqrt(((double) nlme->nrdof) * (nlme->objective - predObj) / (((double) nlme->nparTot) * predObj))); } static int nlme_iterate(nlmePtr nlme, double *settings) { double factor, criterion; SEXP model = nlme->model; double *newtheta = nlme->newtheta; double *theta = nlme->theta; int iteration; long maxIter = (long) settings[0]; double minFactor = settings[1]; double tolerance = settings[2]; Memcpy(newtheta, theta, nlme->nparTot); evaluate(theta, nlme->nparTot , model, nlme->result); nlme_wtCorrAdj(nlme); nlme_RSS(nlme); settings[3] = nlme->conv_failure = 0; for (factor = 1.0, iteration = 1; iteration <= maxIter; iteration++) { /* outer iteration loop */ /* increment and convergence criterion */ criterion = nlme_increment(nlme); if (nlme->conv_failure) return(iteration); /* Unable to make increment */ if (criterion < tolerance) return(iteration); /* successful completion */ int inner_it = 0; do { /* inner loop for acceptable step size */ if (factor < minFactor) { settings[3] = 1; return(iteration); } Memcpy(newtheta, theta, nlme->nparTot); d_axpy(newtheta, factor, nlme->incr, nlme->nparTot); evaluate(newtheta, nlme->nparTot , model, nlme->result); restore_dims(nlme); nlme_wtCorrAdj(nlme); nlme_RSS(nlme); nlme->new_objective = nlme_objective(nlme); if (nlme->conv_failure) return(iteration); /* unable to evaluate objective */ if((inner_it++) % 1000 == 0) R_CheckUserInterrupt(); factor /= 2.0; } while (nlme->new_objective >= nlme->objective); factor *= 4.0; if (factor > 1.0) factor = 1.0; nlme->objective = nlme->new_objective; Memcpy(theta, newtheta, nlme->nparTot); } settings[3] = 2; /* Maximum number of iterations exceeded */ return(iteration - 1); } static void nlme_wrapup(nlmePtr nlme) { SEXP model = nlme->model; evaluate(nlme->theta, nlme->nparTot , model, nlme->result); Memcpy(nlme->add_ons, nlme->result[0], nlme->dd->N * nlme->dd->ZXcols); nlme->objective = nlme_objective(nlme); R_Free(nlme->npar); dimFree(nlme->dd); } void fit_nlme(double *ptheta, double *pDmHalf, int *pgroups, int *pdims, int *pdClass, double *pcorFactor, double *pvarWeights, int *pcorDims, double *settings, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions double *additional, int *pcorOpt, int *pvarOpt, double *sigma, SEXP model) { nlmePtr nlme; PROTECT(model); nlme = nlme_init(ptheta, pDmHalf, pgroups, pdims, pdClass, pcorFactor, pvarWeights, pcorDims, // 17-11-2015; Fixed sigma patch; E van Willigen; Quantitative Solutions additional, pcorOpt, pvarOpt, sigma , model); if(sqrt_eps == 0.0) sqrt_eps = sqrt(DBL_EPSILON); settings[4] = (double) nlme_iterate(nlme, settings); nlme_wrapup(nlme); settings[5] = nlme->objective; nlmeFree(nlme); UNPROTECT(1); } void nlme_one_comp_open (int *nrow, double *Resp, double *inmat) { int i, nn = *nrow; double ke, ka, tl = 0, delta, C = 0, Ca = 0, interval, *Subject, *Time, *Conc, *Dose, *Interval, *V, *Ka, *Ke, sl = DBL_EPSILON; /* sl is last subject number, usually */ /* an integer but passed as double. */ /* It is started at an unlikely value. */ Subject = inmat; Time = inmat + nn; Conc = inmat + 2 * nn; Dose = inmat + 3 * nn; Interval = inmat + 4 * nn; V = inmat + 5 * nn; Ka = inmat + 6 * nn; Ke = inmat + 7 * nn; for(i = nn; i--; Resp++, Subject++, Time++, Conc++, Dose++, Interval++, V++, Ka++, Ke++) { ke = *Ke; ka = *Ka; if (*Subject != sl) { /* new Subject */ sl = *Subject; tl = *Time; *Resp = 0; if (!is_na_DOUBLE(Interval)) { /* steady-state dosing */ interval = *Interval; C = *Dose * ka * (1/(1 - exp(-ke * interval)) - 1/(1 - exp(-ka * interval)))/ (*V * (ka - ke)); Ca = *Dose / (*V * (1 - exp(-ka * interval))); } else { /* non-steady-state */ C = 0; Ca = *Dose/ *V; } } else { /* same Subject */ if (!is_na_DOUBLE(Dose)) { if (!is_na_DOUBLE(Interval)) { /* steady-state dosing */ interval = *Interval; C = *Dose * ka * (1/(1 - exp(-ke * interval)) - 1/(1 - exp(-ka * interval)))/ (*V * (ka - ke)); Ca = *Dose / (*V * (1 - exp(-ka * interval))); } else { /* non-steady-state */ delta = *Time - tl; C = C*exp(-ke * delta) + Ca*ka*(exp(-ke*delta) - exp(-ka*delta))/(ka -ke); Ca = Ca * exp(-ka*delta) + *Dose / *V; } tl = *Time; *Resp = 0; } else if (!is_na_DOUBLE(Conc)) { delta = *Time - tl; *Resp = C * exp(-ke * delta) + Ca * ka * (exp(-ke * delta) - exp(-ka * delta))/(ka - ke); } else *Resp = 0; } } } /* Phenobarbital Model */ void nlme_one_comp_first (int *nrow, double *Resp, double *inmat) { int nn = *nrow, mm = 0; double v, cl, *tl = R_Calloc(nn, double), *ds = R_Calloc(nn, double), sl = DBL_EPSILON; /* sl is last subject number, usually */ /* an integer but passed as double. */ /* It is started at an unlikely value. */ double *Subject = inmat, *Time = inmat + nn, *Dose = inmat + 2 * nn, *V = inmat + 3 * nn, *Cl = inmat + 4 * nn; for(int i = nn; i--; Resp++, Subject++, Time++, Dose++, V++, Cl++) { v = *V; cl = *Cl; *Resp = 0; if (*Subject != sl) { /* new Subject */ if (is_na_DOUBLE(Dose)) { error(_("First observation on an individual must have a dose")); } sl = *Subject; mm = 0; tl[mm] = *Time; ds[mm] = *Dose; } else { /* same Subject */ if (!is_na_DOUBLE(Dose)) { /* Dose measurement */ mm++; tl[mm] = *Time; ds[mm] = *Dose; } else { /* Concentration measurement */ for(int j = 0; j <= mm; j++) { *Resp += ds[j] * exp(-cl * (*Time - tl[j]) / v) / v; } } } } R_Free(ds); R_Free(tl); } nlme/src/pythag.c0000644000176000001440000000172214251721455013474 0ustar ripleyusers/* Copyright 2018 The R Core Team This file is part of the nlme package for R and related languages and is made available under the terms of the GNU General Public License, version 2, or at your option, any later version, incorporated herein by reference. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, a copy is available at http://www.r-project.org/Licenses/ */ /* Replaces FORTRAN version in rs.f which did not handle special values such as NaN. return value in an arg for maximal portability -- see WRE section 6.6 */ #include #include void F77_SUB(hypot)(double *a, double *b, double *p) { *p = hypot(*a, *b); } nlme/ChangeLog0000644000176000001440000015615714772474640013045 0ustar ripleyusers2025-03-31 Brian Ripley * DESCRIPTION: Version is 3.1-168 * Update German translations 2025-01-27 Kurt Hornik * DESCRIPTION (Version): 3.1-167 (released) 2024-08-22 Sebastian Meyer * R/corStruct.R (print.summary.corNatural): failed from wrong coef() method. 2024-08-21 Sebastian Meyer * src/nlmefit.c (mixed_fcn): guard against non-finite results of 'internal_loglik', potentially causing infinite looping in 'optif9'; reported for simulate.lme() in PR#17955 and PR#18433. * tests/predict.lme.R: add corresponding regression test. 2024-08-16 Sebastian Meyer * tests/corFactor.R, tests/corMatrix.R: rename and add test of spatial correlation with groups. * src/corStruct.c (corStruct_recalc): fix iterating over 'Xy' to be compatible with spatial correlation structures, avoiding memory errors from nlme() (PR#18192) and gnls() (PR#17227). Thanks to Laurens Bogaardt for the useful reproducible example and to Mikko Korpela, Benjamin Tyner, and Ivan Krylov for initial debugging. * tests/nlme.R: add corresponding regression test. 2024-08-13 Kurt Hornik * DESCRIPTION (Version): 3.1-166 (released) 2024-08-12 Sebastian Meyer * R/corStruct.R (Initialize.corARMA): catch unsupported values of 'p' and 'q' (PR#18777, thanks to Liming Li). * tests/corStruct.R: added, with regression test. 2024-06-18 Sebastian Meyer * tests/deviance.R, tests/nlme.R, tests/updateLme.R: use 'MASS' conditionally. 2024-06-16 Kurt Hornik * man/pairs.compareFits.Rd: * man/pairs.lmList.Rd: * man/pairs.lme.Rd: * man/plot.ACF.Rd: * man/plot.Variogram.Rd: * man/plot.augPred.Rd: * man/plot.gls.Rd: * man/plot.lmList.Rd: * man/plot.lme.Rd: * man/plot.nfnGroupedData.Rd: Add package anchors for links to targets from package 'lattice'. 2024-06-05 Sebastian Meyer * DESCRIPTION (Depends): update to real minimum R version (R >= 3.6.0). * po, inst/po: update (installed) translations * man/simulate.lme.Rd, man/summary.lme.Rd: drop unneeded \donttest. 2024-04-29 Sebastian Meyer * R/nlme.R (nlme.nlsList): fix scoping issue for nlsList() and self-starting nlme() calls with a preconstructed formula. 2024-04-28 Sebastian Meyer * R/corStruct.R (corARMA): corARMA() no longer returns the dysfunctional/undocumented corIdent() structure, with a clear error message when neither 'p' nor 'q' are set > 0 (PR#17988). 2024-04-23 Sebastian Meyer * R/VarCov.R (getVarCov.lme, getVarCov.gls): support 'individual[s]' with only one observation (PR#16806). * tests/getVarCov.R: add corresponding regression tests. 2024-04-17 Sebastian Meyer * R/lme.R (predict.lme): use formula() instead of re-evaluating the call (with the wrong scope), similar to PR#15892. * R/nlme.R (nlme.formula): nlme() finally works with fixed variance weights (PR#17712), thanks to the pointers by Bill Denney, Benjamin Tyner, and Ben Bolker. * tests/varFixed.R: added, based on BD's example. * R/varFunc.R (varIdent): warn about misguided varIdent(~1|g) 2023-12-08 Martin Maechler * tests/augPred_lab.R: manually do Hmisc label(.) <- .. * DESCRIPTION (Version): 3.1-165; no longer suggesting 'Hmisc'. 2023-11-27 Martin Maechler * src/nlmefit.c: 2 x format 'int': s/%ld/%d/ * DESCRIPTION (Version): 3.1-164 2023-07-31 Martin Maechler * R/nlme.R (nlme.formula, formula.nlme): * R/gnls.R (gnls, formula.gnls): store 'model' argument as 'formula' ==> trivial formula() methods, fixing PR#18559 by Ben Bolker. 2023-04-06 Martin Maechler * tests/sigma-fixed-etc.R (nlme): loosen tol for sM4$tTable[,"Std.Error"] * DESCRIPTION (Version): 3.1-163 2023-01-28 Martin Maechler * DESCRIPTION (Version): 3.1-162 (to be released) * R/corStruct.R (corIdent, *.corIdent): deprecated corIdent() and some of the "corIdent" methods. * man/nlme-deprecated.Rd: deprecation 2023-01-26 Sebastian Meyer * src/matrix.h: fix return value in C declaration of Fortran subroutine 'RS'. (PR#18438 by Lionel Henry.) 2023-01-23 Sebastian Meyer * R/groupedData.R (nfGroupedData, nmGroupedData): fix deprecation logic to give a warning when not called internally. * R/groupedData.R (balancedGrouped): suppress spurious warning from testing for numeric row names. 2022-11-17 Martin Maechler * DESCRIPTION (Version): 3.1-161 (released) * R/pdMat.R (str.pdMat): new method, fixing error for un-initialized, and misleading e.g., in `pdDiag` case. 2022-10-10 Brian Ripley * DESCRIPTION (Version): 3.1-160 (released) 2022-08-24 Brian Ripley * src/nlmefit.c: Fix for -Wstrict-prototypes. 2022-07-28 Martin Maechler * DESCRIPTION (Version): 3.1-159 * R/gnls.R (gnls): 'if (deparse(params[[nm]][[3]]) != "1")' fails for long formulas (R-help list, thanks to Bill Dunlap, Jul 24) 2022-07-05 Brian Ripley * man/{gls,lme}: document the prohibition on (rather than ignoring of) offset() terms. 2022-06-13 Brian Ripley * DESCRIPTION (Version): 3.1-158 (released) * R/lme.R (formula.lme): get the formula from the terms instead of re-evaluating the call (with the wrong scope), fixing PR#15892. * tests/scoping.R: add corresponding regression test. * R/nlsList.R: use inherits() instead of comparing class to string. 2022-03-25 Brian Ripley * DESCRIPTION (Version): 3.1-157 (released) 2022-03-24 Sebastian Meyer * R/nlme.R (nlme.formula): * R/gnls.R (gnls): revert check for offset() terms in non-linear models (avoid symbolic interpretation of arithmetic expressions). * R/lme.R (formula.lme): defer fix for scoping issue to give more time to update reverse dependencies 2022-03-22 Brian Ripley * DESCRIPTION (Version): 3.1-156 (unreleased) 2022-03-18 Sebastian Meyer * R/gls.R: keep "terms" from gls() for use in predict.gls(), fixing PR#18283. * R/zzMethods.R, NAMESPACE: drop formula-based terms.gls(). * tests/gls.R: add corresponding regression test. * R/gls.R (formula.gls): * R/lme.R (formula.lme): get the formula from the terms instead of re-evaluating the call (with the wrong scope), fixing PR#15892. * tests/scoping.R: add corresponding regression test. 2022-03-17 Sebastian Meyer * R/lme.R (lme.formula): * R/nlme.R (nlme.formula): * R/gls.R (gls): * R/gnls.R (gnls): stop() at offset() terms, fixing PR#17880. (They were previously ignored.) 2022-03-08 Sebastian Meyer Improve handling of factor variables in predict() methods. * R/gls.R (predict.gls): * R/gnls.R (predict.gnls): * R/lme.R (predict.lme): * R/nlme.R (predict.nlme): call model.frame() with 'xlev' to make sure factor levels are compatible with the employed contrasts (fixing PR#17226), including to warn for numeric 'newdata' for factor variables, and to support character input (cf. PR#18312). * tests/gls.R: * tests/nlme2.R: * tests/predict.lme.R: add corresponding regression tests. * R/gnls.R (gnls): always return contrast _matrices_ not just names of contrast functions. Needed for the above fix and for consistency with the other modelling functions in nlme. 2022-03-05 Sebastian Meyer * inst/CITATION: use citation(auto=meta) and add NLME book. * DESCRIPTION (Depends): finally require R >= 3.5.0. * R/lmList.R: drop old warnErrList() code, part of utils >= 3.5.0. * man/reStruct.Rd: late doc update for the pdClass default changed 2000-07-07 (PR#17740). 2022-03-04 Sebastian Meyer * R/lme.R (predict.lme): fix predictions for character-type newdata. The example in ch04.R produced wrong results with R >= 4.0.0 (PR#18312). * tests/predict.lme: add corresponding regression test. * R/newFunc.R (asOneFormula, getCovariateFormula, getResponseFormula): * R/newMethods.R (getGroupsFormula.default): fix environment of created formula (was local envir, now .GlobalEnv), in line with stats::asOneSidedFormula() in R 4.2.0. * inst/scripts/ch06.R: increase maxiter for nlsList() of Soybean data to only fail for a single plot, consistent with the book (p. 289). 2022-03-03 Sebastian Meyer Setup extra tests conditional on nlme:::doExtras() * DESCRIPTION: add SASmixed to Suggests (used in code from NLME book) * inst/scripts: arrange for cleaner Rdiff() (drop proc.time(), tag platform-dependent output via ## IGNORE_RDIFF_*, reduce digits in tests) * tests/extras: added, including test scripts to run the full code from the installed book chapters (with reference output) * tests/nlme-stall.R: moved to extras 2022-03-02 Sebastian Meyer * R/lmList.R (coef.lmList, summary.lmList): fix finding unique coefficient names when the set of estimated coefficients varies between subgroups (PR#16542); based on a patch by Ben Bolker. * tests/lmList.R: add corresponding regression test 2022-02-28 Sebastian Meyer Clean up license information * DESCRIPTION (Authors@R): "R Core Team" rather than "R-core" * DESCRIPTION (License): dropped redundant "| file LICENCE" * LICENCE: removed (copy of GPL-2) * LICENSE.note: created from README * README: removed 2022-02-26 Sebastian Meyer * R/VarCov.R (getVarCov.lme): * R/corStruct.R (Variogram.corSpatial): * R/lmList.R (predict.lmList): * R/lme.R (plot.ranef.lme): fix partial matching issues. 2022-02-25 Sebastian Meyer Fix more scoping issues (detected by sourcing the installed chapter scripts in a local environment) * R/simulate.R (simulate.lme): evaluate constructed calls in the parent frame. * R/lme.R (augPred.lme): look for data in the parent frame. * R/gls.R (augPred.gls): (ditto) 2022-02-23 Sebastian Meyer * R/simulate.R (simulate.lme): fix `useGen = TRUE` branch. 2022-01-13 Brian Ripley * DESCRIPTION (Version): 3.1-155 (released) * src: Use R_Calloc, R_Free. 2021-11-02 Sebastian Meyer * R/nlme.R (nlme.nlsList, nlme.formula): fix more scoping issues with self-starting models by evaluating calls in the parent frame. * R/nlsList.R (nlsList.selfStart): (ditto) * tests/scoping.R: add corresponding regression tests. 2021-10-21 Sebastian Meyer * R/gnls.R (gnls), tests/scoping.R: fix evaluation environment of the internal `nls` call used for self-starting models (PR#18157). * R/nlme.R (nlme.formula), tests/nlme.R: fix "unused argument" error when explicitly specifying `groups` in a self-starting model. 2021-09-23 Martin Maechler * DESCRIPTION (Version): 3.1-154 (unreleased) * R/gls.R (print.intervals.gls): do not print `attr(., "label")` twice; ditto in R/lme.R, PR#18196, with thanks to Johannes Ranke. 2021-09-07 Martin Maechler * R/groupedData.R ("[.groupedData"): change the default of `drop` to to FALSE for the case of `x[j]`, fixing PR#18177. * R/lme.R (print.summary.lme): change partial match to `x$coefficients`, PR#18184. * DESCRIPTION: Release 3.1-154 2021-08-05 Martin Maechler * R/zzMethods.R (.onLoad), R/VarCorr.R: remove code used only if(getRversion() < "3.3"); from Sebastian Meyer. 2021-03-09 Martin Maechler * R/varFunc.R (print.varFunc): use full 'unconstrained' argument name, fixing PR#17767, thanks to Sebastian Meyer. * DESCRIPTION (Version, Date): 3.1-153 (*not* yet for release) 2021-02-12 Brian Ripley * po: update fr translations. 2020-02-03 Brian Ripley * DESCRIPTION (Version, Date): 3.1-152 for 4.0.4. 2020-12-09 Martin Maechler * nlme/man/Remifentanil.Rd: change 2 URLs to 'moved to' locations. 2020-12-07 Martin Maechler * R/corStruct.R (print.corCompSymm, print.summary.corCompSymm): new, thanks to patch in PR#17990 by Sebastian Meyer; also fixing typo ("Uninitialized"). 2020-10-29 Martin Maechler * DESCRIPTION (Version): 3.1-151 * R/varFunc.R (varConstProp): constructor and methods, from PR#17954 by Johannes Ranke. 2020-10-02 Brian Ripley * DESCRIPTION (Version, Date): Prepare to release 3.1-150. 2020-09-24 Peter Dalgaard * R/VarCov.R tests/getVarCov.R: Patch set from Sebastian Meyer to fix group order issues PR#16744 * tests/corFactor.R: missed commit from patch for PR#16110 * INDEX: removed as it was out of date and autobuilt anyway 2020-08-21 Brian Ripley * R/pdMat.R: use parent.frame not sys.parent for data= args * DESCRIPTION (Version, Date): Prepare to release 3.1-149. 2020-08-20 Peter Dalgaard * NAMESPACE, R/corStruct.R, man/corFactor.corStruct.Rd, man/corMatrix.corStruct.Rd, tests/corFactor.R: Applied patch set from Sebastian Meyer to fix misnamed corFactor.compSymm -> corFactor.corCompSymm PR#16110 2020-07-20 Deepayan Sarkar * R/lme.R: Applied patch from Johannes Ranke to fix PR#17761 * DESCRIPTION: update version / date (unreleased) 2020-05-13 Martin Maechler * DESCRIPTION (Contact, MailingList): R-help (*not* R-core) 2020-04-21 Martin Maechler * DESCRIPTION (Version): 3.1-148 (not yet released) * man/nlsList.Rd: fix stopifnot(.) check in examples. 2020-03-03 Brian Ripley * src/nlmefit.c: clean up code. 2020-03-03 Brian Ripley * DESCRIPTION (Version): 3.1-147 (released) * po: update, including updated German translations from Detlef Steuer 2020-03-11 Martin Maechler * DESCRIPTION (Version): 3.1-146 (unreleased) * man/Remifentanil.Rd: more information incl references. 2020-03-03 Brian Ripley * DESCRIPTION (Version): 3.1-145 (released) * src/nlmefit.c: avoid clang-UBSAN warning. 2020-02-06 * DESCRIPTION (Version): 3.1-144 (released) 2020-02-02 Kurt Hornik * man/gnls.Rd: Drop docs for argument not in usage. 2019-12-10 Brian Ripley * DESCRIPTION (Version): 3.1-143 (released) * tests/augPred_lab.R: change yet another 'plucked from air' tolerance. 2019-11-07 Martin Maechler * DESCRIPTION (Version): 3.1-142 (released) * R/nlme.R: use vapply and is.matrix. * man/pairs.compareFits.Rd: change example. 2019-09-26 Brian Ripley * src/nlmefit.c: suppress warning from clang trunk. 2019-08-01 Kurt Hornik * DESCRIPTION (Version): 3.1-141 (released) 2019-07-27 Kurt Hornik * R/lme.R: * tests/nlme2.R: Robustify against using stringsAsFactors = FALSE by default. 2019-05-10 Brian Ripley * DESCRIPTION (Version): 3.1-140 (released) 2019-05-01 Brian Ripley * src/init.c: correct declaration of fit_nlme 2019-04-10 Brian Ripley * src/nlmefit.c: remove clang warning. 2019-04-08 Brian Ripley * DESCRIPTION (Version): 3.1-139 (released) 2019-04-08 Brian Ripley * R/groupedData.R: *GroupedData are exported, so use :: not ::: 2019-04-07 Martin Maechler * Release 3.1-138. 2019-04-02 Brian Ripley * Start preparing to release 3.1-138 for R 3.6.0 2019-04-02 Martin Maechler * po/{R-de,de}.po: updated 2019-01-23 Martin Maechler * R/lme.R (lme.formula, lmeControl): new option 'allow.n.lt.q=FALSE' by default now triggers error "fewer observations than random effects in all level groups". * src/nlmefit.c (finite_diff_Hess): prevent integer overflow (and later seg.fault) for large 'nTot' (already for npar >= 305). 2018-08-04 Martin Mächler * DESCRIPTION (Version): 3.1-138 (unreleased) * R/groupedData.R: deprecate the *undocumented* functions nmGroupedData() and nfGroupedData() in favor of their wrapper groupedData() (to allow subsequent code simplification). 2018-08-03 Martin Maechler * R/lmList.R (plot.intervals.lmList, ..), tests/lmList.R: make 'xlab', 'ylab', 'strip' regular arguments (instead of wrongly trying to use them from `...`). * R/lme.R (plot.ranef.lme, ..): (ditto) 2018-05-08 Brian Ripley * tests/sigma-fixed-etc.R: increase tolerance for ATLAS run. 2018-04-07 Brian Ripley * DESCRIPTION (Version): 3.1-137 for release with R 3.5.0 * po/*/.pot: updated * po/{R-de,de}.po: updated 2018-03-09 Brian Ripley * DESCRIPTION: Update Date, release for R-devel. * tests/nlme-stall.R: Add comments. 2018-02-27 Martin Mächler * R/nlme.R, man/nlmeControl.Rd: nlmeControl() gets new `msWarnNoConv` option. When it is true, as by default, nlme() now warns about non convergence in the LME step of the 'alternating algorithm'. Applies e.g. also to the nlme-stall.R example. 2018-02-27 Brian Ripley * DESCRIPTION: Update Date. (Still unreleased.) Relax R (>= 3.5.0) to 3.4.0 so it can be released generally once 3.5.0 is out. * src/init.c, src/nlmefit.h: Remove broken utilities added on 2018-01-31. * src/pythag.c: New file, contents moved from init.c. * tests/nlme-stall.R: New regression test, optional. * tests/sigma-fixed-etc.R: Changed tolerance after win-builder run, change t7.fix.REML.lme to use optim() (as done for LME, and Solaris has false convergence with nlminb()). Drop all uses of platform-dependent tolerances. 2018-02-26 Brian Ripley * src/init.c, src/rs.f: The 2018-01-31 change is broken (passes pointers as doubles). Try a simpler approach, to replace PYTHAG in rs.f by a wrapped call to the C99 function hypot(). 2018-02-16 Brian Ripley * DESCRIPTION (Version): 3.1-131.1, for R 3.4.4. (and 3.1-131) are available at https://svn.r-project.org/R-packages/branches/R-3-4-branch/nlme * tests/deparse.R: comment on failure with macOS's Accelerate. 2018-01-31 Martin Maechler * src/nlmefit.h, src/init.c (risnan, risfinite, ..): utilities to check for NaN, NA, Inf etc from Fortran. [Since removed.] * src/rs.f (PYTHAG): prevent infinite loop checking for finite arg. as reported in https://stat.ethz.ch/pipermail/r-devel/2018-January/075459.html . * src/nlme.c (nlme_iterate): add R_CheckUserInterrupt() 2018-01-02 Martin Maechler * R/lmList.R (warnErrList): bug fix. Added to the 'utils' package for R-devel, keep here for R <= 3.4.x. 2018-02-16 Brian Ripley * DESCRIPTION (Version): 3.1-135.5 (released for R-devel only) 2018-01-23, 2018-02-16 Brian Ripley * tests/predict.lme.R: increase tolerance. 2018-01-01 Brian Ripley * DESCRIPTION (Version): 3.1-135 (released for R-devel only) * tests/anova.gls.R: increase tolerance. 2017-12-24 Brian Ripley * tests/anova.gls.R: increase tolerance. 2017-12-01 Brian Ripley * DESCRIPTION (Version): 3.1-134, R >= 3.5.0 * R/VarCorr.R: correct breakage in r7326 (2017-03-07) (broke packages joineR and lme4). 2017-11-28 Brian Ripley * DESCRIPTION (Version): 3.1-133 (released for R-devel but withdrawn) * tests/coef.Rout.save: update for R-pre-3.5.0 changes to str() 2017-09-18 Martin Maechler * tests/nlme2.R: 'tweak and investigate platform dependent results' 2017-03-07 Martin Maechler * nlme/R/VarCorr.R, nlme/man/VarCorr.Rd: see below. * 'correct default for VarCorr.lme() to what it has really been.' * 'Fix print.*()'. * 'Cosmetic (not changing any results)' 2017-02-27 Martin Maechler * nlme/R/gnls.R, nlme/man/glsControl.Rd, nlme/man/gnlsControl.Rd, nlme/man/lmeControl.R: 'cosmetic' 2017-02-22 Martin Maechler * DESCRIPTION (Version): 3.1-132 (unreleased) * R/gnls.R, src/gnls.c: 'small cosmetic related to getting closer to the root cause of PR#17227' 2017-02-11 Brian Ripley * src/nlmefit.c: gcc -Wconversion pointed out misuse of long constants '0L' and '1L'. 2017-02-06 Martin Maechler * DESCRIPTION (Version): 3.1-131, tweaked test tolerance to also pass openblas 0.2.18, in * tests/sigma-fixed-etc.R example 6 2017-01-23 Martin Maechler * DESCRIPTION (Version): 3.1-130 * NAMESPACE, R/zzmethods.R, tests/deviance.R: workaround design error in 3.1-129 re deviance. 2017-01-17 Martin Maechler * R/groupedData.R (groupedData): must prepend 'nlme::' for call, fixing PR #17211. 2016-12-12 Martin Maechler * R/lme.R (Variogram.lme): fix PR #17192, with thanks to Sebastian Meyer. 2016-07-11 Martin Maechler * DESCRIPTION (Version): 3.1-129 * NAMESPACE, R/zzMethods.R (confint, sigma, deviance) methods (the last giving an error). 2016-05-04 Martin Maechler * R/lme.R, etc (lmeControl): 'sigma = 0' is now allowed (and equivalent to 'sigma = NULL'); this fixes mgcv::gamm()'s use of the equivalent of 'do.call(lmeControl, lmeControl())'. 2016-04-26 Martin Maechler * DESCRIPTION (Version): 3.1-128 * R/lme.R (qqnorm.lme): fixed bug introduced in v 3.1-127 * R/lme.R, R/nlme.R, etc: "fixed sigma" now computes 'apVar' correctly; thanks to patches from Siem Heisterkamp * R/lme.R, R/gls.R: coef(summary(.)) now also works for "gls", "lme". * R/gls.R (anova.gls): fixed a very long standing bug in the F statistics for the ML case, thanks to Siem H. 2016-03-21 Martin Maechler * R/nlme.R (getParsNlme): wish of PR#16614 : now predict REs as NA for non-existing levels instead of signalling error. * R/*.R: cosmetics: More vapply(); quote(.) instead of as.name(), passing '...' down in print() methods, etc. 2016-03-16 Martin Maechler * DESCRIPTION (Version): 3.1-127 * R/lmList.R, R/nlsList.R: same kind of error catching -> warning * */*.R: speedup cosmetics: seq_along; vapply(); lengths(); lapply(a, `[[`, i). Less eval(parse(text = ....)) 2016-03-12 Martin Maechler * DESCRIPTION: version 3.1-126 * R/nlme.R (predict.nlme): fix bug PR#16715; +cosmetic; also in * R/lmList.R, R/nlsList.R: better error catching -> warning() 2016-02-27 Brian Ripley * DESCRIPTION: version 3.1-125; released * tests/coef.Rout.save: update for R 3.3.x 2016-02-13 Brian Ripley * src/*.[ch]: remove use of S.h, clean up. * src/nls.c: Unused in R, so remove. 2016-01-25 Brian Ripley * src/*.c: include directly headers included via R.h. 2016-01-19 Martin Maechler * DESCRIPTION: version 3.1-124, and released 2016-01-19 Brian Ripley * src/{corStruct,gnls,nlme,nlmefit,nls}.c: Avoid clang warnings on implicit conversions. 2016-01-18 Martin Maechler * nlme/man/lmeControl.Rd, R/lme.R, etc: in lmeControl() etc, currently 'apVar' to FALSE when sigma is fixed, and document that somewhat. 2016-01-11 Martin Maechler * R/VarCorr.R, man/VarCorr.Rd: add optional '...' and remove 'rdig' from the argument list of the generic (for other methods). 2015-11-25 Bert van Willigen --- with modifications by MM * DESCRIPTION: version 3.1-123 (released 2016-01-17) * man/*Control.Rd: Fixed "sigma" (residual error) added. * R/gls.R, R/gnls.R, R/lme.R, R/nlme.R, R/reStruct.R: Fixed sigma added. * src/init.c, src/nlme.c, src/nlmefit.?: * tests/example_[1-9]_wequantify.R: 9 files added. * README: Credentials added. 2015-08-18 Luke Tierney * DESCRIPTION: version 3.1-122 * src/nlmefit.c: Added PROTECT/UNPROTECT calls. 2015-06-29 Brian Ripley * DESCRIPTION: version is 3.1-121 * NAMESPACE: tweak imports. 2015-02-20 Brian Ripley * DESCRIPTION: version is 3.1-120 2015-02-07 Brian Ripley * man/bdf.Rd: change markup for a dead URL 2015-01-29 Brian Ripley * po/*.de.po: updates. 2015-01-23 Brian Ripley * NAMESPACE: register lme method for simulate() 2015-01-10 Martin Maechler * remove non-useful legacy "code": q(); emacs "Mode: S" etc 2015-01-09 Brian Ripley * DESCRIPTION: version is 3.1-119 * man/bdf.Rd: update URL. 2014-10-20 Brian Ripley * R/*.R: remove unused assignments. 2014-10-07 Brian Ripley * DESCRIPTION: version is 3.1-118 2014-09-30 Brian Ripley * R/nlme.R: nlme with self-starting model incorrectly required 'start'. * tests/nlme2.R: regression test for above. * R/*, src/* correct copyright information. 2014-03-31 Brian Ripley * DESCRIPTION: version is 3.1-117 * po/R-fr.po: update. 2014-03-28 Brian Ripley * DESCRIPTION: version is 3.1-116 * R/{lme,newMethods,nlsList}.R: modify messages. * po/{R-pl,pl}.po: update. 2014-03-19 Brian Ripley * tests/missing.{R,Rout.save}: reduce 'digits' for cleaner results on platforms without extended-precision hardware. * po/R-de.po: Update from Detlef Steuer. 2014-03-09 Brian Ripley * DESCRIPTION: version is 3.1-115 * R/{gls,gnls,lme,nmle}.R, man/{lmeScale,*Control}.Rd: remove msScale and nlmStepMax arguments which were used for nlm(), where that is not longer used. 2014-03-08 Brian Ripley * DESCRIPTION: version is 3.1-114 * R/new-methods.R: labeling from fitted() was sometimes wrong as the 'groups' component lost row names. (PR#15678) * tests/fitted.R: add regression test. * R/lme.R: clean up * man/{lmeControl,lmeScale}.Rd: update.. 2013-11-17 Brian Ripley * DESCRIPTION: version is 3.1-113 * src/{matrix,nlOptimizer}.h: typos in guard names (clang 3.4) 2013-10-21 Martin Maechler * R/gls.R, man/gls-internal.Rd: remove redundant parentheses. 2013-10-03 Brian Ripley * man/{gls,lme}.Rd: add links, warn on no-covariate formulae. 2013-09-30, 2013-10-02 Brian Ripley * DESCRIPTION: version is 3.1-112 * R/gls.R, man/glsControl.Rd, man/Initialize.glsStruct.Rd. Remove 'qrTol', which was unused and set to the non-existent .Machine$single.eps, that is to NULL. * NAMESPACE, man/gls-internal.Rd: export glsApVar and glsEstimate for use in package rms. * R/gls.R, lme.R: more use of integer constants. * man/*.Rd: classes in quotes, more links, remove CVS lines. * R/lme.R, R/newFunc.R, tests/predict.lme.R: fix asOneFormula and predict.lme for y ~ 0. (see https://stat.ethz.ch/pipermail/r-devel/2013-September/067600.html) * R/lme.R: Several of the return components were incorrect for a model of the form fixed = resp ~ 0. 2013-08-17 Brian Ripley * add start on ko translations. 2013-08-15 Brian Ripley * DESCRIPTION: version is 3.1-111 * R/lmList.R: Adjust to cope with failed fits and fits with fewer coefficients returned by lm(). (Contributed by Ruth Ripley.) 2013-07-02 Brian Ripley * DESCRIPTION: version is 3.1-110, * R/{gls,gnls,lme}.R: Replace as.name() calls by quote(stats::nls) etc. * inst/LICENCE: remove. 2013-03-21 Brian Ripley * inst/CITATION: modernize. 2013-03-11 Brian Ripley * LICENCE: remove (it was not a licence file). 2013-01-26 Brian Ripley * DESCRIPTION: version is 3.1-109, depends on R (>= 3.0.0). 2013-01-26 Brian Ripley * DESCRIPTION: version is 3.1-108, depends on R (< 3.0.0) and has chol.f and rs.f in .Rbuildignore. 2013-01-23 Brian Ripley * man/[n]lme.Rd: add a note about the need to scale the response. * man/lmeControl.Rd: correct description of 'msTol' argument. * man/[n]lmeControl.Rd: correct description of 'opt' argument (it is a character string). * man/*.Rd: s/Jose/José/ * R/[n]lme.R, man/[n]lmeControl.Rd: allow '...' for further control arguments to be based though to nlminb() and optim(). 2013-01-13 Brian Ripley * DESCRIPTION: add accent on JCP's first name (and declare UTF-8 encoding). Add EISPACK authors. * src/rs.f: minimal version of eigen.f containing just RS and ancillaries (replacing eigen.f). 2013-01-12 Brian Ripley * DESCRIPTION: version is 3.1-107 * src/{chol,eigen}.f: port files from R (where they are deprecated/defunct). 2012-12-06 Kurt Hornik * DESCRIPTION: version is 3.1-106, add roles to Authors@R. 2012-11-28 Brian Ripley * NAMESPACE: import selectively from lattice and stats. 2012-09-24 Brian Ripley * DESCRIPTION: version is 3.1-105 * R: improve messages for translation. 2012-09-01 Brian Ripley * po: add Polish translations. 2012-08-30 Brian Ripley * src/init.c: force use of registered symbols in R >= 2.16.0 2012-05-23 Brian Ripley * DESCRIPTION: version is 3.1-104 * src/gnls.c, src/nlme.c, src/nlmefit.[ch]: type mismatches shown by clang's -Wconversion 2012-04-25 Brian Ripley * src/nlmefit.c: type mismatch shown by clang's -Wconversion 2012-03-29 Brian Ripley * src/nlOptimizer.c: increase PROTECTion (reported by Andrew Runnalls). 2012-02-15 Brian Ripley * inst/CITATION: protect against TRE bug in UTF-8 locales. 2012-01-14 Brian Ripley * DESCRIPTION: version is 3.1-103 2011-12-25 Brian Ripley * DESCRIPTION: needs Suggests: MASS for data(package=) 2011-07-19 Brian Ripley * DESCRIPTION: version is 3.1-102 * R/newMethods.R: getData.nls (aka getData.lme) used the na.action of the call on the whole data and not on the model frame: should have used the na.action component of the result. * tests/{lme.R,lme.Rout.save,ss2.rda}: test for above. * man/simulate.lme: document as method. 2011-07-11 Brian Ripley * COPYING: rename to GPL-2 * LICENCE, inst/LICENCE: adjust wording accordingly 2011-05-30 Brian Ripley * R/newFunc.R: name arguments to lapply() when ... is present. 2011-05-06 Brian Ripley * DESCRIPTION: version is 3.1-101 2011-04-23 Martin Maechler 2011-04-14 Martin Maechler * man/augPred.Rd, R/groupedData.R, R/gls.R, R/lme.R, R/simulate.R Changes he failed to document. 2011-03-26 Brian Ripley * src/{nlmefit,pdMat}.c: remove unused variables detected by -Wunused-but-set-variable 2011-03-11 Brian Ripley * Release 3.1-100 for R 2.13.0 * NAMESPACE: no longer re-export BIC * man/BIC.Rd: removed. 2011-02-23 Brian Ripley * DESCRIPTION: version is 3.1-100, require R >= 2.13 * man/BIC.Rd: make a stub referring to stats::BIC() * Everywhere: remove obsolete email addresses of former authors 2011-02-23 Brian Ripley * DESCRIPTION: version is 3.1-99 (unreleased, used for R-devel), remove email addresses of former authors (and JCP has moved). * R/{new,zz}Methods.R: Put all BIC() methods in one place, as the default method. * man/BIC.Rd: remove aliases to methods (not all of which actually existed) * man/BIC.logLik.Rd: merge into BIC.Rd * tests/lme.Rout.save: update for R 2.13.0. * NAMESPACE, R/newMethods.R: prepare for migration of BIC() to stats. * R/{gls,gnls,lme}.R, NAMESPACE: add nobs() methods. 2011-02-10 Brian Ripley * DESCRIPTION (Version, Date): 3.1-98 2011-02-04 Brian Ripley * data/{MathAchieve,bdf}.rda: resave with xz compression. * DESCRIPTION: depend on R (>= 2.10). 2010-10-01 Brian Ripley * DESCRIPTION (Version, Date): 3.1-97 2010-09-22 Brian Ripley * man/residuals.gls.Rd: incorrect default, see https://stat.ethz.ch/pipermail/r-devel/2010-September/058487.html 2009-12-22 Brian Ripley * man/ACF.gls.Rd: has \seealso to itself: seems ACF.lme was meant. 2009-12-18 Brian Ripley * DESCRIPTION: add BugReports field. 2009-10-12,16 Brian Ripley * DESCRIPTION (Version, Date): 3.1-96 * po/R-de.po, po/de.po: update 2009-09-16 Martin Maechler * DESCRIPTION (Version, Date): 3.1-95 * R/nlme.R (nonlinModel): use unname() instead of clearNames() 2009-09-02 Brian Ripley * DESCRIPTION (Version, Date): 3.1-94 * man/*.Rd: remove unnecessarily anchored links, including several incorrect ones. 2009-08-16 Brian Ripley * DESCRIPTION (Version, Date): 3.1-93 * R/lmList.R, tests/lmList.R: bug fix for predict.lmList (PR#13788) * R/gls.R, tests/anova.gls.R: bug fix for anova.gls (PR#13567) 2009-05-30 Brian Ripley * R/gnls.R, R/corStruct.Rd: minor message wording changes from Debian 'bug' report. * R/R-de.po: add [ Missing entries for 3.1-9[12] which were concerned with German translations. ] 2009-01-16 Brian Ripley * man/*.Rd: expand tabs 2008-12-30 Brian Ripley * man/summary.pdMat.Rd: avoid embedded newlines in \code strings. 2008-12-27 Brian Ripley * DESCRIPTION (Version, Date): 3.1-90 * R/gls.R: call dist correctly (PR#13418) 2008-12-19 Brian Ripley * man/*.Rd: clean up some reference formats and misuse of $...$. 2008-12-11 Brian Ripley * man/*.Rd: spelling * src/nlOptimizer.c: missing PROTECT 2008-06-07 Brian Ripley * DESCRIPTION (Version, Date): 3.1-89 * R/lme.R: fitted.lme() always dropped, when it should drop for one column but not for one row. * tests/lme.R, lme.Rout.save: add regression test for single-row predictions. 2008-04-10 Brian Ripley * R/zzMethods.R: add .onUnload() to unload the DLL. 2008-03-30 Brian Ripley * DESCRIPTION (Version, Date): 3.1-88 2008-02-19 Brian Ripley * man/logLik.lme.Rd, man/logLik.gnls.Rd: correct description of 'REML' argument. 2008-02-19 Brian Ripley * inst/CITATION: add file (essentially what citation() would produce, without the warning). 2008-02-18 Brian Ripley * DESCRIPTION (Version, Date): 3.1-87 * R/gnls.R, tests/gls.R: fix for PR#10364, missing row names on predict.gnls. 2008-02-11 Duncan Murdoch * R/*.R: Return invisible(x) from numerous print methods. 2007-12-30 Douglas Bates * [r4884] man/plot.nffGroupedData.Rd: Correct malformed link reported by Yihui Xie . Remove reference to nonexistent URL. * [r4885] Initialize.reStruct.Rd, collapse.groupedData.Rd, fitted.lmeStruct.Rd, lme.Rd, lme.groupedData.Rd, lme.lmList.Rd, logLik.reStruct.Rd, nlme.nlsList.Rd, plot.nfnGroupedData.Rd, plot.nmGroupedData.Rd, recalc.reStruct.Rd, residuals.lme.Rd, residuals.lmeStruct.Rd: Remove reference to nonexistent URL 2007-10-04 Kurt Hornik * DESCRIPTION (Version, Date): 3.1-86 2007-10-04 Brian Ripley * R/corStruct.R: check for uninitialized corARMA structures. 2007-09-17 Brian Ripley * DESCRIPTION (Version, Date): 3.1-85 Also, use approved form of GPL (>=2). * R/varFunc.R: fix for PR#9831. * tests/coef.R: test for the above. * tests/lme.Rout.save: update format for R >= 2.6.0. * man/corRatio.Rd: wrong formula, reported to R-devel by Ben Bolker on 2007-09-03. 2007-07-26 Brian Ripley * DESCRIPTION (Version, Date): 3.1-84 * LICENCE, inst/LICENCE: clarify this is licensed under GPL >= 2. * README, R/*.R, src/*.[ch]: Update source for GPL. * man/*.Rd: add header with licence conditions 2007-07-02 Brian Ripley * R/varFunc.R: varIdent did not look at its 'fixed' arg, PR#9765 * tests/varIndent.R: test for the above. 2007-06-13 Brian Ripley * R/VarCov.R: correct getVarCov.gls, PR#9752 2007-06-13 Brian Ripley * DESCRIPTION (Version, Date): 3.1-83 Also, update authors and email addresses where known. * R/lme.R: called quantile on potentially missing values. * tests/missing.{R,Rout.save}: test summary methods 2007-06-12 Brian Ripley * DESCRIPTION (Version, Date): 3.1-82 Also, R >= 2.4.0 because of seq_along. * tests/lme.Rout.save: back to 2.5.1 layout. 2007-05-29 Brian Ripley * R/{gls,lme,pdMat}.R: qualify uses of nchar() by 'type'. * R/lme.R: layout of over-long error message. * tests/lme.Rout.save: update for above and for 2.6.0 layout. * R/{gls,gnls,lme,nlme}.R: copy row names to fitted values and residuals. * R/{gls,gnls,lme}.R: support naresid and napredict. * man/{residuals,fitted}.lme.Rd: document this. * tests/missing.{R,Rout.save}: tests of missing-value support. 2007-05-20,24 Brian Ripley * R/*.R: partial matching issues, switch to seq_along. 2007-05-15 Brian Ripley * DESCRIPTION (Version, Date): 3.1-81 * NAMESPACE, R/zzMethods.R: migrate vcov methods from stats to here. 2007-05-04 Brian Ripley * man/{Extracr.pdMat,getdata.*,summary.varFunc}.Rd: remove surplus }. 2007-03-30 Brian Ripley * DESCRIPTION (Version, Date): 3.1-80 * R/nlme.R (contrMat): Allow for expressions in 'fixed'. * tests/contrMat.R: regression test for above. * R/gls.R: bug fix for the case of y ~ 0. * tests/gls.R: regression test for above. * R/{lme,lmList,newMethods}.R: patch for lattice 0.15-x. 2007-01-30 Brian Ripley * DESCRIPTION (Title): Capitalize for consistency. 2006-12-29 Brian Ripley * DESCRIPTION (Version, Date): 3.1-79 * R/corStruct.R, R/pdMat.R, R/reStruct.R, man/corStruct.Rd, man/pdMat.Rd, man/reStruct.Rd: add '...' argument to as.matrix() methods. (Needed for 2.5.0, but works in earier versions.) 2006-12-10 Douglas Bates * DESCRIPTION (Version, Date): 3.1-78 2006-12-06 Douglas Bates * R/nlme.R (contrMat): Ensure that the contrasts component is a list of matrices by expanding function names if necessary. 2006-11-29 Douglas Bates * DESCRIPTION: Prepare for new version. * R/newMethods.R (getData.nls): getData.nls for R's nls objects * inst/scripts/ch*.R: update Pinheiro and Bates (2000) scripts 2006-11-29 Brian Ripley * R/reStruct.R: fix PR#9262, multiple-line deparse. * R/gls.R, groupedData.R, lme.R, lmList.R, newMethods,R, nlme.R: more deparse width issues. 2006-09-28 Douglas Bates * R/nlme.R (getParsNlme): backed out change that caused failure reported by Christian Ritz. 2006-09-18 Douglas Bates * R/VarCorr.R (VarCorr): Clean up problems in this file and several others detected by codetools. 2006-09-11 Douglas Bates * R/nlme.R (getParsNlme): '[[' not '[' in case start$fixed is a list * R/gls.R,gnls.R,newMethods.R,nlme.R,pdMat,Rsimulate.R: fix problems exposed by codetools. 2006-07-31 Douglas Bates * man/ranef.lme.Rd: Modified the description of the `standard' argument to more clearly describe its effect. 2006-07-24 Douglas Bates * R/lme.R: Patch by Andrew Robinson and Berwin Turlach to set maximum number of function calls in nlminb. 2006-07-03 Douglas Bates * DESCRIPTION: Version is 3.1-75 * man/{many files}: Documentation changes contributed by Spencer Graves . Most of the changes add Pinheiro and Bates (2000) as a reference or add additional \seealso{} entries. Some examples from Pinheiro and Bates (2000) have also been added. * R/nlme.R: reformat the code, typo. 2006-07-03 Martin Maechler * R/lme.R (lme.formula): when control()$returnObject is TRUE, only warn instead of stop() in the case of non-convergence. * tests/lme.R: test the above * tests/lme.Rout.save: 2006-06-02 Brian Ripley * DESCRIPTION: Version is 3.1-74 2006-05-31 Brian Ripley * R/lme.R: Keep terms and optional model frame in lme.formula. Use terms for prediction (get safe prediction that way). Add keep.data argument to lme and methods. * man/lme*.Rd: update for keep.data argument. * R/newMethods.R: make use of saved data in getData methods. * tests/getData.R, tests/predict.lme.R: new tests. 2006-05-24 Brian Ripley * R/gls.R, man/comparePred.Rd: 'minimum' and 'maximum' were evaluated on a formula in the comparePred methods. Instead, evaluate 'primary' in the 'data' used to fit object1, and document what is done. (Reported by Mark Difford.) 2006-05-22 Brian Ripley * DESCRIPTION: Version is 3.1-73 2006-05-21 Brian Ripley * LICENCE, inst/LICENCE: add and install a licence file. 2006-05-18 Brian Ripley * R/groupedData.R: adjust method of as.data.frame. * R/newFunc.R: fix bug in gsummary with objects that have classes, e.g. Hmisc labels. (Reported by Mark Difford, in a private followup to https://stat.ethz.ch/pipermail/r-help/2006-May/094549.html.) * tests/augPred_lab.R: tests for the above fix. 2006-05-12 Brian Ripley * R/gls.R, R/gnls.R, R/nlme.R: missing data=data in terms calls, needed to resolve '.' on rhs of formulae. * DESCRIPTION: Version is 3.1-72 2006-03-29 Brian Ripley * R/newMethods.R: as.list() did not work on symbols in R. 2006-03-14 Brian Ripley * R/lme.R, man/Variogram.Rd: make example work (na.omit in the wrong place). 2006-03-10 Brian Ripley * DESCRIPTION: Version is 3.1-71 2006-02-17 Brian Ripley * R/nlsList.R: need to allow for multi-line deparse. * tests/deparse.R: add regression test 2006-01-05 Brian Ripley * DESCRIPTION: Version is 3.1-70 * src/init.c, src/Makevars: make use of gcc4 visibility where supported * inst/mlbook/ch0[45].R: remove unnecessary use of data() * inst/scripts/ch0[58].R: all allowed versions of R have nlminb * R/gls.R: element 'optimMethod' in the return value for glsControl was unnamed. * R/{gls,ngls,lme,nlme}.R, man/{gls,ngls,lme,nlme}Control.Rd: let the user (rather than the version of R) choose the optimizer to be used. 2006-01-05 Brian Ripley * src/init.c: missing registration for ARMA_constCoef * inst/scripts/ch02.R: correct argument names in simulate.lme call 2005-12-31 Brian Ripley * DESCRIPTION: Version is 3.1-69, require 2.3.0. * NAMESPACE: use registration. * R/*.R: use registered symbols. 2005-12-31 Brian Ripley * DESCRIPTION: Version is 3.1-68. * src/init.c: new file to register symbols * R/corStruct.R: corrected one use of PACKAGE="base" * R/lmList.R: remove attempted use of 'frame = 1' 2005-12-09 Deepayan Sarkar * R/newMethods.R, R/groupedData.R: fix for problem described in https://stat.ethz.ch/pipermail/r-help/2005-December/082890.html (superpose.line/symbol components were being truncated to length of an arbitrary component). 2005-12-09 Brian Ripley * DESCRIPTION: Version is 3.1-67. * R/gls.R: Replace do.call by eval.parent on massaged call. * po/fr.R, po/R-fr.R, inst/po: add French translation by Philippe Grosjean and automated en@quot translation. 2005-08-25 Douglas Bates * R/gls.R: Added option "optimMethod" to gls, gnls, and lme. 2005-08-24 Douglas Bates * R/lme.R (print.intervals.lme): Replace calls to print.matrix by print(as.matrix()). 2005-07-25 Douglas Bates * inst/scripts/ch08.R: Cleaned up examples in ch04, ch06, ch08. * src/matrix.h: Include R_Ext/Linpack.h in addition to R_Ext/Applic.h 2005-07-19 Douglas Bates * R/gnls.R: Added definition of convIter when using nlminb or when using optim. Reindented this and other R source files. 2005-07-12 Douglas Bates * inst/scripts/ch01.R: Clean up and check these scripts * src/nlmefit.c (gls_loglik): re-write contributed by ?? (I accidentally deleted the email message). * R/lme.R (lme.formula): Use nlminb if available. 2005-06-08 Douglas Bates * R/lme.R (predict.lme): Fixed bug when using a name for a formula in original fit. (Reported by Arne.Mueller@sanofi-aventis.com) 2005-05-20 Douglas Bates * man/contr.SAS.Rd: Removed 2005-04-04 Douglas Bates * R/newFunc.R: Removed contr.SAS definition as it has been revised and moved into the stats package for R-2.1.0 2005-03-02 Douglas Bates * src/nlmefit.c (gls_loglik): Replaced rnkm1 by p. * po/,inst/po/: Added localization support. 2004-11-04 Douglas Bates * src/nlmefit.c (dimFree): Fix memory leak reported by Brian Ripley. 2004-11-03 Douglas Bates * man/varWeights.Rd: Remove all calls to data() * man/corExp.Rd: Remove all references to the mva package 2004-08-10 Douglas Bates * man/pairs.compareFits.Rd: fix syntax errors (new check available in R CMD check) 2004-01-14 Douglas Bates * man/getCovariate.varFunc.Rd: Syntax correction from Kurt. 2003-12-16 Douglas Bates * install.R: Create stored image 2003-08-29 Douglas Bates * tests/lme.Rout.save (Coefficients): Now consistent with i386-linux result. * src/base.h: Replace R_ext/Mathlib.h by Rmath.h 2003-08-09 Douglas Bates * man/Covariate.varFunc.Rd, man/Matrix.pdMat.Rd, man/Matrix.reStruct.Rd, man/Names.pdMat.Rd, man/Names.reStruct.Rd, man/coef.corStruct.Rd, man/coef.modelStruct.Rd, man/coef.pdMat.Rd, man/coef.reStruct.Rd, man/coef.varFunc.Rd, man/getData.lmList.Rd, man/gnls.Rd: Use \method for replacement method documentation as per Rd changes * R/lme.R: Changed check for intercept-like column in getFixDF (PR#2418) 2003-06-12 Douglas Bates * DESCRIPTION: New release * man/ranef.lmList.Rd, man/nlme.Rd: Overdocumented arguments 2003-06-10 Douglas Bates * man/MathAchSchool.Rd, man/MathAchieve.Rd, ChangeLog, DESCRIPTION, R/groupedData.R, inst/scripts/ch03.R, inst/scripts/ch04.R: Release 3.1-42 * inst/scripts/ch01.R: Protecting power in formula 2003-06-10 Douglas Bates * R/groupedData.R: Fixed bug in groupedData constructor when outer is not missing. 2003-05-16 Douglas Bates * src/nlmefit.c (internal_EM): Fix by Peter Dalgaard for compound symmetry EM calculations (PR#2985) 2003-05-05 Douglas Bates * R/lmList.R (update.lmList): Changed this and several other update methods. * R/groupedData.R: Use eval instead of do.call (Dieter Menne) 2003-04-17 Douglas Bates * NAMESPACE: contributed by Brian Ripley * man/print.corStruct.Rd: Removed this and many other redundant documentation files for S3 methods. * R/ Remove redundant GPL notices. 2003-03-25 Douglas Bates * R/nlme.R (nonlinModel): Moved definition from AAA.R to here * man/summary.nlsList.Rd: Remove references to summary.nls * R/newMethods.R: Remove vestigial definitions of AIC.lm * R/zzMethods.R: Remove references to AIC.lm 2003-02-08 Douglas Bates * R/lme.R (lme.formula): Removed hessian=TRUE in calls to optim as suggested by Brian Ripley. 2003-01-30 Douglas Bates * R/lme.R: Incorporate change from Brian Ripley in response to Dieter Menne * man/lme.lmList.Rd, man/lme.groupedData.Rd, man/lme.Rd: Documentation of the contrasts argument added (Greg Warnes). 2003-01-30 Douglas Bates * R/lme.R (lme.formula): Incorporate Greg Warnes' changes for the contrasts argument. * R/nlsList.R: Correct check for is.null(class(FUN)) 2002-12-27 Douglas Bates * R/newFunc.R (gsummary): Fix comparison in check for varying columns (PR#1775 - bug report with fix provided by Dieter Menne. 2002-12-11 Douglas Bates * R/lme.R (print.lme): Removed one more as.vector() * R/varFunc.R (print.summary.varFixed): changed instances of deparse(as.vector(x)) to deparse(x) here and in many other places. 2002-09-10 Saikat DebRoy * nlsList.R (nlsList.formula): Use "try" instead of "restart". 2002-08-09 Douglas Bates * R/groupedData.R: Fixed creation of grouped data from a formula only * R/newGenerics.R: Renamed the initialize generic and all methods and calls to Initialize so as not to conflict with the methods package. 2002-07-23 Douglas Bates * R/lme.R (update.lme): Fix formula handling in update methods (Brian Ripley). 2002-04-20 Douglas Bates * R/nlme.R: Bug fix by SDR - convergence criterion was being calculated incorrectly. 2002-04-04 Douglas Bates * man/getVarCov.Rd: Added an example of the type="marginal" Corrected misplaced brace. * R/VarCov.R (getVarCov.lme): Added the getVarCov functions contributed by Mary Lindstrom 2002-03-27 Douglas Bates * R/lme.R (anova.lme): Change strvar != "NA" to !is.na(strvar) 2002-03-05 Douglas Bates * man/ACF.gls.Rd: Changed Jose's email address on this and all the other man pages. * R/varFunc.R: Incorporate fix from Thomas Lumley and from Setzer Woodrow for the logic where ifelse(length(el) == 1, is used instead of if(length(el) == 1) * R/pdMat.R: Change all vestigial instances of T and F to TRUE and FALSE. 2001-12-18 Douglas Bates * R/corStruct.R: Finally resolved the print.summary.corSymm controversy so it prints and it prints the correct value. 2001-12-10 Douglas Bates * R/lme.R: unclassed the logLik component of an lme summary before trying to put it into a data frame for printing. 2001-12-01 Douglas Bates * R/zzMethods.R: Removed the .Alias calls. 2001-10-30 Douglas Bates * man/pairs.lme.Rd: Modified many documentation files to pass the codoc checks. 2001-10-23 Douglas Bates * man/ACF.lme.Rd: Modified many, many method definitions and documentation files to get them to pass the R-1.4.0 (in development) package checking process. 2001-10-08 Douglas Bates * R/lmList.R: Fixed definition of logLik.lmList to work with R (but it is still rather ugly). * R/varFunc.R: Changed definition of logLik.varComb to return a logLik object. 2001-10-05 Douglas Bates * R/lmList.R: Fixed selection of id[subscripts] in the panel function of pairs.lmList (and several other functions) so it does not produce a warning from evaluating is.na(NULL). 2001-09-17 Douglas Bates * R/nlme.R: Incorporated a change from Setzer.Woodrow@epamail.epa.gov for using nested grouping factors in nlme. 2001-06-20 Douglas Bates * R/varFunc.R: Changes in calling sequences and in documentation so the package passes codoc() checks. These affect many files in both the R and the man directory. No changes of substance. 2001-05-29 Martin Maechler * R/zzMethods.R: Use .Alias() * R/newGenerics.R: Generic AIC() * R/newMethods.R: logLik.lm() moved to "base R" * man/AIC.Rd, * man/AIC.logLik.Rd: AIC.logLik() and AIC.lm() as well * man/logLik.lm.Rd: 2001-03-28 Douglas Bates * R/simulate.R: Modified simulate.lme for default pdMat class of pdLogChol. 2001-02-24 Douglas Bates * R/newFunc.R: Removed the old fake xyplot function. The new work by Murrell and Sarkar will make this superfluous. * man/MEestimate.Rd: Added manual pages for MEEM, MEdecomp, MEestimate. * R/newMethods.R: Revised assignments in plotting methods to be compatible with the Murrell/Sarkar preliminary trellis package. * src/nlmefit.c (internal_decomp): Corrected an error reported by Kathryn Chaloner where Srows >= ZXrows. 2001-01-10 Douglas Bates * DESCRIPTION (Maintainer): Added Maintainer entry to DESCRIPTION. 2000-12-09 Douglas Bates * R/lme.R: (Variogram.lme) Coerced n.pairs to numeric and corrected calls to dist. 2000-12-08 Douglas Bates * R/lme.R: Changed all calls to dist in lme.R, gls.R and corStruct.R to use the argument "method" rather than "metric". * R/pdMat.R: Replaced calls to .Fortran("dbksl", ...) with calls to the R function solve() for R-1.2.0 where the S_compat.c file has been removed. * inst/scripts/ch01.R: Added the chapter scripts from "Mixed-Effects Models in S and S-PLUS" to the inst directory. * man/formula.nlme.Rd: Modified the examples in this and many other .Rd files to use the Loblolly data and the SSasymp self-starting function. There were many occasions where the Soybean data was being fit to a default formulation of an nlme model just to get things like a formula. This fit of the Soybean data is difficult and time consuming and not very illuminating. 2000-11-30 Douglas Bates * src/matrix.c: Removed dependency on S_compat.h by replacing calls to dqrdca with the equivalent call to dqrdc2. 2000-07-24 Saikat DebRoy * Changed various uses of do.call to eval. The reason for doing this is to allow calls to the function calling eval from within another function. It's the old scoping problem again. 2000-07-07 Saikat DebRoy * src/nlme.c, src/nlmefit.c: Added mixed_grad in calls to optif9. * src/nlmefit.c : Added handling of pdLogChol objects (pdClass = 4) in various functions. * src/nlmefit.c (mixed_grad): New function giving analytic gradient for mixed-effects log-likelihood. * R/nlme.R (nlme.formula): Added updating of the pdFactor in the PNLS step. * R/reStruct.R: Made pdLogChol the default representation for reStruct objects. * src/pdMat.c (logChol_pd): new function. * R/pdMat.R: Added back the pdLogChol class and associated methods. 2000-07-03 Douglas Bates * man/corFactor.corStruct.Rd: Added an alias for corFactor.corNatural * src/nlmefit.c (internal_loglik): Changed the return value on error from R_NegInf to -DOUBLE_XMAX so the optif[09] optimizers will work properly. * src/corStruct.c (corStruct_factList): Provided a correct call to the R version of F77_CALL(chol) here and everywhere else in this source file. * R/zzz.R: Removed the deprecated call to provide 2000-03-17 Douglas Bates * added many data sets * incorporated patches from Brian Ripley to use optim for the optimization rather than nlm * src/nlmefit.c (internal_loglik): Returned R_NegInf instead of generating a error on a singular precision matrix. * DESCRIPTION (Depends): Changed Depends to R version 1.0.1 because of problem with assigning components of lists. 1999-12-23 Douglas Bates * TITLE: Changed the title to nlme nlme/NAMESPACE0000644000176000001440000003515714365320302012465 0ustar ripleyusersuseDynLib(nlme, .registration=TRUE) importFrom("graphics", pairs, par, plot) importFrom("stats", # many S3 generics for which we define methods AIC, BIC, anova, as.formula, asOneSidedFormula, coef, coefficients, confint, contr.SAS, contr.helmert, contr.poly, contr.sum, contr.treatment, contrasts, "contrasts<-", delete.response, dist, fitted, extractAIC, formula, lm, logLik, mad, median, model.frame, model.matrix, na.fail, na.omit, napredict, naresid, nlm, nlminb, nls, nls.control, nobs, optim, pchisq, pf, predict, pt, qchisq, qf, qnorm, qqnorm, qt, quantile, resid, residuals, rnorm, runif, setNames, sigma, simulate, terms, update, update.formula, var, vcov) importFrom("utils", head, tail, capture.output, packageDescription, str , warnErrList) importFrom("lattice", Rows, bwplot, dotplot, llines, lpoints, lsegments, ltext, panel.abline, panel.bwplot, panel.dotplot, panel.grid, panel.histogram, panel.linejoin, panel.loess, panel.superpose, panel.xyplot, splom, strip.default, trellis.par.get, xyplot) export(ACF, allCoef, asOneFormula, asTable, augPred, balancedGrouped, "coef<-", "coefficients<-", collapse, compareFits, comparePred, corAR1, corARMA, corCAR1, corCompSymm, corExp, corFactor, corGaus , corIdent # deprecated , corLin, corMatrix, corNatural, corRatio, corSpatial, corSpher, corSymm, "covariate<-", Dim, fdHess, fixed.effects, fixef, gapply, getCovariate, getCovariateFormula, getData, getGroups, getGroupsFormula, getResponse, getResponseFormula, getVarCov, gls, glsControl, glsStruct, gnls, gnlsControl, gnlsStruct, groupedData, gsummary, Initialize, intervals, isBalanced, isInitialized, LDEsysMat, lme, lmeControl, lmeStruct, lmList, logDet, "matrix<-", Names, "Names<-", needUpdate, nfGroupedData, nmGroupedData, # << Deprecated --> TODO: Defunct nlme, nlmeControl, nlmeStruct, nlsList, pdBlocked, pdCompSymm, pdConstruct, pdDiag, pdFactor, pdIdent, pdLogChol, pdMat, pdMatrix, pdNatural, pdSymm, phenoModel, pooledSD, quinModel, random.effects, ranef, recalc, reStruct, simulate.lme, splitFormula, varComb, varConstPower, VarCorr, varExp, varConstProp, varFixed, varFunc, varIdent, Variogram, varPower, varWeights) # called directly via do.call export(anova.lme, nlsList.formula, plot.lme) # needed as name stored in the call via match.call export(lme.formula, lme.lmList, lmList.formula, nlme.formula, nlme.nlsList) # exported for package rms export(glsApVar, glsEstimate) S3method("[", groupedData) S3method("[", pdBlocked) S3method("[", pdMat) S3method("[", reStruct) S3method("[<-", pdMat) S3method(ACF, gls) S3method(ACF, lme) S3method(anova, gls) S3method(anova, lme) S3method(as.data.frame, groupedData) S3method(as.matrix, corStruct) S3method(as.matrix, pdMat) S3method(as.matrix, reStruct) S3method(asTable, groupedData) S3method(augPred, gls) S3method(augPred, lme) S3method(augPred, lmList) S3method(coef, corAR1) S3method(coef, corARMA) S3method(coef, corCAR1) S3method(coef, corCompSymm) S3method(coef, corLin) S3method(coef, corNatural) S3method(coef, corSpatial) S3method(coef, corSpher) S3method(coef, corStruct) S3method(coef, corSymm) S3method(coef, gls) S3method(coef, gnls) S3method(coef, lme) S3method(coef, lmList) S3method(coef, modelStruct) S3method(coef, pdBlocked) S3method(coef, pdCompSymm) S3method(coef, pdDiag) S3method(coef, pdIdent) S3method(coef, pdMat) S3method(coef, pdNatural) S3method(coef, pdSymm) S3method(coef, reStruct) S3method(coef, summary.lme, getCTable) S3method(coef, summary.gls, getCTable) S3method(coef, summary.nlsList) S3method(coef, varComb) S3method(coef, varConstPower) S3method(coef, varConstProp) S3method(coef, varExp) S3method(coef, varFixed) S3method(coef, varFunc) S3method(coef, varIdent) S3method(coef, varPower) S3method("coef<-", corAR1) S3method("coef<-", corARMA) S3method("coef<-", corCAR1) S3method("coef<-", corCompSymm) S3method("coef<-", corNatural) S3method("coef<-", corSpatial) S3method("coef<-", corStruct) S3method("coef<-", corSymm) S3method("coef<-", modelStruct) S3method("coef<-", pdBlocked) S3method("coef<-", pdMat) S3method("coef<-", reStruct) S3method("coef<-", varComb) S3method("coef<-", varConstPower) S3method("coef<-", varConstProp) S3method("coef<-", varExp) S3method("coef<-", varFixed) S3method("coef<-", varIdent) S3method("coef<-", varPower) S3method(collapse, groupedData) S3method(comparePred, gls) S3method(comparePred, lme) S3method(comparePred, lmList) S3method(confint, lme) S3method(confint, lmList) S3method(confint, nlsList) S3method(corFactor, corCompSymm) S3method(corFactor, corAR1) S3method(corFactor, corARMA) S3method(corFactor, corCAR1) S3method(corFactor, corNatural) S3method(corFactor, corSpatial) S3method(corFactor, corStruct) S3method(corFactor, corSymm) S3method(corMatrix, corAR1) S3method(corMatrix, corARMA) S3method(corMatrix, corCAR1) S3method(corMatrix, corCompSymm) S3method(corMatrix, corNatural) S3method(corMatrix, corSpatial) S3method(corMatrix, corStruct) S3method(corMatrix, corSymm) S3method(corMatrix, pdBlocked) S3method(corMatrix, pdCompSymm) S3method(corMatrix, pdDiag) S3method(corMatrix, pdIdent) S3method(corMatrix, pdMat) S3method(corMatrix, reStruct) S3method("covariate<-", varFunc) S3method(deviance, gls) S3method(deviance, lme) S3method(Dim, corSpatial) S3method(Dim, corStruct) S3method(Dim, default) S3method(Dim, pdCompSymm) S3method(Dim, pdDiag) S3method(Dim, pdIdent) S3method(Dim, pdMat) S3method(Dim, pdNatural) S3method(Dim, pdSymm) S3method(extractAIC, gls) S3method(extractAIC, lme) S3method(fitted, gls) S3method(fitted, glsStruct) S3method(fitted, gnls) S3method(fitted, gnlsStruct) S3method(fitted, lme) S3method(fitted, lmeStruct) S3method(fitted, lmList) S3method(fitted, nlmeStruct) S3method(fixef, lme) S3method(fixef, lmList) S3method(formula, corStruct) S3method(formula, gls) S3method(formula, gnls) S3method(formula, groupedData) S3method(formula, lme) S3method(formula, lmList) S3method(formula, modelStruct) S3method(formula, nlme) S3method(formula, nlsList) S3method(formula, pdBlocked) S3method(formula, pdMat) S3method(formula, reStruct) S3method(formula, varComb) S3method(formula, varFunc) S3method(getCovariate, corSpatial) S3method(getCovariate, corStruct) S3method(getCovariate, data.frame) S3method(getCovariate, varFunc) S3method(getData, gls) S3method(getData, gnls) S3method(getData, lme) S3method(getData, lmList) S3method(getData, nlme) S3method(getData, nls) S3method(getGroups, corStruct) S3method(getGroups, data.frame) S3method(getGroups, gls) S3method(getGroups, lme) S3method(getGroups, lmList) S3method(getGroups, varFunc) S3method(getGroupsFormula, default) S3method(getGroupsFormula, gls) S3method(getGroupsFormula, lme) S3method(getGroupsFormula, lmList) S3method(getGroupsFormula, reStruct) S3method(getResponse, data.frame) S3method(getResponse, gls) S3method(getResponse, lme) S3method(getResponse, lmList) S3method(getVarCov, gls) S3method(getVarCov, lme) S3method(Initialize, corAR1) S3method(Initialize, corARMA) S3method(Initialize, corCAR1) S3method(Initialize, corCompSymm) S3method(Initialize, corLin) S3method(Initialize, corNatural) S3method(Initialize, corSpatial) S3method(Initialize, corSpher) S3method(Initialize, corStruct) S3method(Initialize, corSymm) S3method(Initialize, glsStruct) S3method(Initialize, gnlsStruct) S3method(Initialize, lmeStruct) S3method(Initialize, reStruct) S3method(Initialize, varComb) S3method(Initialize, varConstPower) S3method(Initialize, varConstProp) S3method(Initialize, varExp) S3method(Initialize, varFixed) S3method(Initialize, varFunc) S3method(Initialize, varIdent) S3method(Initialize, varPower) S3method(intervals, gls) S3method(intervals, lme) S3method(intervals, lmList) S3method(isBalanced, groupedData) S3method(isInitialized, pdBlocked) S3method(isInitialized, pdMat) S3method(isInitialized, reStruct) S3method(lme, formula) S3method(lme, groupedData) S3method(lme, lmList) S3method(lmList, formula) S3method(lmList, groupedData) S3method(logDet, corStruct) S3method(logDet, pdBlocked) S3method(logDet, pdCompSymm) S3method(logDet, pdDiag) S3method(logDet, pdIdent) S3method(logDet, pdMat) S3method(logDet, pdNatural) S3method(logDet, pdSymm) S3method(logDet, reStruct) S3method(logLik, corStruct) S3method(logLik, gls) S3method(logLik, glsStruct) S3method(logLik, gnls) S3method(logLik, gnlsStruct) S3method(logLik, lme) S3method(logLik, lmeStruct) S3method(logLik, lmeStructInt) S3method(logLik, lmList) S3method(logLik, reStruct) S3method(logLik, varComb) S3method(logLik, varFunc) S3method("matrix<-", pdBlocked) S3method("matrix<-", pdMat) S3method("matrix<-", reStruct) S3method(model.matrix, reStruct) S3method(Names, formula) S3method(Names, listForm) S3method(Names, pdBlocked) S3method(Names, pdMat) S3method(Names, reStruct) S3method("Names<-", pdBlocked) S3method("Names<-", pdMat) S3method("Names<-", reStruct) S3method(needUpdate, corStruct) S3method(needUpdate, default) S3method(needUpdate, modelStruct) S3method(needUpdate, reStruct) S3method(needUpdate, varComb) S3method(needUpdate, varIdent) S3method(nlme, formula) S3method(nlme, nlsList) S3method(nlsList, formula) S3method(nlsList, selfStart) S3method(nobs, gls) S3method(nobs, gnls) S3method(nobs, lme) S3method(pairs, compareFits) S3method(pairs, lme) S3method(pairs, lmList) S3method(pdConstruct, pdBlocked) S3method(pdConstruct, pdCompSymm) S3method(pdConstruct, pdDiag) S3method(pdConstruct, pdIdent) S3method(pdConstruct, pdLogChol) S3method(pdConstruct, pdMat) S3method(pdConstruct, pdNatural) S3method(pdConstruct, pdSymm) S3method(pdFactor, pdBlocked) S3method(pdFactor, pdCompSymm) S3method(pdFactor, pdDiag) S3method(pdFactor, pdIdent) S3method(pdFactor, pdLogChol) S3method(pdFactor, pdMat) S3method(pdFactor, pdNatural) S3method(pdFactor, pdSymm) S3method(pdFactor, reStruct) S3method(pdMatrix, pdBlocked) S3method(pdMatrix, pdCompSymm) S3method(pdMatrix, pdDiag) S3method(pdMatrix, pdIdent) S3method(pdMatrix, pdMat) S3method(pdMatrix, pdNatural) S3method(pdMatrix, pdSymm) S3method(pdMatrix, reStruct) S3method(plot, ACF) S3method(plot, augPred) S3method(plot, compareFits) S3method(plot, gls) S3method(plot, intervals.lmList) S3method(plot, lme) S3method(plot, lmList) S3method(plot, nffGroupedData) S3method(plot, nfnGroupedData) S3method(plot, nls) S3method(plot, nmGroupedData) S3method(plot, pdMat) S3method(plot, ranef.lme) S3method(plot, ranef.lmList) S3method(plot, simulate.lme) S3method(plot, Variogram) S3method(predict, gls) S3method(predict, gnls) S3method(predict, lme) S3method(predict, lmList) S3method(predict, nlme) S3method(print, anova.lme) S3method(print, compareFits) S3method(print, corCompSymm) S3method(print, corNatural) S3method(print, correlation) S3method(print, corStruct) S3method(print, corSymm) S3method(print, gls) S3method(print, groupedData) S3method(print, intervals.gls) S3method(print, intervals.lme) S3method(print, intervals.lmList) S3method(print, lme) S3method(print, lmList) S3method(print, modelStruct) S3method(print, pdMat) S3method(print, ranef.lme) S3method(print, reStruct) S3method(print, simulate.lme) S3method(print, summary.corCompSymm) S3method(print, summary.corNatural) S3method(print, summary.corStruct) S3method(print, summary.corSymm) S3method(print, summary.gls) S3method(print, summary.lme) S3method(print, summary.lmList) S3method(print, summary.modelStruct) S3method(print, summary.pdMat) S3method(print, summary.varComb) S3method(print, summary.varFixed) S3method(print, summary.varFunc) S3method(print, varComb) S3method(print, VarCorr.lme) S3method(print, VarCov) S3method(print, varFunc) S3method(qqnorm, gls) S3method(qqnorm, lm) S3method(qqnorm, lme) S3method(qqnorm, lmList) S3method(qqnorm, nls) S3method(ranef, lme) S3method(ranef, lmList) S3method(recalc, corAR1) S3method(recalc, corARMA) S3method(recalc, corCAR1) S3method(recalc, corCompSymm) S3method(recalc, corNatural) S3method(recalc, corSpatial) S3method(recalc, corStruct) S3method(recalc, corSymm) S3method(recalc, modelStruct) S3method(recalc, reStruct) S3method(recalc, varFunc) S3method(recalc, varIdent) S3method(residuals, gls) S3method(residuals, glsStruct) S3method(residuals, gnls) S3method(residuals, gnlsStruct) S3method(residuals, lme) S3method(residuals, lmeStruct) S3method(residuals, lmList) S3method(residuals, nlmeStruct) S3method(sigma, gls) S3method(sigma, lme) S3method(sigma, lmList) S3method(simulate, lme) S3method(solve, pdBlocked) S3method(solve, pdDiag) S3method(solve, pdIdent) S3method(solve, pdLogChol) S3method(solve, pdMat) S3method(solve, pdNatural) S3method(solve, pdSymm) S3method(solve, reStruct) S3method(summary, corAR1) S3method(summary, corARMA) S3method(summary, corCAR1) S3method(summary, corCompSymm) S3method(summary, corExp) S3method(summary, corGaus) S3method(summary, corLin) S3method(summary, corNatural) S3method(summary, corRatio) S3method(summary, corSpher) S3method(summary, corStruct) S3method(summary, corSymm) S3method(summary, gls) S3method(summary, lme) S3method(summary, lmList) S3method(summary, modelStruct) S3method(summary, nlsList) S3method(summary, pdBlocked) S3method(summary, pdCompSymm) S3method(summary, pdDiag) S3method(summary, pdIdent) S3method(summary, pdLogChol) S3method(summary, pdMat) S3method(summary, pdNatural) S3method(summary, pdSymm) S3method(summary, reStruct) S3method(summary, varComb) S3method(summary, varConstPower) S3method(summary, varConstProp) S3method(summary, varExp) S3method(summary, varFixed) S3method(summary, varFunc) S3method(summary, varIdent) S3method(summary, varPower) S3method(str, pdMat) S3method(update, corStruct) S3method(update, gls) S3method(update, gnls) S3method(update, groupedData) S3method(update, lme) S3method(update, lmList) S3method(update, modelStruct) S3method(update, nlme) S3method(update, nlsList) S3method(update, reStruct) S3method(update, varComb) S3method(update, varConstPower) S3method(update, varConstProp) S3method(update, varExp) S3method(update, varFunc) S3method(update, varPower) S3method(VarCorr, lme) S3method(VarCorr, pdBlocked) S3method(VarCorr, pdMat) S3method(Variogram, corExp) S3method(Variogram, corGaus) S3method(Variogram, corLin) S3method(Variogram, corRatio) S3method(Variogram, corSpatial) S3method(Variogram, corSpher) S3method(Variogram, default) S3method(Variogram, gls) S3method(Variogram, lme) S3method(varWeights, glsStruct) S3method(varWeights, lmeStruct) S3method(varWeights, varComb) S3method(varWeights, varFunc) S3method(vcov, gls) S3method(vcov, lme) ## deprecated: S3method("coef<-", corIdent) S3method(summary, corIdent) S3method(recalc, corIdent) S3method(logDet, corIdent) S3method(Initialize, corIdent) S3method(corMatrix, corIdent) nlme/TODO0000644000176000001440000000342614251721455011740 0ustar ripleyusers -*- org -*- * Priority 1-2 (urgent - important) ** TODO REML <-> ML 'Std.Error's for fixed effecs in summary(n?lme()) are the *same* but should not, Both S+ nlme [note from Siem Heisterkamp] and e.g. lme4 do differ. ** DONE svn ci -m'patch from Siem Heisterkamp ['apVar' for "fixed sigma"] + changes to make intervals(.) working' *** svn-diffB R/gls.R R/gnls.R R/lme.R R/newFunc.R R/nlme.R man/glsControl.Rd man/gnlsControl.Rd man/gnlsObject.Rd man/intervals.lmList.Rd man/intervals.lme.Rd man/lmeControl.Rd man/lmeObject.Rd man/nlmeControl.Rd man/nlmeObject.Rd tests/sigma-fixed-etc.R ** DONE svn ci -m'fix qqnorm.lme() bug - undetected because of "wrong" \dontrun{}' *** svn-diffB R/lme.R man/qqnorm.lme.Rd * Priority 3-4 (project for ...) ** TODO stats::summary.lm , stats::print.summary.lm by default do *NOT* compute and print the correlation matrix. *** stats:::summary.lm (object, correlation = FALSE, symbolic.cor = FALSE, ...) *** stats:::print.summary.lm (x, digits = max(3L, getOption("digits") - 3L), symbolic.cor = x$symbolic.cor, signif.stars = getOption("show.signif.stars"), ...) *** 'nlme' should at least *allow* to not compute and print so people would use summary(.) much more often probably ! MM thinks the default should even *change* not to print the correlation ** TODO Bug 16703 -- corFactor/corMatrix use O(n^2) storage - sparseMatrix would help *** https://bugs.r-project.org/show_bug.cgi?id=16703 ** TODO Bug 16806 - nlme getVarCov() fails for corSpatial fits for individuals with a single observation only *** https://bugs.r-project.org/show_bug.cgi?id=16806 ** TODO methods extractAIC.lme & extractAIC.gls should be here rather than in MASS, because extractAIC() and step() are in stats * Priority 5 (nice to have) nlme/inst/0000755000176000001440000000000014251721456012221 5ustar ripleyusersnlme/inst/CITATION0000644000176000001440000000061614251721456013361 0ustar ripleyusers## R package reference generated from DESCRIPTION metadata citation(auto = meta) ## NLME book bibentry(bibtype = "Book", title = "Mixed-Effects Models in S and S-PLUS", author = c(person(c("José", "C."), "Pinheiro"), person(c("Douglas", "M."), "Bates")), year = "2000", publisher = "Springer", address = "New York", doi = "10.1007/b98882") nlme/inst/po/0000755000176000001440000000000014251721456012637 5ustar ripleyusersnlme/inst/po/de/0000755000176000001440000000000014251721456013227 5ustar ripleyusersnlme/inst/po/de/LC_MESSAGES/0000755000176000001440000000000014632316272015013 5ustar ripleyusersnlme/inst/po/de/LC_MESSAGES/nlme.mo0000644000176000001440000000400214531445451016277 0ustar ripleyusers 041!f370H7TE!9=8wj/&K9rK3SEhI)LJv@    All parameters must be less than 1 in absolute valueCoefficient matrix not invertibleFirst observation on an individual must have a doseHaven't written the compound symmetry case for this yetOverfitted model!Singularity in backsolve at level %ld, block %ldToo many parameters for finite-difference Hessian; npar = %d, nTot = %g.Unable to form Cholesky decomposition: the leading minor of order %d is not pos.def.Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]Unknown spatial correlation classanalytic gradient is not available with compound symmetryanalytic gradient is not available with matrix logarithmProject-Id-Version: R 4.0.0 / nlme 3.1-145 Report-Msgid-Bugs-To: PO-Revision-Date: 2020-04-01 15:16+0200 Last-Translator: Detlef Steuer Language-Team: German Language: de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Der Betrag aller Parameter muss kleiner 1 sein.Koeffizientenmatrix nicht invertierbarErste Beobachtung eines Individuums muss eine Dosis habenFall von zusammengesetzter Symmetrie wurde für dies noch nicht geschriebenÜberangepasstes Modell!Singularität in backsolve auf Stufe %ld, Block %ldZu viele Parameter für eine finite-differenzen Hesse-matrix; npar = %d, nTot = %g.Cholesky-Zerlegung kann nicht bestimmt werden: Führender Minor der Ordnung %d ist nicht positiv definitUnfähig eine Eigenwert-Eigenvektor-Zerlegung zu bilden [RS(.) ierr = %d]Unbekannte räumliche Korrelations-Klasseanalytischer Gradient ist nicht mit zusammengesetzter Symmetrie verfügbaranalytischer Gradient ist nicht mit Matrixlogarithmus verfügbarnlme/inst/po/de/LC_MESSAGES/R-nlme.mo0000644000176000001440000012752314632316272016514 0ustar ripleyusersFL |X0Y#$)" *A)l$+*;0)l6H34h@ >5&;\/JE EY 0 O 1 !-R!*!.!!!2!3/"c"&|"""""""+# H#%i##,##!#$-4$b$&w$9$#$$$%G<%.%$%&%.%-.&1\&,&)&,&'l*':'#''(( ?(`({(;(>(=)2M)) )7)6):*&U*6|*/*6*=+PX+7+;+1,7O,A,*,',$->A-3-c-;.<T.0.1.J.7?/w/Q/9/<0>U050$090G)1Iq1J1>2>E2?2?2C3BH3A3?3< 4BJ4$464/425+L51x5575F6CG6@66677";79^7H71778*K8Dv8*8.8o9o9V9'L:0t:::<:B;=^;D;E;E'<Hm<E<H<-E=8s==)=<=13>2e>1>,>8>=0?;n?=?=?2&@QY@C@&@2A4IA.~A?A%A:B;NB;BBOIC&CCC,C>D>]D6D%D%D8E<XE<E:E9 F8GF1F0F3F3G2KGW~G:G+H6=H5tH$HWH8'IT`I5I)I0J2FJ2yJ9JJ?K%AKOgK+KNKG2L8zL3L*L/M1BM<tM@M3M&NOBNLN:N)OIDOHO7O$P\4P"P P6P' Q4QKQDeQ.QQ+Q%R&+k4jkk)kUk>>l%}l,l<l- m2;m5nm7m3mnq.n@n)n* o76o&no'ooCoFpAdp1ppp<qDEq?q7qDrBGr@rPr_sE|sLsGt:WtKt=tu.7uLfu>ufuLYvLvDvP8w]wCw#+xhOxUxGySVyIy0yI%zToz[zW {Kx{M{N|Na|R|Q}PU}N}Q}YG~5~N~<&Kc6N,5IbbTRdHJ=KNZ؂F3?z2g=U?ӄWj,L4y!ІBH1DzRSSfVSGe2=+;JO>֊PDfB?J.DyFF3L_P+17]92ώB-E=s>>/c,Cb5??;6$r3:˒==D;::.44c50Δ6`6<.ԕ7;;!wV@S1=,×44%6Z?ј@%1MW,NҙG!8iA,04BBwILQenaԜP60BR>N2f0'2XL%؟&PD;Ѡ6''E8m&.͡:?7:w228gQ'1UTi2#<=R0s5'S"{$&ç+<+h=9:763n3B֩1=K9Iê5 ?CHG̫HG]L>.1=`+$ʭ*xy /# $x; mVo\[U@!&(#-=81 =}2,% (l^w],'2H+O ND.FXP6< `r?D5- :Wdv0z0ZJs'>gyC)99>3T8c!t;fCq&)S/._*4<7Qe4A$aG+MKuF1LjB:h|Bi?#kYEA6 n ~{"R57%@EpbI"3  / *"corStruct" object must have a "fixed" attribute"pdMat" element must have a formula"pdMat" elements must have a formula%s and %s must have the same group levels%s can have at most two components%s can only be a list or numeric%s can only have names "const" and "power"%s can only have names "const" and "prop"%s is not a valid effect name%s is not a valid object for "pdMat"%s must have group names in 'varConstPower'%s must have group names in 'varConstProp'%s not available for plotting%s not available for plotting%s not found in data%s not found in data%s not matched%s not matched%s problem, convergence error code = %s message = %s%s without "primary" can only be used with fits of "groupedData" objects'FUN' can only be a function or a list of functions'Id' must be between 0 and 1'L' must have at most %d column'L' must have at most %d columns'Terms' must be between 1 and %d'asTable' can only be used with balanced 'groupedData' objects'asTable' cannot be used with multilevel grouped data'data' argument not used, but taken from groupedData object'data' in %s call must evaluate to a data frame'data' must be a "groupedData" object if 'formula' does not include groups'data' must be a "groupedData" object if 'groups' argument is missing'data' must be given explicitly to use 'nls' to get initial estimates'data' must be given explicitly to use 'nlsList''data' must inherit from "groupedData" class if 'random' does not define groups'distance' and 'object' have incompatible lengths'fixed' must be a formula or list of formulae'form' and 'nam' have incompatible lengths'form' and 'pdClass' have incompatible lengths'form' argument must be a formula'form' can only be a formula or a list of formulae'form' can only be a formula, or a list of formulas'form' must be a formula'form' must be a formula when not NULL'form' must be a list'form' must be a one-sided formula'form' must be a two-sided formula'form' must have a covariate'form' must have all components as formulas'form' not consistent with 'nam''id' can only be a formula or numeric'id' must be between 0 and 1'idLabels' can only be a formula or a vector'idLabels' of incorrect length'lme.lmList' will redefine 'data''model' must be a formula'nam' and 'pdClass' have incompatible lengths'nam' must be a list'nint' is not consistent with 'breaks''nlme.nlsList' will redefine 'fixed', 'data', and 'start''object' has not been Initialize()d'object' must be a formula'object' must be a list or a formula'object' must be a list when not missing, not a matrix, and not numeric'params' must be a formula or list of formulae'pdClass' must be a character vector'preserve' must be a two-sided formula'random' must be a formula or list of formulae'range' must be > 0 in "corLin" initial value'range' must be > 0 in "corSpatial" initial value'start' must have a component called 'fixed''subset' can only be character or integer'subset' ignored with single grouping factor'subset' must be a list'sumLenSq := sum(table(groups)^2)' = %g is too large. Too large or no groups in your correlation structure?'sumLenSq' = %g is too large (larger than maximal integer)'value' must be a one sided formula'value' must be a square matrix'which' can only be character or integer'which' must be between 1 and %dAIC undefined for REML fitDo increase 'msMaxIter'!Iteration %d, LME step: nlm() did not converge (code = %d).Iteration %d, LME step: nlminb() did not converge (code = %d).L may only involve fixed effects with the same denominator DFLNone of the arguments specify more than one blockLength of names should be %dPORT message:Within-group std. dev. must be a positive numeric valueall arguments to 'varComb' must be of class "varFunc".all elements in the argument must generate "pdMat" objectsall elements must have a non-zero sizeall elements must have formulas when any has a formulaall elements must have names when any has namesall elements of 'form' list must be two-sided formulasall elements of a "reStruct" object must have a non-zero sizeall elements of formula must be list of two-sided formulae or two-sided formulaeall fitted objects must have the same estimation methodall fitted objects must use the same number of observationsall variables used in 'formula' must be in 'data'an object of length %d does not match a Cholesky factoran object of length %d does not match the required parameter sizearguments imply different number of blocksat least one of 'p' and 'q' must be > 0at least two coefficients are neededaugmentation of random effects only available for single levelautoregressive order must be a non-negative integercan only construct "varFunc" object from another "varFunc" object, a formula, or a character stringcan only fit "lmList" objects with single grouping variablecan only fit "nlsList" objects with single grouping variablecannot access the matrix of object without namescannot access the matrix of uninitialized objectscannot access the number of columns of uninitialized objects without namescannot calculate REML log-likelihood for "gnls" objectscannot change 'form'cannot change coefficients before initialization or when all parameters are fixedcannot change dimensions on an initialized "pdMat" objectcannot change parameter length of initialized "pdMat" objectcannot change parameter length of initialized "varComb" objectcannot change parameter length of initialized objectscannot change the length of 'object'cannot change the length of covariate in "varFunc" objectcannot change the length of the "varExp" parameter after initializationcannot change the length of the "varIdent" parameter after initializationcannot change the length of the "varStruct" parameter after initializationcannot change the length of the parameter after initializationcannot change the length of the parameter of a "corAR1" objectcannot change the length of the parameter of a "corARMA" objectcannot change the length of the parameter of a "corCAR1" objectcannot change the length of the parameter of a "corCompSymm" objectcannot change the length of the parameter of a "corNatural" objectcannot change the length of the parameter of a "corStruct" objectcannot change the length of the parameter of a "corSymm" objectcannot change the number of columns on an initialized objectcannot change the parameter when length of parameters is undefinedcannot do pairs of just one variablecannot evaluate groups for desired levels on 'newdata'cannot extract groups formula without a formulacannot extract matrix from an uninitialized objectcannot extract model matrix without formulacannot extract parameters of uninitialized objectcannot extract the dimensionscannot extract the inverse from an uninitialized objectcannot extract the log of the determinant from an uninitialized objectcannot extract the matrix from an uninitialized "pdCompSymm" objectcannot extract the matrix from an uninitialized "pdIdent" objectcannot extract the matrix from an uninitialized objectcannot extract the matrix with uninitialized dimensionscannot fix variances in all groupscannot get confidence intervals on var-cov components: %scannot get confidence intervals on var-cov components: %s Consider '%s'cannot get the inverse of an uninitialized objectcannot have duplicated column names in a "pdMat" objectcannot have zero distances in "corSpatial"cannot obtain constrained coefficients with uninitialized dimensionscannot omit grouping factor without 'form'cannot use an anonymous function for the modelcannot use smaller level of grouping for "correlation" than for "random". Replacing the former with the latter.cannot use smaller level of grouping for 'correlation' than for 'random'. Replacing the former with the latter.collapsing level cannot be smaller than display level; setting it to the display levelcomputed "gls" fit is singular, rank %sconstant in "varConstProp" structure must be > 0covariate must be a data framecovariate must be numericcovariate must have a level attribute when 'id' is a formulacovariate must have a level attribute when 'idLabels' is a formulacovariate must have a level attribute when groups are presentcovariate must have unique values within groups for "corAR1" objectscovariate must have unique values within groups for "corARMA" objectscovariate must have unique values within groups for "corCAR1" objectscovariate must have unique values within groups for "corNatural" objectscovariate must have unique values within groups for "corSymm" objectsdata argument to "data.frame" method for 'getGroups' does not make sensedata in %s call must evaluate to a data framedegrees of freedom and weights must have the same lengthdeviance undefined for REML fitdimnames of 'value' must match or be NULLdo not know how to calculate correlation matrix of %s objectdo not know how to get coefficients for %s objectdo not know how to obtain constrained coefficientsdo not know how to obtain parameters of %s objecteffect %s not matchedeffects %s not matchedelements in 'object' must be formulas or "pdMat" objectsfewer observations than random effects in all level %s groupsfirst argument to 'groupedData' must be a two-sided formulafirst argument to 'nfGroupedData' must be a two-sided formulafirst argument to 'nmGroupedData' must be a two-sided formulafirst model has a different response from the restfitted objects with different fixed effects. REML comparisons are not meaningful.fixed parameter names in 'varIdent' must be a subset of group namesfixed parameters must have group namesfixed parameters must have group names in 'varExp'fixed parameters must have group names in 'varPower'fixed parameters must have names in 'varIdent'fixed-effects model must be a formula of the form "resp ~ pred"formula(object) must return a formulaformulae in 'fixed' must be of the form "parameter ~ expr"formulae in 'params' must be of the form "parameter ~ expr"formulae in 'random' must be of the form "parameter ~ expr"group name not matched in starting values for random effects: %sgroup names not matched in starting values for random effects: %sgroups levels mismatch in 'random' and starting values for 'random' at level %signoring 'group' in "varFixed" formulaignoring argument 'form'ignoring argument 'nam'ignoring initial values (no grouping factor)incompatible formulas for groups in "random" and "correlation"incompatible formulas for groups in 'random' and 'correlation'incompatible lengths for 'random' and grouping factorsincompatible lengths for object namesindividual %s was not used in the fitinitial value for "corLin" parameters of wrong dimensioninitial value for "corNatural" parameters of wrong dimensioninitial value for "corSpatial" parameters of wrong dimensioninitial value for "corSpher" parameters of wrong dimensioninitial value for "corSymm" parameters of wrong dimensioninitial value for "reStruct" overwritten in 'lme.lmList'initial value for "varExp" should be of length %dinitial value for "varExp" should be of length 1initial value for "varIdent" should be of length %dinitial value for "varPower" should be of length %dinitial value for "varPower" should be of length 1initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)initial value for 'reStruct' overwritten in 'nlme.nlsList'initial value for parameter of wrong lengthinitial value in "corCompSymm" must be greater than %sinitial value of nugget ratio must be between 0 and 1initial value should be of length %dinitial values for "corNatural" do not define a positive-definite correlation structureinitial values for "corNatural" must be between -1 and 1initial values for "corSymm" do not define a positive-definite correlation structureinitial values for "corSymm" must be between -1 and 1initial values for 'varIdent' must be > 0initial values must have group names in 'varExp'initial values must have group names in 'varIdent'initial values must have group names in 'varPower'initializing "pdCompSymm" object is not positive definiteinvalid formula for groupslength of 'nam' not consistent with dimensions of initial valuelevel of %s does not match formula %slist with starting values for random effects must have names or be of length %dlog-likelihood not available with NULL fitsmaximum number of iterations (lmeControl(maxIter)) reached without convergencemaximum number of iterations (maxIter = %d) reached without convergencemaximum number of iterations reached without convergencemismatch between group names and fixed values namesmissing call attribute in "nlsList" objectmodel formula must be of the form "resp ~ pred"model must be a formula of the form "resp ~ pred"models with "corStruct" and/or "varFunc" objects not allowedmore than one degree of freedom is needed when one them is zero.moving average order must be a non-negative integermultiple levels not allowedmust give names when initializing "pdCompSymm" from parameter without a formulamust give names when initializing "pdIdent" from parameter without a formulamust give names when initializing from matrix or parametermust have formula when no names are givennames being assigned do not correspond to a permutation of previous namesnames mismatch in 'random' and starting values for 'random' at level %snames of 'value' are not consistent with 'nam' argumentnames of object and value must matchnames of starting value for "varIdent" object must contain all but one of the stratum levelsneed an object with call componentneed data to calculate covariateneed data to calculate covariate of "corStruct" objectnegative degrees of freedom not allowedno coefficients to fitno condensed linear modelno default method for extracting the square root of a "pdMat" objectno degrees of freedom for estimating std. dev.no degrees of freedom specifiedno effects allowed in right side of formulano fitted "lme" objectno initial values for model parametersno model variogram available with 'showModel = TRUE'nonexistent group in 'newdata'nonexistent group names for initial valuesnonexistent group names for initial values in "varExp"nonexistent group names for initial values in "varPower"nonexistent group names for initial values in 'varIdent'nonexistent group requested in 'subset'nonexistent groups requested in 'subset'nonexistent level %snonexistent levels %snot (yet) implemented. Contributions are welcome; use intervals() instead (for now)not implemented for "nlme" objectsnot implemented for multiple levels of nestingnumber of columns in starting values for random component at level %s should be %dnumber of rows in starting values for random component at level %s should be %dobject formula must be of the form "resp ~ pred"object must inherit from class %sobjects must have a "call" component or attributeobjects must have coefficients with same row namesobjects must inherit from classes %s, or %sold-style self-starting model functions are no longer supported. New selfStart functions are available. Use SSfpl instead of fpl, SSfol instead of first.order.log, SSbiexp instead of biexp, SSlogis instead of logistic. If writing your own selfStart model, see "help(selfStart)" for the new form of the "initial" attribute.only one display level allowedonly one level allowed for predictionsonly one level allowed in 'gapply'only one level allowed in 'gsummary'only one level of grouping allowedonly residuals allowedonly residuals and random effects allowedonly single effects allowed in left side of 'form'only single level allowedparameter in "corCompSymm" structure must be < 1 in absolute valueparameter in AR(1) structure must be between -1 and 1parameter in CAR(1) structure must be between 0 and 1parameters in ARMA structure must be < 1 in absolute valueplot method only implemented for comparing modelsrange must be > 0 in "corSpher" initial valueright-hand side of first argument must be a conditional expressionsecond argument must be a groupedData objectsecond argument to 'groupedData' must inherit from data.framesingle group not supported -- use groupedData()some fitted objects deleted because response differs from the first modelstarting estimates must have names when 'params' is missingstarting values for random effects must include group levelsstarting values for random effects should be a list, or a matrixstarting values for the 'fixed' component are not the correct lengthstarting values for the random components should be a list of matricesstep halving factor reduced below minimum in NLS stepstep halving factor reduced below minimum in PNLS stepterm %s not matchedterms %s not matchedterms can only be integers or charactersterms must all have the same denominator DFundefined collapsing level %s for %sundefined display level %s for %sundefined group declared in 'subset'unique values of the covariate for "corSymm" objects must be a sequence of consecutive integersunique values of the covariate for "corNatural" objects must be a sequence of consecutive integerswrong group levelsx-y data to splom got botched somehowProject-Id-Version: R 4.0.0 / nlme-3.1-145 Report-Msgid-Bugs-To: bugs@r-project.org PO-Revision-Date: 2020-04-01 15:18+0200 Last-Translator: Detlef Steuer Language-Team: German Language: de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); "corStruct"-Objekt muss ein "fixed"-Attribut haben."pdMat"-Element muss eine Formel haben."pdMat"-Elemente müssen eine Formel haben%s und %s müssen die gleichen Gruppenstufen haben%s kann höchstens zwei Komponenten haben.%s kann nur eine Liste oder numerisch sein.%s kann nur die Namen "const" und "power" haben.%s kann nur die Namen "const" und "power" haben.%s ist kein gültiger Effektname%s ist kein gültiges Objekt für "pdMat".%s muss Gruppennamen in 'varConstPower' haben.%s muss Gruppennamen in 'varConstPower' haben.%s nicht verfügbar für grafische Darstellung%s nicht verfügbar für grafische Darstellung%s nicht in Daten gefunden%s nicht in Daten gefunden%s nicht übereinstimmend%s nicht übereinstimmend%s Problem, Konvergenzfehlerkode = %s Nachricht = %s%s ohne "primary" kann nur für Anpassungen von "groupedData"-Objekten genutzt werden.'FUN' kann nur eine Funktion oder eine Liste von Funktionen sein.'Id' muss zwischen 0 und 1 liegen'L' muss zumindest %d Spalte haben:'L' muss zumindest %d Spalten haben:'Terms' müssen zwischen 1 und %d liegen.'asTable' kann nur mit balancierten 'groupedData'-Objekten benutzt werden'asTable' kann nicht mit mehrstufig gruppierten Daten benutzt werden'data' Argument nicht benutzt, aber vom groupedData Objekt genommen'data' in %s muss sich zu einem Dataframe berechnen'data' muss ein "groupedData"-Objekt sein, wenn 'formula' keine Gruppen enthält.'data' muss ein "groupedData"-Objekt sein, falls 'groups'-Argument fehlt'data' muss explizit angegeben werden, um 'nls' zum Gewinnen von Initialschätzungen zu nutzen.'data' muss explizit angegeben werden, um 'nlsList' zu benutzen.'data' muss von der Klasse "groupedData" erben, falls 'random' keine Gruppen definiert.'distance' und 'object' haben inkompatible Längen'fixed' muss eine Formel oder eine Liste von Formeln sein.'form' und 'nam' haben inkompatible Längen'form' und 'pdClass' haben inkompatible Längen'form'-Argument muss eine Formel sein'form' kann nur eine Formel oder eine Liste von Formeln sein.'form' kann nur eine Formel oder eine Liste von Formeln sein.'form' muss eine Formel sein'form' muss eine Formel sein, wenn nicht NULL'form' muss eine Liste sein'form' muss eine einseitige Formel sein'form' muss eine zweiseitige Formel sein.'form' muss eine Kovariate haben.'form' muss alle Komponenten als Formeln enthalten.'form' nicht konsistent mit 'nam''id' kann nur eine Formel oder numerisch sein.'id' muss zwischen 0 und 1 liegen'idLabels' kann nur eine Formel oder eine Vektor sein.'idLabels' hat falsche Länge'lme.lmList' wird 'data' redefinieren'model' muss eine Formel sein.'nam' und 'pdClass' haben inkompatible Längen'nam' muss eine Liste sein'nint' ist nicht konsistent mit 'breaks''nlme.nlsList' wird 'fixed', 'data' und 'start' neu definierenInitialize() wurde nicht für »object« ausgeführt'object' muss eine Formel sein'object' muss eine Liste oder Formel sein'object' muss eine Liste sein, wenn es nicht fehlt, keine Matrix und nicht numerisch.'params' müssen eine Formel oder eine Liste von Formeln sein.'pdClass' muss ein Zeichenvektor sein'preserve' muss eine zweiseitige Formel sein'random' muss eine Formel oder eine Liste von Formeln sein.'range' im "corLin"-Anfangswert muss > 0 sein'range' muss im "corSpatial"-Anfangswert > 0 sein.'start' muss eine Komponente mit Namen 'fixed' haben.'subset' kann nur ein Zeichen oder eine ganze Zahl sein'subset' mit einzelnem Gruppierungsfaktor ignoriert'subset' muss eine Liste sein'sumLenSq := sum(table(groups)^2)' = %g ist zu groß. Zu große oder keine Gruppen in der Korrelationsstrujtur? 'sumLenSq' = %g ist zu groß (größer als maximale Integerzahl)'value' muss eine einseitige Formel sein.'value' muss eine quadratische Matrix sein'which' kann nur ein Buchstabe oder eine Ganzzahl sein.'which' muss zwischen 1 und %d liegen.AIC für REML Anpassung nicht definiertBitte 'msMaxIter' erhöhen!Iteration %d, LME Schritt: nlm() hat nicht konvergiert (Kode = %d).Iteration %d, LME Schritt: nlminb() hat nicht konvergiert (Kode = %d).L kann nur feste Effekte mit dem gleichen Nenner DF einschließenKeines der Argumente gibt mehr als einen Block anLänge von names sollte %d seinPORT Nachricht:SD innerhalb der Gruppe muss positiver numerischer Wert seinAlle Argumente für 'varComb' müssen von der Klasse "varFunc" sein.Alle Elemente des Arguments müssen "pdMat"-Objekte generieren.Alle Elemente müssen eine Größe ungleich Null haben.Alle Elemente müssen Formeln habe, wenn irgendeins eine Formel hat.Alle Elemente müssen Namen habe, wenn irgendeins einen Namen hat.Alle Elemente der 'form'-Liste müssen zweiseitige Formeln sein.Alle Elemente eines "reStruct"-Objekts müssen eine Größe ungleich Null haben.Alle Elemente der Formel müssen eine Liste zweiseitiger Formeln oder zweiseitige Formeln sein.Alle gefitteten Objekte müssen die gleiche Schätzungsmethode haben.Alle gefitteten Objekte müssen die gleiche Zahl von Beobachtungen benutzen.Alle in 'formula' benutzten Variablen müssen in 'data' enthalten sein.Ein Objekt der Länge %d entspricht keinem Cholesky-FaktorEin Objekt der Länge %d entspricht nicht der benötigten Parametergröße.Argumente implizieren eine unterschiedliche Zahl von Blöcken'p' oder 'q' muss > 0 seinmindestens zwei Koeffizienten werden benötigtAugmentation von zufälligen Effekten ist nur für einzelne Stufe verfügbarAutoregressive Ordnung muss eine nicht-negative Ganzzahl sein."varFunc"-Objekt kann nur aus anderem "varFunc", einer Formel oder einer Zeichenkette erstellt werden.Nur "lmList"-Objekte mit einzelner Gruppenvariable können angepasst werden.nur "lmList"-Objekte mit einzelner Gruppenvariable können angepasst werden.Auf die Matrix des Objekts kann ohne Namen nicht zugegriffen werden.Auf die Matrix der nicht initialisierten Objekten kann nicht zugegriffen werden.Auf die Spaltenanzahl nicht initialisierter Objekte kann ohne Namen nicht zugegriffen werden.REML Log-likelihood für "gnls"-Objekte kann nicht berechnet werden'form' kann nicht geändert werden.Koeffizienten können nicht vor der Initialisierung oder wenn alle Parameter fest sind geändert werden.Die Dimensionen eines initialisierten "pdMat"-Objekts können nicht geändert werden.Länge des initialisierten "pdMat"-Objekts kann nicht geändert werden.Parameterlänge eines initialisierten "varComb"-Objekts kann nicht geändert werdenParameterlänge von initialisierten Objekten kann nicht geändert werden.Länge von 'object' kann nicht geändert werden.Die Länge der Kovariate im "varFunc"-Objekt kann nicht geändert werden.Länge des Parameters "varExp" kann nach der Initialisierung nicht geändert werden.Länge des Parameters "varIdent" kann nach der Initialisierung nicht mehr geändert werden.Länge des Parameters "varStruct" kann nach der Initialisierung nicht geändert werden.Länge des Parameters kann nach der Initialisierung nicht geändert werden.Die Länge des Parameters eines "corAR1"-Objekts kann nicht geändert werden.Die Länge des Parameters eines "corARMA"-Objekts kann nicht geändert werden.Die Länge des Parameters eines "corCAR1"-Objekts kann nicht geändert werden.Die Länge des Parameters eines "corCompSymm"-Objekts kann nicht geändert werden.Die Länge des Parameters eines "corNatural"-Objekts kann nicht geändert werden.Die Länge des Parameters eines "corStruct"-Objekts kann nicht geändert werden.Die Länge des Parameters eines "corSymm"-Objekts kann nicht geändert werden.Die Anzahl der Spalten eines initialisierten Objekts kann nicht geändert werden.Der Parameter kann nicht geändert werden, wenn die Länge der Parameter undefiniert ist.kann pairs nicht mit nur einer Variablen durchführenGruppen für gewünschte Stufen auf 'newdata' können nicht ausgewertet werdenGruppenformel ohne eine Formel kann nicht extrahiert werden.Matrix kann nicht von einem nicht initialisierten Objekt extrahiert werden.Modellmatrix kann ohne Formel nicht extrahiert werden.Parameter eines nicht initialisierten Objekts können nicht extrahiert werden.Dimensionen können nicht extrahiert werden.Inverse eines nicht initialisierten Objekts kann nicht extrahiert werden.Der Logarithmus der Determinante eines nicht initialisierten Objekts kann nicht extrahiert werden.Matrix eines nicht initialisierten "pdCompSymm"-Objekts kann nicht extrahiert werdenMatrix eines nicht initialisierten "pdIdent"-Objekts kann nicht extrahiert werden.Matrix eines nicht initialisierten Objekts kann nicht extrahiert werden.Matrix mit nicht initialisierten Dimensionen kann nicht extrahiert werden.Varianzen können nicht in allen Gruppen festgehalten werden.Konfidenzintervalle für var-cov-Komponenten können nicht bestimmt werden: %sKonfidenzintervalle für var-cov-Komponenten können nicht bestimmt werden: %s Evtl. '%s'Inverse eines nicht initialisierten Objekts kann nicht bestimmt werdenIn "pdMat"-Objekten darf es keine doppelten Spaltennamen geben.Es darf keine Null-Distanzen in "corSpatial" gebenEingeschränkte Koeffizienten können nicht mit nicht initialisierten Dimensionen nicht erlangt werden.Gruppierungsfaktor ohne 'form' kann nicht weggelassen werden.eine anonyme Funktion kann für das Modell nicht benutzt werdenZur Gruppierung in "correlation" kann keine kleinere Stufe als für "random" benutzt werden. Ersteres wird durch letzteres ersetzt.Für die Gruppierung von 'correlation' kann keine kleinere Stufe als für 'random' benutzt werden. Ersteres wird durch letzteres ersetzt.Die Collapsing-Stufe kann nicht kleiner sein, als die Anzeigestufe; sie wird auf die Anzeigestufe gesetzt.errechneter "gls"-Fit ist singulär, Rang %sKonstante in "varConstPower"-Struktur muss > 0 sein.Kovariate muss ein Dataframe seinKovariate muss numerisch seinKovariate muss ein Stufenattribut haben, wenn 'id' eine Formel istKovariate muss ein Stufenattribut haben, wenn 'idLabels' eine Formel istKovariate muss ein Stufenattribut haben, wenn Gruppen vorhanden sindKovariate muss eindeutige Werte innerhalb der Gruppen für "corAR1-Objekte" haben.Kovariate muss eindeutige Werte innerhalb der Gruppen für "corARMA-Objekte" haben.Kovariate muss eindeutige Werte innerhalb der Gruppen für "corCAR1-Objekte" haben.Kovariate muss eindeutige Werte innerhalb der Gruppen für "corNatural-Objekte" haben.Kovariate muss eindeutige Werte innerhalb der Gruppen für "corSymm"-Objekte haben.Datenargument für "data.frame"-Methode für 'getGroups' nicht sinnvollDaten im %s-Aufruf müssen einen Dataframe ergebenFreiheitsgrade und Gewichte müssen die gleiche Länge haben.Devianz für REML Anpassung nicht definiertdimnames von 'value' müssen übereinstimmen oder NULL seinEs ist nicht bekannt, wie die Korrelationsmatrix des Objekts %s berechnet wird.nicht bekannt, wie Koeffizienten erlangt werden für %s-ObjektEs ist nicht bekannt, wie eingeschränkte Koeffizienten bestimmt werden können.Es ist nicht bekannt, wie Parameter des Objekts %s abgefragt werden.Effekt %s nicht übereinstimmendEffekte %s nicht übereinstimmendElemente in 'object' müssen Formeln oder "pdMat"-Objekte sein.weniger Beobachtungen als zufällige Effekte in allen Gruppen der Stufe %serstes Argument für 'groupedData' muss eine zweiseitige Formel seinerstes Argument für 'nfGroupedData' muss eine zweiseitige Formel seinerstes Argument für 'nmGroupedData' muss eine zweiseitige Formel seinerstes Modell hat eine vom Rest abweichende AntwortGefittete Objekte mit unterschiedlichen festen Effekten. REML Vergleiche haben keine Bedeutung.Feste Parameternamen in 'varIdent' müssen eine Teilmenge von Gruppennamen sein.Feste Parameter müssen Gruppennamen haben.Feste Parameter müssen Gruppennamen in 'varExp' haben.Feste Parameter müssen Gruppennamen in 'varPower' haben.Feste Parameter müssen in 'varIdent' Namen haben.Feste-Effekte-Modell muss eine Formel der Form "resp ~ pred" sein.Formel(Objekt) muss eine Formel zurückgeben.Formeln in 'fixed' müssen die Form "parameter ~ expr" haben.Formeln in 'params' müssen die Form "parameter ~ expr" haben.Formeln in 'random' müssen die Form "parameter ~ expr" haben.Gruppenname nicht zu Startwerten für Zufallseffekte passend: %sGruppennamen nicht zu Startwerten für Zufallseffekte passend: %sGruppenstufen stimmen in 'random' und in den Startwerten für 'random' auf Stufe %s nicht überein.'group' in "varFixed"-Formel wird ignoriert.Argument 'form' wird ignoriertArgument 'nam' wird ignoriertStartwerte werden ignoriert (kein Gruppierungsfaktor)inkompatible Formeln für Gruppen in "random" und "correlation"inkompatible Formeln für Gruppen in 'random' und 'correlation'inkompatible Längen für 'random' und Gruppierungsfaktoreninkompatible Länge für ObjektnamenIndividuum %s wurde in der Anpassung nicht benutzt.Anfangswert für Parameter "corLin" hat falsche Dimension.Anfangswert für "corNatural"-Parameter hat falsche DimensionAnfangswert des Parameters "corSpatial" hat falsche DimensionAnfangswert für Parameter "corSpher" hat falsche DimensionAnfangswert für "corSymm"-Parameter hat falsche DimensionAnfangswert für "reStruct" in 'lme.lmList' überschriebenStartwert von "varExp" sollte Länge %d haben.Anfangswert für "varExp" sollte die Länge 1 haben.Startwert von "varIndent" sollte die Länge %d haben.Startwert von "varPower" sollte Länge %d haben.Anfangswert für "varPower" sollte die Länge 1 haben.Anfangswert für 'range' kleiner als minimale Distanz. Er wird auf 1.1 * min (distance) gesetzt.Anfangswert für 'reStruct' in 'nlme.nlsList' überschriebenAnfangswerte für Parameter hat falsche LängeAnfangswert in "corCompSymm" muss größer als %s sein.Anfangswert des Nugget-Anteils muss zwischen 0 und 1 liegenStartwert sollte Länge %d haben.Anfangswerte für "corNatural" definieren keine positiv-definite Korrelationsstruktur.Anfangswerte für "corNatural" müssen zwischen -1 und 1 liegen.Anfangswerte für "corSymm" definieren keine positiv-definite Korrelationsstruktur.Anfangswerte für "corSymm" müssen zwischen -1 und 1 liegen.Startwerte für 'varIdent' müssen > 0 sein.Anfangswerte müssen Gruppennamen in 'varExp' haben.Startwerte müssen Gruppennamen in 'varIdent' haben.Anfangswerte müssen Gruppennamen in 'varPower' haben.Initialisierendes "pdCompSymm"-Objekt ist nicht positiv-definitungültige Formel für GruppenLänge von 'nam' nicht konsistent mit Dimensionen des StartwertsStufe von %s passt nicht zu Formel %sListe mit Startwerten für Zufallseffekte muss Namen haben oder %d lang sein.Log-likelihood nicht mit NULL-Fit verfügbarmaximale Anzahl der Iterationen (lmeControl(maxIter)) ohne Konvergenz erreichtmaximale Anzahl der Iterationen (maxIter = %d) ohne Konvergenz erreichtmaximale Anzahl der Iterationen ohne Konvergenz erreichtkeine Übereinstimmung zwischen Gruppennamen und festen Wertnamenfehlendes Aufrufattribut in "nlsList"-ObjektModell-Formel muss die Form "resp ~ pred" haben.Modell muss eine Formel der Form "resp ~ pred" sein.Modelle mit "corStruct"- und/oder "varFunc"-Objekten nicht erlaubtMehr als ein Freiheitsgrad wird benötigt, wenn einer von ihnen Null ist.Ordnung des gleitenden Durchschnitts muss eine nicht-negative Ganzzahl sein.mehrere Stufen nicht erlaubtWenn "pdCompSymm" über Parameter ohne eine Formel initialisiert wird, müssen Namen vergeben werden.Wenn "pdIdent" über Parameter ohne eine Formel initialisiert wird, müssen Namen gegeben werden.Namen müssen vergeben werden, wenn von Matrix oder Parameter initialisiert wirdmuss Formel haben, wenn keine Namen gegeben sindZugeordnete Namen entsprechen keiner Permutation vorheriger Namen.Namen in 'random' und in den Startwerten für 'random' auf Stufe %s passen nicht Namen von 'value' sind nicht mit dem Argument 'nam' konsistentNamen von Objekt und Wert müssen übereinstimmen.Die Namen des Startwerts für ein "varIdent"-Objekt müssen alles außer einer Schichtstufe enthalten.ein Objekt mit Aufruf-Komponenten wird benötigtUm Kovariate zu berechnen, werden Daten benötigt.Zur Berechnung der Kovariate des "corStruct"-Objekts werden Daten benötigt.negative Freiheitsgrade nicht erlaubtkeine Koeffizienten anzupassenkein zusammengefasstes lineares Modellkeine Standardmethode, um die Quadratwurzel eines "pdMat"-Objekts zu extrahierenkeine Freiheitsgrade für Schätzung von Standardabweichungkeine Freiheitsgrade angegebenkeine Effekte auf der rechten Seite der Formel erlaubtkein angepasstes "lme"-Objektkeine Anfangswerte für Modellparameterkein Modell-Variogramm mit 'showModel = TRUE' verfügbarnicht existierende Gruppe in 'newdata'Nicht existierende Gruppenamen für Startwertenicht existente Gruppennamen für Anfangswerte in "varExp"nicht existierende Gruppennamen für Anfangswerte in "varPower"nicht existente Gruppennamen für Startwerte in 'varIdent'nicht existierende Gruppe in 'subset' angefordert.nicht existierende Gruppen in 'subset' angefordertnicht existierende Stufe %snicht existierende Stufen %s(nocht) nicht implementiert. Beiträge sind willkommen; Für den Moment stattdessen intervals() nutzennicht für "nlme"-Objekte implementiertnicht für mehrstufige Schachtelung implementiertAnzahl der Spalten in Startwerten für Zufallskomponente auf Stufe %s sollte %d sein.Anzahl der Zeilen in Startwerten für Zufallskomponente auf Stufe %s sollte %d sein.Objekt-Formel muss von der Form "resp ~ pred" seinObjekt muss von der Klasse %s erbenObjekte müssen eine "call"-Komponente oder -Attribut haben.Objekte müssen Koeffizienten mit gleichen Zeilennamen haben.Objekte müssen von den Klassen %s oder %s erbenSelbst-startende Model Funktionen im alten Stil werden nicht mehr unterstützt. Neue selbst-startende Funktionen sind verfügbar. Nutzen Sie SSfpl statt fpl, SSfol statt first.order.lag, SSbiexp statt biexp, SSlogis statt logistic. Um eigene selbst-startende Modelle zu implementieren, sehen Sie unter "help(selfStart)" die neue Form der "initial" Attribute nach.nur eine Anzeigestufe erlaubtnur eine Stufe für Vorhersagen erlaubtnur eine Stufe in 'gapply' erlaubtnur eine Stufe in 'gsummary' erlaubtnur eine Stufe der Gruppierung erlaubtnur Residuen erlaubtnur Residuen und zufällige Effekte erlaubtnur einzelne Effekte auf der linken Seite von 'form' erlaubtnur einzelne Stufe erlaubtParameter in "corCompSymm"-Struktur muss vom Betrag < 1 sein.Parameter in AR(1)-Struktur muss zwischen -1 und 1 liegenParameter in CAR(1)-Struktur muss zwischen 0 und 1 liegen.Parameter in ARMA-Struktur müssen vom Betrag < 1 sein.Plotmehtode nur für Modellvergleiche implementiertSpannweite im "corSpher"-Anfangswert muss > 0 sein.rechte Seite des ersten Arguments muss ein bedingter Ausdruck seinzweites Argument muss ein groupedData-Objekt seinzweites Argument für 'groupedData' muss von data.frame erbeneinzelne Gruppe nicht unterstützt -- nutze groupedData()einige gefittete Objekte gelöscht, da Antwort vom ersten Modell abweichtStartschätzung muss Namen haben, wenn 'params' fehltStartwerte für Zufallseffekte müssen Gruppenstufen enthalten.Startwerte für Zufallseffekte sollten eine Liste oder eine Matrix sein.Startwerte für die Komponente 'fixed' haben nicht die richtige Länge.Startwerte für Zufallskomponenten sollten eine Liste von Matrizen sein.Schrittlängen-Halbierungsfaktor reduziert unter Minimum im NLS-SchrittSchrittlängenhalbierungsfaktor unter das Minimum in PNLS-Schritt vermindertTerm %s nicht übereinstimmendTerme %s nicht übereinstimmendTerme können nur Ganzzahlen oder Zeichen seinTerme müssen alle den gleichen Freiheitsgrad im Nenner habenCollapsing-Stufe %s für %s nicht definiertundefinierte Anzeigestufe %s für %sundefinierte Gruppe in 'subset' deklariertEindeutige Werte der Kovariate für "corSymm"-Objekte müssen eine Sequenz von aufeinander folgenden ganzen Zahlen sein.Eindeutige Werte der Kovariate für "corNatural"-Objekte müssen eine Sequenz von aufeinanderfolgenden ganzen Zahlen seinfalsche Gruppenstufenx-y-Daten an splom wurden irgendwie verpfuscht.nlme/inst/po/pl/0000755000176000001440000000000014251721456013252 5ustar ripleyusersnlme/inst/po/pl/LC_MESSAGES/0000755000176000001440000000000014632316272015036 5ustar ripleyusersnlme/inst/po/pl/LC_MESSAGES/nlme.mo0000644000176000001440000000317314632316272016332 0ustar ripleyusers l 4!&3H7|0E!+9M89b-4H4HU}&?@:  All parameters must be less than 1 in absolute valueCoefficient matrix not invertibleFirst observation on an individual must have a doseHaven't written the compound symmetry case for this yetSingularity in backsolve at level %ld, block %ldUnable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]Unknown spatial correlation classanalytic gradient is not available with compound symmetryanalytic gradient is not available with matrix logarithmProject-Id-Version: nlme 3.1-115 Report-Msgid-Bugs-To: PO-Revision-Date: 2012-05-29 07:55+0100 Last-Translator: Łukasz Daniel Language-Team: Łukasz Daniel Language: pl_PL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); Wszystkie parametry muszą być na moduł mniejsze niż 1Macierz współczynników nie jest odwracalnaPierwsza obserwacja jednostki musi mieć zamknięcieJak na razie nie została napisany przypadek dla tej złożonej symetriiOsobliwość w 'backsolve' na poziomie %ld, blok %ldNie można uformować dekompozycji wartość własna-wektor własny [RS(.) ierr = %d]Nieznana klasa przestrzennej korelacjigradient analityczny nie jest dostępny dla złożonej symetriigradient analityczny nie jest dostępny z algorytmem macierzowymnlme/inst/po/pl/LC_MESSAGES/R-nlme.mo0000644000176000001440000012640214632316272016532 0ustar ripleyusers3 L0#$)+"U x*$+;3)o6H37k@ >5)/_JEE 0fO1-*G.r!23* &C j " "  + !%0!V!,s!!!!!-!)"&>"9e"#""$"G#.K#$z#&#.#-#1#$,U$)$,$$#$%(5% ^%=%2%%6 &:D&&&6&/&6 '=D'P'7'; (1G(7y(A(*($)>C)3)c);*<V*0*1*J*7A+y+Q+9+<,>W,5,$,9,G+-Is-J->.>G.?.?.C/BJ/A/?/<0BL0$060/021+N11z1171F2CI2@26273"=39`31373*4D/4*t4.4o4o>5V5'6-6L6<f6B6=6D$7Ei7E7H7E>8H8-888)49<^919291:,2:8_:=:;:=;=P;2;Q;C<&W<2~<4<.<?=%U=:{=;=;=.>O>&?(?A?>Y?>?6?%@%4@8Z@<@<@: A9HA8A1A0A3B3RB2BWB:C+LC6xC5C$CW D8bDTD5D)&E0PE2E2E9E!F?]j]f^:w^R^=_'C_qk_+_] `Pg`C```Y]akaM#baqb>b7c6Jc:c#c?c? d1`dBd d1d/(e4XeKe3e6 f'Df=lf.f4f$g93gmg!gVgEh2Lh0hah8i/Ki3{i8i@iD)j6njDjDj"/k2Rk0kCk+kW&l<~l#l]lE=m1mDm@mC;nJn_nG*oHro9o@oF6p,}p.pIp;#qt_qSqT(r9}rHrJsUKs$scsF*tMqtMtA u1OuOuGuIvJcv>v@v@.w@owDwCwB9x@|x8xIx,@yAmy1y@y4"z=Wz!zDzJzSG{P{@{B-|3p|F|>|C*}5n}U}5}/0~u`~u~jL3+%P=MD܀b!bbeJbT:h;P߃607g4-ԄcQfKY[^[4SKH.9;Q6]Ĉ*"JMIJ-b*.ً::0?k%.ь@QADB؍NPj=<?6?v>kIa?@C,0p^C[DC4=?W>E֓N:(dGc_ZÕKFj9JV6ISחA+%m^bGU+=ə_:g1yԚ)N_x^؛(7%`%HD:9X37 5?@uBB,<6iLOW=efJb,1ڡB O/ϣ2628i,Ϥ-=(X>658-Qf8B/4]dn§?1QqMèKL]IJf?;3*.A9p{~&E, 'q%c2.|j _,4w :%m3]?&)3(1 XhT* zedM(}'-WEH-=Fu@a>0 x{YQ8Zi*N17 .&/$  UCp`AG^P<g[b Dt yIJ;L#rR#ks~!"0!\" BO$5fVKnv6/S+l)29+o"corStruct" object must have a "fixed" attribute"pdMat" element must have a formula"pdMat" elements must have a formula%s and %s must have the same group levels%s can have at most two components%s can only be a list or numeric%s can only have names "const" and "power"%s is not a valid effect name%s is not a valid object for "pdMat"%s must have group names in 'varConstPower'%s not available for plotting%s not available for plotting%s not found in data%s not found in data%s not matched%s not matched%s problem, convergence error code = %s message = %s%s without "primary" can only be used with fits of "groupedData" objects'FUN' can only be a function or a list of functions'Id' must be between 0 and 1'L' must have at most %d column'L' must have at most %d columns'Terms' must be between 1 and %d'asTable' can only be used with balanced 'groupedData' objects'asTable' cannot be used with multilevel grouped data'data' in %s call must evaluate to a data frame'data' must be a "groupedData" object if 'formula' does not include groups'data' must be a "groupedData" object if 'groups' argument is missing'data' must be given explicitly to use 'nls' to get initial estimates'data' must be given explicitly to use 'nlsList''data' must inherit from "groupedData" class if 'random' does not define groups'distance' and 'object' have incompatible lengths'fixed' must be a formula or list of formulae'form' and 'nam' have incompatible lengths'form' and 'pdClass' have incompatible lengths'form' argument must be a formula'form' can only be a formula or a list of formulae'form' can only be a formula, or a list of formulas'form' must be a formula'form' must be a formula when not NULL'form' must be a list'form' must be a one-sided formula'form' must be a two-sided formula'form' must have a covariate'form' must have all components as formulas'form' not consistent with 'nam''id' can only be a formula or numeric'id' must be between 0 and 1'idLabels' can only be a formula or a vector'idLabels' of incorrect length'lme.lmList' will redefine 'data''model' must be a formula'nam' and 'pdClass' have incompatible lengths'nam' must be a list'nint' is not consistent with 'breaks''nlme.nlsList' will redefine 'fixed', 'data', and 'start''object' has not been Initialize()d'object' must be a formula'object' must be a list or a formula'object' must be a list when not missing, not a matrix, and not numeric'params' must be a formula or list of formulae'pdClass' must be a character vector'preserve' must be a two-sided formula'random' must be a formula or list of formulae'range' must be > 0 in "corLin" initial value'range' must be > 0 in "corSpatial" initial value'start' must have a component called 'fixed''subset' can only be character or integer'subset' ignored with single grouping factor'subset' must be a list'value' must be a one sided formula'value' must be a square matrix'which' can only be character or integer'which' must be between 1 and %dL may only involve fixed effects with the same denominator DFLNone of the arguments specify more than one blockLength of names should be %dall arguments to 'varComb' must be of class "varFunc".all elements in the argument must generate "pdMat" objectsall elements must have a non-zero sizeall elements must have formulas when any has a formulaall elements must have names when any has namesall elements of 'form' list must be two-sided formulasall elements of a "reStruct" object must have a non-zero sizeall elements of formula must be list of two-sided formulae or two-sided formulaeall fitted objects must have the same estimation methodall fitted objects must use the same number of observationsall variables used in 'formula' must be in 'data'an object of length %d does not match a Cholesky factoran object of length %d does not match the required parameter sizearguments imply different number of blocksat least two coefficients are neededaugmentation of random effects only available for single levelautoregressive order must be a non-negative integercan only construct "varFunc" object from another "varFunc" object, a formula, or a character stringcan only fit "lmList" objects with single grouping variablecan only fit "nlsList" objects with single grouping variablecannot access the matrix of object without namescannot access the matrix of uninitialized objectscannot access the number of columns of uninitialized objects without namescannot calculate REML log-likelihood for "gnls" objectscannot change 'form'cannot change coefficients before initialization or when all parameters are fixedcannot change dimensions on an initialized "pdMat" objectcannot change parameter length of initialized "pdMat" objectcannot change parameter length of initialized "varComb" objectcannot change parameter length of initialized objectscannot change the length of 'object'cannot change the length of covariate in "varFunc" objectcannot change the length of the "varExp" parameter after initializationcannot change the length of the "varIdent" parameter after initializationcannot change the length of the "varStruct" parameter after initializationcannot change the length of the parameter after initializationcannot change the length of the parameter of a "corAR1" objectcannot change the length of the parameter of a "corARMA" objectcannot change the length of the parameter of a "corCAR1" objectcannot change the length of the parameter of a "corCompSymm" objectcannot change the length of the parameter of a "corNatural" objectcannot change the length of the parameter of a "corStruct" objectcannot change the length of the parameter of a "corSymm" objectcannot change the number of columns on an initialized objectcannot change the parameter when length of parameters is undefinedcannot do pairs of just one variablecannot evaluate groups for desired levels on 'newdata'cannot extract groups formula without a formulacannot extract matrix from an uninitialized objectcannot extract model matrix without formulacannot extract parameters of uninitialized objectcannot extract the dimensionscannot extract the inverse from an uninitialized objectcannot extract the log of the determinant from an uninitialized objectcannot extract the matrix from an uninitialized "pdCompSymm" objectcannot extract the matrix from an uninitialized "pdIdent" objectcannot extract the matrix from an uninitialized objectcannot extract the matrix with uninitialized dimensionscannot fix variances in all groupscannot get confidence intervals on var-cov components: %scannot get the inverse of an uninitialized objectcannot have duplicated column names in a "pdMat" objectcannot have zero distances in "corSpatial"cannot obtain constrained coefficients with uninitialized dimensionscannot omit grouping factor without 'form'cannot use an anonymous function for the modelcannot use smaller level of grouping for "correlation" than for "random". Replacing the former with the latter.cannot use smaller level of grouping for 'correlation' than for 'random'. Replacing the former with the latter.collapsing level cannot be smaller than display level; setting it to the display levelcomputed "gls" fit is singular, rank %scovariate must be a data framecovariate must be numericcovariate must have a level attribute when 'id' is a formulacovariate must have a level attribute when 'idLabels' is a formulacovariate must have a level attribute when groups are presentcovariate must have unique values within groups for "corAR1" objectscovariate must have unique values within groups for "corARMA" objectscovariate must have unique values within groups for "corCAR1" objectscovariate must have unique values within groups for "corNatural" objectscovariate must have unique values within groups for "corSymm" objectsdata argument to "data.frame" method for 'getGroups' does not make sensedata in %s call must evaluate to a data framedegrees of freedom and weights must have the same lengthdimnames of 'value' must match or be NULLdo not know how to calculate correlation matrix of %s objectdo not know how to get coefficients for %s objectdo not know how to obtain constrained coefficientsdo not know how to obtain parameters of %s objecteffect %s not matchedeffects %s not matchedelements in 'object' must be formulas or "pdMat" objectsfewer observations than random effects in all level %s groupsfirst argument to 'groupedData' must be a two-sided formulafirst argument to 'nfGroupedData' must be a two-sided formulafirst argument to 'nmGroupedData' must be a two-sided formulafirst model has a different response from the restfitted objects with different fixed effects. REML comparisons are not meaningful.fixed parameter names in 'varIdent' must be a subset of group namesfixed parameters must have group namesfixed parameters must have group names in 'varExp'fixed parameters must have group names in 'varPower'fixed parameters must have names in 'varIdent'fixed-effects model must be a formula of the form "resp ~ pred"formula(object) must return a formulaformulae in 'fixed' must be of the form "parameter ~ expr"formulae in 'params' must be of the form "parameter ~ expr"formulae in 'random' must be of the form "parameter ~ expr"group name not matched in starting values for random effects: %sgroup names not matched in starting values for random effects: %sgroups levels mismatch in 'random' and starting values for 'random' at level %signoring 'group' in "varFixed" formulaignoring argument 'form'ignoring argument 'nam'incompatible formulas for groups in "random" and "correlation"incompatible formulas for groups in 'random' and 'correlation'incompatible lengths for 'random' and grouping factorsincompatible lengths for object namesindividual %s was not used in the fitinitial value for "corLin" parameters of wrong dimensioninitial value for "corNatural" parameters of wrong dimensioninitial value for "corSpatial" parameters of wrong dimensioninitial value for "corSpher" parameters of wrong dimensioninitial value for "corSymm" parameters of wrong dimensioninitial value for "reStruct" overwritten in 'lme.lmList'initial value for "varExp" should be of length %dinitial value for "varExp" should be of length 1initial value for "varIdent" should be of length %dinitial value for "varPower" should be of length %dinitial value for "varPower" should be of length 1initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)initial value for 'reStruct' overwritten in 'nlme.nlsList'initial value for parameter of wrong lengthinitial value in "corCompSymm" must be greater than %sinitial value of nugget ratio must be between 0 and 1initial value should be of length %dinitial values for "corNatural" do not define a positive-definite correlation structureinitial values for "corNatural" must be between -1 and 1initial values for "corSymm" do not define a positive-definite correlation structureinitial values for "corSymm" must be between -1 and 1initial values for 'varIdent' must be > 0initial values must have group names in 'varExp'initial values must have group names in 'varIdent'initial values must have group names in 'varPower'initializing "pdCompSymm" object is not positive definiteinvalid formula for groupslength of 'nam' not consistent with dimensions of initial valuelevel of %s does not match formula %slist with starting values for random effects must have names or be of length %dlog-likelihood not available with NULL fitsmaximum number of iterations (lmeControl(maxIter)) reached without convergencemaximum number of iterations (maxIter = %d) reached without convergencemaximum number of iterations reached without convergencemismatch between group names and fixed values namesmissing call attribute in "nlsList" objectmodel formula must be of the form "resp ~ pred"model must be a formula of the form "resp ~ pred"models with "corStruct" and/or "varFunc" objects not allowedmore than one degree of freedom is needed when one them is zero.moving average order must be a non-negative integermultiple levels not allowedmust give names when initializing "pdCompSymm" from parameter without a formulamust give names when initializing "pdIdent" from parameter without a formulamust give names when initializing from matrix or parametermust have formula when no names are givennames being assigned do not correspond to a permutation of previous namesnames mismatch in 'random' and starting values for 'random' at level %snames of 'value' are not consistent with 'nam' argumentnames of object and value must matchnames of starting value for "varIdent" object must contain all but one of the stratum levelsneed an object with call componentneed data to calculate covariateneed data to calculate covariate of "corStruct" objectnegative degrees of freedom not allowedno coefficients to fitno condensed linear modelno default method for extracting the square root of a "pdMat" objectno degrees of freedom for estimating std. dev.no degrees of freedom specifiedno effects allowed in right side of formulano fitted "lme" objectno initial values for model parametersno model variogram available with 'showModel = TRUE'nonexistent group in 'newdata'nonexistent group names for initial valuesnonexistent group names for initial values in "varExp"nonexistent group names for initial values in "varPower"nonexistent group names for initial values in 'varIdent'nonexistent group requested in 'subset'nonexistent groups requested in 'subset'nonexistent level %snonexistent levels %snot implemented for "nlme" objectsnot implemented for multiple levels of nestingnumber of columns in starting values for random component at level %s should be %dnumber of rows in starting values for random component at level %s should be %dobject formula must be of the form "resp ~ pred"object must inherit from class %sobjects must have a "call" component or attributeobjects must have coefficients with same row namesold-style self-starting model functions are no longer supported. New selfStart functions are available. Use SSfpl instead of fpl, SSfol instead of first.order.log, SSbiexp instead of biexp, SSlogis instead of logistic. If writing your own selfStart model, see "help(selfStart)" for the new form of the "initial" attribute.only one display level allowedonly one level allowed for predictionsonly one level allowed in 'gapply'only one level allowed in 'gsummary'only one level of grouping allowedonly residuals allowedonly residuals and random effects allowedonly single effects allowed in left side of 'form'only single level allowedparameter in "corCompSymm" structure must be < 1 in absolute valueparameter in AR(1) structure must be between -1 and 1parameter in CAR(1) structure must be between 0 and 1parameters in ARMA structure must be < 1 in absolute valueplot method only implemented for comparing modelsrange must be > 0 in "corSpher" initial valueright-hand side of first argument must be a conditional expressionsecond argument must be a groupedData objectsecond argument to 'groupedData' must inherit from data.framesome fitted objects deleted because response differs from the first modelstarting estimates must have names when 'params' is missingstarting values for random effects must include group levelsstarting values for random effects should be a list, or a matrixstarting values for the 'fixed' component are not the correct lengthstarting values for the random components should be a list of matricesstep halving factor reduced below minimum in NLS stepstep halving factor reduced below minimum in PNLS stepterm %s not matchedterms %s not matchedterms can only be integers or charactersterms must all have the same denominator DFundefined collapsing level %s for %sundefined display level %s for %sundefined group declared in 'subset'unique values of the covariate for "corSymm" objects must be a sequence of consecutive integersunique values of the covariate for "corNatural" objects must be a sequence of consecutive integerswrong group levelsx-y data to splom got botched somehowProject-Id-Version: nlme 3.1-115 Report-Msgid-Bugs-To: bugs@r-project.org PO-Revision-Date: 2014-03-25 17:00+0100 Last-Translator: Łukasz Daniel Language-Team: Łukasz Daniel Language: pl_PL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); X-Poedit-SourceCharset: iso-8859-1 X-Generator: Poedit 1.5.4 X-Poedit-Bookmarks: -1,-1,-1,72,-1,-1,-1,-1,-1,-1 obiekt "corStruct" musi posiadać atrybut "fixed".element "pdMat" musi posiadać formułęelementy "pdMat" muszą posiadać formułę%s oraz %s muszą mieć te same poziomy grup%s może posiadać najwyżej dwa komponenty%s może być jedynie listą lub liczbą%s może posiadać jedynie nazwy "const" oraz "power"%s nie jest poprawną nazwą efektu%s nie jest poprawnym obiektem dla klasy "pdMat"%s musi posiadać nazwy grup w 'varConstPower'%s nie jest dostępne do rysowania%s nie są dostępne do rysowania%s nie są dostępne do rysowania%s nie został znaleziony w danych%s nie zostały znalezione w danych%s nie zostały znalezione w danychczłon %s nie został dopasowanyczłony %s nie zostały dopasowaneczłony %s nie zostały dopasowaneproblem %s, kod błędu zbieżności = %s komunikat = %s%s bez "primary" może być użyte jedynie z dopasowaniami obiektów "groupedData"argument 'FUN' może być jedynie funkcją lub listą funkcjiargument 'id' musi być pomiędzy 0 a 1'L' musi mieć co najwyzej %d kolumnę'L' musi mieć co najwyzej %d kolumny'L' musi mieć co najwyzej %d kolumnargument 'Terms' musi być pomiędzy 1 a %dfunkcja 'asTable()' może być użyta jedynie ze zbalansowanymi obiektami klasy "groupedData"funkcja 'asTable()' nie może być użyta z wielopoziomowymi zgrupowanymi danymiargument 'data' w wywołaniu %s musi wyliczać się do ramki danychargument 'data' musi być obiektem klasy "groupedData" jeśli argument 'fomula' nie zawiera grupargument 'data' musi być obiektem klasy "groupedData" jeśli brakuje argumentu 'groups' argument 'data' musi być podany bezpośrednio aby użyć 'nls()' w celu uzyskania początkowych oszacowańargument 'data' musi być podane bezpośrednio aby użyć funkcji 'nlsList()'argument 'data' musi być obiektem klasy "groupedData" jeśli argument 'random' nie określa grupargumenty 'distance' oraz 'object' mają niespójne długościargument 'fixed' musi być formułą lub listą formułargumenty 'form' oraz 'nam' mają niezgodne długościargumenty 'form' oraz 'pdClass' mają niezgodne długościargument 'form' musi być formułąargument 'form' może być jedynie formułą lub listą formułargument 'form' może być jedynie formułą lub listą formułargument 'form' nie jest obiektem klasy "formula"argument 'form' musi być formułą, gdy nie jest wartością NULLargument 'form' musi być listąargument 'form' musi być jednostronną formułąargument 'form' musi być dwustronną formułąargument 'form' musi posiadać zmienną niezależnąargument 'form' musi mieć wszystkie komponenty przedstawione jako formułyargument 'form' nie jest spójny z argumentem 'nam'argument 'id' może być jedynie formułą lub liczbąargument 'id' musi być pomiędzy 0 a 1argument 'IdLabels' może być jedynie formułą lub wektoremargument 'IdLabels' ma niepoprawną długośćfunkcja 'lme.lmList()' przedefiniuje argument 'data'argument 'model' musi być formułąargumenty 'nam' oraz 'pdClass' mają niezgodne długościargument 'nam' musi być listą'nint' jest niespójne z 'breaks'funkcja 'nlme.nlsList()' ponownie przedefiniuje argumenty 'fixed', 'data' oraz 'start'argument 'object' nie został zainicjalizowany metodą 'Initialize()'argument 'model' nie jest obiektem klasy "formula"argument 'object' musi być listą lub formułąargument 'object' musi być listą, gdy nie jest brakujący, nie jest macierzą, ani też liczbąargument 'params' musi być formułą lub listą formułargument 'pdClass' musi być wektorem tekstowymargument 'preserve' musi być dwustronną formułąargument 'random' musi być formułą lub listą formułargument 'range' musi być > 0 w początkowej wartości "corLin"argument 'range' musi być > 0 w początkowej wartości "corSpatial"argument 'start' musi mieć komponent o nazwie 'fixed'argument 'subset' może być jedynie znakiem lub liczbą całkowitąargument 'subset' został zignorowany z jednym czynnikem grupującymargument 'subset' musi być listąargument 'value' musi być jednostronną formułąargument 'value' musi być kwadratową macierząargument 'which' może być jedynie tekstem lub liczbą całkowitąargument 'which' musi być pomiędzy 1 a %d'L' może zawierać jedynie stałe efekty z tą samą liczbą stopni swobody mianownikażaden z argumentów nie określa więcej niż jednego blokuDługość nazw powinna wynosić %dwszystkie argumenty przekazywane do funkcji 'varComb()' muszą być obiektami klasy "varFunc"wszystkie elementy w argumencie muszą tworzyć obiekty klasy "pdMat"wszystkie elementy muszą mieć niezerowy rozmiarwszystkie elementy muszą mieć formułę, gdy którykolwiek posiadawszystkie elementy muszą mieć nazwy, gdy którykolwiek posiadawszystkie elementy listy 'form' muszą być dwustronnymi formułamiwszystkie elementy obiektu klasy "reStruct" muszą mieć niezerowy rozmiarwszystkie elementy formuły muszą być listą dwustronnych formuł lub dwustronnymi formułamiwszystkie dopasowane obiekty muszą mieć tę samą metodę oszacowaniawszystkie dopasowane obiekty muszą używać tej samej liczby obserwacjiwszystkie zmienne użyte w 'formula' muszą być w 'data'obiekt o długości %d nie zgadza się z czynnikiem Cholesky'egoobiekt o długości %d nie zgadza się z wymaganym rozmiarem parametruargumenty sugerują różną liczbę blokówprzynajmniej dwa współczynniki są potrzebnerozszerzenie efektów losowych dostępne jedynie dla pojedynczego poziomurząd autoregresji musi być nieujemną liczbą całkowitąmożna stworzyć jedynie obiekt klasy "varFunc" z innego obiektu klasy "varFunc", formuły lub łańcucha tekstowegomożna dopasować jedynie obiekty klasy "lmList" z pojedynczą zmienną grupującąmożna dopasować jedynie obiekty klasy "nlsList" z pojedynczą zmienną grupującąnie można uzyskać dostępu do macierzy obiektu bez nazwnie można uzyskać dostępu do macierzy niezainicjalizowanych obiektównie można uzyskać liczby kolumn niezainicjalizowanych obiektów bez nazwnie można obliczyć REML logarytmu funkcji wiarygodności dla obiektów klasy "gnls"nie można zmienić argumentu 'form'nie można zmienić współczynników przed zainicjowaniem lub gdy wszystkie parametry są ustalonenie można zmienić wymiarów zainicjalizowanego obiektu klasy "pdMat"nie można zmienić długości parametru zainicjowanego obiektu klasy "pdMat"nie można zmienić długości parametru zainicjalizowanego obiektu "varComb"nie można zmienić długości parametru zainicjowanych obiektównie można zmienić długości argumentu 'object'nie można zmienić długości zmiennej niezależnej w obiekcie klasy "varFunc"nie można zmienić długości parametru "varExp" po jego zainicjowaniunie można zmienić długości parametru "varIdent" po jego zainicjowaniunie można zmienić długości parametru "varStruct" po jego zainicjowaniunie można zmienić długości parametru po jego zainicjowaniunie można zmienić długości parametru obiektu klasy "corCAR1"nie można zmienić długości parametru obiektu klasy "corARMA"nie można zmienić długości parametru obiektu klasy "corCAR1"nie można zmienić długości parametru obiektu klasy "corCompSymm"nie można zmienić długości parametru obiektu klasy "corNatural"nie można zmienić długości parametru obiektu klasy "corStruct"nie można zmienić długości parametru obiektu klasy "corSymm"nie można zmienić liczby kolumn zainicjowanego obiektunie można zmienić parametru gdy długość parametru jest nieokreślonanie można zrobić par tylko jednej zmiennejnie można wyznaczyć grup dla pożądanych poziomów w 'newdata'nie można wyodrębnić formuł grup bez formułynie można wyodrębnić macierzy z niezainicjalizowanego obiektunie można wyodrębnić macierzy modelu bez formułynie można wyodrębnić parametrów niezainicjowanego obiektunie można wyodrębnić wymiarównie można wyodrębnić odwrotności z niezainicjalizowanego obiektunie można wyodrębnić logarytmu macierzy z niezainicjalizowanego obiektunie można wyodrębnić macierzy z niezainicjalizowanego obiektu klasy "pdCompSymm"nie można wyodrębnić macierzy z niezainicjalizowanego obiektu klasy "pdIdent"nie można wyodrębnić macierzy z niezainicjalizowanego obiektunie można wyodrębnić macierzy z niezainicjalizowanymi wymiaraminie można ustalić wariancji we wszystkich grupachnie można uzyskać przedziałów ufności na komponentach var-cov: %snie można uzyskać odwrotności niezainicjalizowanego obiektunie można mieć powtórzonych nazw kolumn w obiekcie klasy "pdMat"nie można mieć zerowych odległości w "corSpatial"nie można uzyskać ograniczonych współczynników z niezainicjalizowanych wymiarównie można pominąć czynnika grupującego bez 'form'nie można użyć anonimowej funkcji dla modelunie można użyć mniejszego poziomu grupowania dla "correlation" niż dla "random". Zastępowanie pierwszego drugim.nie można użyć mniejszego poziomu grupowania dla 'correlation' niż dla 'random'. Zastępowanie pierwszego drugim.poziom zapadania nie może być mniejszy niż poziom wyświetlania; ustawianie go do poziomu wyświetlaniaobliczone dopasowanie "gls" jest osobliwe, ranga %szmienna niezależna musi być ramką danychzmienna niezależna musi być liczbązmienna niezależna musi mieć atrybut poziomu, gdy argument 'id' jest formułązmienna niezależna musi mieć atrybut poziomu, gdy 'idLabels' jest formułązmienna niezależna musi mieć atrybut poziomu, gdy grupy są obecnezmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów klasy "corCAR1"zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów klasy "corARMA"zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów klasy "corCAR1"zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów klasy "corNatural"zmienna wyjaśniająca musi mieć unikalne wartości w obrębie grup dla obiektów klasy "corSymm"argument danych przekazywany do metody 'data.frame()' dla 'getGroups()' nie ma sensudane w wywołaniu %s muszą wyliczać się do ramki danychstopnie swobody oraz wagi muszą mieć tę samą długośćnazwy wymiarów argumentu 'value' muszą się zgadzać lub być wartością NULLnie wiadomo jak policzyć macierz korelacji obiektu %snie wiadomo jak uzyskać współczynniki dla obiektu %snie wiadomo jak uzyskać ograniczone współczynnikinie wiadomo jak uzyskać parametry obiektu %sefekt %s nie został dopasowanyefekty %s nie zostały dopasowaneefekty %s nie zostały dopasowaneelementy w argumencie 'object' muszą być formułami lub obiektami klasy "pdMat"mniej obserwacji niż losowych efektów we wszystkich grupach w poziomie %spierwszy argument przekazywany do funkcji 'groupedData()' musi być dwustronną formułąpierwszy argument przekazywany do funkcji 'nmGroupedData()' musi być dwustronną formułąpierwszy argument przekazywany do funkcji 'nmGroupedData()' musi być dwustronną formułąpierwszy model ma inną zmienną zależną od resztydopasowane obiekty z różnymi stałymi efektami. Porównania REML nie mają sensu.ustalone nazwy parametrów w 'varIdent' muszą być podzbiorem nazw grupustalone parametry muszą posiadać nazwy grupustalone parametry muszą posiadać nazwy grup w 'varExp'ustalone parametry muszą posiadać nazwy grup w 'varPower'ustalone parametry muszą posiadać nazwy w 'varIdent'model stałych efektów musi być formułą o formie "zmienna zależna ~ zmienna niezależna"'formuła(obiekt)' musi zwracać formułęformuły w argumencie 'fixed' muszą mieć formę "parametr ~ wyrażenie".formuły w argumencie 'param' muszą mieć formę "parametr ~ wyrażenie"formuły w argumencie 'random' muszą mieć formę "parametr ~ wyrażenie"nazwa grupy nie zgadza się z początkowymi wartościami dla efektów losowych: %snazwy grup nie zgadzają się z początkowymi wartościami dla efektów losowych: %snazwy grup nie zgadzają się z początkowymi wartościami dla efektów losowych: %spoziomy grup nie zgadzają się w 'random' oraz początkowych wartościach 'random' na poziomie %sIgnorowanie 'group' w formule klasy "varFixed"ignorowanie argumentu 'form'ignorowanie argumentu 'nam'niespójne formuły dla grup w "random" oraz "correlation"niespójne formuły dla grup w 'random' oraz 'correlation'niespójne długości dla 'random' oraz czynników grupującychniezgodne długości dla nazw obiektujednostka %s nie została użyta w dopasowaniupoczątkowa wartość parametrów "corLin" ma niepoprawny wymiarpoczątkowe wartości dla parametrów "corNatural" posiadają niepoprawne wymiarypoczątkowa wartość parametrów "corSpatial" ma niepoprawny wymiarpoczątkowa wartość parametrów "corSpher" ma niepoprawny wymiarpoczątkowe wartości dla parametrów "corSymm" posiadają niepoprawne wymiarypoczątkowa wartość dla "reStruct" została nadpisana w funkcji 'lme.lmList()'początkowa wartość dla "varExp" powinna być długości %dpoczątkowa wartość dla "varExp" powinna być długości 1początkowa wartość dla "varIdent" powinna być długości %dpoczątkowa wartość dla "varPower" powinna być długości %dpoczątkowa wartość dla "varPower" powinna być długości 1początkowa wartość 'range' mniejsza niż minimalna odległość. Ustawianie jej na '1.1 * min(distance)'początkowa wartość dla 'reStruct' nadpisana w funkcji 'nlme.nlsList()'początkowa wartość parametru posiada niepoprawną długośćpoczątkowa wartość w "corCompSymm" musi być większa niż %spoczątkowa wartość proporcji samorodka musi być pomiędzy 0 a 1początkowa wartość powinna być długości %dpoczątkowe wartości dla "corNatural" nie definiują dodatnio określonej strukture korelacjipoczątkowe wartości dla "corNatural" muszą być pomiędzy -1 a 1początkowe wartości dla "corSymm" nie definiują dodatnio określonej struktury korelacjipoczątkowe wartości dla "corNatural" muszą być pomiędzy -1 a 1początkowe wartości dla 'varIdent' muszą być > 0początkowe wartości muszą posiadać nazwy grupy w 'varExp'początkowe wartości muszą posiadać nazwy grupy w 'varIdent'początkowe wartości muszą posiadać nazwy grup w 'varPower'inicjalizowany obiekt klasy "pdCompSymm" nie jest dodatnio określonyniepoprawna formuła dla grupdługość argumentu 'nam' nie jest spójna z wymiarami początkowej wartościpoziom %s nie zgadza się z formułą %slista z początkowymi wartościami dla efektów losowych musi zawierać nazwy lub być długości %dlogarytm funkcji wiarygodności nie jest dostępny z dopasowaniami NULLmaksymalna liczba iteracji ('lmeControl(maxIter)') została osiągnięta bez uzyskania zbieżnościmaksymalna liczba iteracji (maxIter = %d) została osiągnięta bez uzyskania zbieżnościmaksymalna liczba iteracji została osiągnięta bez uzyskania zbieżnościniezgodność pomiędzy nazwami grup oraz nazwami ustalonych wartościbrakuje wywoływanego atrybutu w obiekcie klasy "nlsList"formuła modelu musi mieć formę "zmienna zależna ~ zmienna niezależna"argument 'model' musi być formułą o formie "zmienna zależna ~ zmienna niezależna"modele z obiektami klasy "corStruct" oraz/lub "varFunc" nie są dozwolonewięcej niż jeden stopień swobody jest potrzebny jeśli jeden człon wynosi zero.rząd średniej ruchomej musi być nieujemną liczbą całkowitąwielokrotne poziomy nie są dozwolonenazwy są wymagane podczas inicjalizowania obiektu klasy "pdCompSymm" z parametru bez formułynazwy są wymagane gdy występuje inicjalizowanie obiektu klasy "pdIdent" z parametru bez formułynazwy są wymagane, gdy następuje inicjowanie z macierzy lub parametruformuła jest wymagana, gdy nie podano nazwprzypisane nazwy nie odpowiadają permutacji poprzednich nazwnazwy nie zgadzają się w 'random' oraz początkowych wartościach dla 'random' na poziomie %snazwy argumentu 'value' nie są spójne z argumentem 'nam'nazwy obiektu oraz wartości muszą się zgadzaćnazwy wartości początkowych dla obiektu klasy "varIdent" muszą zawierać wszystkie oprócz jednego z poziomów warstwywymagany jest obiekt z komponentem 'call'argument 'data' jest wymagany aby wyliczyć zmienną wyjaśniającą obiektu klasy "corSpatial"argument 'data' jest wymagany aby wyliczyć zmienną wyjaśniającą obiektu klasy "corStruct"ujemne stopnie swobody nie są dozwolonebrak współczynników do dopasowaniabrak skondensowanego modelu liniowegobrak domyślnej metody dla uzyskania pierwiastka z obiektu klasy "pdMat"brak stopni swobody na potrzeby oszacowania odchylenia standardowegonie określono stopni swobodynie są dozwolone żadne efekty po prawej stronie fomułybrak dopasowanego obiektu "lme"brak początkowych wartości dla parametrów modelubrak dostępnego modelu wariogramu w 'showModel = TRUE'nieistniejąca grupa w 'newdata'nieistniejące nazwy grup dla początkowych wartościnieistniejące nazwy grup dla początkowych wartości w "varExp"nieistniejące nazwy grup dla początkowych wartości w "varPower"nieistniejące nazwy grup dla początkowych wartości w 'varIdent'zażądano nieistniejącej grupy w 'subset'.zażądano nieistniejących grup w argumencie 'subset'nieistniejący poziom %snieistniejące poziomy %snieistniejące poziomy %sfunkcja 'getVarCov.lme()' nie jest zaimplementowana dla obiektów klasy "nlme"funkcja 'getVarCov.lme()' nie jest zaimplementowana dla wielu poziomów zagnieżdżenialiczba kolumn w wartościach początkowych dla losowego komponentu na poziomie %s powinna wynosić %dliczba wierszy w wartościach początkowych dla losowego komponentu na poziomie %s powinna wynosić %dformuła modelu musi mieć formę "zmienna zależna ~ zmienna niezależna"argument 'object' nie jest obiektem klasy %sobiekty muszą mieć komponent 'call' lub atrybutobiekty muszą mieć współczynniki z tymi samymi nazwami wierszysamoinicjujące się funkcje modelu starego stylu nie są już dłużej wspierane Brak dostępnych funkcji 'selfStart'. Użyj 'SSfpl' zamiast 'fpl', 'SSfol' zamiast 'first.order.log', 'SSbiexp' zamiast 'biexp', 'SSlogis' zamiast 'logistic'. Jeśli piszesz swój własny model 'selfStart', zobacz 'help(selfStart)' aby uzyskać informację o nowej formie atrybutu 'initial'.tylko jeden poziom wyświetlenia jest dozwolonytylko jeden poziom jest dozwolony dla przewidywańtylko jeden poziom jest dozwolony w funkcji 'gapply()'tylko jeden poziom jest dostępny w funkcji 'gsummary()'tylko jeden poziom grupowania jest dozwolonyjedynie reszty są dozwolonetylko reszty oraz efekty losowe są dozwolonetylko pojedynczy efekt jest dozwolony po lewej stronie 'form'jedynie pojedynczy poziom jest dozwolonyparametr w strukturze "corCompSymm" musi być pomiędzy -1 a 1parametr w strukturze AR(1) musi być pomiędzy -1 a 1parametr w strukturze AR(1) musi być pomiędzy 0 a 1parametry w strukturze ARMA muszą być pomiędzy -1 a 1metoda rysująca wykres została zaimplementowana jedynie do porównywania modelizakres musi być > 0 w początkowej wartości "corShere"prawa strona pierwszego argumentu musi być wyrażeniem warunkowymdrugi argument musi być obiektem "groupedData"drugi argument przekazywany do funkcji 'groupedData()' musi dziedziczyć z klasy "data.frame"niektóre dopasowane obiekty zostały usunięte ponieważ zmienne zależne różnią się od pierwszego modelupoczątkowe oszacowania muszą mieć nazwy gdy brakuje 'params'wartości początkowe dla losowych efektów muszą zawierać w sobie poziomy gruppoczątkowe wartości dla efektów losowych powinny być listą lub macierząpoczątkowe wartości dla komponentu 'fixed' nie mają poprawnej długościwartości początkowe dla losowych komponentów powinny być listą macierzyczynnik skracający krok został zredukowany poniżej minimum w kroku NLSczynnik skracający krok został zredukowany poniżej minimum w kroku PNLSczłon %s nie został dopasowanyczłony %s nie zostały dopasowaneczłony %s nie zostały dopasowaneczłony mogą być tylko liczbami całkowitymi lub tekstamiwszystkie człony muszą mieć ten sam mianownik DFniezdefiniowany poziom %s zapadania dla %sniezdefiniowany poziom %s wyświetlenia dla %sniezdefiniowana grupa zadeklarowana w argumencie 'subset'unikalne wartości zmiennej wyjaśniającej dla obiektów klasy "corSymm" muszą być ciągiem kolejnych liczb całkowitychunikalne wartości zmiennej wyjaśniającej dla obiektów klasy "corNatural" muszą być ciągiem kolejnych liczb całkowitychbłędne poziomy grupydane x-y przekazywane do funkcji 'splom()' zostały jakoś uszkodzonenlme/inst/po/fr/0000755000176000001440000000000014251721456013246 5ustar ripleyusersnlme/inst/po/fr/LC_MESSAGES/0000755000176000001440000000000014632316272015032 5ustar ripleyusersnlme/inst/po/fr/LC_MESSAGES/nlme.mo0000644000176000001440000000407414531445451016327 0ustar ripleyusers 041!f370H7TE!9=8wtE%%k<= G!PigZ"*}HJ    All parameters must be less than 1 in absolute valueCoefficient matrix not invertibleFirst observation on an individual must have a doseHaven't written the compound symmetry case for this yetOverfitted model!Singularity in backsolve at level %ld, block %ldToo many parameters for finite-difference Hessian; npar = %d, nTot = %g.Unable to form Cholesky decomposition: the leading minor of order %d is not pos.def.Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]Unknown spatial correlation classanalytic gradient is not available with compound symmetryanalytic gradient is not available with matrix logarithmProject-Id-Version: nlme 3.1-65 Report-Msgid-Bugs-To: PO-Revision-Date: 2021-02-06 16:27+0100 Last-Translator: Philippe Grosjean Language-Team: French Language: fr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n > 1); X-Generator: Poedit 2.4.2 Tous les paramètres doivent être inférieurs à 1 en valeur absolueMatrice de coefficient non inversibleLa première observation sur un individu doit avoir une doseLes cas de symétrie composée n'ont pas encore été écritsModèle surajusté !Singularité rencontrée en résolution inverse au niveau %ld, bloc %ldTrop de paramètres pour un Hessien de différences finies : par = %d, not = %g.Incapable de former la décomposition de Cholesky : le premier mineur d’ordre %d n’est pas pos.def.Incapable de former la décomposition valeurs propres - vecteurs propres [RS(.) ierr = %d]Classes de corrélation spatiale inconnuesun gradient analytique n'est pas disponible avec une symétrie composéeun gradient analytique n'est pas disponible avec une matrice logarithmiquenlme/inst/po/fr/LC_MESSAGES/R-nlme.mo0000644000176000001440000012600114632316272016521 0ustar ripleyusers6 |0 #:$^)" *)F$d+*;)F6dH3@5 v>5/ J<EE0OD1-*. !N 2p 3  & !"-!"P!s!+! !%!", "M"!l""-""&"9##L#p#$#G#.#$'$&L$.s$-$1$,%)/%,Y%%#%%(% &=,&2j&&6&:&&,'6S'/'6'='P/(7(;(1(7&)A^)*)$)>)3/*cc*;*<+0@+1q+J+7+&,Q;,9,<,>-5C-$y-9-G-I .Jj.>.>.?3/?s/C/B/A:0?|0<0B0$<16a1/121+11'2Y27w2F2C2@:36{373"39 41G47y4*4D4*!5.L5o{5o5V[6'606 7*7<D7B7=7D8EG8E8H8E9Hb9-989):<<:1y:2:1:,;8=;=v;;;=;=.<2l<Q<C<&5=2\=4=.=?=%3>:Y>;>;> ?O?&?@@>7@>v@6@%@%A88A<qA<A:A9&B8`B1B0B3B30C2dCWC:C+*D6VD5D$DWD8@ETyE5E)F0.F2_F2F9FF?G%ZGOG+GNGGKH8H3H*I/+I1[I<I@I3 J?JO[JLJ:J)3KI]KHK7K$(L\ML"L L6L'%MMMdMD~M.MM+N>N&UN4|NN*N6N82O8kO'O(O*O" P.CPRrPOP0Q!FQ1hQ2QLQS&9S"`S$S"SS)S2 T?TBYT5T5T:U1CU-uUBU,U=VIQV;V<V@WDUWFW5W6X(NX(wX+X$X!X$Y`8YbYY%Z5Z2[+[5 \3V\&\*\0\/ ](=]*f]6]5]B]=A^^<^Q^<-_#j_F_*_H`JI`:`Q`K!ahma=aUb4jb6b-b3c'8c;`c<cc7c.d-Id+wd d=de2!e#Te4xe!e ee2fAf)[f7f7ff+gX@g7g7g/ h79hJqhJh0iI8iLii.i$j=@j'~j^j.k$4kAYkDk4kWl?mlOlJlsHmOmF nTSnInIn8 yIJy=y$y9yL1zG~zDz: {MF{5{R{8|GV|1|X|E)}8o}}7~i~40<e:!JPJOVWBWZ`MM\FYV=353i0(΄JTBHKK,3xl_6yDF=<Fz)KF7L~ˉe-5GQGD2&3YIN׌M&LtS@9V;9̎>=EwD9@BzK+ w5GeD[6EגGGeB#?1TgDY3RCD$0i79ҖK MX?mmqUߘ?5JuV?7Wc-8!QZ1ޛKCg%Aќ6,Ic 6ΝBDHF+Ԟ*++%W7}ge2$=۠F`%.)I)s+ ɣ6;!]OyBɤB FOF=ݥO3k@VK7V`ڧJ;YWY89J̩Q&i( nڪoI,ԫvcD 6fN (#aBi]*,~"o( A&kVn}/2K xOFj MW4{-w@"= rU#y-sC1.+q?.zR<:3)8^ 9pP60* &' %hLe1b7['/g)!5J$l$+G_|ES!5 0u;d`>2t4X\Y%3T Q,mIHZ"corStruct" object must have a "fixed" attribute"pdMat" element must have a formula"pdMat" elements must have a formula%s and %s must have the same group levels%s can have at most two components%s can only be a list or numeric%s can only have names "const" and "power"%s can only have names "const" and "prop"%s is not a valid effect name%s is not a valid object for "pdMat"%s must have group names in 'varConstPower'%s must have group names in 'varConstProp'%s not available for plotting%s not available for plotting%s not found in data%s not found in data%s not matched%s not matched%s problem, convergence error code = %s message = %s%s without "primary" can only be used with fits of "groupedData" objects'FUN' can only be a function or a list of functions'Id' must be between 0 and 1'L' must have at most %d column'L' must have at most %d columns'Terms' must be between 1 and %d'asTable' can only be used with balanced 'groupedData' objects'asTable' cannot be used with multilevel grouped data'data' in %s call must evaluate to a data frame'data' must be a "groupedData" object if 'formula' does not include groups'data' must be a "groupedData" object if 'groups' argument is missing'data' must be given explicitly to use 'nls' to get initial estimates'data' must be given explicitly to use 'nlsList''data' must inherit from "groupedData" class if 'random' does not define groups'distance' and 'object' have incompatible lengths'fixed' must be a formula or list of formulae'form' and 'nam' have incompatible lengths'form' and 'pdClass' have incompatible lengths'form' argument must be a formula'form' can only be a formula or a list of formulae'form' can only be a formula, or a list of formulas'form' must be a formula'form' must be a formula when not NULL'form' must be a list'form' must be a one-sided formula'form' must be a two-sided formula'form' must have a covariate'form' must have all components as formulas'form' not consistent with 'nam''id' can only be a formula or numeric'id' must be between 0 and 1'idLabels' can only be a formula or a vector'idLabels' of incorrect length'lme.lmList' will redefine 'data''model' must be a formula'nam' and 'pdClass' have incompatible lengths'nam' must be a list'nint' is not consistent with 'breaks''nlme.nlsList' will redefine 'fixed', 'data', and 'start''object' has not been Initialize()d'object' must be a formula'object' must be a list or a formula'object' must be a list when not missing, not a matrix, and not numeric'params' must be a formula or list of formulae'pdClass' must be a character vector'preserve' must be a two-sided formula'random' must be a formula or list of formulae'range' must be > 0 in "corLin" initial value'range' must be > 0 in "corSpatial" initial value'start' must have a component called 'fixed''subset' can only be character or integer'subset' ignored with single grouping factor'subset' must be a list'value' must be a one sided formula'value' must be a square matrix'which' can only be character or integer'which' must be between 1 and %dL may only involve fixed effects with the same denominator DFLNone of the arguments specify more than one blockLength of names should be %dall arguments to 'varComb' must be of class "varFunc".all elements in the argument must generate "pdMat" objectsall elements must have a non-zero sizeall elements must have formulas when any has a formulaall elements must have names when any has namesall elements of 'form' list must be two-sided formulasall elements of a "reStruct" object must have a non-zero sizeall elements of formula must be list of two-sided formulae or two-sided formulaeall fitted objects must have the same estimation methodall fitted objects must use the same number of observationsall variables used in 'formula' must be in 'data'an object of length %d does not match a Cholesky factoran object of length %d does not match the required parameter sizearguments imply different number of blocksat least two coefficients are neededaugmentation of random effects only available for single levelautoregressive order must be a non-negative integercan only construct "varFunc" object from another "varFunc" object, a formula, or a character stringcan only fit "lmList" objects with single grouping variablecan only fit "nlsList" objects with single grouping variablecannot access the matrix of object without namescannot access the matrix of uninitialized objectscannot access the number of columns of uninitialized objects without namescannot calculate REML log-likelihood for "gnls" objectscannot change 'form'cannot change coefficients before initialization or when all parameters are fixedcannot change dimensions on an initialized "pdMat" objectcannot change parameter length of initialized "pdMat" objectcannot change parameter length of initialized "varComb" objectcannot change parameter length of initialized objectscannot change the length of 'object'cannot change the length of covariate in "varFunc" objectcannot change the length of the "varExp" parameter after initializationcannot change the length of the "varIdent" parameter after initializationcannot change the length of the "varStruct" parameter after initializationcannot change the length of the parameter after initializationcannot change the length of the parameter of a "corAR1" objectcannot change the length of the parameter of a "corARMA" objectcannot change the length of the parameter of a "corCAR1" objectcannot change the length of the parameter of a "corCompSymm" objectcannot change the length of the parameter of a "corNatural" objectcannot change the length of the parameter of a "corStruct" objectcannot change the length of the parameter of a "corSymm" objectcannot change the number of columns on an initialized objectcannot change the parameter when length of parameters is undefinedcannot do pairs of just one variablecannot evaluate groups for desired levels on 'newdata'cannot extract groups formula without a formulacannot extract matrix from an uninitialized objectcannot extract model matrix without formulacannot extract parameters of uninitialized objectcannot extract the dimensionscannot extract the inverse from an uninitialized objectcannot extract the log of the determinant from an uninitialized objectcannot extract the matrix from an uninitialized "pdCompSymm" objectcannot extract the matrix from an uninitialized "pdIdent" objectcannot extract the matrix from an uninitialized objectcannot extract the matrix with uninitialized dimensionscannot fix variances in all groupscannot get confidence intervals on var-cov components: %scannot get the inverse of an uninitialized objectcannot have duplicated column names in a "pdMat" objectcannot have zero distances in "corSpatial"cannot obtain constrained coefficients with uninitialized dimensionscannot omit grouping factor without 'form'cannot use an anonymous function for the modelcannot use smaller level of grouping for "correlation" than for "random". Replacing the former with the latter.cannot use smaller level of grouping for 'correlation' than for 'random'. Replacing the former with the latter.collapsing level cannot be smaller than display level; setting it to the display levelcomputed "gls" fit is singular, rank %sconstant in "varConstProp" structure must be > 0covariate must be a data framecovariate must be numericcovariate must have a level attribute when 'id' is a formulacovariate must have a level attribute when 'idLabels' is a formulacovariate must have a level attribute when groups are presentcovariate must have unique values within groups for "corAR1" objectscovariate must have unique values within groups for "corARMA" objectscovariate must have unique values within groups for "corCAR1" objectscovariate must have unique values within groups for "corNatural" objectscovariate must have unique values within groups for "corSymm" objectsdata argument to "data.frame" method for 'getGroups' does not make sensedata in %s call must evaluate to a data framedegrees of freedom and weights must have the same lengthdimnames of 'value' must match or be NULLdo not know how to calculate correlation matrix of %s objectdo not know how to get coefficients for %s objectdo not know how to obtain constrained coefficientsdo not know how to obtain parameters of %s objecteffect %s not matchedeffects %s not matchedelements in 'object' must be formulas or "pdMat" objectsfewer observations than random effects in all level %s groupsfirst argument to 'groupedData' must be a two-sided formulafirst argument to 'nfGroupedData' must be a two-sided formulafirst argument to 'nmGroupedData' must be a two-sided formulafirst model has a different response from the restfitted objects with different fixed effects. REML comparisons are not meaningful.fixed parameter names in 'varIdent' must be a subset of group namesfixed parameters must have group namesfixed parameters must have group names in 'varExp'fixed parameters must have group names in 'varPower'fixed parameters must have names in 'varIdent'fixed-effects model must be a formula of the form "resp ~ pred"formula(object) must return a formulaformulae in 'fixed' must be of the form "parameter ~ expr"formulae in 'params' must be of the form "parameter ~ expr"formulae in 'random' must be of the form "parameter ~ expr"group name not matched in starting values for random effects: %sgroup names not matched in starting values for random effects: %sgroups levels mismatch in 'random' and starting values for 'random' at level %signoring 'group' in "varFixed" formulaignoring argument 'form'ignoring argument 'nam'incompatible formulas for groups in "random" and "correlation"incompatible formulas for groups in 'random' and 'correlation'incompatible lengths for 'random' and grouping factorsincompatible lengths for object namesindividual %s was not used in the fitinitial value for "corLin" parameters of wrong dimensioninitial value for "corNatural" parameters of wrong dimensioninitial value for "corSpatial" parameters of wrong dimensioninitial value for "corSpher" parameters of wrong dimensioninitial value for "corSymm" parameters of wrong dimensioninitial value for "reStruct" overwritten in 'lme.lmList'initial value for "varExp" should be of length %dinitial value for "varExp" should be of length 1initial value for "varIdent" should be of length %dinitial value for "varPower" should be of length %dinitial value for "varPower" should be of length 1initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)initial value for 'reStruct' overwritten in 'nlme.nlsList'initial value for parameter of wrong lengthinitial value in "corCompSymm" must be greater than %sinitial value of nugget ratio must be between 0 and 1initial value should be of length %dinitial values for "corNatural" do not define a positive-definite correlation structureinitial values for "corNatural" must be between -1 and 1initial values for "corSymm" do not define a positive-definite correlation structureinitial values for "corSymm" must be between -1 and 1initial values for 'varIdent' must be > 0initial values must have group names in 'varExp'initial values must have group names in 'varIdent'initial values must have group names in 'varPower'initializing "pdCompSymm" object is not positive definiteinvalid formula for groupslength of 'nam' not consistent with dimensions of initial valuelevel of %s does not match formula %slist with starting values for random effects must have names or be of length %dlog-likelihood not available with NULL fitsmaximum number of iterations (lmeControl(maxIter)) reached without convergencemaximum number of iterations (maxIter = %d) reached without convergencemaximum number of iterations reached without convergencemismatch between group names and fixed values namesmissing call attribute in "nlsList" objectmodel formula must be of the form "resp ~ pred"model must be a formula of the form "resp ~ pred"models with "corStruct" and/or "varFunc" objects not allowedmore than one degree of freedom is needed when one them is zero.moving average order must be a non-negative integermultiple levels not allowedmust give names when initializing "pdCompSymm" from parameter without a formulamust give names when initializing "pdIdent" from parameter without a formulamust give names when initializing from matrix or parametermust have formula when no names are givennames being assigned do not correspond to a permutation of previous namesnames mismatch in 'random' and starting values for 'random' at level %snames of 'value' are not consistent with 'nam' argumentnames of object and value must matchnames of starting value for "varIdent" object must contain all but one of the stratum levelsneed an object with call componentneed data to calculate covariateneed data to calculate covariate of "corStruct" objectnegative degrees of freedom not allowedno coefficients to fitno condensed linear modelno default method for extracting the square root of a "pdMat" objectno degrees of freedom for estimating std. dev.no degrees of freedom specifiedno effects allowed in right side of formulano fitted "lme" objectno initial values for model parametersno model variogram available with 'showModel = TRUE'nonexistent group in 'newdata'nonexistent group names for initial valuesnonexistent group names for initial values in "varExp"nonexistent group names for initial values in "varPower"nonexistent group names for initial values in 'varIdent'nonexistent group requested in 'subset'nonexistent groups requested in 'subset'nonexistent level %snonexistent levels %snot implemented for "nlme" objectsnot implemented for multiple levels of nestingnumber of columns in starting values for random component at level %s should be %dnumber of rows in starting values for random component at level %s should be %dobject formula must be of the form "resp ~ pred"object must inherit from class %sobjects must have a "call" component or attributeobjects must have coefficients with same row namesold-style self-starting model functions are no longer supported. New selfStart functions are available. Use SSfpl instead of fpl, SSfol instead of first.order.log, SSbiexp instead of biexp, SSlogis instead of logistic. If writing your own selfStart model, see "help(selfStart)" for the new form of the "initial" attribute.only one display level allowedonly one level allowed for predictionsonly one level allowed in 'gapply'only one level allowed in 'gsummary'only one level of grouping allowedonly residuals allowedonly residuals and random effects allowedonly single effects allowed in left side of 'form'only single level allowedparameter in "corCompSymm" structure must be < 1 in absolute valueparameter in AR(1) structure must be between -1 and 1parameter in CAR(1) structure must be between 0 and 1parameters in ARMA structure must be < 1 in absolute valueplot method only implemented for comparing modelsrange must be > 0 in "corSpher" initial valueright-hand side of first argument must be a conditional expressionsecond argument must be a groupedData objectsecond argument to 'groupedData' must inherit from data.framesome fitted objects deleted because response differs from the first modelstarting estimates must have names when 'params' is missingstarting values for random effects must include group levelsstarting values for random effects should be a list, or a matrixstarting values for the 'fixed' component are not the correct lengthstarting values for the random components should be a list of matricesstep halving factor reduced below minimum in NLS stepstep halving factor reduced below minimum in PNLS stepterm %s not matchedterms %s not matchedterms can only be integers or charactersterms must all have the same denominator DFundefined collapsing level %s for %sundefined display level %s for %sundefined group declared in 'subset'unique values of the covariate for "corSymm" objects must be a sequence of consecutive integersunique values of the covariate for "corNatural" objects must be a sequence of consecutive integerswrong group levelsx-y data to splom got botched somehowProject-Id-Version: nlme 3.1-65 Report-Msgid-Bugs-To: bugs@r-project.org PO-Revision-Date: 2014-03-30 08:37+0100 Last-Translator: Philippe Grosjean Language-Team: French Language: fr MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n > 1); X-Generator: Poedit 1.6.4 l'objet "corStruct" doit avoir un attribut "fixed"l'lment "pdMat" doit contenir une formuleles lments de "pdMat" doivent contenir des formules%s et %s doivent avoir les mmes niveaux de groupes%s peut avoir jusqu' deux composantes%s ne peut qu'tre une liste, ou un nombre%s ne peut avoir que les noms "const" et "power"%s ne peut avoir que les noms "const" et "prop"%s n'est pas un nom valide pour un effet%s n'est pas un objet correct pour "pdMat"%s doit avoir des noms de groupes dans 'varConstPower'%s doit avoir des noms de groupes dans 'varConstProp'%s non disponible pour le graphe%s non disponibles pour le graphe%s non trouv dans les donnes%s non trouv dans les donnes%s non assorti%s non assortisproblme %s, code d'erreur de convergence = %s message = %s%s sans "primary" ne peut tre utilis avec des ajustement d'objets "groupedData"'FUN' ne peut qu'tre une fonction ou une liste de fonctions'id' doit tre compris entre 0 et 1'L' doit avoir au moins %d colonne'L' doit avoir au moins %d colonnes'Terms' doivent tre compris entre 1 et %d'asTable' ne peut tre utilis qu'avec des objets 'groupedData' balancs'asTable' ne peut tre utilis avec des donnes groupements multiniveaux'data dans l'appel %s doit tre valu comme un data.frame'data' doit tre dans un objet "groupedData" si 'formula' n'inclus pas de groupes'data' doit tre un objet "groupedData" si l'argument 'groups' est manquant'data' doit tre fourni de manire explicite pour utiliser 'nls' afin d'obtenir les estimateurs initiaux'data' doit tre fourni explicitement pour utiliser 'nlsList''data' doit hriter de la classe "groupedData" si 'random' ne dfinit pas les groupes'distance' et 'object' ont des tailles incompatibles'fixed' doit tre une formule ou une liste de formules'form' et 'nam' ont des tailles incompatibles'form' et 'pdClass' ont des longueurs incompatiblesl'argument 'form' doit tre une formule'form' ne peut qu'tre une formule ou une liste de formules'form' ne peut tre qu'une formule, ou une liste de formules'form' doit tre une formule'form' doit tre une formule, lorsqu'il n'est pas NULL.'form' doit tre une liste'form' doit tre une formule un seul membre'formf doit tre une formule deux membres'form' doit avoir une covariable'form' doit avoir tous ses composantes sous forme de formules'form' non conforme avec 'nam''id' doit tre une formule ou une valeur numrique'id' doit tre compris entre 0 et 1'idLabels' ne peut tre qu'une formule ou un vecteur'idLabels' de longueur incorrecte'lme.lmList' va redfinir 'data''model' doit tre une formule'nam' et 'pdClass' ont des longueurs incompatibles'nam' doit tre une liste'nint' n'est pas consistant avec 'breaks''nlme.nlsList' va redfinir 'fixed', 'data', et 'start''object' n'a pas t initialis ; utilisez Initialize()'object' doit tre une formule'object' doit tre une liste ou une formule'object' doit tre une liste, lorsqu'il n'est pas manquant, pas une matrice ou un nombre'params' doit tre une formule ou une liste de formules'pdClass' doit tre un vecteur de chanes de caractres'preserve' doit tre une formule deux membres'random' doit tre une formule ou une liste de formulesl'tendue ('range') doit tre > 0 pour les valeurs initiales dans "corLin"l'tendue des valeurs initiales ('range') dans "corSpatial" doit tre > 0 'start' doit avoir une composante nomme 'fixed''subset' ne peut qu'tre une chane de caractres ou une valeur numrique'subset' ignor lors de l'utilisation d'un seul facteur pour le regroupement'subset' doit tre une liste'value' doit tre une formule un seul membre'value' doit tre une matrice carre'which' ne peut tre qu'une chane de caractres ou un entier'which' doit tre compris entre 1 et %d'L' ne peut que prendre en compte des effets fixes ayant mme degr de libert au dnominateurAucun des arguments ne spcifie plus d'un blocLa longueur des noms devrait tre %dtous les arguments de 'varComb' doivent tre de classe "varFunc".tous les lments dans l'argument doivent gnrer des objets "pdMat"tous les lments doivent avoir une taille non nulletous les lments doivent contenir des formules, si au moins l'un d'eux en contient unetous les lments doivent tre nomms, lorsqu'au moins un l'esttous les lments de la liste 'form' doivent tre des formules double membrestous les lments d'un objet "reStruct" doivent avoir une taille non nulletous les lments de type formule doivent tre des listes de formules deux membres ou des formules deux membrestous les objets ajusts doivent l'tre l'aide de la mme mthode d'estimationtous les objets ajusts doivent utiliser le mme nombre d'observationstoutes les variables utilises dans 'formula' doivent aussi se retrouver dans 'data'un objet de longueur %d ne correspond pas une factorisation de Choleskyun objet de longeur %d ne correspond pas la taille requise du paramtreles arguments impliquent des nombres diffrents de blocsil faut au moins deux coefficientsl'augmentation des effets alatoires n'est disponible que pour un seul niveaul'ordre autorgressif doit tre un entier positif ou nulun objet "varFunc" ne peut tre construit qu' partir d'un autre objet "varFunc", une formula ou une chane de caractresseuls les objets "lmList" peuvent tre ajusts avec une seule variable de groupeseuls les objets "nlsList" peuvent tre ajusts avec une seule variable de groupeimpossible d'accder la matrice d'un objet dont les noms ne sont pas dfinisimpossible d'accder la matrice d'objets non initialissimpossible de changer le nombre de colonnes d'un objet non initialis et sans nomsimpossible de calculer la log-vraissemblance REML pour les objets "gnls"Impossible de changer 'form'impossible de changer les coefficients avant initialisation ou lorsque tous les paramtres sont fixsimpossible de changer les dimensions d'un objet "pdMat" initialisimpossible de changer la longueur des paramtres dans un objet "pdMat" initialisimpossible de modifier la longueur du paramtre pour des objets "varComb" initialissla longueur du paramtre ne peut tre modifie dans les objets initialissimpossible de modifier la taille de 'object'impossible de changer la longueur de la covariable dans l'objet "varFunc"impossible de changer la longueur du paramtre "varExp" aprs l'initialisationimpossible de changer la longueur du paramtre "varIdent" aprs l'initialisationimpossible de changer la longueur du paramtre "varStruct" aprs l'initialisationimpossible de changer la longueur du paramtre aprs l'initialisationImpossible de changer la longueur des paramtres d'un objet "corAR1"impossible de changer la longueur des paramtres d'un objet "corARMA"Impossible de changer la longueur des paramtres d'un objet "corCAR1"impossible de changer la longueur des paramtres d'un objet "corCompSymm"impossible de changer la longueur des paramtres d'un objet "corNatural"impossible de changer la longueur des paramtres d'un objet "corStruct"impossible de changer la longueur des paramtres d'un objet "corSymm"impossible de changer le nombre de colonnes d'un objet initialisle paramtre ne peut tre modifi lorsque la longueur des paramtres est indfinieimpossible d'apparier avec seulement une variableimpossible d'valuer les groupes pour les niveaux dsirs de 'newdata'impossible d'extraire les groupes sans une formule dispositionimpossible d'extraire une matrice pour un objet non initialisimpossible d'extraire la matrice du modle sans une formule dispositionimpossible d'extraire les paramtres d'objets non initialissimpossible d'extraire les dimensionsimpossible d'extraire l'inverse d'un objet non initialisimpossible d'extraire le logarithme du dterminant d'un objet non initialisimpossible d'extraire la matrice d'un objet "pdCompSymm" non initialisimpossible d'extraire la matrice d'un objet "pdIdent" non initialisimpossible d'extraire la matrice d'un objet non initialisimpossible d'extraire la matrice en utilisant des dimensions non initialisesimpossible de fixer les variances de tous les groupesimpossible de calculer un intervalle de confiance sur les composantes var-cov : %simpossible d'obtenir l'inverse d'un objet non initialisles noms de colonnes dupliqus ne sont pas permis dans un objet "pdMat"distances nulles non autorises dans "corSpatial"impossible d'obtenir les coefficients de contrainte avec des dimensions non initialisesle facteur utilis pour le regroupement ne peut tre omis sans 'form'impossible d'utiliser une formule anonyme pour le modleimpossible d'utiliser un niveau plus petit pour le regroupement de "correlation" par rapport "random". Replacement du premier par le second.impossible d'utiliser un niveau plus petit pour le regroupement de 'correlation' par rapport 'random'. Replacement du premier par le second.le niveau de fusion ne peut tre plus petit que le niveau d'affichage ; il est fix au niveau d'affichagel'ajustement "gls" calcul est singulier, de rang %sla constante dans la structure "varConstPower" doit tre > Ola covariable doit tre un tableau de donnes (data.frame)la covariable doit tre numriquela covariable doit avoir un attribut 'level', lorsque 'id' est une formulela covariable doit avoir un attribut 'level', lorsque 'idLabels' est une formulela covariable doit avoir un attribut 'level', lorsque des groupes sont prsentsLa covariable doit avoir des valeurs uniques pour les intragroupes des objets "corAR1"la covariable doit avoir des valeurs uniques pour les intragroupes des objets "corARMA"la covariable doit avoir des valeurs uniques pour les intragroupes des objets "corCAR1"la cavariable doit avoir des valeurs uniques pour les intragroupes des objets 'corNatural'La covariable doit avoir des valeurs uniques l'intrieur des groupes pour les objets "corSymm"l'argument 'data' pour la mthode "data.frame" de 'getGroups' n'a pas de sensles donnes dans l'appel %s doivent tre values comme un tableau de donnes ("data frame")les degrs de libert et les pondrations doivent avoir la mme tailleles noms de dimensions ('dimnames') des valeurs doivent correspondre ou bien tre NULLIncapable de calculer la matrice de corrlation de l'objet %simpossible d'obtenir les coefficients de l'objet %simpossible d'obtenir les coefficients de contrainteincapable d'obtenir les paramtres de l'objet %seffet %s incohrenteffets %s incohrentles lments dans 'object' doivent tre des formules ou des objets "pdMat"moins d'observations qu'il n'y a d'effets alatoires dans les niveaux des groupes %sle premier argument 'groupedData' doit tre une formule deux membresle premier argument de 'nfGroupedData' doit tre une formule deux membresle premier argument de 'nmGroupedData' doit tre une formule deux membresle premier modle a une rponse diffrente du resteles objets ont t ajusts avec diffrents effets fixes. Les comparaisons REML n'ont aucun sens dans ce cas.les noms des paramtres fixs dans 'varIdent' doivent tre un sous-ensemble des noms de groupesles paramtres fixs doivent avoir des noms de groupesles paramtres fixes doivent avoir des noms de groupes dans 'varExp'les paramtres fixs doivent avoir des noms de groupes dans 'varPower'les paramtres fixs doivent avoir leurs noms dans 'varIdent'un modle effet fixe doit tre une formule de la forme "resp ~ pred"formula(object) doit renvoyer une formuleles formules dans 'fixed' doivent tre de la forme "paramtre ~ expression"les formules dans 'params' doivent tre de la forme "parameter ~ expr"les formules dans 'random' doivent tre de la forme "paramtre ~ expression"le nom de groupe ne correspond pas aux valeurs de dpart pour les effets alatoires : %sles noms des groupes ne correspondent pas aux valeurs de dpart pour les effets alatoires : %sniveaux de groupes incohrents dans 'random' et dans les valeurs de dpart pour 'random' au niveau %s'group' est ignor dans la formule "varFixed"L'argument 'form' est ignorL'argument 'nam' est ignorformules incompatibles entre les groupes dans "random" et "correlation"formules incompatibles entre les groupes dans 'random' et 'correlation'tailles incompatibles entre 'random' et les facteurs de regroupementlongueurs non compatibles pour les noms de l'objetl'individu %s n'a pas t utilis dans l'ajustementla valeur initiale pour les paramtres "corLin" n'ont pas la bonne tailleLa valeur initiale pour les paramtres "corNatural" n'a pas la bonne dimensionla valeur initiale pour les paramtres "corSpatial" n'ont pas la bonne taillela valeur initiale pour les paramtres "corSpher" sont de la mauvaise tailleLa valeur initiale pour les paramtres de "corSymm" n'ont pas les bonnes dimensionsla valeur initiale de "reStruct" est remplace dans 'lme.lmList'la valeur initiale pour "varExp" doit tre de longueur %dla valeur initiale pour "varExp" devrait tre de longueur 1la valeur initiale de "varIdent" doit tre de longueur %dla valeur initiale pour "varPower" devrait tre de longueur %dla valeur initiale pour "varPower" devrait tre de longueur 1la valeur initiale pour l'tendue ('range') est infrieure la distance minimale. Elle est fixe 1.1 * min(distance)la valeur initiale pour 'reStruct' est remplace dans 'nlme.nlsList'la valeur initiale du paramtre est de la mauvaise tailleLa valeur initiale dans "corCompSymm" doit tre plus grande que %sla valeur initiale du coefficient de ppite doit tre comprise entre 0 et 1la valeur initiale doit tre de longueur %dLes valeurs initiales pour "corNatural" ne sont pas dfinies sous forme d'une structure de corrlation positive-dfinieLes valeurs initiales pour "corNatural" doivent se situer entre -1 et 1les valeurs initiales pour "corSymm" ne dfinissent pas une structure de corrlation positive-dfinieLes valeurs initiales pour "corSymm" doivent se situer entre -1 et 1les valeurs initiales pour 'varIdent' doivent tre > 0les valeurs initiales doivent avoir des noms de groupes dans 'varExp'les valeurs initiales doivent avoir des noms de groupes dans 'varIdent'les valeurs initiales doivent avoir des noms de groupes dans 'varPower'l'initialisation d'un objet "pdCompSymm" n'est pas fini et positifformule incorrecte pour les groupesla longueur de 'nam' ne correspond pas aux dimensions initialesle niveau de %s ne correspond pas la formule %sla liste contenant les valeurs de dpart pour les effets alatoires doit tre nommes ou de longueur %dla log-vraissemblance n'est pas disponible avec des ajustements NULLle nombre maximum d'itrations (lmeControl(maxIter)) est atteint, mais pas la convergencele nombre maximum d'itrations (maxIter = %d) est atteint, mais pas la convergencele nombre maximum d'itrations est atteint, mais pas la convergenceincohrence entre les noms de groupes et les noms des valeurs fixesattribut d'appel manquant dans l'objet "nlsList"la formule du modle doit tre de la forme "rep ~ pred"le modle doit tre une formule de la forme "resp ~ pred"les modles avec objets "corStruct" et / ou "varFunc" ne sont pas autorissplus d'un degr de libert est ncessaire lorsque l'un d'entre eux vaut zro.l'ordre de la moyenne mobile doit tre un entier positif ou nulniveaux multiples non permisil faut fournir les noms lors de l'initialisation de "pdCompSymm" depuis un paramtre sans fournir de formuleil faut fournir les noms lorsqu'un objet "pdIdent" est initialis depuis un paramtre sans fournir de formulelors de l'initialisation depuis une matrice ou un paramtre, il faut fournir les nomsune formule est ncessaire lorsque les noms ne sont pas fournisles noms affect ne correspondent pas une permutation des noms de dpartincohrence de noms entre 'random' et les valeurs de dpart pour 'random' au niveau %sLes noms de 'value' ne sont pas conformes avec l'argument 'nam'les noms de l'objet et ses valeurs ne correspondent pasles noms des valeurs de dpart pour "varIdent" doivent contenir tous les niveaux stratifis sauf unncessite un objet avec une composante 'call'des donnes sont ncessaires pour calculer la covariabledes donnes sont ncessaires pour calculer les covariables d'un objet "corStruct"des degrs de libert ngatifs ne sont pas permispas de coefficients ajusteraucun modle linaire condenspas de mthode par dfaut pour extraire la racine carre de l'objet "pdMat"aucun nombre de degrs de libert pour l'estimation de l'cart typeaucun degr de libert n'est spcifiaucun effet n'est autoris dans le membre de droite de la formulepas d'objet "lme" ajustpas de valeurs initiales pour les paramtres du modleaucun variogramme n'est disponible pour le modle avec 'showModel = TRUE'groupe inexistant dans 'newdata'noms de groupes inexistants pour les valeurs initialesnoms de groupes inexistants pour les valeurs initiales de "varExp"noms de groupes inexistants pour les valeurs initiales de "varPower"noms de groupes inexistants pour les valeurs initiales dans 'varIdent'groupe inexistant mais requis dans 'subset'groupes inexistants demands dans 'subset'niveau inexistant %sniveaux inexistants %sPas implment pour des objets "nlme"Pas implment pour des niveaux multiples d'imbricationle nombre de colonnes dans les valeurs de dpart pour la composante alatoire au niveau %s doit tre %dle nombre de lignes dans les valeurs de dpart pour la composante alatoire au niveau %s doit tre %dl'objet formule doit tre de la forme "rep ~ pred"l'objet doit hriter de la classe %sles objets doivent avoir une composante ou un attribut "call"les objets doivent avoir des coefficients qui ont mmes noms de lignesles fonctions de modles 'self-start' d'un ancien style ne sont plus supportes. Les nouvelles fonctions selfStart sont disponibles. Utilisez SSfpl la place de fpl, SSfol la place de first.order.log, SSbiexp la place de biexp, SSlogis la place de logistic. Si vous crez votre propre fonction de modle selfStart, voyez "help(selfStart)" pour la nouvelle forme de l'attribut "initial".un seul niveau d'affichage est permisseul un niveau est permis pour les prdictionsseul un niveau est autoris pour 'gapply'seul un niveau est permis dans 'gsummary'seul un niveau de regroupement est autorisseuls les rsidus sont autorissseuls les rsidus et les effets alatoires sont permisseul un effet est permis dans le membre de gauche de 'form'seul un niveau est autorisles paramtres d'une structure "corCompSymm" doivent tre < 1 en valeur absolueLe paramtre dans la structure AR(1) doit se situer entre - 1 et 1Le paramtre dans la structure CAR(1) doit se situer entre -1 et 1les paramtres d'une structure ARMA doivent tre < 1 en valeur absoluela mthode 'plot' n'est implmente que pour la comparaison de modlesl'tendue des valeurs initiales dans "corSpher" doit tre > 0le membre de droite du premier argument doit tre une expression conditionnellele second argument doit tre un objet 'groupedData'le second argument de 'groupedData' doit hriter d'un data.framecertains objets ajusts sont limins parce que leur rponse diffre du premier modleles estimations initiales doivent tre nomms lorsque 'params' est manquantles valeurs de dpart pour les effets alatoires doivent inclure les niveaux de groupeles valeurs de dpart pour les effets alatoires doivent tre dans une liste ou dans une matriceles valeurs de dpart pour la composante 'fixed' n'ont pas la bonne tailleles valeurs de dpart pour les composantes alatoires devraient tre un liste de matricesle facteur de division par deux du pas est rduit en dessous du minimum dans un pas NLSle facteur de rduction chaque tape est abaiss en dessous du minimum une tape PNLSle terme %s est incohrentles termes %s sont incohrentsLes termes peuvent tre seulement des entiers ou des chanes de caractresLes termes doivent tous avoir le mme nombre de degrs de libert au dnominateurniveau de fusion non dfini %s pour %sniveau d'affichage non dfini %s pour %sgroupe non dclar dans 'subset'les valeurs uniques des covariables pour les objets "corSymm" doivent tre des squences d'entiers conscutifsles valeurs uniques pour la covariables des objets "corNatural" doivent tre une squence d'entiers conscutifsniveaux de groupes erronsles donnes x-y de 'splom' ont t corrompusnlme/inst/po/en@quot/0000755000176000001440000000000014251721456014252 5ustar ripleyusersnlme/inst/po/en@quot/LC_MESSAGES/0000755000176000001440000000000014632316272016036 5ustar ripleyusersnlme/inst/po/en@quot/LC_MESSAGES/nlme.mo0000644000176000001440000000353714632316272017336 0ustar ripleyusers 041!f370H7TE!9=8w/4!377k0HT/E!98&    All parameters must be less than 1 in absolute valueCoefficient matrix not invertibleFirst observation on an individual must have a doseHaven't written the compound symmetry case for this yetOverfitted model!Singularity in backsolve at level %ld, block %ldToo many parameters for finite-difference Hessian; npar = %d, nTot = %g.Unable to form Cholesky decomposition: the leading minor of order %d is not pos.def.Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]Unknown spatial correlation classanalytic gradient is not available with compound symmetryanalytic gradient is not available with matrix logarithmProject-Id-Version: nlme 3.1-165 Report-Msgid-Bugs-To: PO-Revision-Date: 2024-06-06 12:49+0200 Last-Translator: Automatically generated Language-Team: none Language: en MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); All parameters must be less than 1 in absolute valueCoefficient matrix not invertibleFirst observation on an individual must have a doseHaven't written the compound symmetry case for this yetOverfitted model!Singularity in backsolve at level %ld, block %ldToo many parameters for finite-difference Hessian; npar = %d, nTot = %g.Unable to form Cholesky decomposition: the leading minor of order %d is not pos.def.Unable to form eigenvalue-eigenvector decomposition [RS(.) ierr = %d]Unknown spatial correlation classanalytic gradient is not available with compound symmetryanalytic gradient is not available with matrix logarithmnlme/inst/po/en@quot/LC_MESSAGES/R-nlme.mo0000644000176000001440000012360314632316272017532 0ustar ripleyusersJl 0#$)#"M p*)$+)*U;)6H;3@ >75v;/J Ec E 0 O !1p!-!*!.!!*"2L"3""&""" #",#O#+l# #%##,#)$!H$j$-$$&$9$#(%L%$g%G%.%$&&(&.O&-~&1&,&) ',5'b'lz':'#"(F((f( (((;(> )=_)2)) )7)63*:j*&*6*/+63+=j+P+7+;1,1m,7,A,*-'D-$l->-3-c.;h.<.0.1/JD/7//Q/9.0<h0>050$19?1Gy1I1J 2>V2>2?2?3CT3B3A3?4<]4B4$465/952i5+515576FP6C6@6677S7"797H71187c8*8D8* 9.69oe9o9VE:':0::;<.;Bk;=;D;E1<Ew<H<E=HL=-=8==)><F>1>2>1>,?8G?=?;?=?=8@2v@Q@C@&?A2fA4A.A?A%=B:cB;B;BCOC&CD)D,AD>nD>D6D%#E%IE8oE<E<E:"F9]F8F1F0G33G3gG2GWG:&H+aH6H5H$HWI8wITI5J);J0eJ2J2J9J6K?QK%KOK+LN3LGL8L3M*7M/bM1M<M@N3BNvNONLN:/O)jOIOHO7'P$_P\P"P Q6%Q'\QQQDQ.Q)R+IRuR&R4RR*S62S8iS8S'S(T*,TTWT"TDT.U'CURkUOU0V!?V1aV2V+V VLW`X&X"X$X"XY)(Y2RYYBY5Y5Z:NZ1Z-ZBZ,,[=Y[/[I[;\<M\@\D\F]5W]6]H]( ^(6^+_^$^!^$^`^bX__%__0a#9a$]a)a"a a*a)bEb$cb/b.b;b)#cMc6kcHc7c #dHDd$dFd9d?3e3seReMeMHf8fWf9'g1ag2g6g%g6#h7Zhh*hh&h&i Bi/ci(i)i i0j"8j)[jj5jj.jI!k'kkk(kKk2'l(Zl*l2l1l5m4Im-~m0mmpm>jn'n#n,n$"oGobo;o>o=o28pkp p7p:p: q&Dq6kq/q:q= rPKr7r;r9s7JsAs*s/s$t>Dt3tct;u<Wu0u1uJu7BvzvQv9v<w>\w5w(w9wG4xI|xJx>y>Py?y?yCzBSzAz?z<{BU{${:{/{2(|+[|1||7|F}CV}@}6}7~"J~9m~L~1~7&*^D..o,wV'k0ā@F>=DÂEENHE݃L#-p8ׄ-<%1b21Dž,<&=c?AA#2eQG&26Y82Ɉ?%<>b??!W*'D,`>F̋:%N%t8<ӌ<:M9<1013b32ʎ[BY+6ȏ5$5WZ8T5@-v46ّ69GC%O+VNGѓ83R*/1<@P3ŕOL1:~)IP-?~$\"@ c6'D.Y+ԙ&8"K*n68К< +F,r*Tʛ"DB.'RޜO10!1ԝ2+9 eLӟ&&(@"i)6͠B5a5:͡1-:Bh,Aآ/IJ?<ԣ@HRF56HO((+$!;(]`bJ%]3f`'>h WH/Hd,DF?%O&@R+(P:C8Z<c>5J#$I)jb4XF]) =;! .A~BY<I.;V?7$& 2t*G9"k7#r0 z 61[KQ,sL:|go_4"{J}pSE*DaqU8uny-5 !  xANMwi%/lB9E2@e3T+ m\1 vCG 6=^'-0("corStruct" object must have a "fixed" attribute"pdMat" element must have a formula"pdMat" elements must have a formula%s and %s must have the same group levels%s can have at most two components%s can only be a list or numeric%s can only have names "const" and "power"%s can only have names "const" and "prop"%s is not a valid effect name%s is not a valid object for "pdMat"%s must have group names in 'varConstPower'%s must have group names in 'varConstProp'%s not available for plotting%s not available for plotting%s not found in data%s not found in data%s not matched%s not matched%s problem, convergence error code = %s message = %s%s without "primary" can only be used with fits of "groupedData" objects'FUN' can only be a function or a list of functions'Id' must be between 0 and 1'L' must have at most %d column'L' must have at most %d columns'Terms' must be between 1 and %d'asTable' can only be used with balanced 'groupedData' objects'asTable' cannot be used with multilevel grouped data'data' argument not used, but taken from groupedData object'data' in %s call must evaluate to a data frame'data' must be a "groupedData" object if 'formula' does not include groups'data' must be a "groupedData" object if 'groups' argument is missing'data' must be given explicitly to use 'nls' to get initial estimates'data' must be given explicitly to use 'nlsList''data' must inherit from "groupedData" class if 'random' does not define groups'distance' and 'object' have incompatible lengths'fixed' must be a formula or list of formulae'form' and 'nam' have incompatible lengths'form' and 'pdClass' have incompatible lengths'form' argument must be a formula'form' can only be a formula or a list of formulae'form' can only be a formula, or a list of formulas'form' must be a formula'form' must be a formula when not NULL'form' must be a list'form' must be a one-sided formula'form' must be a two-sided formula'form' must have a covariate'form' must have all components as formulas'form' not consistent with 'nam''id' can only be a formula or numeric'id' must be between 0 and 1'idLabels' can only be a formula or a vector'idLabels' of incorrect length'lme.lmList' will redefine 'data''model' must be a formula'nam' and 'pdClass' have incompatible lengths'nam' must be a list'nint' is not consistent with 'breaks''nlme.nlsList' will redefine 'fixed', 'data', and 'start''object' has not been Initialize()d'object' must be a formula'object' must be a list or a formula'object' must be a list when not missing, not a matrix, and not numeric'params' must be a formula or list of formulae'pdClass' must be a character vector'preserve' must be a two-sided formula'random' must be a formula or list of formulae'range' must be > 0 in "corLin" initial value'range' must be > 0 in "corSpatial" initial value'start' must have a component called 'fixed''subset' can only be character or integer'subset' ignored with single grouping factor'subset' must be a list'sumLenSq := sum(table(groups)^2)' = %g is too large. Too large or no groups in your correlation structure?'sumLenSq' = %g is too large (larger than maximal integer)'value' must be a one sided formula'value' must be a square matrix'which' can only be character or integer'which' must be between 1 and %dAIC undefined for REML fitDo increase 'msMaxIter'!Iteration %d, LME step: nlm() did not converge (code = %d).Iteration %d, LME step: nlminb() did not converge (code = %d).L may only involve fixed effects with the same denominator DFLNone of the arguments specify more than one blockLength of names should be %dPORT message:Within-group std. dev. must be a positive numeric valueall arguments to 'varComb' must be of class "varFunc".all elements in the argument must generate "pdMat" objectsall elements must have a non-zero sizeall elements must have formulas when any has a formulaall elements must have names when any has namesall elements of 'form' list must be two-sided formulasall elements of a "reStruct" object must have a non-zero sizeall elements of formula must be list of two-sided formulae or two-sided formulaeall fitted objects must have the same estimation methodall fitted objects must use the same number of observationsall variables used in 'formula' must be in 'data'an object of length %d does not match a Cholesky factoran object of length %d does not match the required parameter sizearguments imply different number of blocksat least one of 'p' and 'q' must be > 0at least two coefficients are neededaugmentation of random effects only available for single levelautoregressive order must be a non-negative integercan only construct "varFunc" object from another "varFunc" object, a formula, or a character stringcan only fit "lmList" objects with single grouping variablecan only fit "nlsList" objects with single grouping variablecannot access the matrix of object without namescannot access the matrix of uninitialized objectscannot access the number of columns of uninitialized objects without namescannot calculate REML log-likelihood for "gnls" objectscannot change 'form'cannot change coefficients before initialization or when all parameters are fixedcannot change dimensions on an initialized "pdMat" objectcannot change parameter length of initialized "pdMat" objectcannot change parameter length of initialized "varComb" objectcannot change parameter length of initialized objectscannot change the length of 'object'cannot change the length of covariate in "varFunc" objectcannot change the length of the "varExp" parameter after initializationcannot change the length of the "varIdent" parameter after initializationcannot change the length of the "varStruct" parameter after initializationcannot change the length of the parameter after initializationcannot change the length of the parameter of a "corAR1" objectcannot change the length of the parameter of a "corARMA" objectcannot change the length of the parameter of a "corCAR1" objectcannot change the length of the parameter of a "corCompSymm" objectcannot change the length of the parameter of a "corNatural" objectcannot change the length of the parameter of a "corStruct" objectcannot change the length of the parameter of a "corSymm" objectcannot change the number of columns on an initialized objectcannot change the parameter when length of parameters is undefinedcannot do pairs of just one variablecannot evaluate groups for desired levels on 'newdata'cannot extract groups formula without a formulacannot extract matrix from an uninitialized objectcannot extract model matrix without formulacannot extract parameters of uninitialized objectcannot extract the dimensionscannot extract the inverse from an uninitialized objectcannot extract the log of the determinant from an uninitialized objectcannot extract the matrix from an uninitialized "pdCompSymm" objectcannot extract the matrix from an uninitialized "pdIdent" objectcannot extract the matrix from an uninitialized objectcannot extract the matrix with uninitialized dimensionscannot fix variances in all groupscannot get confidence intervals on var-cov components: %scannot get confidence intervals on var-cov components: %s Consider '%s'cannot get the inverse of an uninitialized objectcannot have duplicated column names in a "pdMat" objectcannot have zero distances in "corSpatial"cannot obtain constrained coefficients with uninitialized dimensionscannot omit grouping factor without 'form'cannot use an anonymous function for the modelcannot use smaller level of grouping for "correlation" than for "random". Replacing the former with the latter.cannot use smaller level of grouping for 'correlation' than for 'random'. Replacing the former with the latter.collapsing level cannot be smaller than display level; setting it to the display levelcomputed "gls" fit is singular, rank %sconstant in "varConstProp" structure must be > 0covariate must be a data framecovariate must be numericcovariate must have a level attribute when 'id' is a formulacovariate must have a level attribute when 'idLabels' is a formulacovariate must have a level attribute when groups are presentcovariate must have unique values within groups for "corAR1" objectscovariate must have unique values within groups for "corARMA" objectscovariate must have unique values within groups for "corCAR1" objectscovariate must have unique values within groups for "corNatural" objectscovariate must have unique values within groups for "corSymm" objectsdata argument to "data.frame" method for 'getGroups' does not make sensedata in %s call must evaluate to a data framedegrees of freedom and weights must have the same lengthdeviance undefined for REML fitdimnames of 'value' must match or be NULLdo not know how to calculate correlation matrix of %s objectdo not know how to get coefficients for %s objectdo not know how to obtain constrained coefficientsdo not know how to obtain parameters of %s objecteffect %s not matchedeffects %s not matchedelements in 'object' must be formulas or "pdMat" objectsfewer observations than random effects in all level %s groupsfirst argument to 'groupedData' must be a two-sided formulafirst argument to 'nfGroupedData' must be a two-sided formulafirst argument to 'nmGroupedData' must be a two-sided formulafirst model has a different response from the restfitted objects with different fixed effects. REML comparisons are not meaningful.fixed parameter names in 'varIdent' must be a subset of group namesfixed parameters must have group namesfixed parameters must have group names in 'varExp'fixed parameters must have group names in 'varPower'fixed parameters must have names in 'varIdent'fixed-effects model must be a formula of the form "resp ~ pred"formula(object) must return a formulaformulae in 'fixed' must be of the form "parameter ~ expr"formulae in 'params' must be of the form "parameter ~ expr"formulae in 'random' must be of the form "parameter ~ expr"group name not matched in starting values for random effects: %sgroup names not matched in starting values for random effects: %sgroups levels mismatch in 'random' and starting values for 'random' at level %signoring 'group' in "varFixed" formulaignoring argument 'form'ignoring argument 'nam'ignoring initial values (no grouping factor)incompatible formulas for groups in "random" and "correlation"incompatible formulas for groups in 'random' and 'correlation'incompatible lengths for 'random' and grouping factorsincompatible lengths for object namesindividual %s was not used in the fitinitial value for "corLin" parameters of wrong dimensioninitial value for "corNatural" parameters of wrong dimensioninitial value for "corSpatial" parameters of wrong dimensioninitial value for "corSpher" parameters of wrong dimensioninitial value for "corSymm" parameters of wrong dimensioninitial value for "reStruct" overwritten in 'lme.lmList'initial value for "varExp" should be of length %dinitial value for "varExp" should be of length 1initial value for "varIdent" should be of length %dinitial value for "varPower" should be of length %dinitial value for "varPower" should be of length 1initial value for 'range' less than minimum distance. Setting it to 1.1 * min(distance)initial value for 'reStruct' overwritten in 'nlme.nlsList'initial value for parameter of wrong lengthinitial value in "corCompSymm" must be greater than %sinitial value of nugget ratio must be between 0 and 1initial value should be of length %dinitial values for "corNatural" do not define a positive-definite correlation structureinitial values for "corNatural" must be between -1 and 1initial values for "corSymm" do not define a positive-definite correlation structureinitial values for "corSymm" must be between -1 and 1initial values for 'varIdent' must be > 0initial values must have group names in 'varExp'initial values must have group names in 'varIdent'initial values must have group names in 'varPower'initializing "pdCompSymm" object is not positive definiteinvalid formula for groupslength of 'nam' not consistent with dimensions of initial valuelevel of %s does not match formula %slist with starting values for random effects must have names or be of length %dlog-likelihood not available with NULL fitsmaximum number of iterations (lmeControl(maxIter)) reached without convergencemaximum number of iterations (maxIter = %d) reached without convergencemaximum number of iterations reached without convergencemismatch between group names and fixed values namesmissing call attribute in "nlsList" objectmodel formula must be of the form "resp ~ pred"model must be a formula of the form "resp ~ pred"models with "corStruct" and/or "varFunc" objects not allowedmore than one degree of freedom is needed when one them is zero.moving average order must be a non-negative integermultiple levels not allowedmust give names when initializing "pdCompSymm" from parameter without a formulamust give names when initializing "pdIdent" from parameter without a formulamust give names when initializing from matrix or parametermust have formula when no names are givennames being assigned do not correspond to a permutation of previous namesnames mismatch in 'random' and starting values for 'random' at level %snames of 'value' are not consistent with 'nam' argumentnames of object and value must matchnames of starting value for "varIdent" object must contain all but one of the stratum levelsneed an object with call componentneed data to calculate covariateneed data to calculate covariate of "corStruct" objectnegative degrees of freedom not allowedno coefficients to fitno condensed linear modelno default method for extracting the square root of a "pdMat" objectno degrees of freedom for estimating std. dev.no degrees of freedom specifiedno effects allowed in right side of formulano fitted "lme" objectno initial values for model parametersno model variogram available with 'showModel = TRUE'nonexistent group in 'newdata'nonexistent group names for initial valuesnonexistent group names for initial values in "varExp"nonexistent group names for initial values in "varPower"nonexistent group names for initial values in 'varIdent'nonexistent group requested in 'subset'nonexistent groups requested in 'subset'nonexistent level %snonexistent levels %snot (yet) implemented. Contributions are welcome; use intervals() instead (for now)not implemented for "nlme" objectsnot implemented for correlation structures without a grouping factornot implemented for multiple levels of nestingnot implemented for uncorrelated errorsnumber of columns in starting values for random component at level %s should be %dnumber of rows in starting values for random component at level %s should be %dobject formula must be of the form "resp ~ pred"object must inherit from class %sobjects must have a "call" component or attributeobjects must have coefficients with same row namesobjects must inherit from classes %s, or %soffset() terms are not supportedold-style self-starting model functions are no longer supported. New selfStart functions are available. Use SSfpl instead of fpl, SSfol instead of first.order.log, SSbiexp instead of biexp, SSlogis instead of logistic. If writing your own selfStart model, see "help(selfStart)" for the new form of the "initial" attribute.only one display level allowedonly one level allowed for predictionsonly one level allowed in 'gapply'only one level allowed in 'gsummary'only one level of grouping allowedonly residuals allowedonly residuals and random effects allowedonly single effects allowed in left side of 'form'only single level allowedparameter in "corCompSymm" structure must be < 1 in absolute valueparameter in AR(1) structure must be between -1 and 1parameter in CAR(1) structure must be between 0 and 1parameters in ARMA structure must be < 1 in absolute valueplot method only implemented for comparing modelsrange must be > 0 in "corSpher" initial valueright-hand side of first argument must be a conditional expressionsecond argument must be a groupedData objectsecond argument to 'groupedData' must inherit from data.framesingle group not supported -- use groupedData()some fitted objects deleted because response differs from the first modelstarting estimates must have names when 'params' is missingstarting values for random effects must include group levelsstarting values for random effects should be a list, or a matrixstarting values for the 'fixed' component are not the correct lengthstarting values for the random components should be a list of matricesstep halving factor reduced below minimum in NLS stepstep halving factor reduced below minimum in PNLS stepsupplied %d starting value, need %dsupplied %d starting values, need %dterm %s not matchedterms %s not matchedterms can only be integers or charactersterms must all have the same denominator DFundefined collapsing level %s for %sundefined display level %s for %sundefined group declared in 'subset'unique values of the covariate for "corSymm" objects must be a sequence of consecutive integersunique values of the covariate for "corNatural" objects must be a sequence of consecutive integerswrong group levelsx-y data to splom got botched somehowProject-Id-Version: nlme 3.1-165 PO-Revision-Date: 2024-06-06 11:06 Last-Translator: Automatically generated Language-Team: none Language: en MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); "corStruct" object must have a "fixed" attribute"pdMat" element must have a formula"pdMat" elements must have a formula%s and %s must have the same group levels%s can have at most two components%s can only be a list or numeric%s can only have names "const" and "power"%s can only have names "const" and "prop"%s is not a valid effect name%s is not a valid object for "pdMat"%s must have group names in ‘varConstPower’%s must have group names in ‘varConstProp’%s not available for plotting%s not available for plotting%s not found in data%s not found in data%s not matched%s not matched%s problem, convergence error code = %s message = %s%s without "primary" can only be used with fits of "groupedData" objects‘FUN’ can only be a function or a list of functions‘Id’ must be between 0 and 1‘L’ must have at most %d column‘L’ must have at most %d columns‘Terms’ must be between 1 and %d‘asTable’ can only be used with balanced ‘groupedData’ objects‘asTable’ cannot be used with multilevel grouped data‘data’ argument not used, but taken from groupedData object‘data’ in %s call must evaluate to a data frame‘data’ must be a "groupedData" object if ‘formula’ does not include groups‘data’ must be a "groupedData" object if ‘groups’ argument is missing‘data’ must be given explicitly to use ‘nls’ to get initial estimates‘data’ must be given explicitly to use ‘nlsList’‘data’ must inherit from "groupedData" class if ‘random’ does not define groups‘distance’ and ‘object’ have incompatible lengths‘fixed’ must be a formula or list of formulae‘form’ and ‘nam’ have incompatible lengths‘form’ and ‘pdClass’ have incompatible lengths‘form’ argument must be a formula‘form’ can only be a formula or a list of formulae‘form’ can only be a formula, or a list of formulas‘form’ must be a formula‘form’ must be a formula when not NULL‘form’ must be a list‘form’ must be a one-sided formula‘form’ must be a two-sided formula‘form’ must have a covariate‘form’ must have all components as formulas‘form’ not consistent with ‘nam’‘id’ can only be a formula or numeric‘id’ must be between 0 and 1‘idLabels’ can only be a formula or a vector‘idLabels’ of incorrect length‘lme.lmList’ will redefine ‘data’‘model’ must be a formula‘nam’ and ‘pdClass’ have incompatible lengths‘nam’ must be a list‘nint’ is not consistent with ‘breaks’‘nlme.nlsList’ will redefine ‘fixed’, ‘data’, and ‘start’‘object’ has not been Initialize()d‘object’ must be a formula‘object’ must be a list or a formula‘object’ must be a list when not missing, not a matrix, and not numeric‘params’ must be a formula or list of formulae‘pdClass’ must be a character vector‘preserve’ must be a two-sided formula‘random’ must be a formula or list of formulae‘range’ must be > 0 in "corLin" initial value‘range’ must be > 0 in "corSpatial" initial value‘start’ must have a component called ‘fixed’‘subset’ can only be character or integer‘subset’ ignored with single grouping factor‘subset’ must be a list‘sumLenSq := sum(table(groups)^2)’ = %g is too large. Too large or no groups in your correlation structure?‘sumLenSq’ = %g is too large (larger than maximal integer)‘value’ must be a one sided formula‘value’ must be a square matrix‘which’ can only be character or integer‘which’ must be between 1 and %dAIC undefined for REML fitDo increase ‘msMaxIter’!Iteration %d, LME step: nlm() did not converge (code = %d).Iteration %d, LME step: nlminb() did not converge (code = %d).L may only involve fixed effects with the same denominator DFLNone of the arguments specify more than one blockLength of names should be %dPORT message:Within-group std. dev. must be a positive numeric valueall arguments to ‘varComb’ must be of class "varFunc".all elements in the argument must generate "pdMat" objectsall elements must have a non-zero sizeall elements must have formulas when any has a formulaall elements must have names when any has namesall elements of ‘form’ list must be two-sided formulasall elements of a "reStruct" object must have a non-zero sizeall elements of formula must be list of two-sided formulae or two-sided formulaeall fitted objects must have the same estimation methodall fitted objects must use the same number of observationsall variables used in ‘formula’ must be in ‘data’an object of length %d does not match a Cholesky factoran object of length %d does not match the required parameter sizearguments imply different number of blocksat least one of ‘p’ and ‘q’ must be > 0at least two coefficients are neededaugmentation of random effects only available for single levelautoregressive order must be a non-negative integercan only construct "varFunc" object from another "varFunc" object, a formula, or a character stringcan only fit "lmList" objects with single grouping variablecan only fit "nlsList" objects with single grouping variablecannot access the matrix of object without namescannot access the matrix of uninitialized objectscannot access the number of columns of uninitialized objects without namescannot calculate REML log-likelihood for "gnls" objectscannot change ‘form’cannot change coefficients before initialization or when all parameters are fixedcannot change dimensions on an initialized "pdMat" objectcannot change parameter length of initialized "pdMat" objectcannot change parameter length of initialized "varComb" objectcannot change parameter length of initialized objectscannot change the length of ‘object’cannot change the length of covariate in "varFunc" objectcannot change the length of the "varExp" parameter after initializationcannot change the length of the "varIdent" parameter after initializationcannot change the length of the "varStruct" parameter after initializationcannot change the length of the parameter after initializationcannot change the length of the parameter of a "corAR1" objectcannot change the length of the parameter of a "corARMA" objectcannot change the length of the parameter of a "corCAR1" objectcannot change the length of the parameter of a "corCompSymm" objectcannot change the length of the parameter of a "corNatural" objectcannot change the length of the parameter of a "corStruct" objectcannot change the length of the parameter of a "corSymm" objectcannot change the number of columns on an initialized objectcannot change the parameter when length of parameters is undefinedcannot do pairs of just one variablecannot evaluate groups for desired levels on ‘newdata’cannot extract groups formula without a formulacannot extract matrix from an uninitialized objectcannot extract model matrix without formulacannot extract parameters of uninitialized objectcannot extract the dimensionscannot extract the inverse from an uninitialized objectcannot extract the log of the determinant from an uninitialized objectcannot extract the matrix from an uninitialized "pdCompSymm" objectcannot extract the matrix from an uninitialized "pdIdent" objectcannot extract the matrix from an uninitialized objectcannot extract the matrix with uninitialized dimensionscannot fix variances in all groupscannot get confidence intervals on var-cov components: %scannot get confidence intervals on var-cov components: %s Consider ‘%s’cannot get the inverse of an uninitialized objectcannot have duplicated column names in a "pdMat" objectcannot have zero distances in "corSpatial"cannot obtain constrained coefficients with uninitialized dimensionscannot omit grouping factor without ‘form’cannot use an anonymous function for the modelcannot use smaller level of grouping for "correlation" than for "random". Replacing the former with the latter.cannot use smaller level of grouping for ‘correlation’ than for ‘random’. Replacing the former with the latter.collapsing level cannot be smaller than display level; setting it to the display levelcomputed "gls" fit is singular, rank %sconstant in "varConstProp" structure must be > 0covariate must be a data framecovariate must be numericcovariate must have a level attribute when ‘id’ is a formulacovariate must have a level attribute when ‘idLabels’ is a formulacovariate must have a level attribute when groups are presentcovariate must have unique values within groups for "corAR1" objectscovariate must have unique values within groups for "corARMA" objectscovariate must have unique values within groups for "corCAR1" objectscovariate must have unique values within groups for "corNatural" objectscovariate must have unique values within groups for "corSymm" objectsdata argument to "data.frame" method for ‘getGroups’ does not make sensedata in %s call must evaluate to a data framedegrees of freedom and weights must have the same lengthdeviance undefined for REML fitdimnames of ‘value’ must match or be NULLdo not know how to calculate correlation matrix of %s objectdo not know how to get coefficients for %s objectdo not know how to obtain constrained coefficientsdo not know how to obtain parameters of %s objecteffect %s not matchedeffects %s not matchedelements in ‘object’ must be formulas or "pdMat" objectsfewer observations than random effects in all level %s groupsfirst argument to ‘groupedData’ must be a two-sided formulafirst argument to ‘nfGroupedData’ must be a two-sided formulafirst argument to ‘nmGroupedData’ must be a two-sided formulafirst model has a different response from the restfitted objects with different fixed effects. REML comparisons are not meaningful.fixed parameter names in ‘varIdent’ must be a subset of group namesfixed parameters must have group namesfixed parameters must have group names in ‘varExp’fixed parameters must have group names in ‘varPower’fixed parameters must have names in ‘varIdent’fixed-effects model must be a formula of the form "resp ~ pred"formula(object) must return a formulaformulae in ‘fixed’ must be of the form "parameter ~ expr"formulae in ‘params’ must be of the form "parameter ~ expr"formulae in ‘random’ must be of the form "parameter ~ expr"group name not matched in starting values for random effects: %sgroup names not matched in starting values for random effects: %sgroups levels mismatch in ‘random’ and starting values for ‘random’ at level %signoring ‘group’ in "varFixed" formulaignoring argument ‘form’ignoring argument ‘nam’ignoring initial values (no grouping factor)incompatible formulas for groups in "random" and "correlation"incompatible formulas for groups in ‘random’ and ‘correlation’incompatible lengths for ‘random’ and grouping factorsincompatible lengths for object namesindividual %s was not used in the fitinitial value for "corLin" parameters of wrong dimensioninitial value for "corNatural" parameters of wrong dimensioninitial value for "corSpatial" parameters of wrong dimensioninitial value for "corSpher" parameters of wrong dimensioninitial value for "corSymm" parameters of wrong dimensioninitial value for "reStruct" overwritten in ‘lme.lmList’initial value for "varExp" should be of length %dinitial value for "varExp" should be of length 1initial value for "varIdent" should be of length %dinitial value for "varPower" should be of length %dinitial value for "varPower" should be of length 1initial value for ‘range’ less than minimum distance. Setting it to 1.1 * min(distance)initial value for ‘reStruct’ overwritten in ‘nlme.nlsList’initial value for parameter of wrong lengthinitial value in "corCompSymm" must be greater than %sinitial value of nugget ratio must be between 0 and 1initial value should be of length %dinitial values for "corNatural" do not define a positive-definite correlation structureinitial values for "corNatural" must be between -1 and 1initial values for "corSymm" do not define a positive-definite correlation structureinitial values for "corSymm" must be between -1 and 1initial values for ‘varIdent’ must be > 0initial values must have group names in ‘varExp’initial values must have group names in ‘varIdent’initial values must have group names in ‘varPower’initializing "pdCompSymm" object is not positive definiteinvalid formula for groupslength of ‘nam’ not consistent with dimensions of initial valuelevel of %s does not match formula %slist with starting values for random effects must have names or be of length %dlog-likelihood not available with NULL fitsmaximum number of iterations (lmeControl(maxIter)) reached without convergencemaximum number of iterations (maxIter = %d) reached without convergencemaximum number of iterations reached without convergencemismatch between group names and fixed values namesmissing call attribute in "nlsList" objectmodel formula must be of the form "resp ~ pred"model must be a formula of the form "resp ~ pred"models with "corStruct" and/or "varFunc" objects not allowedmore than one degree of freedom is needed when one them is zero.moving average order must be a non-negative integermultiple levels not allowedmust give names when initializing "pdCompSymm" from parameter without a formulamust give names when initializing "pdIdent" from parameter without a formulamust give names when initializing from matrix or parametermust have formula when no names are givennames being assigned do not correspond to a permutation of previous namesnames mismatch in ‘random’ and starting values for ‘random’ at level %snames of ‘value’ are not consistent with ‘nam’ argumentnames of object and value must matchnames of starting value for "varIdent" object must contain all but one of the stratum levelsneed an object with call componentneed data to calculate covariateneed data to calculate covariate of "corStruct" objectnegative degrees of freedom not allowedno coefficients to fitno condensed linear modelno default method for extracting the square root of a "pdMat" objectno degrees of freedom for estimating std. dev.no degrees of freedom specifiedno effects allowed in right side of formulano fitted "lme" objectno initial values for model parametersno model variogram available with ‘showModel = TRUE’nonexistent group in ‘newdata’nonexistent group names for initial valuesnonexistent group names for initial values in "varExp"nonexistent group names for initial values in "varPower"nonexistent group names for initial values in ‘varIdent’nonexistent group requested in ‘subset’nonexistent groups requested in ‘subset’nonexistent level %snonexistent levels %snot (yet) implemented. Contributions are welcome; use intervals() instead (for now)not implemented for "nlme" objectsnot implemented for correlation structures without a grouping factornot implemented for multiple levels of nestingnot implemented for uncorrelated errorsnumber of columns in starting values for random component at level %s should be %dnumber of rows in starting values for random component at level %s should be %dobject formula must be of the form "resp ~ pred"object must inherit from class %sobjects must have a "call" component or attributeobjects must have coefficients with same row namesobjects must inherit from classes %s, or %soffset() terms are not supportedold-style self-starting model functions are no longer supported. New selfStart functions are available. Use SSfpl instead of fpl, SSfol instead of first.order.log, SSbiexp instead of biexp, SSlogis instead of logistic. If writing your own selfStart model, see "help(selfStart)" for the new form of the "initial" attribute.only one display level allowedonly one level allowed for predictionsonly one level allowed in ‘gapply’only one level allowed in ‘gsummary’only one level of grouping allowedonly residuals allowedonly residuals and random effects allowedonly single effects allowed in left side of ‘form’only single level allowedparameter in "corCompSymm" structure must be < 1 in absolute valueparameter in AR(1) structure must be between -1 and 1parameter in CAR(1) structure must be between 0 and 1parameters in ARMA structure must be < 1 in absolute valueplot method only implemented for comparing modelsrange must be > 0 in "corSpher" initial valueright-hand side of first argument must be a conditional expressionsecond argument must be a groupedData objectsecond argument to ‘groupedData’ must inherit from data.framesingle group not supported -- use groupedData()some fitted objects deleted because response differs from the first modelstarting estimates must have names when ‘params’ is missingstarting values for random effects must include group levelsstarting values for random effects should be a list, or a matrixstarting values for the ‘fixed’ component are not the correct lengthstarting values for the random components should be a list of matricesstep halving factor reduced below minimum in NLS stepstep halving factor reduced below minimum in PNLS stepsupplied %d starting value, need %dsupplied %d starting values, need %dterm %s not matchedterms %s not matchedterms can only be integers or charactersterms must all have the same denominator DFundefined collapsing level %s for %sundefined display level %s for %sundefined group declared in ‘subset’unique values of the covariate for "corSymm" objects must be a sequence of consecutive integersunique values of the covariate for "corNatural" objects must be a sequence of consecutive integerswrong group levelsx-y data to splom got botched somehownlme/inst/po/ko/0000755000176000001440000000000014251721456013250 5ustar ripleyusersnlme/inst/po/ko/LC_MESSAGES/0000755000176000001440000000000014531445451015034 5ustar ripleyusersnlme/inst/po/ko/LC_MESSAGES/nlme.mo0000644000176000001440000000265414531445451016333 0ustar ripleyusers\ 4!3 7T!98!M,CDV5KJaAll parameters must be less than 1 in absolute valueCoefficient matrix not invertibleFirst observation on an individual must have a doseHaven't written the compound symmetry case for this yetUnknown spatial correlation classanalytic gradient is not available with compound symmetryanalytic gradient is not available with matrix logarithmProject-Id-Version: nlme 3.1-105 Report-Msgid-Bugs-To: PO-Revision-Date: 2013-08-16 18:27-0600 Last-Translator: Chel Hee Lee Language-Team: R Development Translation Teams (Korean) Language: ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; X-Poedit-SourceCharset: utf-8 X-Generator: Poedit 1.5.4 모든 파라미터들의 절대값이 반드시 1 보다 작아야 합니다가역적이지 않은 계수행렬입니다개인의 첫번째 관측값은 반드시 dose 이어야 합니다이것에 대하여 compound symmetry의 경우는 아직 작성되지 않았습니다알 수 없는 spatial correlation 클래스입니다analytic gradient는 compound symmetry와 함께 사용할 수 없습니다analytic gradient는 matrix logarithm과 함께 사용할 수 없습니다nlme/inst/po/ko/LC_MESSAGES/R-nlme.mo0000644000176000001440000001122314531445451016522 0ustar ripleyusers#4/L0 ):)d #-Q$l 79>Q>CBAV?<146f58 6-d{"OF D 0 6 :C /~ 0 6 / ,F 0s : 2 : QM $ I KGZLKJ;H<P O]FKG@3S &1:X# !"   "corStruct" object must have a "fixed" attribute%s and %s must have the same group levels%s not found in data%s not found in data'Id' must be between 0 and 1'Terms' must be between 1 and %d'form' must be a formula'form' must be a list'id' must be between 0 and 1'nam' must be a list'object' has not been Initialize()d'object' must be a formula'pdClass' must be a character vector'subset' must be a list'which' must be between 1 and %dall fitted objects must have the same estimation methodcannot change 'form'cannot change dimensions on an initialized "pdMat" objectcannot change the length of the parameter after initializationcannot change the length of the parameter of a "corAR1" objectcannot change the length of the parameter of a "corCompSymm" objectcannot change the length of the parameter of a "corNatural" objectcannot change the length of the parameter of a "corStruct" objectcannot change the length of the parameter of a "corSymm" objectcovariate must be a data framedo not know how to calculate correlation matrix of %s objectdo not know how to obtain parameters of %s objectinitial value in "corCompSymm" must be greater than %sinitial value of nugget ratio must be between 0 and 1maximum number of iterations reached without convergenceneed data to calculate covariateneed data to calculate covariate of "corStruct" objectno coefficients to fitno fitted "lme" objectnot implemented for "nlme" objectsProject-Id-Version: nlme 3.1-105 PO-Revision-Date: 2013-08-16 18:52-0600 Last-Translator: Chel Hee Lee Language-Team: R Development Translation Teams (Korean) Language: ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; X-Poedit-SourceCharset: utf-8 X-Generator: Poedit 1.5.4 "corStruct" 객체는 반드시 "fixed" 속성을 가지고 있어야 합니다%s와 %s은 반드시 같은 그룹 수준들을 가져야 합니다데이터로부터 %s를 찾을 수 없습니다'Id'는 반드시 0과 1 사이에 있어야 합니다'Terms'는 반드시 1과 %d 사이에 있어야 합니다'form'은 반드시 formula 이어야 합니다'form'은 반드시 리스트이어야 합니다'id'는 반드시 0과 1 사이에 있어야 합니다'nam'은 반드시 리스트이어야 합니다'object'가 초기화 되지 않았습니다'object'는 반드시 formula이어야 합니다'pdClass'는 반드시 문자형 벡터이어야 합니다'subset'은 반드시 리스트이어야 합니다'which'는 반드시 1과 %d 사이에 있어야 합니다모든 객체들이 같은 추정방법을 이용하여 적합되어야 합니다'form'를 변경할 수 없습니다초기화된 "pdMat" 객체의 차원정보를 변경할 수 없습니다초기화 이후에는 파라미터의 길이를 변경할 수 없습니다"corAR1" 객체의 파라미터의 길이를 변경할 수 없습니다"corCompSymm" 객체의 파라미터의 길이를 변경할 수 없습니다"corNatural" 객체의 파라미터의 길이를 변경할 수 없습니다"corStruct" 객체의 파라미터의 길이를 변경할 수 없습니다"corSymm" 객체의 파라미터의 길이를 변경할 수 없습니다공변량은 반드시 데이터프레임이어야 합니다%s 객체의 상관행렬을 어떻게 계산해야 할 지 알 수 없습니다%s 객체의 파라미터들을 어떻게 얻어야 할지 알 수 없습니다"corCompSymm" 내의 초기값은 반드시 %s 보다 커야 합니다nugget ratio의 초기값은 반드시 0과 1 사이에 있어야 합니다수렴하지 않고 지정된 최대 반복수에 도달하였습니다공변량을 계산할 데이터가 필요합니다"corStruct" 객체의 공변량을 계산하기 위한 데이터가 필요합니다적합할 계수가 없습니다적합된 "lme" 객체가 없습니다"nlme" 객체들에 대하여 구현되지 않았습니다nlme/inst/mlbook/0000755000176000001440000000000014251721456013504 5ustar ripleyusersnlme/inst/mlbook/README0000644000176000001440000000031714251721456014365 0ustar ripleyusersThe scripts in this directory reproduce some of the examples from the book Snijders, Tom and Bosker, Roel (1999), Multilevel Analysis: An Introduction to Basic and Advanced Multilevel Modeling, Sage. nlme/inst/mlbook/ch05.R0000644000176000001440000000100414251721456014361 0ustar ripleyuserslibrary(nlme) # data(bdf) ## Model with random slope for IQ.ver.cen ## Compare with Table 5.1, p. 71. fm5 <- lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, data = bdf, random = ~ IQ.ver.cen, method = "ML") summary(fm5) VarCorr(fm5) -2 * c(logLik(fm5)) # deviance ## Add centered class size and interaction ## Compare with Table 5.2, p. 75 fm6 <- update(fm5, langPOST ~ avg.IQ.ver.cen + IQ.ver.cen * grpSiz.cen) summary(fm6) VarCorr(fm6) -2 * c(logLik(fm6)) # deviance nlme/inst/mlbook/ch04.R0000644000176000001440000000163014251721456014365 0ustar ripleyuserslibrary(nlme) # data(bdf) ## Fit the null model ## Compare with Table 4.1, p. 47 fm1 <- lme(langPOST ~ 1, data = bdf, random = ~ 1 | schoolNR) VarCorr(fm1) -2*c(logLik(fm1)) # deviance ## Fit model with fixed IQ term and random intercept ## Compare with Table 4.2, p. 49 ## From the results in Tables 4.2 and 4.4, it appears that ## maximum likelihood fits are used, not REML fits. fm2 <- update(fm1, langPOST ~ IQ.ver.cen) summary(fm2) VarCorr(fm2) -2 * c(logLik(fm2)) # deviance ## Purely fixed-effects model for comparison ## Compare with Table 4.3, p. 51 fm3 <- lm(langPOST ~ IQ.ver.cen, data = bdf) summary(fm3) -2 * c(logLik(fm3)) # deviance ## Model with average IQ for the school ## Compare with Table 4.4, p. 55 fm4 <- update(fm2, langPOST ~ IQ.ver.cen + avg.IQ.ver.cen) summary(fm4) VarCorr(fm4) -2 * c(logLik(fm4)) # deviance nlme/inst/scripts/0000755000176000001440000000000014271005035013676 5ustar ripleyusersnlme/inst/scripts/ch03.R0000644000176000001440000000747114251721456014601 0ustar ripleyusers#-*- R -*- # initialization library(nlme) options(width = 65, digits = 5) options(contrasts = c(unordered = "contr.helmert", ordered = "contr.poly")) pdf(file = 'ch03.pdf') # Chapter 3 Describing the Structure of Grouped Data # 3.1 The Display Formula and Its Components formula( Rail ) formula( ergoStool ) formula( Machines ) formula( Orthodont ) formula( Pixel ) formula( Oats ) table( Oxboys$Subject ) table( getGroups( Oxboys ) ) unique( table( getGroups( Oxboys ) ) ) # a more concise result unique( table( getCovariate( Oxboys ), getGroups( Oxboys ) ) ) length( unique( getCovariate( Oxboys ) ) ) unique( getGroups(Pixel, level = 1) ) unique( getGroups(Pixel, level = 2) ) Pixel.groups <- getGroups( Pixel, level = 1:2 ) class( Pixel.groups ) names( Pixel.groups ) unique( Pixel.groups[["Side"]] ) formula( PBG ) PBG.log <- update( PBG, formula = deltaBP ~ log(dose) | Rabbit ) formula(PBG.log) unique( getCovariate(PBG.log) ) unique( getCovariate(PBG) ) # 3.2 Constructing groupedData Objects # The next line is not from the book. # It is added to ensure that the file is available write.table( Oxboys, "oxboys.dat" ) Oxboys.frm <- read.table( "oxboys.dat", header = TRUE ) class( Oxboys.frm ) # check the class of the result dim( Oxboys.frm ) # check the dimensions Oxboys <- groupedData( height ~ age | Subject, data = read.table("oxboys.dat", header = TRUE), labels = list(x = "Centered age", y = "Height"), units = list(y = "(cm)") ) Oxboys # display the object unique( getGroups( Oxboys ) ) plot( BodyWeight, outer = ~ Diet, aspect = 3 ) # Figure 3.3 plot( BodyWeight, outer = TRUE, aspect = 3 ) plot( Soybean, outer = ~ Year * Variety ) # Figure 6.10 plot( Soybean, outer = ~ Variety * Year ) gsummary( BodyWeight, invar = TRUE ) plot( PBG, inner = ~ Treatment, scales = list(x = list(log = 2))) ergoStool.mat <- asTable( ergoStool ) ergoStool.mat ergoStool.new <- balancedGrouped( effort ~ Type | Subject, data = ergoStool.mat ) ergoStool.new # 3.3 Controlling Trellis Graphics Presentations of Grouped Data plot(CO2, layout=c(6,2), between=list(x=c(0,0,0.5,0,0))) plot( Spruce, layout = c(7, 4, 3), skip = c(rep(FALSE, 27), TRUE, rep(FALSE, 27), TRUE, rep(FALSE, 12), rep(TRUE, 2), rep(FALSE,13)) ) plot( Spruce, layout = c(9, 3, 3), skip = c(rep(FALSE, 66), TRUE, TRUE, rep(FALSE, 13)) ) unique( getCovariate(DNase) ) log( unique(getCovariate(DNase)), 2 ) plot( DNase, layout=c(6,2), scales = list(x=list(log=2)) ) plot(Pixel, layout = c(4,5), between = list(x = c(0, 0.5, 0), y = 0.5)) plot( Pixel, displayLevel = 1 ) plot( Wafer, display = 1, collapse = 1 ) plot( Wafer, display = 1, collapse = 1, FUN = function(x) sqrt(var(x)), layout = c(10,1) ) # 3.4 Summaries sapply( ergoStool, data.class ) gsummary( Theoph, inv = TRUE ) gsummary( Theoph, omit = TRUE, inv = TRUE ) is.null(gsummary(Theoph, inv = TRUE, omit = TRUE)) # invariants present is.null(gsummary(Oxboys, inv = TRUE, omit = TRUE)) # no invariants gsummary( Theoph ) gsummary( Theoph, FUN = max, omit = TRUE ) Quin.sum <- gsummary( Quinidine, omit = TRUE, FUN = mean ) dim( Quin.sum ) Quin.sum[1:10, ] Quinidine[Quinidine[["Subject"]] == 3, 1:8] Quin.sum1 <- gsummary( Quinidine, omit = TRUE ) Quin.sum1[1:10, 1:7] summary( Quin.sum1 ) summary( Quinidine ) sum( ifelse(is.na(Quinidine[["conc"]]), 0, 1) ) sum( !is.na(Quinidine[["conc"]]) ) sum( !is.na(Quinidine[["dose"]]) ) gapply( Quinidine, "conc", function(x) sum(!is.na(x)) ) table( gapply(Quinidine, "conc", function(x) sum(!is.na(x))) ) changeRecords <- gapply( Quinidine, FUN = function(frm) any(is.na(frm[["conc"]]) & is.na(frm[["dose"]])) ) changeRecords sort( as.numeric( names(changeRecords)[changeRecords] ) ) Quinidine[29:31,] Quinidine[Quinidine[["Subject"]] == 4, ] # cleanup summary(warnings()) nlme/inst/scripts/ch02.R0000644000176000001440000000455714251721456014602 0ustar ripleyusers#-*- R -*- library( nlme ) options( width = 65, digits = 5 ) options( contrasts = c(unordered = "contr.helmert", ordered = "contr.poly") ) pdf( file = 'ch02.pdf' ) # Chapter 2 Theory and Computational Methods for Linear Mixed-Effects Models # 2.2 Likelihood Estimation for LME Models Xmat <- matrix( c(1, 1, 1, 1, 8, 10, 12, 14), ncol = 2 ) Xmat Xqr <- qr( Xmat ) # creates a QR structure qr.R( Xqr ) # returns R qr.Q( Xqr ) # returns Q-truncated qr.Q( Xqr, complete = TRUE ) # returns the full Q fm1Rail.lme <- lme( travel ~ 1, data = Rail, random = ~ 1 | Rail, control = list( msVerbose = TRUE ) ) fm1Rail.lme <- lme( travel ~ 1, data = Rail, random = ~ 1 | Rail, control = list( msVerbose = TRUE, niterEM = 0 )) fm1Machine <- lme( score ~ Machine, data = Machines, random = ~ 1 | Worker ) fm2Machine <- update( fm1Machine, random = ~ 1 | Worker/Machine ) anova( fm1Machine, fm2Machine ) OrthoFem <- Orthodont[ Orthodont$Sex == "Female", ] fm1OrthF <- lme( distance ~ age, data = OrthoFem, random = ~ 1 | Subject ) fm2OrthF <- update( fm1OrthF, random = ~ age | Subject ) orthLRTsim <- simulate.lme( fm1OrthF, m2 = fm2OrthF, nsim = 1000 ) plot( orthLRTsim, df = c(1, 2) ) # produces Figure 2.3 machineLRTsim <- simulate.lme(fm1Machine, m2 = fm2Machine, nsim= 1000) plot( machineLRTsim, df = c(0, 1), # produces Figure 2.4 layout = c(4,1), between = list(x = c(0, 0.5, 0)) ) stoolLRTsim <- simulate.lme( list(fixed = effort ~ 1, data = ergoStool, random = ~ 1 | Subject), m2 = list(fixed = effort ~ Type), method = "ML", nsim = 1000 ) plot( stoolLRTsim, df = c(3, 4) ) # Figure 2.5 data( PBIB, package = 'SASmixed' ) pbibLRTsim <- simulate.lme(list( fixed = response ~ 1, data = PBIB, random = ~ 1 | Block ), m2 = list(fixed = response ~ Treatment, data = PBIB, random = ~ 1 | Block), method = "ML", nsim = 1000 ) plot( pbibLRTsim, df = c(14,16,18), weights = FALSE ) # Figure 2.6 summary( fm2Machine ) fm1PBIB <- lme(response ~ Treatment, data = PBIB, random = ~ 1 | Block) anova( fm1PBIB ) fm2PBIB <- update( fm1PBIB, method = "ML" ) fm3PBIB <- update( fm2PBIB, response ~ 1 ) anova( fm2PBIB, fm3PBIB ) anova( fm2Machine ) # cleanup summary(warnings()) nlme/inst/scripts/ch06.R0000644000176000001440000001012714251721456014574 0ustar ripleyusers#-*- 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 = "ch06.pdf") # Chapter 6 Nonlinear Mixed-Effects Models: # Basic Concepts and Motivating Examples # 6.2 Indomethicin Kinetics plot(Indometh) fm1Indom.nls <- nls(conc ~ SSbiexp(time, A1, lrc1, A2, lrc2), data = Indometh) summary(fm1Indom.nls) plot(fm1Indom.nls, Subject ~ resid(.), abline = 0) (fm1Indom.lis <- nlsList(conc ~ SSbiexp(time, A1, lrc1, A2, lrc2), data = Indometh)) plot(intervals(fm1Indom.lis)) ## IGNORE_RDIFF_BEGIN (fm1Indom.nlme <- nlme(fm1Indom.lis, random = pdDiag(A1 + lrc1 + A2 + lrc2 ~ 1), control = list(tolerance = 0.0001))) ## IGNORE_RDIFF_END fm2Indom.nlme <- update(fm1Indom.nlme, random = pdDiag(A1 + lrc1 + A2 ~ 1)) anova(fm1Indom.nlme, fm2Indom.nlme) (fm3Indom.nlme <- update(fm2Indom.nlme, random = A1+lrc1+A2 ~ 1)) fm4Indom.nlme <- update(fm3Indom.nlme, random = pdBlocked(list(A1 + lrc1 ~ 1, A2 ~ 1))) ## IGNORE_RDIFF_BEGIN anova(fm3Indom.nlme, fm4Indom.nlme) ## IGNORE_RDIFF_END anova(fm2Indom.nlme, fm4Indom.nlme) plot(fm4Indom.nlme, id = 0.05, adj = -1) qqnorm(fm4Indom.nlme) plot(augPred(fm4Indom.nlme, level = 0:1)) summary(fm4Indom.nlme) # 6.3 Growth of Soybean Plants head(Soybean) plot(Soybean, outer = ~ Year * Variety) (fm1Soy.lis <- nlsList(weight ~ SSlogis(Time, Asym, xmid, scal), data = Soybean, ## in R >= 3.4.3, more iterations are needed for "1989P5" ## due to a change of initial values in SSlogis(); ## control is passed to getInitial() only since R 4.1.0 control = list(maxiter = 60))) ## IGNORE_RDIFF_BEGIN (fm1Soy.nlme <- nlme(fm1Soy.lis)) ## IGNORE_RDIFF_END fm2Soy.nlme <- update(fm1Soy.nlme, weights = varPower()) anova(fm1Soy.nlme, fm2Soy.nlme) plot(ranef(fm2Soy.nlme, augFrame = TRUE), form = ~ Year * Variety, layout = c(3,1)) soyFix <- fixef(fm2Soy.nlme) options(contrasts = c("contr.treatment", "contr.poly")) ## IGNORE_RDIFF_BEGIN (fm3Soy.nlme <- update(fm2Soy.nlme, fixed = Asym + xmid + scal ~ Year, start = c(soyFix[1], 0, 0, soyFix[2], 0, 0, soyFix[3], 0, 0))) ## IGNORE_RDIFF_END anova(fm3Soy.nlme) # The following line is not in the book but needed to fit the model fm4Soy.nlme <- nlme(weight ~ SSlogis(Time, Asym, xmid, scal), data = Soybean, fixed = list(Asym ~ Year*Variety, xmid ~ Year + Variety, scal ~ Year), random = Asym ~ 1, start = c(17, 0, 0, 0, 0, 0, 52, 0, 0, 0, 7.5, 0, 0), weights = varPower(0.95), control = list(verbose = TRUE)) # FIXME: An update doesn't work for the fixed argument when fixed is a list ## p. 293-4 : summary(fm4Soy.nlme) plot(augPred(fm4Soy.nlme))# Fig 6.14, p. 295 # 6.4 Clinical Study of Phenobarbital Kinetics (fm1Pheno.nlme <- nlme(conc ~ phenoModel(Subject, time, dose, lCl, lV), data = Phenobarb, fixed = lCl + lV ~ 1, random = pdDiag(lCl + lV ~ 1), start = c(-5, 0), na.action = NULL, naPattern = ~ !is.na(conc))) fm1Pheno.ranef <- ranef(fm1Pheno.nlme, augFrame = TRUE) # (These plots used to encounter difficulties, now fine): plot(fm1Pheno.ranef, form = lCl ~ Wt + ApgarInd) plot(fm1Pheno.ranef, form = lV ~ Wt + ApgarInd) options(contrasts = c("contr.treatment", "contr.poly")) if(FALSE)## This fit just "ping-pongs" until max.iterations error fm2Pheno.nlme <- update(fm1Pheno.nlme, fixed = list(lCl ~ Wt, lV ~ Wt + ApgarInd), start = c(-5.0935, 0, 0.34259, 0, 0), control = list(pnlsTol = 1e-4, maxIter = 500, msVerbose = TRUE, opt = "nlm")) ##summary(fm2Pheno.nlme) ##fm3Pheno.nlme <- ## update(fm2Pheno.nlme, ## fixed = lCl + lV ~ Wt, ## start = fixef(fm2Pheno.nlme)[-5]) ##plot(fm3Pheno.nlme, conc ~ fitted(.), abline = c(0,1)) # cleanup summary(warnings()) nlme/inst/scripts/ch01.R0000644000176000001440000001113614271005035014556 0ustar ripleyusers#-*- R -*- library(nlme) pdf(file = 'ch01.pdf') options( width = 65, digits = 5 ) options( contrasts = c(unordered = "contr.helmert", ordered = "contr.poly") ) # Chapter 1 Linear Mixed-Effects Models: Basic Concepts and Examples # 1.1 A Simple Example of Random Effects Rail fm1Rail.lm <- lm( travel ~ 1, data = Rail ) fm1Rail.lm fm2Rail.lm <- lm( travel ~ Rail - 1, data = Rail ) fm2Rail.lm fm1Rail.lme <- lme(travel ~ 1, data = Rail, random = ~ 1 | Rail) summary( fm1Rail.lme ) fm1Rail.lmeML <- update( fm1Rail.lme, method = "ML" ) summary( fm1Rail.lmeML ) plot( fm1Rail.lme ) # produces Figure 1.4 intervals( fm1Rail.lme ) anova( fm1Rail.lme ) # 1.2 A Randomized Block Design plot.design( ergoStool ) # produces Figure 1.6 contrasts( ergoStool$Type ) ergoStool1 <- ergoStool[ ergoStool$Subject == "1", ] model.matrix( effort ~ Type, ergoStool1 ) # X matrix for Subject 1 fm1Stool <- lme(effort ~ Type, data = ergoStool, random = ~ 1 | Subject) summary( fm1Stool ) anova( fm1Stool ) options( contrasts = c( factor = "contr.treatment", ordered = "contr.poly" ) ) contrasts( ergoStool$Type ) fm2Stool <- lme(effort ~ Type, data = ergoStool, random = ~ 1 | Subject) summary( fm2Stool ) anova( fm2Stool ) model.matrix( effort ~ Type - 1, ergoStool1 ) fm3Stool <- lme(effort ~ Type - 1, data = ergoStool, random = ~ 1 | Subject) summary( fm3Stool ) anova( fm3Stool ) intervals( fm1Stool ) plot( fm1Stool, # produces Figure 1.8 form = resid(., type = "p") ~ fitted(.) | Subject, abline = 0 ) # 1.3 Mixed-effects Models for Replicated, Blocked Designs with(Machines, interaction.plot( Machine, Worker, score, las = 1)) # Figure 1.10 fm1Machine <- lme( score ~ Machine, data = Machines, random = ~ 1 | Worker ) fm1Machine fm2Machine <- update( fm1Machine, random = ~ 1 | Worker/Machine ) fm2Machine anova( fm1Machine, fm2Machine ) ## delete selected rows from the Machines data MachinesUnbal <- Machines[ -c(2,3,6,8,9,12,19,20,27,33), ] ## check that the result is indeed unbalanced table(MachinesUnbal$Machine, MachinesUnbal$Worker) fm1MachinesU <- lme( score ~ Machine, data = MachinesUnbal, random = ~ 1 | Worker/Machine ) fm1MachinesU intervals( fm1MachinesU ) fm4Stool <- lme( effort ~ Type, ergoStool, ~ 1 | Subject/Type ) if (interactive()) intervals( fm4Stool ) (fm1Stool$sigma)^2 (fm4Stool$sigma)^2 + 0.79621^2 Machine1 <- Machines[ Machines$Worker == "1", ] model.matrix( score ~ Machine, Machine1 ) # fixed-effects X_i model.matrix( ~ Machine - 1, Machine1 ) # random-effects Z_i fm3Machine <- update( fm1Machine, random = ~Machine - 1 |Worker) summary( fm3Machine ) anova( fm1Machine, fm2Machine, fm3Machine ) # 1.4 An Analysis of Covariance Model names( Orthodont ) levels( Orthodont$Sex ) OrthoFem <- Orthodont[ Orthodont$Sex == "Female", ] fm1OrthF.lis <- lmList( distance ~ age, data = OrthoFem ) coef( fm1OrthF.lis ) intervals( fm1OrthF.lis ) plot( intervals ( fm1OrthF.lis ) ) # produces Figure 1.12 fm2OrthF.lis <- update( fm1OrthF.lis, distance ~ I( age - 11 ) ) plot( intervals( fm2OrthF.lis ) ) # produces Figure 1.13 fm1OrthF <- lme( distance ~ age, data = OrthoFem, random = ~ 1 | Subject ) summary( fm1OrthF ) fm1OrthFM <- update( fm1OrthF, method = "ML" ) summary( fm1OrthFM ) fm2OrthF <- update( fm1OrthF, random = ~ age | Subject ) anova( fm1OrthF, fm2OrthF ) random.effects( fm1OrthF ) ranef( fm1OrthFM ) coef( fm1OrthF ) plot( compareFits(coef(fm1OrthF), coef(fm1OrthFM))) # Figure 1.15 plot( augPred(fm1OrthF), aspect = "xy", grid = TRUE ) # Figure 1.16 # 1.5 Models for Nested Classification Factors fm1Pixel <- lme( pixel ~ day + I(day^2), data = Pixel, random = list( Dog = ~ day, Side = ~ 1 ) ) intervals( fm1Pixel ) plot( augPred( fm1Pixel ) ) # produces Figure 1.18 VarCorr( fm1Pixel ) summary( fm1Pixel ) fm2Pixel <- update( fm1Pixel, random = ~ day | Dog) anova( fm1Pixel, fm2Pixel ) fm3Pixel <- update( fm1Pixel, random = ~ 1 | Dog/Side ) anova( fm1Pixel, fm3Pixel ) fm4Pixel <- update( fm1Pixel, pixel ~ day + I(day^2) + Side ) summary( fm4Pixel ) # 1.6 A Split-Plot Experiment fm1Oats <- lme( yield ~ ordered(nitro) * Variety, data = Oats, random = ~ 1 | Block/Variety ) anova( fm1Oats ) fm2Oats <- update( fm1Oats, yield ~ ordered(nitro) + Variety ) anova( fm2Oats ) summary( fm2Oats ) fm3Oats <- update( fm1Oats, yield ~ ordered( nitro ) ) summary( fm3Oats ) fm4Oats <- lme( yield ~ nitro, data = Oats, random = ~ 1 | Block/Variety ) summary( fm4Oats ) VarCorr( fm4Oats ) intervals( fm4Oats ) plot(augPred(fm4Oats), aspect = 2.5, layout = c(6, 3), between = list(x = c(0, 0, 0.5, 0, 0))) # produces Figure 1.21 # cleanup summary(warnings()) nlme/inst/scripts/sims.rda0000644000176000001440000031663314251721456015367 0ustar ripleyusers_"""MVJR{ dHf!"IQd,!!E)Ysg?a_?|\:٫k877zӄNm44khhjT aGS؂@sa N ~ůhzzzzzzzzzzzzzzzps͋\$[BI*}$́gVi$n<,E֧u[.G[|63 %G,[Y\f=X ;Ŧ[b@8:_OP%{:$i3`L`vm4w7'fpG5"ל\Aq|pgWMTbnPYt`N:)u׀!yb 2>O!~V>ErDx؞E'~.׈s S xVS{tf^V{vNe, {\K ?3wՆ@ m=k][x1w:QX%?is髭D?X\x2#1v^u].`F`(Zr0nfVw3{:#&;$qG)~t++m]:3~b"(NH\rf`VƇ~22oK^F:eW|X wi=z˥0b㷇|*KwǍ~V %c`nJjnnso`_qv?K> 4f-LߜcgW]~һ&y !x4'>DY[ߴZGmK?tӌ$#0b+-پ.7"O+-)WF1,^-zxoγQ"dmL ٧.Zn7e]+4ݾ:FSC&`[F,[aV[epPJm2~>\a"P^_:. Xw{o 6 NŮn+Mn+d[F%]=ܦqˀv)7-֠Sq)n0oR-`(O<{kr|J?LfSTP,9;?b.N};ݵ)p?3)xnÂ&Voޞ1nM[zC%&9`b0(O]܃[ڋub9)u:y皼[+ 6XXFczF48`puŏ U^AOx't>苣>_=U"<ý&~ Q-;O3F26r >Dh~> Xֹ(ji\l|kٜ&O34m扶řLa9+N(j&Ujw >yK7e%t;% DOshDٺ>+lg<6'>̬y9o*@ !:sח ߣӮn9W L)^}`޿o +{s|vG]ϵl}bP9v&` M$}*;Ԡopoh<:j¥s+s>,4+`[D%m'/Bf,;|*۲< ;}:V+Y旃x77~+g,Cm]TUfؚy|Y9iK[njc7;Swo,uX7,z%^Ҷ)mN܈݁}s|ics^Ϟ]rK1>ٕh`܍s(b}YpΛ%:c^L9>wG< ͇ч:4+6 ŕ`<23_nv$!cG=%j]5krubNyJ֊^-Sc䉓^Si ?^Vs09_ AGڂ}zibd=f M,T͓ځ݈wn1P ۺ\ e5LA95>Ӽ(GFhwnlPgڷk8{j0O轌$GP"ެd6OnOuJ`򝷛̣͂=VU.0*M|: ؇Ƙq]^Xy~v~;Sq{{ ǩGn}֊o`}%:>|pR_N s 1:;gp^qtjIe V6ڦiQl*&Wh*pwђБ9ʰ<Ԧ= ee]v؎\3.U33OG]߰kzV\ߕ]-6|]<`1-D|Aφ_GK'k(&zx1R̿;(b_1_|\Nԩ_{0cZVS>.ss saOrAoᖰb7Ƚ=H{ F~|;c÷Z0摃5$~{ Cv :=CG7_TD{Qy6{}l-} ߨ$59=^nu4~*փ#n0Ç .> _ 28w9:SrIHN/P.mX {T3锱w`sp@}G23x6#pߚ;tϰJfVCa>tAÑPwP2wp쏒dNzјw|rKaC3p+<{ߵ8Og쭹B2'04P8<fZ3}gaYw1W_[cqs=ٕi逞xk8CT}s7Щ\d;#v ]̋U/zv?'_ oBp>JqYr%9!o{WG؇9'Uu/c*uԔܑz*0)o}Jc߾(+٥fCO[9i|[tvńzmfco>cci^9WQSueP䁶#|AV,yڞ9z4qFW x^UٶC&|?HE}❗Wp49q#j0Ϙ)9<Z/H9SїCCϑ<3xberk~1Cta3bis,K,Sƒ}c۰/S#g@uv; }-2r;eK7i cm+/+R 4]VşVN3q_]@xw x|9پ*u5_!:VZz=Of!la w&^_ ea20>}Vc|vd) 2ە<.eKM`C+y9i/gy#+x5GSsfnG&}uf"`w:5x7>9? 327b.lc4'_peYv??rtc[ZǍtĺ!~q``d>w@IQE=6&m߫}}Cхw;9 `cppy*^>ϡ FnֽOo>~;xΤ {nkucp uHP{|HWRp]]՘L֌u)-~`=r1 [!z$pyluM[`+~FK}Ls+O?E'n`4 {<"uQ`w ?:c-J`_ p7ج6bdAAƄm?Nl[ YљC޾jZ%Gg(>dWs0!sճuu^j. _uvK+Q8;1I5,PbƠX`%bw-ypݶ pbZ`(o͒] LԒԭaA1o=Ak pPvL7 (qxB=jnƺ׸[S]E޳<]co9ِ _FlNKMs/'ƺE`W꺥)cNMNfx3擊nΠT[VZVonuh/k \ˇnä=vvl sPxy.'0}k;~o}ve%ؗ]#83^9j:wHAЯ /y#bAq[lX| >+{m57[c}.1 ?CZΎz_ykʫGEBNg#Q@l([__rpgMKgt|ۮ`PBwqvnױtrs+J\]kxX~ i#c f6ٯ1 s%6/em3{QmC_ctvǻ=[adSVWu w>Z~1)H9E_~ZO6>W}n3d0`_ǔ~s-2TWuܔYK{wfe_O 8ț)X^[,ź2#/>6Vs|vBq}ǝ@(;WϜ>M(?uuSjo8/)EZ  y;_? C7<'2-ں_-?5{ }g!/aq \۪my#{<`B-+R_ot^GM}:|g O8ʎXjL_}pP/ /ڻyш#a7;549` @BL E'-:I@6Ӡ9n6gh1ݍkٴJh-ƺݚOc~ V.~?(]Hw٣|G:X-P0[v!Qê29vf-+ ߎ}^}0Fo5'lI\u'Y_>Sf=B/&>&uzyX9(s|aE1Ьp(x̹|d\:ǀe̾Y՟/eoº7*-D9[bYho*R[M` Lu[IA!ъ<(Z0ޯq8ڻt`_6e (}넷-oc>.=l) w{7]z6bړmSc:x=5<>nsh{'T i8} yȁl˜^9.90h!毸'=ڀ9W㮅#gҩ}=¼gU-`Ofß_5po։BsXy9lν"K y܂kZͱ.+ض'plAgn`s~0[+f{9oxL1v~z#^ґ@/<`v#wcX~$<2X41[+'ǼZP;pKfGis6)ݚ=;fx.n{_`24ژ`;͋ y$h5(Գdy_+ѝN6JMPOxTTO-wɌpaw;Ʉɽzb}N+*7ώ(?=3H=_W0?b 17h3۝5XW^y,՟S?c?U]z-sg̙]Kk77777777ߤjfT3j&P̈́H5fLSbT1xY'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd ,%|O>Y'Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@Y" Kd,%D@!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%BDH!Y"$Kd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DDY""KDd,%"DD1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%bDL1Y"&Kd,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH Y"!K$d,%DBH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%Kd,%RDJH)Y"%K*Klƿ}-hkx-L4]W`o y]Ei[́7&Ą `>i{XحBۧf7NjP`[_?;6~56v?JXIڙJHvK152`F-zrt`Nn=v\@`|$ٌ׮۳ԿZ Xò؀]9&μ (&9+x,us,\8 0/inz`M1=8Ⴌ>^noPzM|bp.0Rf \_iu/Fw0# ^ w`?tqV5_Y4jus檆KuYZ WnI\S٬``.ڳEϻ͠"?`VLvi-f{e(.Н l݊oSUh[*pgxGc_efC~=`9Yvv"C5W&Ps [4-`&113Vzq~L0mI (u=Ӯꚁ:uaKI]}־sv}g}\W^T7:*Pde /p߽cXxGGLsQ+edV;A~z%s, k){eKJg<!Kx lE&KzdQR#0so =mnq& fۭ]_t.F#?7jΎ*(&JZşx<ރCI;>Ve.\̀9`m`޳ה8AJ(Mz]Lr~bM޻ &ލ\e 1&W/ c˿bAWKOsjdȷ= 쏲H{8ȣ4vtU'x?,UX5>j;[A`OcoWYw9y[7ꟷ }_Mp?ȏ[1t9.c~q- 컬onއ/T=Oݘ[]>fw7u]g(j>d$p :ݿc^bp2q}vs=pf?t~Jn:CAi5tѻm y8kÒЛ:7z.m9 ZOZM[cqn^;#G/FM*WĒ ;;OllrѠz\ 7t8j>9 L'NgEbf/Hf_5; `\5]֘ U6L^o `r#";51h_ia-Pv~Ȫn,42֭p6Gx"Ow.WEh}}C,ܟՑAQ6WSF[s.xǸPG?N}~k??G# a d^&myKlݦpctAub'p=暑֝}xN׎lYmy-p{7TBC ܰ_|МH֛kZ\ z! M9pgΊfO+*ݣ XxAO I;0 N=붞P$uR\F굿uX:>S@DlzodO7oɹez[j[7`/=0ӇļsY 5VoWٻ3ry(>(d?vFfx6l#p;lљwہ_>&n>#"푒?C#m<1w20>sC;,1.n59}nԺ'W]̿wm̫˘wʳnM?(" -y34k 0W|d۝ۀSs&w8Sx6lte":`˗r+~=DG¿LMÇqR;D9*:<ݿ̋7:g] v?\QͼՕ$i^)vWw{0819o%<n4H;뜁7`îMwI%}_a":60ѓMxS`_⣟ZrЋ[w7;|ٵ\Y Sb:P:7/ҿWf88e gsȑ=S`u ׼4=o^ va';F];hhzm7hz=@]SSڮjD6p_Xeu~0NirEO`"S}`<3 K`]Em;c=}{prpu))x^osk}vl}KRq_/7n7G/.~{-Hl柃W:YZп *2 kl(}e|KfH#;4^axγ;z=j8p*J`޳Y.inxVOqxοg\9{DW#sCӽO1|T`is+(gGܪvn֚TOdOq(f?k5-9Y~l0gG1ȭY` (uc}_z+e5wseG]ty\mm[<~M7z󢡧7cEVv2p;0'sC;E7v&xb)yݞ;g١8C`E]w/V:4#6(d1A vp] a1 }!SNG8!*g;ȾY H:Sk8}!w3xmmKowvlXǺ0v .}xjw!:9/l҄G{XUIлS| \óۖI`Rj%y=@|rvy`~?>4']Б [ZƼQ6,~XG 9taP`^:_s߭~̳_SmYg >oB|n^,?pU&;~Lg{g}mѳ'o~5\ǼX?6<|ϣ ֭¾#o4#x?lo<*e'wgfIٷ[32?{OmUf61hb:G0zc }u,s8jΡ_}eW]ހ|W%D/EMٱRxk'{&_}I4>^M .r:C7<::ȧ+xyjkH>a%\ُf}~D8>Kz7o#,{ԏ@1zuӈx]9!_-.v:pI9@y2ύfhx󦅗\ĺ/n듉_Tm3Nl+z(C 28IΧ~`| ;{Us65uU /zaz;쳷? 탻.:eÏʦa葫<\ܗ熃Gdx 4;q_O9rn9+f7<DŽcnLkkOs6\ہ9cwXMpcmǟv8| cvw YP=eWcKClޔGG8}ݸSA9[, i%}ux\ (}p:tFmM1(%VìWc\_k[yMך 36G8Ao-2BicP9l**^_;T=``Z(|̉-@6sa؏->;xu0 ѽ;ͽݰ-ar}Z5ȵDe쀬[9?j6(ͮ6_RR +XnV}:(lltez'63tܬWk|b"o׌bwK c%ֽ-]cr;Yy6xj3?k Z^rzQ}72>WgL+_ǧMyaX?DZ/uXɸA"O[Y E⹵~e^̈?/{S1F ?ӌpfH0uTWcwU}@]`V}{=k=DuUbӕMx _zإC7)\qEo%Q.8V,."އd[uۊa˼gDm܀_럲rl T&A\ϋ  O17[76ppӇo:iA⸶ߕq (3Ϗ_V:zM"u]!UwwIPY9#p7o9{s6o"/V~A3D)R5;bhm2Kzy[`Law[6] JG˝||/pΝw~~ ?]|_t a^`c؃x>m62q. MT{ߊ0C7mF7<p)3.sw!_'?4 /U1}aK^؂vΣOd7ovv#9_Q7a97B>A>~~}:#HK#ו-d}cxnM/ V{Yu~xptU*j0z>Yr R數f싹 q-=_<(B)w}~ 3Yvt"(SGzfS2|a\#@.;\<TEgCfXC_0k?d2::PpPx,in?|:IA&x0dnR`O]vuE (AT]іX 'o`^v54 {8Tmk 5&xOȎf%au֯oۮ4?bL/?֓q}q yay:`о 5굙6ٸdz "Oc_!Zb(ٔPt{YA@ X7^uNgX6n :I99nS2j#fc߼SwXሠqT ( u>֖ S9ƻՏ@*tZI@.ܽƮnAmPD[ai-G{z#{|@>Qs~{-{3_`1#,'p}7_j >PUrab On^IXԙ*lL_#G5/HwƺڞP`I+ qݽW\CPrwgtVZe^ ߜ]pL7.Jg7!3p/`hp3wݺ[nUチX:,r~Θ1}}.͸.??ϝ v GbTZ y a7OͰoF?Gڗ QEcx>;/؟'FrϽ &`F+C3/ļ]i[Mp?]}4o|s} ٪۱5^O޳L}UE7~F }_|%t_6 <(}N$l;3OPxM~cƣy.ۙ@G=~~{{gI 0}!}31. f!噵.{C`DA77j?:Eηiw_-nނQ3)vjmg6f@ xLl}\ ئ ܎EX<0f.mt`asq kr;jKmZ5__~ҿ3ԯZRMկZw~ҿS_TW-;UjߩUKNկZT_TW-;UjSo~ҿS_TMկZUKNկZw~ҿS7UjW-;UjߩUKNկZg~S_T7*G' IJ霳>"K2dH$$cfQRHDdʔ$T~w>9+^5xΚKY+eZO4F-ͥZlll~2}ׄ+kR+X V`+X V`+X V`+X V@]瑤a~r |_.lpma@$Oo=qC@[7p=Fp~d41;Ļ4ŁTW4]Q ' Z l׼ Qͯ@||@#A|-Z[4fGW)qF5=,&@) ĻEEv4K mH +$@ok<NC4|ONyIe C݋@~@Mߒ%#׺ha'@x:-@ow̔5elwªd >~ZMJ6f e/=` tBf@}7QfgO*v糋_A9M@&q)PmݥxuZ/>'9^%y9-[ (#'2`@-:~Smy $M.> &\xxHV v[?Ӂsm//,'}Ţ>|!_E+^5GX֡iJ@/*owӂqIBl6--YDUm@;k'?yuK 6\u;C;GM"'wNtH+)vX .46z,)d'УWuϖAFdGX>]e"8W  Cz{I`)n 0foI4QTayD)n{--v;u,;@V-4ϋNkWOwO!Sa%n@^4 'Jm8jb ()؃b@\Ws:a J4I)t?@:=Y ҩ7V@FZAΎ1g iQ75/iQ }LS J BڹKffY"iy"5>ե`>Gŀl旌2"$h[ {}绸/gqVn`d]y^c>Jl< d@>g 3ݰ?W/]CeW"=)s=u<մB;SorB@/ ?`!Os|kNE#ⷴ{ tIK/^Njerc?WwuVj /jUΡ]@?^zJ{~S-F{q`r<ϴ#f`j\ j:Ra`]=Xp_L-?s2xNfks(3s粷jn>4g55! Qq Dn?dTN ľ|[{ Mb*j9sрTzѓyIσv$eb_ 6's,{h 8zTV]s- @|a(: d؂X7*b]@z mq̂j/J[`|^Zz*+w NTW+G7ϵ"׭AgܱW y,jNQ dVw1cXi{LQJSvO@,P,5}5AImwPk(w]^p=1:?-kD|4wKC?dIY@|}nW 5{,FgEBzjQSX7 g{?*P3?@M\cęBWm$Q 9>quZZ]{*`nR}0$K dBIڅrC U5 W-wn ~lCy #~_uqi .B@4vgsuͿC{.[ g$ۤ.w@eh|@6^,3'ez8U.G̀~5gtr~X({yH$KYk=ىְ/C;xo^1Z[:Ks-jݚo=Pe7=rka;KRׂ-Zz_=.@.9,pbH_Ezx}\30f.mmjŒ9\~cLS }@߰jW;PtۈIgYވP Қ: Ȳm7|(ΌC>zzaޮXeQ^"SO4@~|Oo 臛 .Q L:]>97-JqL=>5-ߞvǵf` sV}RfЌ|vi"G2j-yQN'-Tw@|6_=~ p#n4(ځ7ҙ&qdmvXp}zMN5ʼnؤ@n4*hO@h: \GC KgyJ ؛L?i>bְ;j=ycg;קAuVR}!Afċ;{?YVQ5…FCdw $d; gyn쪰XTόesʀZÞʻW'rYҚȋ%3@}j,?֩fqJ0}L~jV:wq2rDݻsG02-=::%JyrOlgO"%.←% ozmzэ@6܁:Kj09oߢu:oì PNc@[~_$wME=W*,uFı aՊ`I'A'M/pe/]pkPն>}!.+bOVuُA;8 d˨ x dٞ~mcͯnak[/|вԛx _, OcۿnOkO}Bv 0uuFs YW<7^J|Qt*yC!h<|}p8Pu6GJ.70]|V>&s"D`p=uFy@Y5=h\ove|oΆ9oq?dZ}˰/w@\?d n772qf]@$u:Gt2꫙U4no84ߗUq@53{\0e,xuly!g,Hƣ=9kezz P=rMgFZ8H%-AQ:xC:7`xgnV n'%RBwGF@ Y8izBi+/Pw MoW ׀\݂IC>9ɩ#n/VT;G|٣rN&EH0eJ7ʾ'9PJq`&.7B\7j}Mb^4WbY(j/twljg^m>ӟT+~Ǻ%uǜJDL&ԫ{W ~HUK/ BϠՁxNg Fm?y2C]܇gx6.0= Ul&Tәڠ-@bTG<*D_Pb ֕&]W޵O>xs۞k /w@9>A}ֿnQ)m[y ߲=~C({PvvE`_pKo[Io'z0ٻё'ny7Jj7?4E_\u (SGrJ w|Z+~bc?{ʕ^̭E:x /7dzo}#ER\!䊔c#7ZLn>z~{[ʿJדy!<ULR/|}2yg9 {L#͇ ~`s$ܡ }x7&P{bMj\jŢqL7m*f>02mMy:T1g Q/ZǪi^*[ hӪR "3x( Լ:e DI ΗUDeRS^ I4и2|Y+Ͳ.@<`|#EPcyj1.ōCԕ OWۗca @v[ uatWo gYطu5]r(u !.5Zlj~îD:N$9O]oqd>6 B\^j` C*r\ѿqq`ۈ"? .)".`; w; Xrk5y? ^k˅"@ZlTDhk R*W}S%wP'8QS)W2\ w9@́8U`ծM@<0s{v̦G}G._k#D5h꼿,QW`t۞@40BE4OyhV t0Q Şj4gưkPQ\z.æc,u!NYE:+:ޜ%zR&ub/>i!_'  '37_OzW:ac7WD}~!r94o -JMcPhNjͥM J'hcٻO{<_忉 ?.Jv9ms8RPv#0fU#|\X ־Nf%-6ѕ}1V.@Ջv?}o ¢b60#+xxtMG?/ !@> =2jSP迷n뽒ofa V +s7'=>cV7a5>xFmQZ$sU:S_=؁J/K%/I[ F\PHu/UulRo Ķ>@5PWҡsEu}r֡#?7Or # L׌+xcDl=5~x_5d|q<. .oGuuӧX7񮊆oJ Sz?\E]}{x 'a ‡_~ ~vxKEOzs")\8b9/Q+ޢv=q㧖w:yz W^@~܉a@[NNtgW2b[H6 P+rVNKšQ(,,>z&&xF-~-߆Ϗ~Xh26 FQϜb/խ.=^n5ط!Ukǀ(K}{}^P'ErϺh-o^uAoXO5GΌ5$CEK/^/ `ZKKZ5?=?e{/NEXD;2u i>m~|9B.{ed 5h%\jZ?L*?n[ig< )hZ=ׁEQ o3A?+s\y:5dIMIMIM&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥIMs)kR\ʚ4&5ͥLjbZb+X V`+X V`+X V`+X V7Yd ?cĠ@:f $W@ مIt$i=? .㸣[ .7B;2a=@rݙouR [ozg>UD|w!#`x(W-!@d0Vn *raݯt?N)*Z T؝b@*_DNP;qہк9OH:uZ k(U{Geyv}1@( 2f[x %'>~ipR#x3E(' @HGZz ɰ}赿l}[UV3P* .ܼ! 32V/[ z<@#; 7^p4SfN-nK66ѷ=e}g+PAUyT2n<f|x9 `Cƒ]lޜiͷ"f[fcf槸Pw(Td9ܥc@x?`ˢM@naz&}0G,:_܀1j깣@ܿdY̛i@'*|KhWKRּq|f . Wvmsv@y.z-.vl6Bg,_r"H)y^@~.gn_D" Ǧv=cZjF ,/b> ;}pȹ PD :k@-{PUTro xwڽqa1ܟC?'#kw24"P }w3\H#|.2<7ynxg跊}zJ_=h4[5c){@K>N~ tvat&僈|Fn+8v_3k-pN[ xhzn2jzբ@pr2ADP ?(q%uϸnjk 0\jS5ݙ@K-4~ $EN[E5quobZ~P2Mz\k{ {P+M[j@3q0vīZ;)KpscU@ ٱ(ïR~_]2P"_8CoD]?(2Oާ|yz8'ЅC0 0rJv&KΟAxڴy Pw؛CH3{Jy]Ĕe. wo)U9$CG wo Ü_;jc&;C@r>E<~O-芑cZ㔷$qdP% ?ƺ, #<Ο2y*qi2S.?XqsW0\sEsee:nN@yvzg۟upUTN*&0DmFu@T2W3"?yi@$hyQ=btkdT绣XJ9Ɨ^ɽl O@fܗe<^~3>y#5r@M zY%*#@KwKr-7a̧1R3i)aiJ ڛ]om|ίth U-ͧQ|KIq[{2D|"P|[LeP?YD?C q%y߉_l9tyΥ`Z jsq>)콺`'Pw]$#D\SE YLc&0#~ W_e$ [߰=}'0C(K34|&3'yrQ 0+}" E5@wlAC]U&SP" 4^"_OEvz#+|ifg2/7)x3σぢ*]K!7ӯ T_ѳA@1ɟz ܟҐ쮆 nj_thqíO|ʣ/{Vu핅+3@a#߈_ce/6W&@.jt]7ۂ}bcu'WqB}E=Y͋p☪/oqK4`_~ umȏYԽPk{k [#yP}pz>P=q}.9kZl2 V'u׭ESyq̛=@ޔR8$ wOuD#GBZ#Ig-}+8䇡Ñw~Y3a@~vy=(N5i?+9yzoQX{eqOEzi[8ʧ>H-V"XI>[ t5?Fɕ8'a!KB]خG q0b]&+'KCZGJ`X4u=e>y2`%lg^ZU3}_BH^;W?0RzZվ@sיB!t`-zTYÿ#_+W26@`1->pmjú7ښ́~3E7ϡD;0sUuƟ:C{+y\\ $-,o oL[zL]ԫRٯ ~rŒ@i/ [!z ew]zRMF UO|팀iAWEX@/( *;q穕6wFċ…%pͲV_s,yF/a)Zܪx.ix^jbC׻-|fWKkQrӸu2jmJ)SžvWܗ ̣|#~Հt6]~<-{Qݛ*6~( Sn* ꪿&C"k?Wi/ (jSgY+}#k< S]>+o@>ϱ1XgաH-F 0m5zgjéxr:y^/}6#ȣ^IY^|zv3YoTp76]B2yٵ#@\=s+!Zsq}i:65;sxkgŁ@v0b`Q_؋q>gV(L=ukPef}3B/[Kr;go;ݻ =ZD зy H~c_7^\' uox}|)ݽ[PG?;8$]j폼m%^NMW6 CfȹlnsgHu`Bt죿)J\٨?}xZB  y@?v)~ hyŧkV%a%r]>(&-}A޵)DB}hD6sEmG8tW=B3ĕC5%+j7#ߛ:ހjr0/o{m\PHz&@5׻z+q7yҵF]V 0vC_;GOu>uC8AO{ W[' Њ=e*>(je;uA_}I6=[ ]~迌.};z<'EKތӗ}CKPKe3 f?_%n SrVGյ@ 4KojSɇD_ճtC _R^O:,x|2/ <+c&j28|ڟ- 1y^n',wS69Lc_xBޕN'!T-<췇&[iv n ,j@z&>]:4V.ou9+m#3^.+5٠?s잽0̾@)=8$[WZiߚK,T`'K9Q?0,  ^eU@2<ݧIm^{NFÍNE~@?uq5u=WJ9|bz Q+Si`}&|zV.uB-|~_qNek7*5E|q}$[vn|_JAg9]=Zt] o952_lHpAR!ͭv Ԏ֡W3f=|@e/A5q)(ky&4{}{ƇWggSRzAPN #[or}K:ϓϑJϮF3rF!8n/S[q3ٱ+ځa{I kX-\1 oQ' nJp}%zfmFWKDb&!]4)仿KuWuU+^dOZyCoxpyd ]ݯ|?2֨%֨%֨NYR֨5ji.eZKYR֨5ji.eZKYR֨5ji.eZKYR֨5ji.eZKYR֨5ji.eZKYR֨5ji.eZKYR֨5ji.eZKYR֨5ji.eZKYR֨5ji.eZKYF-SVοjWpqR+93wlil tp7ww߮p_}AjJ~U T'fSVN.VlUTP^)uZ椅ƭaԮ3VF:dsWl=I…c\/w9ʹDJ]uןri u _:l-tm#fSkXG+"b-Q:|rk-A'I$%Qwe8cXڿu#j:kO6*Lg4,Y\qLlLlZgx2~ɚuCvuFxou>i3Y[))_%^x^T5}ظcE"3".(z; >w&0#׳2>_(SӧqaR:+wTmvCTEL.Ân^%7m1%ώt>[ͷ9 mYA0.n:缊l.jZrz+ 2n}0o4bD6eT1u~ }w!#/b r'yo80%EI]t5O0sN5F.{m\6w~Q~I~ ROetٰLK-Kuѻ=_!cgOP T|zǦ--ǃz@qRA5(,l:{IdrӸUzh::fL35o$V'l~-@?wb̢?\Z'\UsqJDž& Cə3'ÒfaO_|{hPUPHiCѩŵ#]7ݎޓ>Ȼ-x*/9]4pDXw/qgK=S&#J(yDomձ>V~sZ;V๽KGעuiFic搜&sS"W4DVDxMJ=+E WoH-(bmD0)?0ZV@¾V+'N{CQJ kCT(.^mڣR߹/%рZHgzOT[k-V.U6Q5o3˗W^dkQIWҎX#sCG^1ʋ(.r^#~ pO3L>b$rBgS<7+oϸ8ne2KChZ-jcы?N ϖӗuQX]i+xƳW! &YB ^# -$(̗2r@{É gk-SΘH/?u+g_]mΝc  _=}CmJ{̎(o^!v`;C\紓1\6<*eMo7򤼯uUˆX,4! H_wzO{Z^3'7UȦ ipT)%6|ܚQM\VͰk?`&^+'lۦEqsXyu=f|?kgU~FlU:^xt&XzCmҦGQe~ept\L3=yѺoĸO^y5][AMַi(yp~0,Iޣ޻G8p+} ʚVkmwoqOrzI)? ,ٻSB-iՙGVLvh,Ibߩ p JB25٨LB"eDe*UCʔ&C(X*uVsss]{b}Z8~%dnpPHk?eK/E6~Y1P(.&T.r Bs5ھ2;Z]HJ[xo:ѱŅ[zǵ8s<2l%ۗCq;4 ,GX㡆$N*9~HsM/oSzʕM>ڥ-[>0hQ=$6VԻv)b,mBh֫-R rt}gPSvLzZZyn@ٝu$ 8>)'9!q$}xu=xkR+l;)axˡ\*&%uC>̿N{ 4ٱµUyR[_gyȣ-,o /Υ z@jux^9"s^KqcIPv~@jbkvJHi.ot{S/ ZTk`:??n$6[ۀ8 Hoz\n1~`nz w^E@-~y@-$6wspHwoC"֛%rmж9)׫=vc^,Wi_K{ޏXΉO~l9# T/h8P囋.8׀0Cjϯ6S@zoj,}>=ϚƀX9tQSf`n/h?6D^7  oiԘ k> %{XtHZJ3@>],& |bi IR2ȳ=Sz⢁\m(يrs+V֝V\S]vj&av h]}%;% tϲ#|+&'/,?q>䴸hR}>1[`S;\O<dW btا9no%|'}g&[ `lG@9b}*\fh,2﷏Je ,~zwj2`ty υY \8v+`]pc00o8LHa<'B*>M 5`}sk cAKn]g[|8{HwX.Ϊrq>N3p]曯'yg]teOM@4O~xLwcpʰ*w1؝ ώv kg꯼s?P~%5@px=9i5+#c@-YEWP Ȣ#"wM|S hԁS@ M"n1F@􌃍79I,q;"dɉk?lۆF N<ê8eۮ SwGIЫ'U=R+Pꗟ[Oo׊U}zK5"( N,nċ?U@toˎ\Y Mۓfυx\,wD9 UI4j#\e|-ZQfnCzycb?mןS@o|M@?^'2>/w"yܷ9׷T|* vh=E@͘w %8g&R2.hI)]0˘]@:&ku_@nJVj2H@ -$)К~#U)o%[>/w{]@GԳLo)a]EV{s- gh -s4EGϴx:}rIm5 >׉٩ l?n"ĝ(w`} #ȷ /uN+O~< fi% b t]{d9 = \58oL@m . 8=1>Z*d̒O|U~߀x&3W0c[r:kt{!/*z9'Dx GB.G~@۪·_Įt)σnS~ݵGR+X!6Zw{;Xs$pv^U@9|~td0rij^FQo)6y4 qo #ٍ?'^#^7 ܗ(¹#3-z8D jJX90f׿Uy+V/@^PV؅x;xW>qt@\Xfu}`:2#ƜRǾXRY2K"߆z g@ؖXg&ZZ&zѦ!m@]wÁq8   g+sOړ8~gKR|R!Gsqnƻ'ܮ>~ yXNv ,%,@6^~~0$qCIxƃ74: \sB46 POɉƲ#?~? }ޤķ5_Ű/~3{̧~ x=?|BLBͨ'F2?G)&xr^ ȏ4M w@3akCf'Ϻ]K6I3_FH0=v BfF^jt)jͽvOj˚u올y2|dfVͧڠގ]U{Iu9S3Wrbe-}gp%g?")O^Pn jR[VmE\T⾅ewwY$^- dtP׍%BXlܮI>c5(@= 'We%o.Q/X"ʬ&gaO ^~ïLBܑ S8)W(V:pqGzs\9Ŋ gd;X+?Œ/v_VУk۶co^?nۗf8:_xPG+6ۈuq}@'o sx~i/>nV1PwՏe3)0VmxLσsH۷Uv JEgT*N`ϯ?}ٵW8J2/7:xy]-2ΎgucH'l` ?\G6ս>Nc>jjSyڦmw򒓿<;g9=yq7ⱵVQ6\36nB}s0t U%3Yjoɽ轛ݧCow[o} :㎹s5}~$Ob#ɝ]w E{F~یrٮ1moʫbWeP<~x9)~د'3H􆊪 ,]R -`z%=Rfˋ4Oc̽nicJ#dEs_yӫЇVF0__xOtgnYeɌ9́$Կ q<1Ii>{Vd~Up>=>C3贾 늋G{E _y̧3o} rp2.n䗣&nHp۵] }D%vZ;z*!&uA<_"5G|.˧*6D!nیML#F \GWtxs"&/i:yߕ8eW>ץjUODKƾZܭȇ'N*ZcsKCk7B\c":K^Ѳ} L3?Qx>މ.XtWL ߆>@ݷ~}9 O6D=gy}E]CN^c|U(}w׌~ ;2@h`lz5;y6M@JLR}W̱;/̻D QO3\墷,A<"?vyvR 7S_@w1nqF?{T C]y]G@'3oxeF7i.iEҖ5컁1ɗ4<8W ~La]y^'z>mY?n=_Esl=:[ v'Nb3 d>&e5MB6⯪|7yoh-`9ȳz>w 3<ݻ M}vmV`G| W;c?nUt'L|5'_,Aݽc+>7#[Tlq;+ؗs6!?H1QJ^!n|!0}̔l>J˃T3>IٿtqA{ty E̅=@{V&KȺu/dž s3;뇼dXl9ֿH.T(~ȃ_uYlğ=,rcNgP. Qhpy Xň~r*+v)`侾4sr ~{Q*glnþPhmʓtǼ-#7ek?Ke\Y'?j9P|*p+0f itsUy #Ml@ޙ-ugoaOyj'#Fe0F= !^c~z/j2'RE[E})G)2tW }ުZpNΞri;CP_^w)vb,q6A!$\=>o|wՓG.\ %ֈ P1": O O,_n?_jH]9LR{)_ bC@PrOMV<5Luvڍ ~$z"?zezX:}ľU>f$Ӆ"ST>`TXP dYxR(.C~CKϯ.s@[>/0ڝoBt3gE"ߛ~:(L7Vsɍ"J)é4kE-<p1\{nbAjKMt{ 1ޠR2ft`O9s'tmoI٬ jChi A6[M KOçd^BIwcߛceoJ;ĉ34Q+AڰM ^ھ'݇R~F!o4={ n`04e]F ɝw9}U7\}kd;Nœwye$ʶ"oȷ/[.-^֎h|>N]d<4DL`k=G,b:A]Oi,\ k$b[qo=L<'r>xl4/ Bet[ эk:i|<$δD⮞"dEpBJ<Ѱ`Y86E=Ql4 }`naS>V WOH.M #V'x|\yS}2];n i;>ُ |4$ >n>LqvI _  lSFaڱTb?8k,ߚ<=S-LcC]ܝ|h\;9[]lD.wҀHY}?P{b!P~?ŕcO}>dU[pwsҊ?-\|IkPآ }IhI?5  EݑEar ^=h@66_5#;bv9#Xi¦Ͻ!JXoOW;>-قo1vq sҚ&ȿ߿\¹ vR{`R 6mV},u_Є}'rR).` 5.yۻ&ǽ|iyfCOT7ۍsu.dp =aؿQB@$H[~S2qq_W9/y ߞXc~Fh|5Wv9)xިv <y-SSwg:y]@5 ;_Ezy60=jSP:~z 0)Z2u'<9pxUV@FgsL>z޹ ΋X OWZxZxZxߔt:e-珞½Q 'W.B^U'sVxeKvbu3GmHYڿojy9R!m.rV`BdR;.}꼺ЫnWcn:E Sժ;^HĦ\@-չ+ydt[9Lgc@C_,DuB) M^q5,]tUXPZ+d(@ekSʁ=e-|)С ut30%G:Ҁxya?L'䁮2ӡBp7\b)aV ާY@]||?2OLhk@n.x[R.)]5%9/Xx[ͽ\;y0w8p7~ wJǙ@moaPCPڍ@٭9!P%y@UΜ[ p@\7|}~+Jy'a7 R7rM -;%3dǿni0#'ms  D ?}cY vMؚBP|:,Z\"jt*n+G9+Tsm sxM20Ʈy ThUjY? \fd=֣4ZѾGj8v<+}ϊ9_:ZySgWzL}@TmFbZl$ߊU7g7:+24El~<シ)AEGcT.߬Ps i{jΧ@GFyuXI] 2SYd5 <"$#x>PQ:ֽv\ٜϡ\,9J0.ƤV _ ںBSko^jFlMlfv#γbЗ̻+ .Sġg9^ǾI ip3 >sܕT9q>hS֎N@8;U ̚rJO<9t* w N, 3n7saQжG^Zɏ=>>Mqi*q1;%QI$}\-r`pF1 ZPL@#!?(cSmx7`\jڎ}BYS&PFuo@la7A@e0&U@^lGqjGzLZus3-;=R~Hq{S~}M+ֈ#ukG{~X3fz]8~3PfL^'KOc%]UΓ p*kUc-@tם"{~*z!?dj`(F[A?7IS6\xˡQ;m'>]<~@D́zU4 -p9FeOh+Vn?;`~0£ugqgo1ڀxLv1?ZܵgqB^7fq;z^&۩Y9vtJ/< :dѭI@^2 X`!g8wwTfuSPbzsҀ\AK>f<73 @ ~_T@^ޝ@z`m3Ef٦Պ7n2pZa!x9s]~J&څ7Gv)XoyZpH`D35ȟlE@o%U9GG#?߾;"m۶Fb}ځƐw\rϾ܂KQy!^t;-TsNy?+`=C-k8q֐&ΛWPzj܋s-ڏkEq|{EerUv?.8+&}xKw D>\pqT>6 e^]RbjZ?ޖ1F'#>C=2OO؃9 ֛gSr(W}j6xٌuV#pR>0O=/tﶥ3ԂR p4͹.Y͈sҿ>=: cx{W?q;* _hxhruj5yYe)jϝ~2yWxnx#7I2&u rǰfȉS1#O\}_ʜ!,^f&yu~_:>X~Qj![];W:hgĺ@~4/?mR* 4y:-xFv@8)Vv_G]pWX?wt|֯e`1!Ђd=o/Γ?Mױ,i"䳫Y;udpFCJrH>|.0jےtj'*{/e}mkdNP6Oľy 09mrQOT=jƸ:,}.npf9ⰹC•rlpw+ a.3菇H!9xrw\Pԋ|nJ6ݞyypx50Md=2L`}LJznT ǯG#5+Lʥä1lq<3UKo./+yy躹 s/4cmSsz, []Z@AԃK.` i>>r},xجPljG܆zɽ8s fma<Դ2`w^X%Dbk8!%b3my{ RXu@ 3UT3B>kzm@yQ&ߺ/ S@:%|m#Ҷy5Y})1t¾}A:-܄>P=0ܗ_ Wn#88z0hvcUıS0[Mc6"//2Y}O9|?\gC7Mv؟eG^zjsR\*؃6AĨ odu$5b@.]8e倾fvxab۶lͯAv\$ָ4;YQ`䎖e[gnX'A7 qCEUG$5 vqġn5K4/S ydGo|oz& =ȟw-4s*VB_;itӟ=XM xPK2 puc$&:nm-\~鱒5)oW3DYux lyYjˌc1)G>*AϞuc`Mz wW Un_@o3 qPY+jlG['ο_ɯy`bY"ߍzQ#\m?O]gOs>fQ#@w$  ߯>3c>(g>7K:nA,X a|z5o`A6~ 9m:MM }t1O/)NۤblK`K5efC]oCߧ.fkh3ȟ xxH}7S@pDQ=EB/+oE"*xaG2)˱?M b6adwS~y~*ľ>M/ǃ.n_n~:%'ru.bة4/Dy-F_'u}pq~>8c.ӳ>]u #feO>2ob7)iF[E1ާka[WDtHMW\s3*dKzLұ_TN8Xa6O}qϯ<\F>.XK^Mi$v^kA\`Ր)Ǭ}_Sb8ξ!,";oIz}wd2 U/= ?S ֨/EG=Y]z0UiYfzosg󢁤UG}#ˁqw7S⷗>@_z8}[>ؿr+[J۾y[u=Pz ɜY֠N ٜ6靨3;sIg&uJX3 @6}9M.Ӓ#=W9`-8MlE.U^ͻ'^?00rv/{ }f)nz/Z C^@]yϥ W+^b?ޖq5&W#>5dY$ұ7s8žU:9GǍ8Wo?߫-eq)S'x >ޛQ[f#NԶ<ݦ'F~'҇s uE-EUuGf\8)M6V@>_q-o)/ z-zkQ.lisxJcq(Pl@ƽ- \#We~]/ LWڢVṯr#:xT+4]嫿> "_|@CS>y[wq8#_A,+81*5qXmeu6fgV[ZC'MXa '. n.d3Mc%z/CI3%77\6E;V=5x5q!em7-ǝp^?#$򹯳»;n#ngUM΋Q/D!;i|*Y6G3tY4sg<<け}Y쫫;3p;.Y9!"k+@e<QϓgCޯBא ypxŭȣ/Їp-@~hp4x!.P'uky'طÚuḰ|]]ۍ&YTqh?m}aEd[q3|\6Zv}Q/}.Հ<ohQEwa&Qɴ E]2ĉ&wPT%>O/r6nH;uaʫ @*>wz{tf#y^ٵ0E6ݻHf ېkۜ.yz΁"3ۑ݅,M 29j>d7w?;{ ³t?]z8goT>Fߨt|+msM],VJ}x(b~̆%A;s}Ӧl` z߁TD֑ 8;o_U}{`|k33DvIf!^9z|'.XI6W eԚ뤣Wb;љOH^o1@?}dRvh?jڴc'?^}I@ߡ=w\>|<|s/)91莙z> s]W*Ub"_;'ɗ"mc6W[^@&8>ùUM}La)Зc9/0Xvy`3BU/Ǫ<)w^ o~}? tV{2vNQc;N.E9ϼzbUk 0kEkݘ7aӏqqlEA8j2Eo>9&{+ y$*5w yy }PvXw4Ǚ:z^~| z60ZŕJ쿆`h~]fzm~e%'z\PKub[}G*|CQ7,{^p:`pbp Q+.^/e:Hmhԏ*3܀%nAo^ɇʛl3yso ~[ [TV*`)TEd8!OS=/N!O/E=%G 3,h0z^r=)ɺ0?|./uӗ-F{le8>φ̓وJKPO= S6Fvp;Q7{O %!Ԁ\f&uD᝵j?kkkS֪锵ji:eZNYS֪锵ji:eZNYS֪锵ji:eZNYS֪锵ji:eZNYS֪锵ji:eZNYS֪锵ji:eZNYS֪锵ji:eZNYS֪锵ji:eZNYS֪锵ji:eZNYS֪UK)+jఴOƹ_?23`+X V`+X V`+X V`+XzF*!qunU\MJMP>SD~3 Ƨ杹T7Vl GOu4WȽHj`zpfgЈ?#~s=;Lɹ8@_J=]#$fѐL0o:y<[2#cН{ˎ( tJx^[s}MuS'-w;Ri_+Hsz52\g@%ͫ}w"]W-jtN8ba>L`nlkĻ0YY*cJ.q@i-shw\{|o[I =leC@L9틃N'`KKw_zC@2fZ"A).[P7䞇@&"KU~w-l U_5k-2-ZwSj&R| 5@տ (^_z20U/D`ݗ>7R%S&o9*_sٶ"o6upe ΦwUy^P/dz ] +|^K 뱏s'*%f- ;lS5k,wq$8Q֏}edbwWQw/z7#לa@,֔%Wuz~{Iadľ:]Sh`kV?^g:<HCD<yyxέ]m@yrK/r}y;L3yVSIFӴx.7m9"_uskֳʀXY?OIL>,8>PjVa 4Se9vGP  'h a݀vsY}&b [<ʋOHWa03Ɠ8Ln آ~P]Qn|_nB=@Q3m{6K^+߬^*g9o,}ptg0yV#0| %_O#Pl ԠkՖ )/3 ?uܛ $5ǣp>?d%z6^&v?6T "2!N.v];] G|z^̕_Msb];~mpyzfTC6 G p.PՙYBxaieεJ~&0Y'/2t$7c<}cy:ώsFcYh2a h wpL9dKܜ:`9ڽ?Ow=ЛGʋc"6)-2.C|=^,Sf땁ў21S seuykjL}@s䝍 I}X}PyA 0IN~K`NIU[CZUsxGN< Z&fO_zۤ2E".XWn\RgDZ/ yWWU@˟Uʯ'/x!)uJ މ&)(MZ=4?tne:*a~j5ʸiZO8,_j@.y 4X8c3\-_Cv~m.MHF".c_X=`|x#qz-!׼5l'7Lt":F7֘qWZq8oVaw쇃a؉,fĚ4[#G"y7&i"j\{a(oѩ?jP t @zսð~A@ z?{o)B"$]|׺zֲ9纮_C=ϳ]\`(%|Y!NkJxn Gtm-H} ͽmYv {5}U7P-stX)筼E8NAQC3_a;c& $τd-QaW{B`;Pv;ˤXܓeHгO@>u/ĹR}y Uqsl.d^YsI+*ພNWs72VuŝST_#KJmn_3s\EqxW߳[}P/{'(77=a&eI%qvff oB|P>!YO &D 2 .l&`}>su"myk`A{|޽7H9!kO: 5d@?ewY\~\,{t '.r>0x{o8+mpM9ny>GEVW\O=.BobދDǡ3'lF<=P&3g΍v!UDީwTdHyY.'0UEYϫ]*"CDG3Z&t]ݜqIRyC3\SiP#A-;/%T~ľn= ]Ffy\׹lst;xL5"|P0XiZu"Pf|4ɌOW&S@՗7) WgKs,飿%[Ynve~'![~kld~5yWȪЯۢnn"ᙩ@ӾcY<ݹyɵDg7Q?3n88vy?:C~f{/z<˖JgjAXTمQql5yT~d|}}6;w_~~>5D>{ Y+Nba21m ҞT`WO<0VSJ"*+NؿW@W6"Ļ O ]'%+vg~L 6@: s;NCUTԃ;yIq|SJq9YǼɗTe=q{G^ȓpm|RC;uXoy7OuSsҝA?8fuJ^uE;9au̍?$| ߷#L-?`є N<ߵ +]yNO8Qo;CqS,^,|yK_A/Im@߿Э6Efo{~GQzxВ" Y:u֕-4u2cd'[{s ζ;Y+}p%~zxXdѾkhP/^u{<.-#Zq37u/⹸/RU,SZW7=uN,&-Ջ!t;wPgkv]"wv ʡgb[\/_`;D`_D&qh=ERjmϢNMVsߥo 733#7b*\N׀:#@P4Gn':G672=~~jNJ[> ^vrĕ/wLSY&cEF=Z)h_!'p U7eWu HW)s;T;-V0w %hY?f5Gs" w0+yΤl_ oO _p(ż}m @+zʧZqgf PG~P{T䅻İﲸQzWTh5!Q.8Y"0|}["0K k*cdO*p<@f-,s,A=RXh wLnr4(죕}bf1)Ovik \~4:fD_19m.}ҪoSFQ?Xs}KC6@/><+pf_#*U*v$6q&R4u֏S @?k~lX_ml ? ~|@5ME Jp {IEĻ >ni@D^r@ƈ V݂C+ފ`;n^<T;1ғOY耚`-a?j6SIO|+Jw֯JSnka߿4tD:k2>UCL/UFx"?눸>Q\\ @{'FL G_p7aOSmܸ/wO-_7ή n( >xpbij-Wbu}ˠf} ٨b?7ږB}Ny@&re>~jdMK< .;RxX*W1Y\ݣi]-1CQx[iC4KJyD!W|-Q+ϱ]3Is r;xfUwX]_]] lguo Dѿ &$ {`|5u"/KtW"2 Ś0r@1빴BrYY ;IVխ?GMTr\!Gg [x?c߷.wR= @ɟ0j #m uS{_vMwA^⾀}&K6R;$ŀ2sF2@-qȼ:>w{C*v~+RY~&8qР4-ܛJ=': ȧVhF . ^}͒X#}P7hR ǫFa\~8Y0AA\'!qi{ESտ}v+w5kO)Ye[uH{ A@<)K_}+1sH]f;oֿaBDXICpmyfS&/qo<}ZSӼȿi:m@ kFx- ęp&8>:T eɰڱǥ~+75]{!fyg R*!Dl(b⃗Q--^Eȿɯs'6.ݎCJQ |_y$Oؼ:4D#J|u6I~t)a,P7sjq6η)TA]!/Pz=ņ@e|~S? e7b3_Ϣut3{ T,⏦帇@~/pRd& uޢK"ڤdb(i fk@ƝJj`qp12^@LSD;&$}qTVPל%=S?RSUՁOHN ܜ}5P%y"Vj[mF {G)*b7:ipyh"D@v:f~=&MW35j;\>J3E=zeL79Nqm. Uwl5rqgRj$'ouVqo<*D+-|'*H nq|`Y{lw?u>N.;@/l ؘd "uVc<wrS4Ri=S OR7awfܧ6c?P:]!MY MՒ4t֑ކ/S:cɣÂ@rY: uOM&t|gB!ab s! l6l2vm ʦt }T粥4̌&U!ʗXʡc:܈uBMz)7YM@^e40tcH].xnϚ? Tf |I-qߎd-tI6BSڿֲ5E( 5ޑw\+@_.871[@YĐ3=P~a2u dƁsISX_Ϗz~ٻ6<*~B w5m҅Cb;ns }J}Ps$w֛3fώUirk:զ 3wJ.irU\,Q=Suv$53@35_|_zU>j:~cFd"Vv~/)^6au B2w9UgEA|/ e=G'eHtr v|{0t0 oւ/F`T7~MU@t +ߚR @`Ϻoy@<3] q'"qm?B-K[Y+d>~6>"Od(;U,ڍ 1cy$x:^^M@H{@ݨl[ـt7]h>y]^+缿7[m]+:ԐȬKy刿9'l>ӭ9"z@rRJ_`=ny?#\|*C"݋*3sҏŤnH)O8P5v a)v_O 'ިb©ty>) N|pL9Ɖetm0K)C(@tZ7;1um`;=-wD薩N,%y)f؂;yu?WJ+c~8:tK";/Q|NHC#>:Աԣ%m/dB A[ʻ/"o*nBφ!PnЮ9̌8qzji@\~+z: @,ݤźPNƓc5֏AAǀqKXD}F& }=Pω^EnjL?77b}_T9' ͣ/0eD\Z츴x4fֵXTI-P/乜]gޭ,@C<> qAN?s]s׃)" {_B7?gOu@WFklKk!b@K uEǸc拝8B@5Y!?tr@=9>)uȻ7gx>"eԝ V" vIuk5 dQK#y@關dp:6.}C_a8Tn$˨'C? 7Ƈ[y IV0=4 ǢXbv![Zy557`i-mX#Y9o%~6Տ8>u>% dLXߺ+ʸJdXVΪY,P|tD(楶ΖxŜ:;:ɇvs" Q_b+bݖx>x`77]g=yAv޵cP鄽0@"Ǎͮ 7Bgg߰ߔ14f Mrʱo!ߥSVF2q$tU+ (o]nGy7ȋ;$D68;[@Qsa䥳Tp]6AA^ \V)o79d<Տ qJ'aɯ;wfXoFxʞr(+>76pJ.ae R-K:k>'_AXPW<_ܷ(Ce?4K2f؊o}˩]PlߘA@~c+nm?)]Ӛyx./jp<\Z$+{aK{iZđf%2 ޙ0B1 Geq3ICXww uUzie*]{b-RQ"zk ^ѧuky ҏR |=_zKR" 5,7orvOT{k b)!ۜkk ŵg|JB3djP8~0OD u^' pY> (8h!sDh֗"nӲN:5OL?ϣ($|G'?#o͎)5|%gBOÝ'*V[K4Ma씵цx|w.~7{Lyc>pFAS"62b)eo *~| ߋgO,!/.4"߅kc5@O^J{{⧊'[Sy#ÏzoB^_㗁_..1"gvPo{ Z>4 D򛹸Uƥ̛j\,[7=SE޾{ ,!Y#^KI72f{P l,;[Qՙ 5=r3$:q#.A+^nf>}T>èǝ %xɧ+2p_@}XX1-Eps+TYӋȃߒَ8Ŝ+9 ɢ-@53F9ăo! /Ⴛ_Y>w[.ɍh{ 6_>A]!f:W|~*&(D][#K&LuIcqi:E_/%<Ө|KAa?ߔ|x?Oֻ-@Veoźx,1j '{Qwdu!6Ji__W?县y-(:ZSm@yU|[́ZN;7:x[[ u/Q9/:>W[a_@duĐϹ$5iYjxJ$}.\A%r|Rrk6P|чG(ۆf"z 긕\c?6y0s/DQ2&zٹǰ/Ӕ(A3?״YV;/󆆨ˎ ǺAy~Ҷ}@ƜZV􋯛n4E,ܹyW)iTJ *þxHG_ðq|{QOde:rMy\>Vi6֑z_)` gDU3=O߿u#֗ZQoTEߢ?zuqf0H0W{mv"*3+i_ޘVuE_|@, *p.sO>Jʨ%w ےi10O|~m"|wzL)ޟ#sp䝠?%xiw~A5VFq5lޖg&\ų^qq yq&뢎iϦ;^\4E.W|$ 4R|\.2~`~ܬw֣`81:7x]6;e.΂|2 v wGqoCօw+>? Tk]i/o9|~ Բ4I^[tVC09]URbG'PfH:m3BF!j:̦u<[ȅ6p}`#c z/x> wHX/~ft~B4⹥S6ǭ:8w`_ɎU TMW*V/!NrF]c!;I9^Fy]ʼnݥ'Qީ:'T򛶍m+Ui@LURBȯ.@ob R8G~b}5sV3ytUtp,Ǧq+uQ^|itkUXY W,4PuC+'&w"φKja_r~߂uy Uj׿MYN(a u ]lJOAc@y,NOr$MI@ZF\ȿ_R\G2{Bcjƅ?Lqi|*\F &ï_Kx%tAڳwkIK@\8H ׺gCG*Ԅ<(tƓ}+nNFwƨ+P>l>$#U927wv>D>qюw)+k|m8~ƾx#)[\ݾ1yuw-OC[v  5+>>uD>ԢC!n(cqPGӛ >މl4z k{أ,͹AŸ9qtmdQKQKQKMiSڨ6ji9ZZNiSڨ6ji9ZZNiSڨ6ji9ZZNiSڨ6ji9ZZNiSڨ6ji9ZZNiSڨ6ji9ZZNiSڨ6ji9ZZNiSڨ6ji9ZZNiSڨ6ji9ZZNiF-WYӼ>b2F]']Ν:8uvcLKn,-w|i}鄋ǻJw]'#yUwsW72$=c4E||iPmBא+_g\t^#!zqRfٓ~nϊXu .;q-Ugj3R3ώ}Ѥ>v9=wbm EgۼfT(tr:w>*ϺoOeYR~h;gq/ϖ<.Ô R0+3{YͩU~ZzM:-&c g[\iG݀St&yкuB'Ou嬙{N?S|(e͎l;z$j) u83߻`@֯*) zl\h!Ĥ~3J ;~TjPb]yw_W,2Y羖upr{jf۔ )Ew &vHr qXDŻ':|Pw/<Ǯ'&OE:]_{ gvSr:49͉ΙR7e:kx%"jc$k#M!Fp[KӾҤ+/-(9R7u.C-_s޼)yɆWXF:)+UsЈ_Օ^U?j= xvvK{!"j8#KJ^9n Hyy^!*Hvz\Gl^d{(,1-]!G|!ɭYs$4';ڜ~J@kO:_¥ֳ5 S[4K՗'y=`cڸt؊woÁ[띿=0/gI >Ƣ:]r9N|wgXOy[G}%o'jk[3`6ݟx?LOf\qO\=$OgYy|ˉ}1  L2Ov,YQFeXen 5:Wz MW7q.펽75PME{>ioV d59µz}ӏ|>7v\ v, . P_/5Õ|o-2^u0ή1st*V2cx6GwCY~U~-F=yc.W*zݾл]Eϧ잱pQ|/Cg:{uy֐stO1 oq;`fޮ=Zw^u`SV\|P$Uk$*+EnkΆjaּ[-z!1+]K[;b:Ыt,+}qLő!p:d%>1Y>)+m./$S)ejg@CvO^,xy--Z?+>7O?1W7mpꫯ:Q=ǙۚG]wg$U>@wZy-eYkU~y7g׾w S8$ʮ{E[X_D5z>rUQz~c_Tc Qk͕b}MnO1m|/vaS[ U[yXB2+)- +e;#o1zEz aZ-W+ 6UQy~`#7vJL:X},1G/ҵ9Byk:|9nQE?mM 1% %P]wC-CPPKt Tu\xԫ[ak^d r7 bK=J6]8ٸgKԴFk>58uVKJãX^ eN.ݟ Zp?3jf]v&601/e~>1EJ*I /KS~UoGTwXF+NvV2dRqsUa{t@-ۏ͹C_uKV=IF?w Gpf7Lg< ">OݓYwYJ]MEI6S1 o;6rrzԹ-8;h91P1WySIy %W6\T1'wWI}p`Tx3/I]=hAn׌<.]k]am3RY} ^l6O$]XҶM^Auڞv8{Lxڎgi" غYG~ J''F=mY22}b;8GMW{lj񿯭$]qSYGSW+t#O&1T/VYm(-hA ZЂ-hA ZЂ-hA ZЂ-hA ZЂ =bY2hnߠ3#.aj¥d(;>9 bQ ˤy͠VT}I-JJب7 *:v\(e>WҞ$[ö[՞ʀhTx*lanT9P3pxVno,AE^;hnyеq|܆i_['WNb˺2yruT.1v'mA%19KTg4Oʍ]bZ p5ѪgOhn+k"2PKT]j6J?3ʻtwoiq:1PeN3ʔ.`6=/F2ygE,(&r:1j^ +})՜X _Iw[xuSHWv ^ |7UW4v!()>!8M-u !w}(vȑ'4An*o~) Tlk6d*:*h 3ƒ&'.spZ=2% $(FR)I="P 9ijANJfsF;˾s)r>**i.PϚ?ؖ:odoRTeôʘ$Y/F)t1n=$o CmjO M#X@y|-7h|wf,-f=l}.hhoQF@j@;E?lxj w螮ӷm{ ZF]@ӐGBDIԂ>"lWO*o)g}'O _.AY.0sMM9X"ߣ.E0P7T3\W[灶V}eSP@^m=2@{&>PT!akcV,$(ٷ*ݹW7% x߆Jn{1P^cԫJ*>54/fƀ奰oȊ6=2 J1oX-@=U9tZ6SCNr8Pڥh3:wO'EA٨|Ц$~`"' z[_OT@E\E\r t߬|3f 'TpxXσ1NyOdZI"6_fm p QpuX^FTǰ";?uu o@gg Hjxƒs4z^~==`yT_|HͫiAc]!thpK8· oy4eY,FF:|en)P5| hxK TW_T֨ǁ.]ṻ 7*;njޏ.*YbLwPX}@s ;θ(Ǔ;Z@ub 'l2sVmFAie߼'lO 5}A ḨmKf#ʏmh-Lx6iJG_W @cE{#KP=v-#NgO@UsMk~UbUhn_Fikk7TnW[?S T&P\}P~z tݨe V)2I-vsL|swyP0 @lB7!g 4}L%ԂA;op7%_@y;; oA]peٜ)ޠT6j[l*~s$関k@fCtH m:ajAMYyR5Ш   Z +*|AA}ܾ8Y%V}'*i Nqaׄ\AlyP߲C>(s6.։l\$T77PHę7`dR(BHl d) ٣T$IB!E%>|?9s:yNu :刌'> ?@Wnk 3bX֤s (JiUIx^0Rsu>'J;QMh6t5}i^̄y0d Aj`rδl }U¨Wlˠf{n>.VGU# r]~D>4 1DGmvSdBH0h\B_{ #9KK'="4Ҳ# IiO+ ЧVlT@P!}FЌq_2y1A(w\%k,@7tf_$VeI6fߟ Ã@NҺEj&I= X ,..qLdNîx!C#H=]iq 83n2~Kʆ{t%(&◾$ދm5yEp׈ 'P;{J6Ȏ盪,SVW 0Am\lŽQdjMO- Wp{qd/5㦀{ Kmq6|XQ c\ a7 j//ֳ}LOgO@sDCtuQ +p~@,zg%š(5ԽYy(:&*R08/li`pj҆0> -w?ȺWh 5kۼZ{oW@|>f\ko3N].p&ҏ~"a~ -;md7A%BD2VZ8{g uAي$0\89c) h+ζȜ SZB~6Lt6y,T^/i*!C/BEćYF4!:w>8[- I73ϗ/iJbi[3*م3WOTZUFnKy0.@.m:]SSow\[{;Akuk(/|2xw|m o5\E4]:gU0@ỳ6W aA 0A' -BW%ݏB& c'}x_LZQ7`7'ic,ݽ5ZX`ЬyBP?PܸIF}x>k̏OP'G!~QnhOb1] \Y}/KRWGEYZ;E}nx&>!Ŕq)sc7J93"V]GddZ](J?T w. |U+ eP)r]}^+K }{/ G[az5O8@,$k?9X̽&A~mUg $5ud^W}Vys pm.&b'Pj XN]* A߼F| ?E O7E#/`4k2<w">8 A9GADgtɕpVVsvPEEKmtG6-evX|Z\ vtAѮJB6=kH!zr jr_+2Z OHduO MlM+ ۱Lf}XD?YT UabǏ|d>7Z5mf\':9D_=z0SџUYD.Ъ<$w NjJ 3 ]>Z `QO" %qaܝO@l)4Kbڞ rVۨAo-u+~(>_s5ً̲V@N^ʡO9Tn5 RAgЄi tf^I =im 8ڷ@Zt3'(9M& \n#]PryGń[?Ϸ*OmWVBE6) *v~d]g |JF}C?2gT<B+cs=h_6 8NL{ ~5RO!rp>ҏx Ȃv9{c*L\5^goϮlGUOl${uÇ^ތdӠ˧9 q0L䉰u|AMl cMڃ脏@l8=?V٭ C^-^āř U5w)&& 2A5h(<C7z@WmZAnp͠1#zx`[KHDW۝0/Dڰ ɼi kL&~aByًf |k%| D~Bٴݹ>@zS mnԵCEyȜ?~gg#>T^թL;)b%d`O܌ NaQQig/Mh06Nck4\pJ?SylzU2O, k*Ȕ<{,@;}xYh8nC̲A/mCG"ٞ=9.dZ9i7|QP2]zZYbE@Purz䫿Y4:#ًH;T4r (oRiB2L<1F^P ʄ6 DU ~6l,-_* T &;уQxfкˁuO~ͻv}wk{'^ybC"#?zݳAͫg%Ҡüy+;;M4 ;+2U>)@RKBK/RKKil@Tj5^$a-k(SL/o~ D8]xW OR@ej.<[Ɗ̣u6\3}}1>w670O#}nJStJ/x#ʡw}a[&9og%tut ;Fyr;<Jrh+EZ|))ɫM̚JȽBe5hʞzN'A#,+w/Vt|0׏4u/@'Aڦ27^)wYjR&Kg[%ߓxU Yh_b<@sq~s5p9?ӁRvnu )M/em=Ȿ: GzM1'p+D|S;አ>9tNHUJC({c`щOy"~!Jؽi Ake1Hiw'Q7 \J:?ї*Y(_3BY_#(KkUS9>N#i}"&DZFb_Kc,.µuD7%.Y<O6.<5< q(~erZ煏@ ]W$}R} ^8* 5ގ6;zm@Y5P&~jG,M= ی?A3& TGݙM,imEDf}>?Ӥ7 bv… 3}- k}⋝'Zno%VV son񺠟>;K,,NqCu ~+l@=Aӭ%D'.K9~*9q4ݏ'wGiw4j?/[E$$dmdz_d[R=mvv&&p280\-["ۋ@V:J<nyQ/V A@SdyVގFOk$oUejL<BA\@}qFK"sB$4|2XxDCtmz [Joˆcfh`C52'D69ղ34v"1\e嫵fѺh D/-o B_C33+ȺM-J )R~A*Rz+mT+-J::#6䇣q|X7GRKJz۳ݵ}[2Zq+…-wcQP4IFA QMaѕv]Y?`SS}=XT-#a,76A|W +AuCTKl΃ntLk` J5ҷTN!B=X Ad_Խ d wJV #H56G_&*y #/k.ZK/oqz;)#}ނ/AW^HsFI=x'Fhh;Ӏ|5T. )pvҫ^HGNEH_Ύ3n33 njcA h.JpJ>@'0Je9tv3KFtP̡BOR9QEtiU $ؿz,:sZ6c(|gg Ĝ#_&@8&@й_,o#]^&,{`0}Rx4+7B-RȐX,N(Ǧ8s](GDmjjlgG05'պ]AS#kнzH{>ΑrPYרGp2QV37'o2&CnPCKyTP^ew0ГGɣQz)=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=ytғG(=yt<')=:蠃:蠃:蠃:蠃:蠃:蠃:蠃:m:x@lGcPuC&1 :N{8@z\=){-w+f`smy7c@y2c]g8s;$-4כ" *?דzC5W?Zv0G%RunhUPS>S56k0~ h|J{؂H6;lw5'ߢi&oM\wxz+Ahĵx>viFV {ʟ7=Q* % N^D^nͦՍg2\\3v| -kn@aLؽ_@-_B?4?.tSxy̫m g aнzkO , q9mAX?4kPV(ԖUBa SX@+4P2,j1כ 秉b#G@aԼ\mɑ/ˑ[2x/.|*eqj ~34HR/.=mHi~U  Abvm&ik4Qæh/9wYxGLu[3"ru2mb hѓEP1qc;ZCāY+omrͦQuKC*TpL:3-j+ op 2j -}eEq}A>j ̽KHdRvʭB V. B363.к/'kMo   j'@#J+-FJTzUq{rNB6:־Wewjq9o$vU( u#OZkЮh2pNE wufI.PlU"xwcHK8vFs՘sdi^}c~NriR@YllB tٷK~u~^pX6־'Fͺ7ofXe*=OǏТI<)Jm-03Yel{i~_tb ?xgP#uZ&eBb`M C%UԱҠY$o6A;5a_*#*Í'i .Nr;.{PHxxT6-zR?@Z5-7i 7PwieZV~@= lYwnjNzӶP(ŒލHpK]ly&#0MI =tnc|vg> D YLچ@+[ ]Ιnq6sq]P <5 e>'Бnݻh_,='wZ^( XrRAI}UG$yA =di{krP8L og_̹+? P)P0p6Z=[7|@rmȖ]Um٧*u5 \,@3VM`Ox\ YVSA@T8?> ʱMy٠ؿdsi 2a I +?qϮorN55jNѠ5Э|8pm'A~Hf^JubίUġ|:a52J=`UlW[[;@P2]g2 i{Ł·\d\ڵk TF9u-{EjZEZt@+=̥y7]a,1 ¾r)?uy10"22l׺@^hஏFdA֋eVׄ^mY`hn=FWe _{W3`p;I4t1(d> %t_6zfnMk.Pj:FAAfl%J޶qR[d}e'㚬jad޳ 5y@ 0evr,"w)\ϱgg |O>$"UP^1YCowЀ*~``֌J J^TŲji5I?6@Rz P+ca* 9Caj@G,x;n(ӟ ,z1@u?>_WN4(ب\~", yk,ʝk.ciIORxG@hzf-@|P=v%z T#;`M¹cP Nh<ǂls}`]⑼ϢDžwǀ~aԫuTl?joc^[;}x9m FۥryC)@((LZ5A($?nպ Rv&NVVD`2G_(/.n8gmNZ!t_@VyB2 (|{WC %of􎩷€Jsů.;c+GaP#_Ϯ.OP a]߉{M~:yk9ʥ=8K176h`@)3Qrid]E~Xh.Z"ËMSH)*B 'w4(?Y *&æPΛr6R QqPnt2R3@#1DjlvP@K+`/RZ@@h-n``Ů8EPxYۖa;֩Y&2>حqT;C&óAFRZMC0f\r1 `>w?f,`ϗp1t'Y {3ōe+Vط vL`Nqր)]/E| ڀ#\Sbht0vzfXaHӄf~)b *WK_Kĵ.*_!,S oKMa4gKI *N͛9#uDk'ms( (H\he;a_ P8#K# 6wv tbn&1t?c*\6ޯ?Ar .D5"Wd)=bMFE7~P0l3`Vfn$rZyui1<{,wZlEY;@XyxRyAnxH0h:0 1ךj<& ^09}q k8xl;~Dcħ<o IDXaj;w؍2(xp?w LwL' ׊bngWဘ8:Գx#Mu#c&\bECtis`~̴ײFg(@=$w-T O.w?lM Pwt3u. X1A["` 'l-y?ěYW9j [Cqe%Hۮ{{B [*LG=4\$gʱ"SkܸKങm錘`7ЊUlTxF2?4}@-hw=}H_tf!(kOU!;g0"o ē7'Ҁ%; #~~gkOU0 0`i{F- g'ʇIhּ?4q a΁`}@%\#r|@YLn:u, _bcWu" %Bԁme9uyħ-KikVh"߆8Cnܷ5*`́K8(zyҕ{gm;ÜDL@ `#4+|ԺKZ''~rWgÀ޵_QPbyfY>x^5*y!Rj`MxhtW(BO`S[7txe5lgu=_5(F$)uGN7,ȎxǰEQ Rf_2-:yu[\%$&mE?XUXj ?n兹ס<6^=Q[C Uy|(́:ۯ*8*4מs>_-Yn?{Ͳe& [|zB e|j#AŪ$)"@{`X%SAgPdN+_+OFct>B@ 6fd|P~jeWc@NV?, rJ͏v' n*t @,aLx jl = *W6'@ ՠILDO35d5kA íG@lA53 9#~R+BKU K Luֶ҈[ `u@)qh2k|7s.+ܦsQY>B׻@@<ܲ[/Q٢8PksA=z5M<<*;/T'j0}į\ܻJ)GE&@3Ozh<Ā)^ 5AɦIN`?;d\خGѠ#xc"dEv\3j?@ɝM:ryd%P6lg 1 ?+:MuNCϲL|˳劮%c[P7/#N5w $Ԣ_( nYٙ\-؋#n{AY/;pĮ! PGZ@3H{4P.~M* ["Lq=9o:=.{Ra⯨xgZZU~с 11lR+?=ZA 2Pq]@2ǔǸk\fu,j364;~dL(,HQ^kh݈%b曹^ I] ѡ@*_{P߃[n>G\?~GT0R/2ng}ħHS}ms 02<#zw"\5@4=0 E<^Z}0T2_MĪA~GN4R>E w ~Fc=#~Kw}|RJ4|/:' yz`%Ps#k{>e\/r:ӑ~bKURv*hۧ -[v`ge[zj.;; CyN0xzl"]}j0av='-=@v< 8@_CR=p=;mP|anxJ.vwNŌl#6|'hwz lثo.BmË7A~Q9߽u2,a!K}YH ̹#s: 1`KIOfOMħ#uL`H-!,ݪ-̉&恤26 jֻ΃@&ͣߊb@UT:Uw_]T7+A@-N*+1 ȢZ].,Z=h+J%:mRO1S nP04}a oYF@+ eUgw>u"/X30S"Z{8b@-G/DWf闦r (5Pc6@s2l(&@=@y*Q4UE+ .1MEYif\N_0ws޿ml3ˇ#sSZ6`]02΃ץAܾ4| rO)8~{o<,#a]`@}YrKss A}v Q t;w`Ru" <goV\I)1 tWnb/(E.yB I@aF;o]%h"xa}q`a LV^\@\{ j |xO1Ȥe%RHh 8W 4 =?Dd2(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=i(=iLS}/|?t0Nz9)oȿ{޾^u 魋 `c!^zm|fox=5i_ǰ<ui]FR? k5D66D^CCB}y7o7}Zf`+OOHE=Z[G/,F78 L/*%ƏQO _e9v0&]>?yZϠ[9gi%>2㞽¿*Ǫx7FcP /W& K]0b\p=6WU|=i3,>{N/nxt<H {{#E@#m؎G1Ot%f닫 a?{dmQW c=MHu1*: Ä)׮|_}v!T;Oxb;-en-Ύ\ 8x""zOl}_jDmJl{$Àwwf+6L즼 ~i3d`\/K|6F+<)A56R;d_vo_@~K>{ Y GvgTy6ޝQJ*W Jp3\ʍ.HXEdLzQ/SqΛc=ʑjIj\49>ٯYgjZnrD^uZ=a.@Aī(ʷ7#b >`k/>k[ J{83 rޫzqʣ|΀,~5o^>eDŽ 30i|TQ|lm=4bd^%!qjUv?;3U* pby`U !;=w-˴p A˕'u :Eb [7Zrߵf}}[f̩hBZiK˿9H7v㑏jxJ{pP˔#Kv{::vS"lC.WX mqJx7$ZM#3n?l8r5FdqMVΖ]ø]3~L"l' ߚu9?| iahŗlv?՘ 4x?c&oWtxqɾw梡zyhYpiɦOl9MP>kcl|W?XkBuwUM`*r7j}6Hx*?x?Fz@Ijș2 G_>/}6$~]a>RS׻w?SlbҔwt2 MX{muٮo/9o=W}O7=LVo_ر[˰^x.-v« N -Mgn!.Sq\;#;.uI#hm]d)D >e3p8_ u:|~hKZoY +N>ѥtQlY\mQFϤY Nzl7zYгaɿ%6>4$mTcSؑdC'DExw rkgxݹ~dzߧʊqWc9u4|QpSZOL}qhͽQ:+%ꔾet==r65_i'5MLb.nOHfl7v_{uY籅8+ѻ*RjbI= {=~l? 3:þJR|;]]CZG*ftHd᝭wf!ճV uf=oXYZFnzxs/V]lRí椲cU6,a2,x/#zJ4hʻW[~}KS+;3I餤NI7ܾ3 OX/eZ}"wjB[DW2jo'DRH:nV!/Z_DON*}O<M8̐mO҇딛*=7]o l`m(sȱ9?,uV|_&ֈyV|z@)q{jWy IŎ->s@2owales@_[XJ@A]zKC[R~o#Oo@P/mz옿#r/ tAtAtAtAtAtAtAt߀=yũmq0砶~bћ,|c4W,?Mրlg@88ʇd<y鹳X|߇{c+8j=*Ň;weݦ|qU@#8`N Y~h_UpP| 8<̴{p Ý>5pXl~,~߆Mn:8Vav_́l8<FB$$$2&3g}$$)2 i@!SBHQ)D$EfzY]߿^wusp ^Es;q(ӛtFj> Sz>w~8;=T,@J?a+]@{}mɖd+&M9Jn E lZxg@>WEt<H=c Zݺ?@zŁaPrI y7In@s HǙlՏwjD87PW2t*Tj@ jϮTV/@)EdzaW5X# vDrH([/3T4gS  (<P隭{䈔x-do@|:B8 !rΫj tW3P[>ެr2)d@uO9R-z\ɞ 7x_a_>8Lּ¸}$}tbbxT\5~짍m'@VTrqt"P+# də*$6Mm;_3nШ+P+fuYT g(z & ^ȧax _7; sKZx΍TeY7g3TKޥ}؈S2 <_*x %DŽ1PQ)+~K3F& n 0M2dŸAKg-m{m BC J+o3zRqv}Oz6P;7DH~Ξi , ؙ0/#NQÞvd#[cbFƒF嫾I0PSKdu{^vț-"}273x:#ν; 3-ol"N=:?ЪS@0id],ZNPQ}"Pf7gsr7+{0[gb?5ŹEb*=t|sF˄!oE.X@$J7^ a@:<'j\ͥ@ݞpxyn^_/:w{D@E3ř=˞hs39;kئr]R3{٬2}S$~Mn&X? !5z^V@~*m+lⅬ/@i: yʫӂ8W5nj"+)BcAЖki=@&g޷1R$0q!bԭJ%GaQa':Kw ڬoH9jumO'ǿL!.7~C R}q^<<5T~8Q '4[ޯ(?%@th ?\葏ςc#@Zry6I\2GY:J=fo@$uyq,>ɋu~ 2eW dxw ž&ȫ_>~D()5~mY] `WbGiAWkd*'O`"ZR@JIږ@7)\o&Mo%2Z۲mhώlڤ4UHqG+ӱNeSMԧW#{T3GO]gv_;%Ŀ`T}Q9yuJhExҹqv0Ds9_1t Hg44 ?` R b Uώz7UF]*"'zR E|dN>Y=d)êv'D2\ anhhSC-n6ExMCc:yݶꟶG~ slko -AqJNsL0A7# 9x\.Ujbvw"~A1]ȬD$#ZJf1Jrh-o52a^U^ΉfQ_=+kĘT-FWc? Z{%y_2^͆k`,^W@ݒpkdI_~ߋ.UǏ8W6 rb~lzԁtӃ yL#l1xt;R+y/#F?D͟zݵ;9 @=S}7y{݀'<>]Ԙ_7|̈́K& K[QA/ #(!LX h+ t?Fhw.Y)LH3%s@fMr=cT:N䑪 +{}E )[6ox'uIs՘eȧ;)|{8}y4qvwx@FL?E Zl8{Nq,61ϹY`:/^ ~l wɨ#jNw E8:BuSO+Z\Z:\ԏ>FFuB@yuYmcalhݏ@<(z&qgyFşZsF&cw;a0:kKzG>ȣ4^.{K_2^۝K +#~zqyY 9|&ɵR56OZvz@:6ņ`w8ꬭAK:T=q&}B) ΂~b\ܿ"0XYݹg-|c޲ ;{Kcz|9LŐSvɬzY缞^6:%zN=󷁨xt)ߧ!7ft k\ITQݖ@l̝ގ8' A~~r%"Ohu -;tϿ_.6~4P }n љ_VQ'.uJ +JP/%~:3|K|=m-79ji20ozBeuTo;p 6b*5o=&l:M8)-aX7^9>q"\,4m8o:R/' _ ԓ=؉ujכ Tq#kM{U'/ BXGgT"eO(ԩ]@/~~ ēWC}m|WHG>؟7d$#yD[y›E5&D*y]տ6yA2|5$ެ!0IHԅ9*W$g}?<ìYxB4C6#EgJ"3@qDru׭K*~q;腭&\u'5.8hN_ n pC^%fbE֖#G{mEin GY G䣆ʩFo0;*I+vI1Br4 uCW>v9Ŀo8#Gy<`O(-@Y D֗lC͵ymM3z`ElO޿oį?Zs<}^fÿa. H<{ 2WYWӎNc`Q~ue;@ l[Ȯm+Oj~L=ބ%)qwB>S+0ݠyig=i73kv,9ݢ8YMSex䦉0%2AfBo GBAM˵G[-󵟞yϺUvɱQ9?ZՋ樿}Lee]a_\e@ }x:/}ժ臇R  6E!?_WTީTϦvnÖJnz KnRDPg#.?btkpc]<]8ggw)V/ p C_=-qѫm#c[3mm"MěS}@'F_pF ⪚= xFf@ygƜDI=*zC~Ӟ;Ѻn#8{s?r"y;PRkQ>@ŞU)>T^ (Ts_L5Ju/DwH9r2u0=48=e Ԅi-> GOoӗJ=vj{9V|މ窀My^TrHuCgaDM403⚆\L&oj߱IE4|Q왨CτniD?z/2Ȫӏ>s*W `%oہK||Rnq{&Ѫܹϫi&㑃sL@+nJv09#N\I]QjgTokBz`|\}lϮ!!-<.[";ҲW(Zk>@V.WbǍ@U85(|SuOí!¦Dwk#وuP[)OǏ(3:?iGxS2C} ##Qk?dž(Mͳ[b?:S(G-,@8wp$ )|lJ6kD:_Rz!0CHYbo2%iYy&oc=ӈH*(rPp{5q_++4jy<΁_ϑ8ӮϢx0'r6ru~> FA4qbM+ve:N&19Q9YU)v8kϸ!n,]o\G9}UEݷ46I컯OnpJ5^ũ "k-8M _/F]{.j#ϻr+!pi؈ߗe%>zǫ&w$'*5Wk|F6#x_5G4Q Q={_KEo uJ q ơMu}V;פIwkfqYBѼ9/:egU_f[ Ύh}'|>/6k$} +Y<[s=葃s=ݧP[D.Ī8?oV.; EIo:Tpz{zɿE_!@}Lވ A?9|v߿Q-zéGw&>Kf`y^%PwfٲLaB ~NiF{S{ΡKۊz!Oa2&w{ȯLDž:W)YHf`$=˟lo{VyHf1ROE0}_[P?i7nަN;`?jNc=Ux[lsгr$dۡ$|wd!2 ݩ5mY@<l^\p? ouHHڶRX]?~Y譋+дpb)~S=̇s}UC>X U ϫlNu_qu# gKt /&{P̋&#K" ȷquƓIK8S;/(9­v!_h<ɍ[t Z2&ƆZZZ+dlh]ZBƆօu!dlh]ZBƆօu!dlh]ZBƆօu!dlh]ZBƆօu!dlh]ZBƆօu!dlh]ZBƆօu!dlh]ZBƆօu!dlh]ZBƆօu!dlh]ZBƆօu!dlh]X8`q08`q08`q08`q(sneL̨ b  vrڵ|*}K*wZJiQZh<3bYH s?ϭ-! (`!$ GsV7qB'_Go04.f;j݄sN`2]5^|fE Uʼ*3?OB2 !_%ʲr*K ^r k'><\SnVYDۮ4bћ'upAR$g5m db_d=y SI Gor=]ȑk\1Z@kNoA7[PE-b]ksٯ0&fa]frnUp "|ҋLj(S) Du~vo00f!&\ߎF/)ʙ4V@<\f bVc@hL[,e/-k呀<@;י?@-_kƆysS5<׭ Vq֢4ٚI*T+[]0K~=2h}W7}L=늽"N8:F~^-ތy;${aq\4Ix-s+e2<Й@[|{w_ my_نdk3zƕ~Ş\ҷ*v¼>%ȷ~olz^ VxЬ4PcMQaL@9~ Hai/MU<^{!Ħ(ض;+kbqζZ*qX}(Q UDruL;4`]@ֿoHdڴnM]g1pa~h[!] Fa:/ yƣY ^ t2Iė"o}xxw#3oD@_m81s@M5Of}D)<@͖O[6Hx -AYuI sz* O`?=hO&pNJ>[m/]V4 j.W"f,9Uyix]6tn9ߡqڗLYD!ÑanQg@س]X8V2no@>){*DOgxyePXXKW߶b@7}}rQ7r7i.?:`8ϑ_ u,`8/bJ@<+T Fn.I憤~a0/|׭e(^ͧLv[|$y&y_Ɔ#.Mn뛀R{8C}mR8קcƚGEҪ@D]( ~=*cy $_aSM~7bO3HAG5W> U>4Mw_ u|4W'{1%vQze/g!j0mB<6>vA\ PF\{>G@f_N*ϖ^ B^^Kz8t$AZc#Cاӱ =f#}u [uOj`-CvhU!ЄʀyyhKn,n{ZsF̗X~ldqn @<=هY"P0/[|yW#΋#wN.9v|7 ;U phͫsIǭzp]a>h._QO~da| /F%dt=?B՝@UN݂ujf_8r}X8KKM/ӚPDPetr>P#WŁ6S߲LQ7nb{8 sH{<2ȗ3y!ۨ|R#e?Ogo@n Ϙ( ;tAn8ؽI{ {0pPv)ucws293@~` S}Bf٢U8e1b{ -yb{6lXs.ZDYyuJ;\1 Vrtj4#Ul0?(Y~O}>]A1:)g98x" wJV=<:XZ+Y8kqIrQ3_W ò>!Cۛ#~Mq9 YɋS%/m;zNOMU>. g*n JK*g6e."rk10|ۆuLJׄzds&^1W,ՑWä2Lح̱:*^34)'v7_''JCϴqtf)\q/ȘHUcVjE/pN;j#%9;CZ 2 d*J@rSR.9O[MZg#r+)pږr?x?>ߞuQc)E/BYG-x,kqY2cy꾎f^@r/}ќ4j[=QF(i=>~v;(E{1G'P*~>A\ܮ}NM&0yfeΑgǮ1@+]U\yu}x7⟂i/  }@tS<9%?.c]Sc+bM[ĥʬI"u+¤-*T"s &85uW!>OCdxb)C3'mnQى5o.45Xw]3VAvRP]j|*K6}-m7nn]@'FAM5qxǥ$= >F>^":lt ]x'?.f;s5n™8_hb[J'@*lʋ_PSKj /c-m}ȇ[.-OU˯ħ@l6n~$̣W.q<@'xn8U]F=#/hz qcxhIJ̑>W?E^g6l ա7s@-^}fג၈8Pi;én s,GRZM`F |w0PKyRV-,&QK.ڔ}'n>]%prN$u/}1ƧL.^9:YwMQV)eUuL8g\n P_k!z[!^n-@_x@w<_mFiy~x+G:NI%rͽ_>X;.oZѧJK%{ݕykǽwq}NܻqwD6وyjD@/]'vLZf< (qЯ̈́ 4|7RT{Wk`="Խ:%*S*⧣k*<-7L1 jQf3P.Nq>a3?s~"+a+*mC%c! )yສJ%_-0>In#:Jb$2!(MZvlºxd^Ds} Cˀ\8?^g1mg<>_NkNˁx{v }Ye`N (곻`(?X觎>l]fe+ng Mne䵇Q{9Z'Q ߫ozBNrhЏ o(s#,<ηF}ѹ뚂-&<JbK'J "+׎z|Gpi(]йqd8km\G0' 6/\qNbuZN<)CGqPE\r1 k?;ew5,Z䦡X5M%ܨ3]ӌD\rܺK@J}D~!r[a_#v`+7O/Eպ`%'m 3Uuޞ.'_^_ݱ E=,Ex-+Í][^ڈ^ĹajZ:btuOԕ fW`㞉# ?Cf;--@5]>Qi;S:t«K1RҝLG~ԋz`]M#m/Lv]JGE?ԑˋzelUN`]&95sQb%U.=)6X 8QX *sT/e?iЎb(+Gr|7!/j bG]ՑL'~^x/x+M+CC7~Ԋ.R!OKG"K"VJ[tnHŎ.8"OǴsuCo 7O4=z~jv,2W^&,1-_zda0{e L=3ٔVj~Bq,lcyď7VǸdOnxλa]+VyzB:V#'y湃~%;BO[+ /ެO_gDڳgcmɾ5emm=Rv④{Lgs@f8щlAh&O:_uߓ_u`!cq$ w"cf b^Zh=wcܯl}ţtUQ~tԋMux=xZTmv6/nͥey9.6O -1S-@w7,Y/3|4ce@7q0Buow1 ܆+\/_ZuIe7d=9XQ_%WinpFl\'j~یWsfˈ]"-[e=I羞Ylrb D?@M=.E_=FHGk9O)@UM=*S>ey2JwJP, p@lI@N11\t}Jz'OOh"_>58Q&9X{8֖Kg"Y松 ynOdt$oCЪXv?}>I% Dr: <槑~!uCLƀzOZ}#OW# n3z_/Xlzx 9m8P,tI ϣ[ ȯ/w cS&B   +d,dZ BBi!d,dZ BBi!d,dZ BBi!d,dZ BBi!d,dZ BBi!d,dZ BBi!d,dZ BBi!d,dZ BBi!d,dZ BBi!d,dZ_wY='^twjky-wT}16'gg/cYh|c?7!|cy}M}j84;yuϿS.{yVNwӼ?1|u/=d$֍ky_Y>x?ZY"JVBjnʥzqYu\ThH8rhzɶ x6PS[Z2lI{^~G%_ډ0tJ`Ɋ[m&{Eq6ό.ubo}jP~p}ba꡸kϹ-7Dry{)b$Q@s"/lNUS=SGɏߤwrѽb=/7jNtY˕sqӗW}Z4y'LTߧEEuȯdB MOGi%J37.֞ͭT))rBlgO-`otU\kc$jh3Юy!xe$Y8]>u ]ozSE d?6Y,=O$rd(B{2N"kڒR^-ȕr])vq(sJ!eܻ^"*@Ⱦ7jr aw2LC,vO~\?GV{uϑ7ݺRycGiw Tj!+Vq9r!Wma#^|aVܗGy''IB][L[$Xff lY9lUm;\#Bk{|utIׁʻM>noyU}JOZvmf;72_Vg'J ==SRֈvgc[ѽkˣoQGR\tÀfq]2];9לּRzU;}uN$J~V8Eyjk'??.(<v/Cvwʷ'Vu[w_>41ܼՆ˴jKD鯸xl@/:\&_lZB|`k*"\ % /iGHoտDEkw42񨅅ֱc?/і~+2nM_gVj|γ}bfW~NQYk%db'=블]A_)Rݯh;\Bm1=52qh!q+{.]=7;󤧢ԢGI#!f!VMQLkl*(=me/F1Ƙ+(88ZV3?cuՋ+3HDD _Z!֋_#sZLȊ쟽cq/[lw՘t*>K=3?osE%lneOCKSh' Ki{-+95S&^vkq_iol\P&?Ĺs PY`|ڋ^rLCO0ȳ,#7}_TX+ЮSJ[;'U66/E3s|v&`pbRrCO( JjJן<\f2VX)cyJNϯַ9=W]}hB};ye[ܷy 8ߢ%$Kum*ܓg0:g3JRſw _ Zq-v3&㛺*8V[v>8Vc#^7of -I ]@-_u\/~tA%oyqǜd=[e?Y&c nlme/inst/scripts/ch05.R0000644000176000001440000001706714251721456014605 0ustar ripleyusers#-*- 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(cs3Exp) fm1Ovar.lme <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), data = Ovary, random = pdDiag(~sin(2*pi*Time))) fm1Ovar.lme ACF(fm1Ovar.lme) plot(ACF(fm1Ovar.lme, maxLag = 10), alpha = 0.01) fm2Ovar.lme <- update(fm1Ovar.lme, correlation = corAR1()) anova(fm1Ovar.lme, fm2Ovar.lme) if (interactive()) intervals(fm2Ovar.lme) fm3Ovar.lme <- update(fm1Ovar.lme, correlation = corARMA(q = 2)) fm3Ovar.lme anova(fm2Ovar.lme, fm3Ovar.lme, test = F) fm4Ovar.lme <- update(fm1Ovar.lme, correlation = corCAR1(form = ~Time)) anova(fm2Ovar.lme, fm4Ovar.lme, test = F) (fm5Ovar.lme <- update(fm1Ovar.lme, corr = corARMA(p = 1, q = 1))) anova(fm2Ovar.lme, fm5Ovar.lme) plot(ACF(fm5Ovar.lme, maxLag = 10, resType = "n"), alpha = 0.01) Variogram(fm2BW.lme, form = ~ Time) plot(Variogram(fm2BW.lme, form = ~ Time, maxDist = 42)) fm3BW.lme <- update(fm2BW.lme, correlation = corExp(form = ~ Time)) ## IGNORE_RDIFF_BEGIN intervals(fm3BW.lme) ## IGNORE_RDIFF_END anova(fm2BW.lme, fm3BW.lme) fm4BW.lme <- update(fm3BW.lme, correlation = corExp(form = ~ Time, nugget = TRUE)) anova(fm3BW.lme, fm4BW.lme) plot(Variogram(fm3BW.lme, form = ~ Time, maxDist = 42)) plot(Variogram(fm3BW.lme, form = ~ Time, maxDist = 42, resType = "n", robust = TRUE)) fm5BW.lme <- update(fm3BW.lme, correlation = corRatio(form = ~ Time)) fm6BW.lme <- update(fm3BW.lme, correlation = corSpher(form = ~ Time)) fm7BW.lme <- update(fm3BW.lme, correlation = corLin(form = ~ Time)) fm8BW.lme <- update(fm3BW.lme, correlation = corGaus(form = ~ Time)) anova(fm3BW.lme, fm5BW.lme, fm6BW.lme, fm7BW.lme, fm8BW.lme) fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont, correlation = corSymm(form = ~ 1 | Subject), weights = varIdent(form = ~ 1 | age)) fm1Orth.gls ## IGNORE_RDIFF_BEGIN intervals(fm1Orth.gls) ## IGNORE_RDIFF_END fm2Orth.gls <- update(fm1Orth.gls, corr = corCompSymm(form = ~ 1 | Subject)) anova(fm1Orth.gls, fm2Orth.gls) intervals(fm2Orth.gls) fm3Orth.gls <- update(fm2Orth.gls, weights = NULL) anova(fm2Orth.gls, fm3Orth.gls) plot(fm3Orth.gls, resid(., type = "n") ~ age | Sex) fm4Orth.gls <- update(fm3Orth.gls, weights = varIdent(form = ~ 1 | Sex)) anova(fm3Orth.gls, fm4Orth.gls) qqnorm(fm4Orth.gls, ~resid(., type = "n")) # not in book but needed for the following command fm3Orth.lme <- lme(distance~Sex*I(age-11), data = Orthodont, random = ~ I(age-11) | Subject, weights = varIdent(form = ~ 1 | Sex)) anova(fm3Orth.lme, fm4Orth.gls, test = FALSE) fm1Dial.gls <- gls(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, Dialyzer) plot(fm1Dial.gls, resid(.) ~ pressure, abline = 0) fm2Dial.gls <- update(fm1Dial.gls, weights = varPower(form = ~ pressure)) anova(fm1Dial.gls, fm2Dial.gls) ACF(fm2Dial.gls, form = ~ 1 | Subject) plot(ACF(fm2Dial.gls, form = ~ 1 | Subject), alpha = 0.01) (fm3Dial.gls <- update(fm2Dial.gls, corr = corAR1(0.771, form = ~ 1 | Subject))) intervals(fm3Dial.gls) anova(fm2Dial.gls, fm3Dial.gls) anova(fm3Dial.gls, fm2Dial.lme, test = FALSE) fm1Wheat2 <- gls(yield ~ variety - 1, Wheat2) Variogram(fm1Wheat2, form = ~ latitude + longitude) plot(Variogram(fm1Wheat2, form = ~ latitude + longitude, maxDist = 32), xlim = c(0,32)) fm2Wheat2 <- update(fm1Wheat2, corr = corSpher(c(28, 0.2), form = ~ latitude + longitude, nugget = TRUE)) fm2Wheat2 fm3Wheat2 <- update(fm1Wheat2, corr = corRatio(c(12.5, 0.2), form = ~ latitude + longitude, nugget = TRUE)) fm3Wheat2 anova(fm2Wheat2, fm3Wheat2) anova(fm1Wheat2, fm3Wheat2) plot(Variogram(fm3Wheat2, resType = "n")) plot(fm3Wheat2, resid(., type = "n") ~ fitted(.), abline = 0) qqnorm(fm3Wheat2, ~ resid(., type = "n")) fm4Wheat2 <- update(fm3Wheat2, model = yield ~ variety) anova(fm4Wheat2) anova(fm3Wheat2, L = c(-1, 0, 1)) # cleanup summary(warnings()) nlme/inst/scripts/ch04.R0000644000176000001440000001617414251721456014602 0ustar ripleyusers#-*- R -*- # initialization library(nlme) library(lattice) 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 = 'ch04.pdf') # Chapter 4 Fitting Linear Mixed-Effects Models # 4.1 Fitting Linear Models in S with lm and lmList fm1Orth.lm <- lm(distance ~ age, Orthodont) fm1Orth.lm par(mfrow=c(2,2)) plot(fm1Orth.lm) # Figure 4.1 fm2Orth.lm <- update(fm1Orth.lm, formula = distance ~ Sex*age) summary(fm2Orth.lm) fm3Orth.lm <- update(fm2Orth.lm, formula = . ~ . - Sex) summary(fm3Orth.lm) bwplot(getGroups(Orthodont)~resid(fm2Orth.lm)) # Figure 4.2 fm1Orth.lis <- lmList(distance ~ age | Subject, Orthodont) getGroupsFormula(Orthodont) fm1Orth.lis <- lmList(distance ~ age, Orthodont) formula(Orthodont) fm1Orth.lis <- lmList(Orthodont) fm1Orth.lis summary(fm1Orth.lis) pairs(fm1Orth.lis, id = 0.01, adj = -0.5) # Figure 4.3 fm2Orth.lis <- update(fm1Orth.lis, distance ~ I(age-11)) intervals(fm2Orth.lis) plot(intervals(fm2Orth.lis)) # Figure 4.5 IGF plot(IGF) # Figure 4.6 fm1IGF.lis <- lmList(IGF) coef(fm1IGF.lis) plot(intervals(fm1IGF.lis)) # Figure 4.7 fm1IGF.lm <- lm(conc ~ age, data = IGF) summary(fm1IGF.lm) # 4.2 Fitting Linear Mixed-Effects Models with lme fm1Orth.lme <- lme(distance ~ I(age-11), data = Orthodont, random = ~ I(age-11) | Subject) fm1Orth.lme <- lme(distance ~ I(age-11), data = Orthodont) fm1Orth.lme <- lme(fm2Orth.lis) fm1Orth.lme fm2Orth.lme <- update(fm1Orth.lme, distance~Sex*I(age-11)) summary(fm2Orth.lme) fitted(fm2Orth.lme, level = 0:1) resid(fm2Orth.lme, level = 1) resid(fm2Orth.lme, level = 1, type = "pearson") newOrth <- data.frame(Subject = rep(c("M11","F03"), c(3, 3)), Sex = rep(c("Male", "Female"), c(3, 3)), age = rep(16:18, 2)) predict(fm2Orth.lme, newdata = newOrth) predict(fm2Orth.lme, newdata = newOrth, level = 0:1) fm2Orth.lmeM <- update(fm2Orth.lme, method = "ML") summary(fm2Orth.lmeM) compOrth <- compareFits(coef(fm2Orth.lis), coef(fm1Orth.lme)) compOrth plot(compOrth, mark = fixef(fm1Orth.lme)) # Figure 4.8 ## Figure 4.9 plot(comparePred(fm2Orth.lis, fm1Orth.lme, length.out = 2), layout = c(8,4), between = list(y = c(0, 0.5, 0))) plot(compareFits(ranef(fm2Orth.lme), ranef(fm2Orth.lmeM)), mark = c(0, 0)) fm4Orth.lm <- lm(distance ~ Sex * I(age-11), Orthodont) summary(fm4Orth.lm) anova(fm2Orth.lme, fm4Orth.lm) #fm1IGF.lme <- lme(fm1IGF.lis) #fm1IGF.lme #intervals(fm1IGF.lme) #summary(fm1IGF.lme) pd1 <- pdDiag(~ age) pd1 formula(pd1) #fm2IGF.lme <- update(fm1IGF.lme, random = pdDiag(~age)) (fm2IGF.lme <- lme(conc ~ age, IGF, random = pdDiag(~age))) #anova(fm1IGF.lme, fm2IGF.lme) anova(fm2IGF.lme) #update(fm1IGF.lme, random = list(Lot = pdDiag(~ age))) pd2 <- pdDiag(value = diag(2), form = ~ age) pd2 formula(pd2) lme(conc ~ age, IGF, pdDiag(diag(2), ~age)) fm4OatsB <- lme(yield ~ nitro, data = Oats, random =list(Block = pdCompSymm(~ Variety - 1))) summary(fm4OatsB) corMatrix(fm4OatsB$modelStruct$reStruct$Block)[1,2] fm4OatsC <- lme(yield ~ nitro, data = Oats, random=list(Block=pdBlocked(list(pdIdent(~ 1), pdIdent(~ Variety-1))))) summary(fm4OatsC) ## establishing the desired parameterization for contrasts options(contrasts = c("contr.treatment", "contr.poly")) fm1Assay <- lme(logDens ~ sample * dilut, Assay, random = pdBlocked(list(pdIdent(~ 1), pdIdent(~ sample - 1), pdIdent(~ dilut - 1)))) fm1Assay anova(fm1Assay) formula(Oxide) fm1Oxide <- lme(Thickness ~ 1, Oxide) fm1Oxide intervals(fm1Oxide, which = "var-cov") fm2Oxide <- update(fm1Oxide, random = ~ 1 | Lot) anova(fm1Oxide, fm2Oxide) coef(fm1Oxide, level = 1) coef(fm1Oxide, level = 2) ranef(fm1Oxide, level = 1:2) fm1Wafer <- lme(current ~ voltage + I(voltage^2), data = Wafer, random = list(Wafer = pdDiag(~voltage + I(voltage^2)), Site = pdDiag(~voltage + I(voltage^2)))) ## IGNORE_RDIFF_BEGIN summary(fm1Wafer) ## IGNORE_RDIFF_END fitted(fm1Wafer, level = 0) resid(fm1Wafer, level = 1:2) newWafer <- data.frame(Wafer = rep(1, 4), voltage = c(1, 1.5, 3, 3.5)) predict(fm1Wafer, newWafer, level = 0:1) newWafer2 <- data.frame(Wafer = rep(1, 4), Site = rep(3, 4), voltage = c(1, 1.5, 3, 3.5)) predict(fm1Wafer, newWafer2, level = 0:2) # 4.3 Examining a Fitted Model plot(fm2Orth.lme, Subject~resid(.), abline = 0) plot(fm2Orth.lme, resid(., type = "p") ~ fitted(.) | Sex, id = 0.05, adj = -0.3) fm3Orth.lme <- update(fm2Orth.lme, weights = varIdent(form = ~ 1 | Sex)) fm3Orth.lme plot(fm3Orth.lme, distance ~ fitted(.), id = 0.05, adj = -0.3) anova(fm2Orth.lme, fm3Orth.lme) qqnorm(fm3Orth.lme, ~resid(.) | Sex) plot(fm2IGF.lme, resid(., type = "p") ~ fitted(.) | Lot, layout = c(5,2)) qqnorm(fm2IGF.lme, ~ resid(.), id = 0.05, adj = -0.75) plot(fm1Oxide) qqnorm(fm1Oxide) plot(fm1Wafer, resid(.) ~ voltage | Wafer) plot(fm1Wafer, resid(.) ~ voltage | Wafer, panel = function(x, y, ...) { panel.grid() panel.xyplot(x, y) panel.loess(x, y, lty = 2) panel.abline(0, 0) }) with(Wafer, coef(lm(resid(fm1Wafer) ~ cos(4.19*voltage)+sin(4.19*voltage)-1))) nls(resid(fm1Wafer) ~ b3*cos(w*voltage) + b4*sin(w*voltage), Wafer, start = list(b3 = -0.0519, b4 = 0.1304, w = 4.19)) fm2Wafer <- update(fm1Wafer, . ~ . + cos(4.5679*voltage) + sin(4.5679*voltage), random = list(Wafer=pdDiag(~voltage+I(voltage^2)), Site=pdDiag(~voltage+I(voltage^2)))) summary(fm2Wafer) ## IGNORE_RDIFF_BEGIN intervals(fm2Wafer) ## IGNORE_RDIFF_END qqnorm(fm2Wafer) qqnorm(fm2Orth.lme, ~ranef(.), id = 0.10, cex = 0.7) pairs(fm2Orth.lme, ~ranef(.) | Sex, id = ~ Subject == "M13", adj = -0.3) fm2IGF.lme c(0.00031074, 0.0053722)/abs(fixef(fm2IGF.lme)) fm3IGF.lme <- update(fm2IGF.lme, random = ~ age - 1) anova(fm2IGF.lme, fm3IGF.lme) qqnorm(fm1Oxide, ~ranef(., level = 1), id=0.10) qqnorm(fm1Oxide, ~ranef(., level = 2), id=0.10) #fm3Wafer <- update(fm2Wafer, # random = list(Wafer = ~voltage+I(voltage^2), # Site = pdDiag(~voltage+I(voltage^2))), # control = list(msVerbose = TRUE, msMaxIter = 200) # ) #fm3Wafer #anova(fm2Wafer, fm3Wafer) #fm4Wafer <- update(fm2Wafer, # random = list(Wafer = ~ voltage + I(voltage^2), # Site = pdBlocked(list(~1, # ~voltage+I(voltage^2) - 1))), # control = list(msVerbose = TRUE, # msMaxIter = 200)) #fm4Wafer #anova(fm3Wafer, fm4Wafer) #qqnorm(fm4Wafer, ~ranef(., level = 2), id = 0.05, # cex = 0.7, layout = c(3, 1)) # The next line is not in the book but is needed to get fm1Machine fm1Machine <- lme(score ~ Machine, data = Machines, random = ~ 1 | Worker) (fm3Machine <- update(fm1Machine, random = ~Machine-1|Worker)) # cleanup summary(warnings()) nlme/inst/scripts/ch08.R0000644000176000001440000002745114251721456014606 0ustar ripleyusers#-*- R -*- # initialization library(nlme) library(lattice) 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 = "ch08.pdf") # Chapter 8 Fitting Nonlinear Mixed-Effects Models # 8.1 Fitting Nonlinear Models in S with nls and nlsList ## outer = ~1 is used to display all five curves in one panel plot(Orange, outer = ~1) logist <- function(x, Asym, xmid, scal) Asym/(1 + exp(-(x - xmid)/scal)) logist <- deriv(~Asym/(1+exp(-(x-xmid)/scal)), c("Asym", "xmid", "scal"), function(x, Asym, xmid, scal){}) Asym <- 180; xmid <- 700; scal <- 300 logist(Orange$age[1:7], Asym, xmid, scal) fm1Oran.nls <- nls(circumference ~ logist(age, Asym, xmid, scal), data = Orange, start = c(Asym = 170, xmid = 700, scal = 500)) summary(fm1Oran.nls) plot(fm1Oran.nls) plot(fm1Oran.nls, Tree ~ resid(.), abline = 0) Orange.sortAvg <- sortedXyData("age", "circumference", Orange) Orange.sortAvg NLSstClosestX(Orange.sortAvg, 130) logistInit <- function(mCall, LHS, data) { xy <- sortedXyData(mCall[["x"]], LHS, data) if(nrow(xy) < 3) { stop("Too few distinct input values to fit a logistic") } Asym <- max(abs(xy[,"y"])) if (Asym != max(xy[,"y"])) Asym <- -Asym # negative asymptote xmid <- NLSstClosestX(xy, 0.5 * Asym) scal <- NLSstClosestX(xy, 0.75 * Asym) - xmid value <- c(Asym, xmid, scal) names(value) <- mCall[c("Asym", "xmid", "scal")] value } logist <- selfStart(logist, initial = logistInit) class(logist) logist <- selfStart(~ Asym/(1 + exp(-(x - xmid)/scal)), initial = logistInit, parameters = c("Asym", "xmid", "scal")) getInitial(circumference ~ logist(age, Asym, xmid, scal), Orange) nls(circumference ~ logist(age, Asym, xmid, scal), Orange) getInitial(circumference ~ SSlogis(age,Asym,xmid,scal), Orange) nls(circumference ~ SSlogis(age, Asym, xmid, scal), Orange) fm1Oran.lis <- nlsList(circumference ~ SSlogis(age, Asym, xmid, scal) | Tree, data = Orange) fm1Oran.lis <- nlsList(SSlogis, Orange) fm1Oran.lis.noSS <- nlsList(circumference ~ Asym/(1+exp(-(age-xmid)/scal)), data = Orange, start = c(Asym = 170, xmid = 700, scal = 500)) fm1Oran.lis summary(fm1Oran.lis) plot(intervals(fm1Oran.lis), layout = c(3,1)) plot(fm1Oran.lis, Tree ~ resid(.), abline = 0) Theoph[1:4,] fm1Theo.lis <- nlsList(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data = Theoph) fm1Theo.lis plot(intervals(fm1Theo.lis), layout = c(3,1)) pairs(fm1Theo.lis, id = 0.1) # 8.2 Fitting Nonlinear Mixed-Effects Models with nlme ## no need to specify groups, as Orange is a groupedData object ## random is omitted - by default it is equal to fixed (fm1Oran.nlme <- nlme(circumference ~ SSlogis(age, Asym, xmid, scal), data = Orange, fixed = Asym + xmid + scal ~ 1, start = fixef(fm1Oran.lis))) summary(fm1Oran.nlme) summary(fm1Oran.nls) pairs(fm1Oran.nlme) fm2Oran.nlme <- update(fm1Oran.nlme, random = Asym ~ 1) anova(fm1Oran.nlme, fm2Oran.nlme) plot(fm1Oran.nlme) ## level = 0:1 requests fixed (0) and within-group (1) predictions plot(augPred(fm2Oran.nlme, level = 0:1), layout = c(5,1)) qqnorm(fm2Oran.nlme, abline = c(0,1)) (fm1Theo.nlme <- nlme(fm1Theo.lis)) ## IGNORE_RDIFF_BEGIN try( intervals(fm1Theo.nlme, which="var-cov") ) ## could fail: Non-positive definite... ## IGNORE_RDIFF_END (fm2Theo.nlme <- update(fm1Theo.nlme, random = pdDiag(lKe + lKa + lCl ~ 1))) fm3Theo.nlme <- update(fm2Theo.nlme, random = pdDiag(lKa + lCl ~ 1)) anova(fm1Theo.nlme, fm3Theo.nlme, fm2Theo.nlme) plot(fm3Theo.nlme) qqnorm(fm3Theo.nlme, ~ ranef(.)) CO2 plot(CO2, outer = ~Treatment*Type, layout = c(4,1)) (fm1CO2.lis <- nlsList(SSasympOff, CO2)) ## IGNORE_RDIFF_BEGIN (fm1CO2.nlme <- nlme(fm1CO2.lis)) ## IGNORE_RDIFF_END (fm2CO2.nlme <- update(fm1CO2.nlme, random = Asym + lrc ~ 1)) anova(fm1CO2.nlme, fm2CO2.nlme) plot(fm2CO2.nlme,id = 0.05,cex = 0.8,adj = -0.5) fm2CO2.nlmeRE <- ranef(fm2CO2.nlme, augFrame = TRUE) fm2CO2.nlmeRE class(fm2CO2.nlmeRE) plot(fm2CO2.nlmeRE, form = ~ Type * Treatment) contrasts(CO2$Type) contrasts(CO2$Treatment) fm3CO2.nlme <- update(fm2CO2.nlme, fixed = list(Asym ~ Type * Treatment, lrc + c0 ~ 1), start = c(32.412, 0, 0, 0, -4.5603, 49.344)) summary(fm3CO2.nlme) anova(fm3CO2.nlme, Terms = 2:4) fm3CO2.nlmeRE <- ranef(fm3CO2.nlme, aug = TRUE) plot(fm3CO2.nlmeRE, form = ~ Type * Treatment) fm3CO2.fix <- fixef(fm3CO2.nlme) fm4CO2.nlme <- update(fm3CO2.nlme, fixed = list(Asym + lrc ~ Type * Treatment, c0 ~ 1), start = c(fm3CO2.fix[1:5], 0, 0, 0, fm3CO2.fix[6])) ## IGNORE_RDIFF_BEGIN summary(fm4CO2.nlme) ## IGNORE_RDIFF_END fm5CO2.nlme <- update(fm4CO2.nlme, random = Asym ~ 1) anova(fm4CO2.nlme, fm5CO2.nlme) CO2$type <- 2 * (as.integer(CO2$Type) - 1.5) CO2$treatment <- 2 * (as.integer(CO2$Treatment) - 1.5) fm1CO2.nls <- nls(uptake ~ SSasympOff(conc, Asym.Intercept + Asym.Type * type + Asym.Treatment * treatment + Asym.TypeTreatment * type * treatment, lrc.Intercept + lrc.Type * type + lrc.Treatment * treatment + lrc.TypeTreatment * type * treatment, c0), data = CO2, start = c(Asym.Intercept = 32.371, Asym.Type = -8.0086, Asym.Treatment = -4.2001, Asym.TypeTreatment = -2.7253, lrc.Intercept = -4.5267, lrc.Type = 0.13112, lrc.Treatment = 0.093928, lrc.TypeTreatment = 0.17941, c0 = 50.126)) anova(fm5CO2.nlme, fm1CO2.nls) # plot(augPred(fm5CO2.nlme, level = 0:1), ## FIXME: problem with levels # layout = c(6,2)) ## Actually a problem with contrasts. ## This fit just ping-pongs. #fm1Quin.nlme <- # nlme(conc ~ quinModel(Subject, time, conc, dose, interval, # lV, lKa, lCl), # data = Quinidine, fixed = lV + lKa + lCl ~ 1, # random = pdDiag(lV + lCl ~ 1), groups = ~ Subject, # start = list(fixed = c(5, -0.3, 2)), # na.action = NULL, naPattern = ~ !is.na(conc), verbose = TRUE) #fm1Quin.nlme #fm1Quin.nlmeRE <- ranef(fm1Quin.nlme, aug = TRUE) #fm1Quin.nlmeRE[1:3,] # plot(fm1Quin.nlmeRE, form = lCl ~ Age + Smoke + Ethanol + ## FIXME: problem in max # Weight + Race + Height + glyco + Creatinine + Heart, # control = list(cex.axis = 0.7)) #fm1Quin.fix <- fixef(fm1Quin.nlme) #fm2Quin.nlme <- update(fm1Quin.nlme, # fixed = list(lCl ~ glyco, lKa + lV ~ 1), # start = c(fm1Quin.fix[3], 0, fm1Quin.fix[2:1])) fm2Quin.nlme <- nlme(conc ~ quinModel(Subject, time, conc, dose, interval, lV, lKa, lCl), data = Quinidine, fixed = list(lCl ~ glyco, lV + lKa ~ 1), random = pdDiag(diag(c(0.3,0.3)), form = lV + lCl ~ 1), groups = ~ Subject, start = list(fixed = c(2.5, 0, 5.4, -0.2)), na.action = NULL, naPattern = ~ !is.na(conc)) summary(fm2Quin.nlme) # wrong values options(contrasts = c("contr.treatment", "contr.poly")) fm2Quin.fix <- fixef(fm2Quin.nlme) ## subsequent fits don't work #fm3Quin.nlme <- update(fm2Quin.nlme, # fixed = list(lCl ~ glyco + Creatinine, lKa + lV ~ 1), # start = c(fm2Quin.fix[1:2], 0.2, fm2Quin.fix[3:4])) #summary(fm3Quin.nlme) #fm3Quin.fix <- fixef(fm3Quin.nlme) #fm4Quin.nlme <- update(fm3Quin.nlme, # fixed = list(lCl ~ glyco + Creatinine + Weight, lKa + lV ~ 1), # start = c(fm3Quin.fix[1:3], 0, fm3Quin.fix[4:5])) #summary(fm4Quin.nlme) ## This fit just ping-pongs ##fm1Wafer.nlmeR <- ## nlme(current ~ A + B * cos(4.5679 * voltage) + ## C * sin(4.5679 * voltage), data = Wafer, ## fixed = list(A ~ voltage + I(voltage^2), B + C ~ 1), ## random = list(Wafer = A ~ voltage + I(voltage^2), ## Site = pdBlocked(list(A~1, A~voltage+I(voltage^2)-1))), ### start = fixef(fm4Wafer), method = "REML", control = list(tolerance=1e-2)) ## start = c(-4.255, 5.622, 1.258, -0.09555, 0.10434), ## method = "REML", control = list(tolerance = 1e-2)) ##fm1Wafer.nlmeR ##fm1Wafer.nlme <- update(fm1Wafer.nlmeR, method = "ML") (fm2Wafer.nlme <- nlme(current ~ A + B * cos(w * voltage + pi/4), data = Wafer, fixed = list(A ~ voltage + I(voltage^2), B + w ~ 1), random = list(Wafer = pdDiag(list(A ~ voltage + I(voltage^2), B + w ~ 1)), Site = pdDiag(list(A ~ voltage+I(voltage^2), B ~ 1))), start = c(-4.255, 5.622, 1.258, -0.09555, 4.5679))) plot(fm2Wafer.nlme, resid(.) ~ voltage | Wafer, panel = function(x, y, ...) { panel.grid() panel.xyplot(x, y) panel.loess(x, y, lty = 2) panel.abline(0, 0) }) ## anova(fm1Wafer.nlme, fm2Wafer.nlme, test = FALSE) # intervals(fm2Wafer.nlme) # 8.3 Extending the Basic nlme Model #fm4Theo.nlme <- update(fm3Theo.nlme, # weights = varConstPower(power = 0.1)) # this fit is way off #fm4Theo.nlme #anova(fm3Theo.nlme, fm4Theo.nlme) #plot(fm4Theo.nlme) ## xlim used to hide an unusually high fitted value and enhance ## visualization of the heteroscedastic pattern # plot(fm4Quin.nlme, xlim = c(0, 6.2)) #fm5Quin.nlme <- update(fm4Quin.nlme, weights = varPower()) #summary(fm5Quin.nlme) #anova(fm4Quin.nlme, fm5Quin.nlme) #plot(fm5Quin.nlme, xlim = c(0, 6.2)) var.nlme <- nlme(follicles ~ A + B * sin(2 * pi * w * Time) + C * cos(2 * pi * w *Time), data = Ovary, fixed = A + B + C + w ~ 1, random = pdDiag(A + B + w ~ 1), # start = c(fixef(fm5Ovar.lme), 1)) start = c(12.18, -3.298, -0.862, 1)) ##fm1Ovar.nlme ##ACF(fm1Ovar.nlme) ##plot(ACF(fm1Ovar.nlme, maxLag = 10), alpha = 0.05) ##fm2Ovar.nlme <- update(fm1Ovar.nlme, correlation = corAR1(0.311)) ##fm3Ovar.nlme <- update(fm1Ovar.nlme, correlation = corARMA(p=0, q=2)) ##anova(fm2Ovar.nlme, fm3Ovar.nlme, test = FALSE) ##intervals(fm2Ovar.nlme) ##fm4Ovar.nlme <- update(fm2Ovar.nlme, random = A ~ 1) ##anova(fm2Ovar.nlme, fm4Ovar.nlme) ##if (interactive()) fm5Ovar.nlme <- update(fm4Ovar.nlme, correlation = corARMA(p=1, q=1)) # anova(fm4Ovar.nlme, fm5Ovar.nlme) # plot(ACF(fm5Ovar.nlme, maxLag = 10, resType = "n"), # alpha = 0.05) # fm5Ovar.lmeML <- update(fm5Ovar.lme, method = "ML") # intervals(fm5Ovar.lmeML) # fm6Ovar.lmeML <- update(fm5Ovar.lmeML, random = ~1) # anova(fm5Ovar.lmeML, fm6Ovar.lmeML) # anova(fm6Ovar.lmeML, fm5Ovar.nlme) # intervals(fm5Ovar.nlme, which = "fixed") fm1Dial.lis <- nlsList(rate ~ SSasympOff(pressure, Asym, lrc, c0) | QB, data = Dialyzer) fm1Dial.lis plot(intervals(fm1Dial.lis)) fm1Dial.gnls <- gnls(rate ~ SSasympOff(pressure, Asym, lrc, c0), data = Dialyzer, params = list(Asym + lrc ~ QB, c0 ~ 1), start = c(53.6, 8.6, 0.51, -0.26, 0.225)) fm1Dial.gnls Dialyzer$QBcontr <- 2 * (Dialyzer$QB == 300) - 1 fm1Dial.nls <- nls(rate ~ SSasympOff(pressure, Asym.Int + Asym.QB * QBcontr, lrc.Int + lrc.QB * QBcontr, c0), data = Dialyzer, start = c(Asym.Int = 53.6, Asym.QB = 8.6, lrc.Int = 0.51, lrc.QB = -0.26, c0 = 0.225)) ## IGNORE_RDIFF_BEGIN summary(fm1Dial.nls) ## IGNORE_RDIFF_END logLik(fm1Dial.nls) plot(fm1Dial.gnls, resid(.) ~ pressure, abline = 0) fm2Dial.gnls <- update(fm1Dial.gnls, weights = varPower(form = ~ pressure)) anova(fm1Dial.gnls, fm2Dial.gnls) ACF(fm2Dial.gnls, form = ~ 1 | Subject) plot(ACF(fm2Dial.gnls, form = ~ 1 | Subject), alpha = 0.05) fm3Dial.gnls <- update(fm2Dial.gnls, corr = corAR1(0.716, form = ~ 1 | Subject)) fm3Dial.gnls intervals(fm3Dial.gnls) anova(fm2Dial.gnls, fm3Dial.gnls) # restore two fitted models fm2Dial.lme <- lme(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, Dialyzer, ~ pressure + I(pressure^2), weights = varPower(form = ~ pressure)) fm2Dial.lmeML <- update(fm2Dial.lme, method = "ML") fm3Dial.gls <- gls(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, Dialyzer, weights = varPower(form = ~ pressure), corr = corAR1(0.771, form = ~ 1 | Subject)) fm3Dial.glsML <- update(fm3Dial.gls, method = "ML") anova( fm2Dial.lmeML, fm3Dial.glsML, fm3Dial.gnls, test = FALSE) # cleanup summary(warnings()) nlme/inst/scripts/runme.R0000644000176000001440000000131414271005035015146 0ustar ripleyusers## NB: These NLME-book chapter scripts are now (2022-02) run as part of ## 'R CMD check nlme' *only* if(nlme:::doExtras()) ## --> ../../tests/extras/scripts.R library(nlme) if(requireNamespace("sfsmisc")) { print(sfsmisc::sessionInfoX(pkgs = c("Matrix", "nlme"))) } else withAutoprint({ packageDescription("nlme") packageDescription("Matrix") sessionInfo() }) sdir <- system.file("scripts", package="nlme") cat("nlme/scripts directory used: ", sdir, "\n=============\n") for(f in list.files(sdir, pattern = "^ch[0-9]*[.]R$")) { cat("\n",f,":\n------\n", sep='') source(file.path(sdir, f), echo=TRUE) } ## runs through, taking only 54 secs now (2020-07) (in BATCH) summary(warnings()) nlme/build/0000755000176000001440000000000014772475055012354 5ustar ripleyusersnlme/build/partial.rdb0000644000176000001440000000007414772475055014502 0ustar ripleyusersb```b`a 00 FN ͚Z d@$/7nlme/man/0000755000176000001440000000000014737242620012017 5ustar ripleyusersnlme/man/plot.compareFits.Rd0000644000176000001440000000350114251721456015536 0ustar ripleyusers% File nlme/man/plot.compareFits.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.compareFits} \title{Plot a compareFits Object} \usage{ \method{plot}{compareFits}(x, subset, key, mark, \dots) } \alias{plot.compareFits} \arguments{ \item{x}{an object of class \code{"\link{compareFits}"}.} \item{subset}{an optional logical or integer vector specifying which rows of \code{x} should be used in the plots. If missing, all rows are used.} \item{key}{an optional logical value, or list. If \code{TRUE}, a legend is included at the top of the plot indicating which symbols (colors) correspond to which objects being compared. If \code{FALSE}, no legend is included. If given as a list, \code{key} is passed down as an argument to the \code{trellis} function generating the plots (\code{dotplot}). Defaults to \code{TRUE}.} \item{mark}{an optional numeric vector, of length equal to the number of coefficients being compared, indicating where vertical lines should be drawn in the plots. If missing, no lines are drawn.} \item{\dots}{optional arguments passed down to the \code{trellis} function generating the plots.} } \description{ A Trellis \code{dotplot} of the values being compared, with different rows per group, is generated, with a different panel for each coefficient. Different symbols (colors) are used for each object being compared. } \value{ A Trellis \code{dotplot} of the values being compared, with rows determined by the groups and panels by the coefficients. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{compareFits}}, \code{\link{pairs.compareFits}}, \code{\link{dotplot}} } \examples{ example(compareFits) # cF12 <- compareFits(coef(lmList(Orthodont)), .. lme(*)) plot(cF12) } \keyword{models} nlme/man/update.varFunc.Rd0000644000176000001440000000331414251721455015173 0ustar ripleyusers% File nlme/man/update.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{update.varFunc} \title{Update varFunc Object} \usage{ \method{update}{varFunc}(object, data, \dots) } \alias{update.varExp} \alias{update.varFunc} \alias{update.varComb} \alias{update.varConstPower} \alias{update.varConstProp} \alias{update.varExpon} \alias{update.varPower} \arguments{ \item{object}{an object inheriting from class \code{"\link{varFunc}"}, representing a variance function structure.} \item{data}{a list with a component named \code{"."} with the current version of the fitted object (from which fitted values, coefficients, and residuals can be extracted) and, if necessary, other variables used to evaluate the variance covariate(s).} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ If the \code{formula(object)} includes a \code{"."} term, representing a fitted object, the variance covariate needs to be updated upon completion of an optimization cycle (in which the variance function weights are kept fixed). This method function allows a reevaluation of the variance covariate using the current fitted object and, optionally, other variables in the original data. } \value{ if \code{formula(object)} includes a \code{"."} term, an \code{varFunc} object similar to \code{object}, but with the variance covariate reevaluated at the current fitted object value; else \code{object} is returned unchanged. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{needUpdate}}, \code{\link{covariate<-.varFunc}} } \keyword{models} nlme/man/coef.pdMat.Rd0000644000176000001440000000353614251721455014274 0ustar ripleyusers% File nlme/man/coef.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.pdMat} \title{pdMat Object Coefficients} \usage{ \method{coef}{pdMat}(object, unconstrained, \dots) \method{coef}{pdMat}(object, \dots) <- value } \alias{coef.pdMat} \alias{coef.pdBlocked} \alias{coef.pdCompSymm} \alias{coef.pdDiag} \alias{coef.pdIdent} \alias{coef.pdNatural} \alias{coef.pdSymm} \alias{coef<-.pdMat} \alias{coef<-.pdBlocked} \arguments{ \item{object}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive-definite matrix.} \item{unconstrained}{a logical value. If \code{TRUE} the coefficients are returned in unconstrained form (the same used in the optimization algorithm). If \code{FALSE} the upper triangular elements of the positive-definite matrix represented by \code{object} are returned. Defaults to \code{TRUE}.} \item{value}{a vector with the replacement values for the coefficients associated with \code{object}. It must be a vector with the same length of \code{coef{object}} and must be given in unconstrained form.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the coefficients associated with the positive-definite matrix represented by \code{object}. } \value{ a vector with the coefficients corresponding to \code{object}. } \references{ Pinheiro, J.C. and Bates., D.M. (1996) "Unconstrained Parametrizations for Variance-Covariance Matrices", Statistics and Computing, 6, 289-296. } \author{José Pinheiro and Douglas Bates } \section{SIDE EFFECTS}{ On the left side of an assignment, sets the values of the coefficients of \code{object} to \code{value}. } \seealso{\code{\link{pdMat}}} \examples{ coef(pdSymm(diag(3))) } \keyword{models} nlme/man/Initialize.varFunc.Rd0000644000176000001440000000323714251721455016016 0ustar ripleyusers% File nlme/man/Initialize.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Initialize.varFunc} \title{Initialize varFunc Object} \usage{ \method{Initialize}{varFunc}(object, data, \dots) } \alias{Initialize.varFunc} \alias{Initialize.varComb} \alias{Initialize.varConstPower} \alias{Initialize.varConstProp} \alias{Initialize.varExp} \alias{Initialize.varFixed} \alias{Initialize.varIdent} \alias{Initialize.varPower} \arguments{ \item{object}{an object inheriting from class \code{"\link{varFunc}"}, representing a variance function structure.} \item{data}{a data frame in which to evaluate the variables named in \code{formula(object)}. } \item{\dots}{this argument is included to make this method compatible with the generic.} } \description{ This method initializes \code{object} by evaluating its associated covariate(s) and grouping factor, if any is present, in \code{data}; determining if the covariate(s) need to be updated when the values of the coefficients associated with \code{object} change; initializing the log-likelihood and the weights associated with \code{object}; and assigning initial values for the coefficients in \code{object}, if none were present. The covariate(s) will only be initialized if no update is needed when \code{coef(object)} changes. } \value{ an initialized object with the same class as \code{object} representing a variance function structure. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Initialize}} } \examples{ vf1 <- varPower( form = ~ age | Sex ) vf1 <- Initialize( vf1, Orthodont ) } \keyword{models} nlme/man/residuals.gls.Rd0000644000176000001440000000327314251721455015071 0ustar ripleyusers% File nlme/man/residuals.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{residuals.gls} \title{Extract gls Residuals} \usage{ \method{residuals}{gls}(object, type, \dots) } \alias{residuals.gls} \alias{residuals.gnls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted linear model, or from class \code{gnls}, representing a generalized nonlinear least squares fitted linear model.} \item{type}{an optional character string specifying the type of residuals to be used. If \code{"response"}, the "raw" residuals (observed - fitted) are used; else, if \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"response"}.} \item{\dots}{some methods for this generic function require additional arguments. None are used in this method.} } \description{ The residuals for the linear model represented by \code{object} are extracted. } \value{ a vector with the residuals for the linear model represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}} \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) residuals(fm1) } \keyword{models} nlme/man/update.modelStruct.Rd0000644000176000001440000000237314251721455016100 0ustar ripleyusers% File nlme/man/update.modelStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{update.modelStruct} \title{Update a modelStruct Object} \usage{ \method{update}{modelStruct}(object, data, \dots) } \alias{update.modelStruct} \alias{update.corStruct} \alias{update.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"modelStruct"}, representing a list of model components, such as \code{corStruct} and \code{varFunc} objects.} \item{data}{a data frame in which to evaluate the variables needed for updating the elements of \code{object}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function updates each element of \code{object}, allowing the access to \code{data}. } \value{ an object similar to \code{object} (same class, length, and names), but with updated elements. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{reStruct}} } \note{This method function is primarily used within model fitting functions, such as \code{lme} and \code{gls}, that allow model components such as variance functions.} \keyword{models} nlme/man/plot.Variogram.Rd0000644000176000001440000000507514633640310015212 0ustar ripleyusers% File nlme/man/plot.Variogram.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.Variogram} \title{Plot a Variogram Object} \usage{ \method{plot}{Variogram}(x, smooth, showModel, sigma, span, xlab, ylab, type, ylim, grid, \dots) } \alias{plot.Variogram} \arguments{ \item{x}{an object inheriting from class \code{"\link{Variogram}"}, consisting of a data frame with two columns named \code{variog} and \code{dist}, representing the semi-variogram values and the corresponding distances. } \item{smooth}{an optional logical value controlling whether a \code{loess} smoother should be added to the plot. Defaults to \code{TRUE}, when \code{showModel} is \code{FALSE}. } \item{showModel}{an optional logical value controlling whether the semi-variogram corresponding to an \code{"modelVariog"} attribute of \code{x}, if any is present, should be added to the plot. Defaults to \code{TRUE}, when the \code{"modelVariog"} attribute is present. } \item{sigma}{an optional numeric value used as the height of a horizontal line displayed in the plot. Can be used to represent the process standard deviation. Default is \code{NULL}, implying that no horizontal line is drawn. } \item{span}{an optional numeric value with the smoothing parameter for the \code{loess} fit. Default is 0.6. } \item{xlab,ylab}{optional character strings with the x- and y-axis labels. Default respectively to \code{"Distance"} and \code{"SemiVariogram"}. } \item{type}{an optional character indicating the type of plot. Defaults to \code{"p"}. } \item{ylim}{an optional numeric vector with the limits for the y-axis. Defaults to \code{c(0, max(x$variog))}. } \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{FALSE}.} \item{\dots}{optional arguments passed to the Trellis \code{xyplot} function.} } \description{ an \code{xyplot} of the semi-variogram versus the distances is produced. If \code{smooth = TRUE}, a \code{loess} smoother is added to the plot. If \code{showModel = TRUE} and \code{x} includes an \code{"modelVariog"} attribute, the corresponding semi-variogram is added to the plot. } \value{ an \code{xyplot} Trellis plot. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Variogram}}, \code{\link[lattice]{xyplot}}, \code{\link{loess}}} \examples{ fm1 <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary) plot(Variogram(fm1, form = ~ Time | Mare, maxDist = 0.7)) } \keyword{models} nlme/man/varWeights.lmeStruct.Rd0000644000176000001440000000237514251721455016420 0ustar ripleyusers% File nlme/man/varWeights.lmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varWeights.lmeStruct} \title{Variance Weights for lmeStruct Object} \usage{ \method{varWeights}{lmeStruct}(object) } \alias{varWeights.lmeStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmeStruct}"}, representing a list of linear mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} } \description{ If \code{object} includes a \code{varStruct} component, the inverse of the standard deviations of the variance function structure represented by the corresponding \code{varFunc} object are returned; else, a vector of ones of length equal to the number of observations in the data frame used to fit the associated linear mixed-effects model is returned. } \value{ if \code{object} includes a \code{varStruct} component, a vector with the corresponding variance weights; else, or a vector of ones. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{varWeights}}} \keyword{models} nlme/man/Wheat2.Rd0000644000176000001440000000461514251721456013446 0ustar ripleyusers% File nlme/man/Wheat2.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Wheat2} \alias{Wheat2} \title{Wheat Yield Trials} \description{ The \code{Wheat2} data frame has 224 rows and 5 columns. } \format{ This data frame contains the following columns: \describe{ \item{Block}{ an ordered factor with levels \code{4} < \code{2} < \code{3} < \code{1} } \item{variety}{ a factor with levels \code{ARAPAHOE} \code{BRULE} \code{BUCKSKIN} \code{CENTURA} \code{CENTURK78} \code{CHEYENNE} \code{CODY} \code{COLT} \code{GAGE} \code{HOMESTEAD} \code{KS831374} \code{LANCER} \code{LANCOTA} \code{NE83404} \code{NE83406} \code{NE83407} \code{NE83432} \code{NE83498} \code{NE83T12} \code{NE84557} \code{NE85556} \code{NE85623} \code{NE86482} \code{NE86501} \code{NE86503} \code{NE86507} \code{NE86509} \code{NE86527} \code{NE86582} \code{NE86606} \code{NE86607} \code{NE86T666} \code{NE87403} \code{NE87408} \code{NE87409} \code{NE87446} \code{NE87451} \code{NE87457} \code{NE87463} \code{NE87499} \code{NE87512} \code{NE87513} \code{NE87522} \code{NE87612} \code{NE87613} \code{NE87615} \code{NE87619} \code{NE87627} \code{NORKAN} \code{REDLAND} \code{ROUGHRIDER} \code{SCOUT66} \code{SIOUXLAND} \code{TAM107} \code{TAM200} \code{VONA} } \item{yield}{ a numeric vector } \item{latitude}{ a numeric vector } \item{longitude}{ a numeric vector } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/summary.nlsList.Rd0000644000176000001440000000676014251721455015442 0ustar ripleyusers% File nlme/man/summary.nlsList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.nlsList} \title{Summarize an nlsList Object} \usage{ \method{summary}{nlsList}(object, \dots) } \alias{summary.nlsList} \arguments{ \item{object}{an object inheriting from class \code{"\link{nlsList}"}, representing a list of \code{nls} fitted objects. } \item{\dots}{optional arguments to the \code{summary.lmList} method. One such optional argument is \code{pool}, a logical value indicating whether a pooled estimate of the residual standard error should be used. Default is \code{attr(object, "pool")}. } } \description{ The \code{summary} function is applied to each \code{nls} component of \code{object} to produce summary information on the individual fits, which is organized into a list of summary statistics. The returned object is suitable for printing with the \code{print.summary.nlsList} method. } \value{ a list with summary statistics obtained by applying \code{summary} to the elements of \code{object}, inheriting from class \code{summary.nlsList}. The components of \code{value} are: \item{call}{a list containing an image of the \code{nlsList} call that produced \code{object}. } \item{parameters}{a three dimensional array with summary information on the \code{nls} coefficients. The first dimension corresponds to the names of the \code{object} components, the second dimension is given by \code{"Value"}, \code{"Std. Error"}, \code{"t value"}, and \code{"Pr(>|t|)"}, corresponding, respectively, to the coefficient estimates and their associated standard errors, t-values, and p-values. The third dimension is given by the coefficients names. } \item{correlation}{a three dimensional array with the correlations between the individual \code{nls} coefficient estimates. The first dimension corresponds to the names of the \code{object} components. The third dimension is given by the coefficients names. For each coefficient, the rows of the associated array give the correlations between that coefficient and the remaining coefficients, by \code{nls} component. } \item{cov.unscaled}{a three dimensional array with the unscaled variances/covariances for the individual \code{lm} coefficient estimates (giving the estimated variance/covariance for the coefficients, when multiplied by the estimated residual errors). The first dimension corresponds to the names of the \code{object} components. The third dimension is given by the coefficients names. For each coefficient, the rows of the associated array give the unscaled covariances between that coefficient and the remaining coefficients, by \code{nls} component. } \item{df}{an array with the number of degrees of freedom for the model and for residuals, for each \code{nls} component. } \item{df.residual}{the total number of degrees of freedom for residuals, corresponding to the sum of residuals df of all \code{nls} components. } \item{pool}{the value of the \code{pool} argument to the function. } \item{RSE}{the pooled estimate of the residual standard error.} \item{sigma}{a vector with the residual standard error estimates for the individual \code{lm} fits. } } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{nlsList}}, \code{\link{summary}}} \examples{ fm1 <- nlsList(SSasymp, Loblolly) summary(fm1) } \keyword{models} nlme/man/nlme.nlsList.Rd0000644000176000001440000001621214363200201014652 0ustar ripleyusers% File nlme/man/nlme.nlsList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlme.nlsList} \title{NLME fit from nlsList Object} \usage{ \method{nlme}{nlsList}(model, data, fixed, random, groups, start, correlation, weights, subset, method, na.action, naPattern, control, verbose) } \alias{nlme.nlsList} \arguments{ \item{model}{an object inheriting from class \code{"\link{nlsList}"}, representing a list of \code{nls} fits with a common model.} \item{data}{this argument is included for consistency with the generic function. It is ignored in this method function.} \item{fixed}{this argument is included for consistency with the generic function. It is ignored in this method function.} \item{random}{an optional one-sided linear formula with no conditioning expression, or a \code{pdMat} object with a \code{formula} attribute. Multiple levels of grouping are not allowed with this method function. Defaults to a formula consisting of the right hand side of \code{formula(fixed)}.} \item{groups}{an optional one-sided formula of the form \code{~g1} (single level of nesting) or \code{~g1/.../gQ} (multiple levels of nesting), specifying the partitions of the data over which the random effects vary. \code{g1,...,gQ} must evaluate to factors in \code{data}. The order of nesting, when multiple levels are present, is taken from left to right (i.e. \code{g1} is the first level, \code{g2} the second, etc.).} \item{start}{an optional numeric vector, or list of initial estimates for the fixed effects and random effects. If declared as a numeric vector, it is converted internally to a list with a single component \code{fixed}, given by the vector. The \code{fixed} component is required, unless the model function inherits from class \code{selfStart}, in which case initial values will be derived from a call to \code{nlsList}. An optional \code{random} component is used to specify initial values for the random effects and should consist of a matrix, or a list of matrices with length equal to the number of grouping levels. Each matrix should have as many rows as the number of groups at the corresponding level and as many columns as the number of random effects in that level.} \item{correlation}{an optional \code{corStruct} object describing the within-group correlation structure. See the documentation of \code{\link{corClasses}} for a description of the available \code{corStruct} classes. Defaults to \code{NULL}, corresponding to no within-group correlations.} \item{weights}{an optional \code{varFunc} object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to \code{varFixed}, corresponding to fixed variance weights. See the documentation on \code{\link{varClasses}} for a description of the available \code{varFunc} classes. Defaults to \code{NULL}, corresponding to homoscedastic within-group errors.} \item{subset}{an optional expression indicating the subset of the rows of \code{data} that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{method}{a character string. If \code{"REML"} the model is fit by maximizing the restricted log-likelihood. If \code{"ML"} the log-likelihood is maximized. Defaults to \code{"ML"}.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{nlme} to print an error message and terminate if there are any incomplete observations.} \item{naPattern}{an expression or formula object, specifying which returned values are to be regarded as missing.} \item{control}{a list of control values for the estimation algorithm to replace the default values returned by the function \code{nlmeControl}. Defaults to an empty list.} \item{verbose}{an optional logical value. If \code{TRUE} information on the evolution of the iterative algorithm is printed. Default is \code{FALSE}.} } \description{ If the random effects names defined in \code{random} are a subset of the \code{lmList} object coefficient names, initial estimates for the covariance matrix of the random effects are obtained (overwriting any values given in \code{random}). \code{formula(fixed)} and the \code{data} argument in the calling sequence used to obtain \code{fixed} are passed as the \code{fixed} and \code{data} arguments to \code{nlme.formula}, together with any other additional arguments in the function call. See the documentation on \code{\link{nlme.formula}} for a description of that function. } \value{ an object of class \code{nlme} representing the linear mixed-effects model fit. Generic functions such as \code{print}, \code{plot} and \code{summary} have methods to show the results of the fit. See \code{nlmeObject} for the components of the fit. The functions \code{resid}, \code{coef}, \code{fitted}, \code{fixed.effects}, and \code{random.effects} can be used to extract some of its components. } \references{ The computational methods follow on the general framework of Lindstrom, M.J. and Bates, D.M. (1988). The model formulation is described in Laird, N.M. and Ware, J.H. (1982). The variance-covariance parametrizations are described in = d} the correlation is zero. Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corSpher}, also inheriting from class \code{corSpatial}, representing a spherical spatial correlation structure. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. Littel, Milliken, Stroup, and Wolfinger (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}}, \code{\link{dist}} } \examples{ sp1 <- corSpher(form = ~ x + y) # example lme(..., corSpher ...) # Pinheiro and Bates, pp. 222-249 fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight, random = ~ Time) # p. 223 fm2BW.lme <- update(fm1BW.lme, weights = varPower()) # p 246 fm3BW.lme <- update(fm2BW.lme, correlation = corExp(form = ~ Time)) # p. 249 fm6BW.lme <- update(fm3BW.lme, correlation = corSpher(form = ~ Time)) # example gls(..., corSpher ...) # Pinheiro and Bates, pp. 261, 263 fm1Wheat2 <- gls(yield ~ variety - 1, Wheat2) # p. 262 fm2Wheat2 <- update(fm1Wheat2, corr = corSpher(c(28, 0.2), form = ~ latitude + longitude, nugget = TRUE)) } \keyword{models} nlme/man/nlmeStruct.Rd0000644000176000001440000000262014251721455014445 0ustar ripleyusers% File nlme/man/nlmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlmeStruct} \title{Nonlinear Mixed-Effects Structure} \usage{ nlmeStruct(reStruct, corStruct, varStruct) } \alias{nlmeStruct} \arguments{ \item{reStruct}{a \code{reStruct} representing a random effects structure.} \item{corStruct}{an optional \code{corStruct} object, representing a correlation structure. Default is \code{NULL}.} \item{varStruct}{an optional \code{varFunc} object, representing a variance function structure. Default is \code{NULL}.} } \description{ A nonlinear mixed-effects structure is a list of model components representing different sets of parameters in the nonlinear mixed-effects model. An \code{nlmeStruct} list must contain at least a \code{reStruct} object, but may also contain \code{corStruct} and \code{varFunc} objects. \code{NULL} arguments are not included in the \code{nlmeStruct} list. } \value{ a list of model components determining the parameters to be estimated for the associated nonlinear mixed-effects model. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{nlme}}, \code{\link{residuals.nlmeStruct}}, \code{\link{reStruct}}, \code{\link{varFunc}} } \examples{ nlms1 <- nlmeStruct(reStruct(~age), corAR1(), varPower()) } \keyword{models} nlme/man/lmeObject.Rd0000644000176000001440000001041014335655115014207 0ustar ripleyusers% File nlme/man/lmeObject.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{lmeObject} \title{Fitted lme Object} \alias{lmeObject} \description{ An object returned by the \code{lme} function, inheriting from class \code{"lme"} and representing a fitted linear mixed-effects model. Objects of this class have methods for the generic functions \code{anova}, \code{coef}, \code{fitted}, \code{fixed.effects}, \code{formula}, \code{getGroups}, \code{getResponse}, \code{intervals}, \code{logLik}, \code{pairs}, \code{plot}, \code{predict}, \code{print}, \code{random.effects}, \code{residuals}, \code{sigma}, \code{summary}, \code{update}, and \code{vcov}. } \value{ The following components must be included in a legitimate \code{"lme"} object. \item{apVar}{an approximate covariance matrix for the variance-covariance coefficients. If \code{apVar = FALSE} in the control values used in the call to \code{lme}, this component is \code{NULL}.} \item{call}{a list containing an image of the \code{lme} call that produced the object.} \item{coefficients}{a list with two components, \code{fixed} and \code{random}, where the first is a vector containing the estimated fixed effects and the second is a list of matrices with the estimated random effects for each level of grouping. For each matrix in the \code{random} list, the columns refer to the random effects and the rows to the groups.} \item{contrasts}{a list of the contrast matrices used to represent factors in the fixed effects formula and/or random effects formula. This information is important for making predictions from a new data frame in which not all levels of the original factors are observed. If no factors are used in the lme model, this component will be an empty list.} \item{dims}{a list with basic dimensions used in the lme fit, including the components \code{N} - the number of observations in the data, \code{Q} - the number of grouping levels, \code{qvec} - the number of random effects at each level from innermost to outermost (last two values are equal to zero and correspond to the fixed effects and the response), \code{ngrps} - the number of groups at each level from innermost to outermost (last two values are one and correspond to the fixed effects and the response), and \code{ncol} - the number of columns in the model matrix for each level of grouping from innermost to outermost (last two values are equal to the number of fixed effects and one).} \item{fitted}{a data frame with the fitted values as columns. The leftmost column corresponds to the population fixed effects (corresponding to the fixed effects only) and successive columns from left to right correspond to increasing levels of grouping.} \item{fixDF}{a list with components \code{X} and \code{terms} specifying the denominator degrees of freedom for, respectively, t-tests for the individual fixed effects and F-tests for the fixed-effects terms in the models.} \item{groups}{a data frame with the grouping factors as columns. The grouping level increases from left to right.} \item{logLik}{the (restricted) log-likelihood at convergence.} \item{method}{the estimation method: either \code{"ML"} for maximum likelihood, or \code{"REML"} for restricted maximum likelihood.} \item{modelStruct}{an object inheriting from class \code{lmeStruct}, representing a list of mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} \item{numIter}{the number of iterations used in the iterative algorithm.} \item{residuals}{a data frame with the residuals as columns. The leftmost column corresponds to the population residuals and successive columns from left to right correspond to increasing levels of grouping.} \item{terms}{the \code{\link{terms}}, including \code{\link{formula}}, see also \link{terms.object}.} \item{sigma}{the estimated within-group error standard deviation.} \item{varFix}{an approximate covariance matrix of the fixed effects estimates.} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{lmeStruct}} \keyword{models} nlme/man/getGroups.varFunc.Rd0000644000176000001440000000307014251721456015670 0ustar ripleyusers% File nlme/man/getGroups.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroups.varFunc} \title{Extract varFunc Groups} \usage{ \method{getGroups}{varFunc}(object, form, level, data, sep) } \alias{getGroups.varFunc} \arguments{ \item{object}{an object inheriting from class \code{varFunc}, representing a variance function structure.} \item{form}{an optional formula with a conditioning expression on its right hand side (i.e. an expression involving the \code{|} operator). Defaults to \code{formula(object)}. Not used.} \item{level}{a positive integer vector with the level(s) of grouping to be used when multiple nested levels of grouping are present. This argument is optional for most methods of this generic function and defaults to all levels of nesting. Not used.} \item{data}{a data frame in which to interpret the variables named in \code{form}. Optional for most methods. Not used.} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}. Not used.} } \description{ This method function extracts the grouping factor associated with the variance function represented by \code{object}, if any is present. } \value{ if \code{object} has a \code{groups} attribute, its value is returned; else \code{NULL} is returned. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \examples{ vf1 <- varPower(form = ~ age | Sex) vf1 <- Initialize(vf1, Orthodont) getGroups(vf1) } \keyword{models} nlme/man/Gun.Rd0000644000176000001440000000240214251721455013034 0ustar ripleyusers% File nlme/man/Gun.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Gun} \alias{Gun} \title{Methods for firing naval guns} \description{ The \code{Gun} data frame has 36 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{rounds}{ a numeric vector } \item{Method}{ a factor with levels \code{M1} \code{M2} } \item{Team}{ an ordered factor with levels \code{T1S} < \code{T3S} < \code{T2S} < \code{T1A} < \code{T2A} < \code{T3A} < \code{T1H} < \code{T3H} < \code{T2H} } \item{Physique}{ an ordered factor with levels \code{Slight} < \code{Average} < \code{Heavy} } } } \details{ Hicks (p.180, 1993) reports data from an experiment on methods for firing naval guns. Gunners of three different physiques (slight, average, and heavy) tested two firing methods. Both methods were tested twice by each of nine teams of three gunners with identical physique. The response was the number of rounds fired per minute.} \source{ Hicks, C. R. (1993), \emph{Fundamental Concepts in the Design of Experiments (4th ed)}, Harcourt Brace, New York. } %\examples{} \keyword{datasets} nlme/man/MathAchSchool.Rd0000644000176000001440000000242714251721455014767 0ustar ripleyusers% File nlme/man/MathAchSchool.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{MathAchSchool} \alias{MathAchSchool} \title{School demographic data for MathAchieve} \description{ The \code{MathAchSchool} data frame has 160 rows and 7 columns. } \format{ This data frame contains the following columns: \describe{ \item{School}{ a factor giving the school on which the measurement is made. } \item{Size}{ a numeric vector giving the number of students in the school } \item{Sector}{ a factor with levels \code{Public} \code{Catholic} } \item{PRACAD}{ a numeric vector giving the percentage of students on the academic track } \item{DISCLIM}{ a numeric vector measuring the discrimination climate } \item{HIMINTY}{ a factor with levels \code{0} \code{1} } \item{MEANSES}{ a numeric vector giving the mean SES score. } } } \details{ These variables give the school-level demographic data to accompany the \code{MathAchieve} data. } %\source{} %\examples{} \keyword{datasets} nlme/man/Variogram.corLin.Rd0000644000176000001440000000371014251721455015462 0ustar ripleyusers% File nlme/man/Variogram.corLin.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.corLin} \title{Calculate Semi-variogram for a corLin Object} \usage{ \method{Variogram}{corLin}(object, distance, sig2, length.out, \dots) } \alias{Variogram.corLin} \arguments{ \item{object}{an object inheriting from class \code{"\link{corLin}"}, representing an Linear spatial correlation structure.} \item{distance}{an optional numeric vector with the distances at which the semi-variogram is to be calculated. Defaults to \code{NULL}, in which case a sequence of length \code{length.out} between the minimum and maximum values of \code{getCovariate(object)} is used.} \item{sig2}{an optional numeric value representing the process variance. Defaults to \code{1}.} \item{length.out}{an optional integer specifying the length of the sequence of distances to be used for calculating the semi-variogram, when \code{distance = NULL}. Defaults to \code{50}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram values corresponding to the Linear correlation model, using the estimated coefficients corresponding to \code{object}, at the distances defined by \code{distance}. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corLin}}, \code{\link{plot.Variogram}}, \code{\link{Variogram}} } \examples{ cs1 <- corLin(15, form = ~ Time | Rat) cs1 <- Initialize(cs1, BodyWeight) Variogram(cs1)[1:10,] } \keyword{models} nlme/man/Oxide.Rd0000644000176000001440000000311514251721455013355 0ustar ripleyusers% File nlme/man/Oxide.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Oxide} \alias{Oxide} \title{Variability in Semiconductor Manufacturing} \description{ The \code{Oxide} data frame has 72 rows and 5 columns. } \format{ This data frame contains the following columns: \describe{ \item{Source}{ a factor with levels \code{1} and \code{2} } \item{Lot}{ a factor giving a unique identifier for each lot. } \item{Wafer}{ a factor giving a unique identifier for each wafer within a lot. } \item{Site}{ a factor with levels \code{1}, \code{2}, and \code{3} } \item{Thickness}{ a numeric vector giving the thickness of the oxide layer. } } } \details{ These data are described in Littell et al. (1996, p. 155) as coming ``from a passive data collection study in the semiconductor industry where the objective is to estimate the variance components to determine the assignable causes of the observed variability.'' The observed response is the thickness of the oxide layer on silicon wafers, measured at three different sites of each of three wafers selected from each of eight lots sampled from the population of lots. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.20) Littell, R. C., Milliken, G. A., Stroup, W. W. and Wolfinger, R. D. (1996), \emph{SAS System for Mixed Models}, SAS Institute, Cary, NC. } %\examples{} \keyword{datasets} nlme/man/pdLogChol.Rd0000644000176000001440000000753714251721455014174 0ustar ripleyusers% File nlme/man/pdLogChol.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdLogChol} \title{General Positive-Definite Matrix} \usage{ pdLogChol(value, form, nam, data) } \alias{pdLogChol} \arguments{ \item{value}{an optional initialization value, which can be any of the following: a \code{pdMat} object, a positive-definite matrix, a one-sided linear formula (with variables separated by \code{+}), a vector of character strings, or a numeric vector. Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional one-sided linear formula specifying the row/column names for the matrix represented by \code{object}. Because factors may be present in \code{form}, the formula needs to be evaluated on a data frame to resolve the names it defines. This argument is ignored when \code{value} is a one-sided formula. Defaults to \code{NULL}.} \item{nam}{an optional character vector specifying the row/column names for the matrix represented by object. It must have length equal to the dimension of the underlying positive-definite matrix and unreplicated elements. This argument is ignored when \code{value} is a character vector. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factor}s appearing in the formulas. Defaults to the parent frame from which the function was called.} } \description{ This function is a constructor for the \code{pdLogChol} class, representing a general positive-definite matrix. If the matrix associated with \code{object} is of dimension \eqn{n}, it is represented by \eqn{n(n+1)/2}{n*(n+1)/2} unrestricted parameters, using the log-Cholesky parametrization described in Pinheiro and Bates (1996). \itemize{ \item When \code{value} is \code{numeric(0)}, an uninitialized \code{pdMat} object, a one-sided formula, or a character vector, \code{object} is returned as an \emph{uninitialized} \code{pdLogChol} object (with just some of its attributes and its class defined) and needs to have its coefficients assigned later, generally using the \code{coef} or \code{matrix} replacement functions. \item If \code{value} is an \emph{initialized} \code{pdMat} object, \code{object} will be constructed from \code{as.matrix(value)}. \item Finally, if \code{value} is a numeric vector, it is assumed to represent the unrestricted coefficients of the matrix-logarithm parametrization of the underlying positive-definite matrix. } } \details{ Internally, the \code{pdLogChol} representation of a symmetric positive definite matrix is a vector starting with the logarithms of the diagonal of the Choleski factorization of that matrix followed by its upper triangular portion. } \value{ a \code{pdLogChol} object representing a general positive-definite matrix, also inheriting from class \code{pdMat}. } \references{ Pinheiro, J.C. and Bates., D.M. (1996) Unconstrained Parametrizations for Variance-Covariance Matrices, \emph{Statistics and Computing} \bold{6}, 289--296. Pinheiro, J.C., and Bates, D.M. (2000) \emph{Mixed-Effects Models in S and S-PLUS}, Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{coef.pdMat}}, \code{\link{pdClasses}}, \code{\link{matrix<-.pdMat}}} \examples{ (pd1 <- pdLogChol(diag(1:3), nam = c("A","B","C"))) (pd4 <- pdLogChol(1:6)) (pd4c <- chol(pd4)) # -> upper-tri matrix with off-diagonals 4 5 6 pd4c[upper.tri(pd4c)] log(diag(pd4c)) # 1 2 3 } \keyword{models} nlme/man/logLik.lmeStruct.Rd0000644000176000001440000000330514251721455015510 0ustar ripleyusers% File nlme/man/logLik.lmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.lmeStruct} \title{Log-Likelihood of an lmeStruct Object} \usage{ \method{logLik}{lmeStruct}(object, Pars, conLin, \dots) } \alias{logLik.lmeStruct} \alias{logLik.lmeStructInt} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmeStruct}"}, representing a list of linear mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} \item{Pars}{the parameter values at which the (restricted) log-likelihood is to be evaluated.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying lme model. Defaults to \code{attr(object, "conLin")}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ \code{Pars} is used to update the coefficients of the model components of \code{object} and the individual (restricted) log-likelihood contributions of each component are added together. The type of log-likelihood (restricted or not) is determined by the \code{settings} attribute of \code{object}. } \value{ the (restricted) log-likelihood for the linear mixed-effects model described by \code{object}, evaluated at \code{Pars}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{lmeStruct}}, \code{\link{logLik.lme}} } \keyword{models} nlme/man/plot.lmList.Rd0000644000176000001440000001027414633640310014524 0ustar ripleyusers% File nlme/man/plot.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.lmList} \title{Plot an lmList Object} \usage{ \method{plot}{lmList}(x, form, abline, id, idLabels, grid, \dots) } \alias{plot.lmList} \arguments{ \item{x}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model.} \item{form}{an optional formula specifying the desired type of plot. Any variable present in the original data frame used to obtain \code{x} can be referenced. In addition, \code{x} itself can be referenced in the formula using the symbol \code{"."}. Conditional expressions on the right of a \code{|} operator can be used to define separate panels in a Trellis display. Default is \code{resid(., type = "pool") ~ fitted(.) }, corresponding to a plot of the standardized residuals (using a pooled estimate for the residual standard error) versus fitted values. } \item{abline}{an optional numeric value, or numeric vector of length two. If given as a single value, a horizontal line will be added to the plot at that coordinate; else, if given as a vector, its values are used as the intercept and slope for a line added to the plot. If missing, no lines are added to the plot. } \item{id}{an optional numeric value, or one-sided formula. If given as a value, it is used as a significance level for a two-sided outlier test for the standardized residuals. Observations with absolute standardized residuals greater than the \eqn{1 - value/2} quantile of the standard normal distribution are identified in the plot using \code{idLabels}. If given as a one-sided formula, its right hand side must evaluate to a logical, integer, or character vector which is used to identify observations in the plot. If missing, no observations are identified. } \item{idLabels}{an optional vector, or one-sided formula. If given as a vector, it is converted to character and used to label the observations identified according to \code{id}. If given as a one-sided formula, its right hand side must evaluate to a vector which is converted to character and used to label the identified observations. Default is \code{getGroups(x)}. } \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default depends on the type of Trellis plot used: if \code{xyplot} defaults to \code{TRUE}, else defaults to \code{FALSE}. } \item{\dots}{optional arguments passed to the Trellis plot function.} } \description{ Diagnostic plots for the linear model fits corresponding to the \code{x} components are obtained. The \code{form} argument gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a \code{|} operator) always implies that different panels are used for each level of the conditioning factor, according to a Trellis display. If \code{form} is a one-sided formula, histograms of the variable on the right hand side of the formula, before a \code{|} operator, are displayed (the Trellis function \code{histogram} is used). If \code{form} is two-sided and both its left and right hand side variables are numeric, scatter plots are displayed (the Trellis function \code{xyplot} is used). Finally, if \code{form} is two-sided and its left had side variable is a factor, box-plots of the right hand side variable by the levels of the left hand side variable are displayed (the Trellis function \code{bwplot} is used). } \value{ a diagnostic Trellis plot. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}},\code{\link{predict.lm}}, \code{\link[lattice]{xyplot}}, \code{\link[lattice]{bwplot}}, \code{\link[lattice]{histogram}} } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) # standardized residuals versus fitted values by gender plot(fm1, resid(., type = "pool") ~ fitted(.) | Sex, abline = 0, id = 0.05) # box-plots of residuals by Subject plot(fm1, Subject ~ resid(.)) # observed versus fitted values by Subject plot(fm1, distance ~ fitted(.) | Subject, abline = c(0,1)) } \keyword{models} nlme/man/Tetracycline2.Rd0000644000176000001440000000164214251721455015020 0ustar ripleyusers% File nlme/man/Tetracycline2.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Tetracycline2} \alias{Tetracycline2} \title{Pharmacokinetics of tetracycline} \description{ The \code{Tetracycline2} data frame has 40 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{conc}{ a numeric vector } \item{Time}{ a numeric vector } \item{Subject}{ an ordered factor with levels \code{4} < \code{5} < \code{2} < \code{1} < \code{3} } \item{Formulation}{ a factor with levels \code{Berkmycin} \code{tetramycin} } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/pdNatural.Rd0000644000176000001440000001006214251721455014236 0ustar ripleyusers% File nlme/man/pdNatural.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdNatural} \title{General Positive-Definite Matrix in Natural Parametrization} \usage{ pdNatural(value, form, nam, data) } \alias{pdNatural} \arguments{ \item{value}{an optional initialization value, which can be any of the following: a \code{pdMat} object, a positive-definite matrix, a one-sided linear formula (with variables separated by \code{+}), a vector of character strings, or a numeric vector. Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional one-sided linear formula specifying the row/column names for the matrix represented by \code{object}. Because factors may be present in \code{form}, the formula needs to be evaluated on a data.frame to resolve the names it defines. This argument is ignored when \code{value} is a one-sided formula. Defaults to \code{NULL}.} \item{nam}{an optional vector of character strings specifying the row/column names for the matrix represented by object. It must have length equal to the dimension of the underlying positive-definite matrix and unreplicated elements. This argument is ignored when \code{value} is a vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} } \description{ This function is a constructor for the \code{pdNatural} class, representing a general positive-definite matrix, using a natural parametrization . If the matrix associated with \code{object} is of dimension \eqn{n}, it is represented by \eqn{n(n+1)/2}{n*(n+1)/2} parameters. Letting \eqn{\sigma_{ij}}{S(i,j)} denote the \eqn{ij}-th element of the underlying positive definite matrix and \eqn{\rho_{ij}=\sigma_{i}/\sqrt{\sigma_{ii}\sigma_{jj}},\;i\neq j}{r(i,j) = S(i,j)/sqrt(S(i,i)S(j,j)), i not equal to j} denote the associated "correlations", the "natural" parameters are given by \eqn{\sqrt{\sigma_{ii}}, \;i=1,\ldots,n}{sqrt(Sii), i=1,..,n} and \eqn{\log((1+\rho_{ij})/(1-\rho_{ij})),\; i \neq j}{log((1+r(i,j))/(1-r(i,j))), i not equal to j}. Note that all natural parameters are individually unrestricted, but not jointly unrestricted (meaning that not all unrestricted vectors would give positive-definite matrices). Therefore, this parametrization should NOT be used for optimization. It is mostly used for deriving approximate confidence intervals on parameters following the optimization of an objective function. When \code{value} is \code{numeric(0)}, an uninitialized \code{pdMat} object, a one-sided formula, or a vector of character strings, \code{object} is returned as an uninitialized \code{pdSymm} object (with just some of its attributes and its class defined) and needs to have its coefficients assigned later, generally using the \code{coef} or \code{matrix} replacement functions. If \code{value} is an initialized \code{pdMat} object, \code{object} will be constructed from \code{as.matrix(value)}. Finally, if \code{value} is a numeric vector, it is assumed to represent the natural parameters of the underlying positive-definite matrix. } \value{ a \code{pdNatural} object representing a general positive-definite matrix in natural parametrization, also inheriting from class \code{pdMat}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. p. 162. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{coef.pdMat}}, \code{\link{pdClasses}}, \code{\link{matrix<-.pdMat}}} \examples{ pdNatural(diag(1:3)) } \keyword{models} nlme/man/augPred.Rd0000644000176000001440000000663314251721455013704 0ustar ripleyusers% File nlme/man/augPred.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{augPred} \title{Augmented Predictions} \usage{ augPred(object, primary, minimum, maximum, length.out, \dots) %% extra argument 'level': \S3method{augPred}{lme}(object, primary = NULL, minimum = min(primary), maximum = max(primary), length.out = 51, level = Q, \dots) } \alias{augPred} \alias{augPred.gls} \alias{augPred.lme} \alias{augPred.lmList} \arguments{ \item{object}{a fitted model object from which predictions can be extracted, using a \code{predict} method.} \item{primary}{an optional one-sided formula specifying the primary covariate to be used to generate the augmented predictions. By default, if a covariate can be extracted from the data used to generate \code{object} (using \code{getCovariate}), it will be used as \code{primary}.} \item{minimum}{an optional lower limit for the primary covariate. Defaults to \code{min(primary)}.} \item{maximum}{an optional upper limit for the primary covariate. Defaults to \code{max(primary)}.} \item{length.out}{an optional integer with the number of primary covariate values at which to evaluate the predictions. Defaults to 51.} \item{level}{an optional integer vector specifying the desired prediction levels. Levels increase from outermost to innermost grouping, with level 0 representing the population (fixed effects) predictions. Defaults to the innermost level.} \item{\dots}{some methods for the generic may require additional arguments.} } \description{ Predicted values are obtained at the specified values of \code{primary}. If \code{object} has a grouping structure (i.e. \code{getGroups(object)} is not \code{NULL}), predicted values are obtained for each group. If \code{level} has more than one element, predictions are obtained for each level of the \code{max(level)} grouping factor. If other covariates besides \code{primary} are used in the prediction model, their average (numeric covariates) or most frequent value (categorical covariates) are used to obtain the predicted values. The original observations are also included in the returned object. } \value{ a data frame with four columns representing, respectively, the values of the primary covariate, the groups (if \code{object} does not have a grouping structure, all elements will be \code{1}), the predicted or observed values, and the type of value in the third column: \code{original} for the observed values and \code{predicted} (single or no grouping factor) or \code{predict.groupVar} (multiple levels of grouping), with \code{groupVar} replaced by the actual grouping variable name (\code{fixed} is used for population predictions). The returned object inherits from class \code{"augPred"}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{gls}, \code{lme}, and \code{lmList}. } \seealso{\code{\link{plot.augPred}}, \code{\link{getGroups}}, \code{\link{predict}}} \examples{ fm1 <- lme(Orthodont, random = ~1) augPred(fm1, length.out = 2, level = c(0,1)) } \keyword{models} nlme/man/corExp.Rd0000644000176000001440000001126114251721455013546 0ustar ripleyusers% File nlme/man/corExp.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corExp} \title{Exponential Correlation Structure} \usage{ corExp(value, form, nugget, metric, fixed) } \alias{corExp} \arguments{ \item{value}{an optional vector with the parameter values in constrained form. If \code{nugget} is \code{FALSE}, \code{value} can have only one element, corresponding to the "range" of the exponential correlation structure, which must be greater than zero. If \code{nugget} is \code{TRUE}, meaning that a nugget effect is present, \code{value} can contain one or two elements, the first being the "range" and the second the "nugget effect" (one minus the correlation between two observations taken arbitrarily close together); the first must be greater than zero and the second must be between zero and one. Defaults to \code{numeric(0)}, which results in a range of 90\% of the minimum distance and a nugget effect of 0.1 being assigned to the parameters when \code{object} is initialized.} \item{form}{a one sided formula of the form \code{~ S1+...+Sp}, or \code{~ S1+...+Sp | g}, specifying spatial covariates \code{S1} through \code{Sp} and, optionally, a grouping factor \code{g}. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{nugget}{an optional logical value indicating whether a nugget effect is present. Defaults to \code{FALSE}.} \item{metric}{an optional character string specifying the distance metric to be used. The currently available options are \code{"euclidean"} for the root sum-of-squares of distances; \code{"maximum"} for the maximum difference; and \code{"manhattan"} for the sum of the absolute differences. Partial matching of arguments is used, so only the first three characters need to be provided. Defaults to \code{"euclidean"}.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{"corExp"} class, representing an exponential spatial correlation structure. Letting \eqn{d} denote the range and \eqn{n} denote the nugget effect, the correlation between two observations a distance \eqn{r} apart is \eqn{\exp(-r/d)}{exp(-r/d)} when no nugget effect is present and \eqn{(1-n) \exp(-r/d)}{(1-n)*exp(-r/d)} when a nugget effect is assumed. Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{"corExp"}, also inheriting from class \code{"corSpatial"}, representing an exponential spatial correlation structure. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. Littel, Milliken, Stroup, and Wolfinger (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. p. 238. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}}, \code{\link{dist}} } \examples{ sp1 <- corExp(form = ~ x + y + z) # Pinheiro and Bates, p. 238 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(cs3Exp) # example lme(..., corExp ...) # Pinheiro and Bates, pp. 222-247 # p. 222 options(contrasts = c("contr.treatment", "contr.poly")) fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight, random = ~ Time) # p. 223 fm2BW.lme <- update(fm1BW.lme, weights = varPower()) # p. 246 fm3BW.lme <- update(fm2BW.lme, correlation = corExp(form = ~ Time)) # p. 247 fm4BW.lme <- update(fm3BW.lme, correlation = corExp(form = ~ Time, nugget = TRUE)) anova(fm3BW.lme, fm4BW.lme) } \keyword{models} nlme/man/Alfalfa.Rd0000644000176000001440000000336114251721455013636 0ustar ripleyusers% File nlme/man/Alfalfa.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Alfalfa} \alias{Alfalfa} \title{Split-Plot Experiment on Varieties of Alfalfa} \description{ The \code{Alfalfa} data frame has 72 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Variety}{ a factor with levels \code{Cossack}, \code{Ladak}, and \code{Ranger} } \item{Date}{ a factor with levels \code{None} \code{S1} \code{S20} \code{O7} } \item{Block}{ a factor with levels \code{1} \code{2} \code{3} \code{4} \code{5} \code{6} } \item{Yield}{ a numeric vector } } } \details{ These data are described in Snedecor and Cochran (1980) as an example of a split-plot design. The treatment structure used in the experiment was a 3\eqn{ x }{\times}4 full factorial, with three varieties of alfalfa and four dates of third cutting in 1943. The experimental units were arranged into six blocks, each subdivided into four plots. The varieties of alfalfa (\emph{Cossac}, \emph{Ladak}, and \emph{Ranger}) were assigned randomly to the blocks and the dates of third cutting (\emph{None}, \emph{S1}---September 1, \emph{S20}---September 20, and \emph{O7}---October 7) were randomly assigned to the plots. All four dates were used on each block. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.1) Snedecor, G. W. and Cochran, W. G. (1980), \emph{Statistical Methods (7th ed)}, Iowa State University Press, Ames, IA } %\examples{} \keyword{datasets} nlme/man/Initialize.glsStruct.Rd0000644000176000001440000000254414251721455016404 0ustar ripleyusers% File nlme/man/Initialize.glsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Initialize.glsStruct} \title{Initialize a glsStruct Object} \usage{ \method{Initialize}{glsStruct}(object, data, control, \dots) } \alias{Initialize.glsStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{glsStruct}"}, representing a list of linear model components, such as \code{corStruct} and \code{varFunc} objects.} \item{data}{a data frame in which to evaluate the variables defined in \code{formula(object)}.} \item{control}{an optional list with control parameters for the initialization and optimization algorithms used in \code{gls}. Defaults to \code{list(singular.ok = FALSE)}, implying that linear dependencies are not allowed in the model.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The individual linear model components of the \code{glsStruct} list are initialized. } \value{ a \code{glsStruct} object similar to \code{object}, but with initialized model components. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link{Initialize.corStruct}}, \code{\link{Initialize.varFunc}}, \code{\link{Initialize}}} \keyword{models} nlme/man/Coef.Rd0000644000176000001440000000223414362732113013156 0ustar ripleyusers% File nlme/man/Coef.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Coef} \title{Assign Values to Coefficients} \usage{ coef(object, ...) <- value coefficients(object, ...) <- value } \alias{coef<-} \alias{coefficients<-} \arguments{ \item{object}{any object representing a fitted model, or, by default, any object with a \code{coef} component.} \item{...}{some methods for this generic function may require additional arguments.} \item{value}{a value to be assigned to the coefficients associated with \code{object}.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include all \code{"\link{pdMat}"}, \code{"\link{corStruct}"} and \code{"\link{varFunc}"} classes, \code{"\link{reStruct}"}, and \code{"modelStruct"}. \code{coefficients<-} is an \emph{alias} for \code{coef<-}. } \value{ will depend on the method function; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{coef}}} \keyword{models} nlme/man/corARMA.Rd0000644000176000001440000000662614613676342013551 0ustar ripleyusers% File nlme/man/corARMA.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corARMA} \title{ARMA(p,q) Correlation Structure} \usage{ corARMA(value, form, p, q, fixed) } \alias{corARMA} \alias{coef.corARMA} \arguments{ \item{value}{a vector with the values of the autoregressive and moving average parameters, which must have length \code{p + q} and all elements between -1 and 1. Defaults to a vector of zeros, corresponding to uncorrelated observations.} \item{form}{a one sided formula of the form \code{~ t}, or \code{~ t | g}, specifying a time covariate \code{t} and, optionally, a grouping factor \code{g}. A covariate for this correlation structure must be integer valued. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{p, q}{non-negative integers specifying respectively the autoregressive order and the moving average order of the \acronym{ARMA} structure. Both default to 0, but at least one should be > 0.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corARMA} class, representing an autocorrelation-moving average correlation structure of order (p, q). Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corARMA}, representing an autocorrelation-moving average correlation structure. } \references{ Box, 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, esp. pp. 236, 397. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corAR1}}, \code{\link{corClasses}} \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}} } \examples{ ## ARMA(1,2) structure, with observation order as a covariate and ## Mare as grouping factor cs1 <- corARMA(c(0.2, 0.3, -0.1), form = ~ 1 | Mare, p = 1, q = 2) # Pinheiro and Bates, p. 237 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) # Pinheiro and Bates use in nlme: # from p. 240 needed on p. 396 fm1Ovar.lme <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), data = Ovary, random = pdDiag(~sin(2*pi*Time))) fm5Ovar.lme <- update(fm1Ovar.lme, correlation = corARMA(p = 1, q = 1)) # p. 396 fm1Ovar.nlme <- nlme(follicles~ A+B*sin(2*pi*w*Time)+C*cos(2*pi*w*Time), data=Ovary, fixed=A+B+C+w~1, random=pdDiag(A+B+w~1), start=c(fixef(fm5Ovar.lme), 1) ) # p. 397 fm3Ovar.nlme <- update(fm1Ovar.nlme, correlation=corARMA(p=0, q=2) ) } \keyword{models} nlme/man/collapse.groupedData.Rd0000644000176000001440000001147114543113774016354 0ustar ripleyusers% File nlme/man/collapse.groupedData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{collapse.groupedData} \title{Collapse a groupedData Object} \usage{ \method{collapse}{groupedData}(object, collapseLevel, displayLevel, outer, inner, preserve, FUN, subset, \dots) } \alias{collapse.groupedData} \arguments{ \item{object}{an object inheriting from class \code{groupedData}, generally with multiple grouping factors. } \item{collapseLevel}{an optional positive integer or character string indicating the grouping level to use when collapsing the data. Level values increase from outermost to innermost grouping. Default is the highest or innermost level of grouping. } \item{displayLevel}{an optional positive integer or character string indicating the grouping level to use as the grouping factor for the collapsed data. Default is \code{collapseLevel}. } \item{outer}{an optional logical value or one-sided formula, indicating covariates that are outer to the \code{displayLevel} grouping factor. If equal to \code{TRUE}, the \code{displayLevel} element \code{attr(object, "outer")} is used to indicate the outer covariates. An outer covariate is invariant within the sets of rows defined by the grouping factor. Ordering of the groups is done in such a way as to preserve adjacency of groups with the same value of the outer variables. Defaults to \code{NULL}, meaning that no outer covariates are to be used. } \item{inner}{an optional logical value or one-sided formula, indicating a covariate that is inner to the \code{displayLevel} grouping factor. If equal to \code{TRUE}, \code{attr(object, "outer")} is used to indicate the inner covariate. An inner covariate can change within the sets of rows defined by the grouping factor. Defaults to \code{NULL}, meaning that no inner covariate is present. } \item{preserve}{an optional one-sided formula indicating a covariate whose levels should be preserved when collapsing the data according to the \code{collapseLevel} grouping factor. The collapsing factor is obtained by pasting together the levels of the \code{collapseLevel} grouping factor and the values of the covariate to be preserved. Default is \code{NULL}, meaning that no covariates need to be preserved. } \item{FUN}{an optional summary function or a list of summary functions to be used for collapsing the data. The function or functions are applied only to variables in \code{object} that vary within the groups defined by \code{collapseLevel}. Invariant variables are always summarized by group using the unique value that they assume within that group. If \code{FUN} is a single function it will be applied to each non-invariant variable by group to produce the summary for that variable. If \code{FUN} is a list of functions, the names in the list should designate classes of variables in the data such as \code{ordered}, \code{factor}, or \code{numeric}. The indicated function will be applied to any non-invariant variables of that class. The default functions to be used are \code{mean} for numeric factors, and \code{Mode} for both \code{factor} and \code{ordered}. The \code{Mode} function, defined internally in \code{gsummary}, returns the modal or most popular value of the variable. It is different from the \code{mode} function that returns the S-language mode of the variable.} \item{subset}{an optional named list. Names can be either positive integers representing grouping levels, or names of grouping factors. Each element in the list is a vector indicating the levels of the corresponding grouping factor to be preserved in the collapsed data. Default is \code{NULL}, meaning that all levels are used. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ If \code{object} has a single grouping factor, it is returned unchanged. Else, it is summarized by the values of the \code{displayLevel} grouping factor (or the combination of its values and the values of the covariate indicated in \code{preserve}, if any is present). The collapsed data is used to produce a new \code{groupedData} object, with grouping factor given by the \code{displayLevel} factor. } \value{ a \code{groupedData} object with a single grouping factor given by the \code{displayLevel} grouping factor, resulting from collapsing \code{object} over the levels of the \code{collapseLevel} grouping factor. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{groupedData}}, \code{\link{plot.nmGroupedData}} } \examples{ # collapsing by Dog collapse(Pixel, collapseLevel = 1) # same as collapse(Pixel, collapseLevel = "Dog") } \keyword{models} nlme/man/glsStruct.Rd0000644000176000001440000000227214251721455014302 0ustar ripleyusers% File nlme/man/glsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{glsStruct} \title{Generalized Least Squares Structure} \usage{ glsStruct(corStruct, varStruct) } \alias{glsStruct} \arguments{ \item{corStruct}{an optional \code{corStruct} object, representing a correlation structure. Default is \code{NULL}.} \item{varStruct}{an optional \code{varFunc} object, representing a variance function structure. Default is \code{NULL}.} } \description{ A generalized least squares structure is a list of model components representing different sets of parameters in the linear model. A \code{glsStruct} may contain \code{corStruct} and \code{varFunc} objects. \code{NULL} arguments are not included in the \code{glsStruct} list. } \value{ a list of model variance-covariance components determining the parameters to be estimated for the associated linear model. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{gls}}, \code{\link{residuals.glsStruct}}, \code{\link{varFunc}} } \examples{ gls1 <- glsStruct(corAR1(), varPower()) } \keyword{models} nlme/man/corMatrix.pdMat.Rd0000644000176000001440000000212414251721455015320 0ustar ripleyusers% File nlme/man/corMatrix.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corMatrix.pdMat} \title{Extract Correlation Matrix from a pdMat Object} \usage{ \method{corMatrix}{pdMat}(object, \dots) } \alias{corMatrix.pdBlocked} \alias{corMatrix.pdCompSymm} \alias{corMatrix.pdDiag} \alias{corMatrix.pdIdent} \alias{corMatrix.pdMat} \alias{corMatrix.pdSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive definite matrix.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The correlation matrix corresponding to the positive-definite matrix represented by \code{object} is obtained. } \value{ the correlation matrix corresponding to the positive-definite matrix represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{pdMatrix}}} \examples{ pd1 <- pdSymm(diag(1:4)) corMatrix(pd1) } \keyword{models} nlme/man/logDet.reStruct.Rd0000644000176000001440000000207314251721455015337 0ustar ripleyusers% File nlme/man/logDet.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logDet.reStruct} \title{Extract reStruct Log-Determinants} \usage{ \method{logDet}{reStruct}(object, \dots) } \alias{logDet.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Calculates, for each of the \code{pdMat} components of \code{object}, the logarithm of the determinant of a square-root factor. } \value{ a vector with the log-determinants of square-root factors of the \code{pdMat} components of \code{object}. } \author{José Pinheiro} \seealso{\code{\link{reStruct}}, \code{\link{pdMat}}, \code{\link{logDet}} } \examples{ rs1 <- reStruct(list(A = pdSymm(diag(1:3), form = ~Score), B = pdDiag(2 * diag(4), form = ~Educ))) logDet(rs1) } \keyword{models} nlme/man/logLik.reStruct.Rd0000644000176000001440000000323314251721455015341 0ustar ripleyusers% File nlme/man/logLik.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.reStruct} \title{Calculate reStruct Log-Likelihood} \usage{ \method{logLik}{reStruct}(object, conLin, \dots) } \alias{logLik.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{conLin}{a condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying model.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Calculates the log-likelihood, or restricted log-likelihood, of the Gaussian linear mixed-effects model represented by \code{object} and \code{conLin} (assuming spherical within-group covariance structure), evaluated at \code{coef(object)}. The \code{settings} attribute of \code{object} determines whether the log-likelihood, or the restricted log-likelihood, is to be calculated. The computational methods are described in Bates and Pinheiro (1998). } \value{ the log-likelihood, or restricted log-likelihood, of linear mixed-effects model represented by \code{object} and \code{conLin}, evaluated at \code{coef{object}}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{reStruct}}, \code{\link{pdMat}}, \code{\link{logLik.lme}} } \keyword{models} nlme/man/Cefamandole.Rd0000644000176000001440000000257014251721455014507 0ustar ripleyusers% File nlme/man/Cefamandole.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Cefamandole} \alias{Cefamandole} \title{Pharmacokinetics of Cefamandole} \description{ The \code{Cefamandole} data frame has 84 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{Subject}{ a factor giving the subject from which the sample was drawn. } \item{Time}{ a numeric vector giving the time at which the sample was drawn (minutes post-injection). } \item{conc}{ a numeric vector giving the observed plasma concentration of cefamandole (mcg/ml). } } } \details{ Davidian and Giltinan (1995, 1.1, p. 2) describe data obtained during a pilot study to investigate the pharmacokinetics of the drug cefamandole. Plasma concentrations of the drug were measured on six healthy volunteers at 14 time points following an intraveneous dose of 15 mg/kg body weight of cefamandole. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.4) Davidian, M. and Giltinan, D. M. (1995), \emph{Nonlinear Models for Repeated Measurement Data}, Chapman and Hall, London. } \examples{ plot(Cefamandole) fm1 <- nlsList(SSbiexp, data = Cefamandole) summary(fm1) } \keyword{datasets} nlme/man/lmList.Rd0000644000176000001440000001003014363200201013524 0ustar ripleyusers% File nlme/man/lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{lmList} \title{List of lm Objects with a Common Model} \usage{ lmList(object, data, level, subset, na.action = na.fail, pool = TRUE, warn.lm = TRUE) \method{lmList}{formula}(object, data, level, subset, na.action = na.fail, pool = TRUE, warn.lm = TRUE) \method{update}{lmList}(object, formula., \dots, evaluate = TRUE) \method{print}{lmList}(x, pool, \dots) } \alias{lmList} \alias{lmList.formula} \alias{print.lmList} \alias{update.lmList} \arguments{ \item{object}{For \code{lmList}, either a linear formula object of the form \code{y ~ x1+...+xn | g} or a \code{groupedData} object. In the formula object, \code{y} represents the response, \code{x1,...,xn} the covariates, and \code{g} the grouping factor specifying the partitioning of the data according to which different \code{lm} fits should be performed. The grouping factor \code{g} may be omitted from the formula, in which case the grouping structure will be obtained from \code{data}, which must inherit from class \code{groupedData}. The method function \code{\link{lmList.groupedData}} is documented separately. For the method \code{update.lmList}, \code{object} is an object inheriting from class \code{lmList}. } \item{formula}{(used in \code{update.lmList} only) a two-sided linear formula with the common model for the individuals \code{lm} fits. } \item{formula.}{Changes to the formula -- see \code{update.formula} for details.} \item{data}{ a data frame in which to interpret the variables named in \code{object}. } \item{level}{ an optional integer specifying the level of grouping to be used when multiple nested levels of grouping are present. } \item{subset}{an optional expression indicating which subset of the rows of \code{data} should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{lmList} to print an error message and terminate if there are any incomplete observations. } \item{pool}{ an optional logical value indicating whether a pooled estimate of the residual standard error should be used in calculations of standard deviations or standard errors for summaries. } \item{warn.lm}{\code{\link{logical}} indicating if \code{\link{lm}()} errors (all of which are caught by \code{\link{tryCatch}}) should be signalled as a \dQuote{summarizing} \code{\link{warning}}.} \item{x}{an object inheriting from class \code{lmList} to be printed.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} \item{evaluate}{If \code{TRUE} evaluate the new call else return the call.} } \description{ \code{Data} is partitioned according to the levels of the grouping factor \code{g} and individual \code{lm} fits are obtained for each \code{data} partition, using the model defined in \code{object}. } \value{ a list of \code{lm} objects with as many components as the number of groups defined by the grouping factor. Generic functions such as \code{coef}, \code{fixed.effects}, \code{lme}, \code{pairs}, \code{plot}, \code{predict}, \code{random.effects}, \code{summary}, and \code{update} have methods that can be applied to an \code{lmList} object. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \seealso{ \code{\link{lm}}, \code{\link{lme.lmList}}, \code{\link{plot.lmList}}, \code{\link{pooledSD}}, \code{\link{predict.lmList}}, \code{\link{residuals.lmList}}, \code{\link{summary.lmList}} } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) summary(fm1) } \keyword{models} nlme/man/lmeStruct.Rd0000644000176000001440000000257614251721456014302 0ustar ripleyusers% File nlme/man/lmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{lmeStruct} \title{Linear Mixed-Effects Structure} \usage{ lmeStruct(reStruct, corStruct, varStruct) } \alias{lmeStruct} \arguments{ \item{reStruct}{a \code{reStruct} representing a random effects structure.} \item{corStruct}{an optional \code{corStruct} object, representing a correlation structure. Default is \code{NULL}.} \item{varStruct}{an optional \code{varFunc} object, representing a variance function structure. Default is \code{NULL}.} } \description{ A linear mixed-effects structure is a list of model components representing different sets of parameters in the linear mixed-effects model. An \code{lmeStruct} list must contain at least a \code{reStruct} object, but may also contain \code{corStruct} and \code{varFunc} objects. \code{NULL} arguments are not included in the \code{lmeStruct} list. } \value{ a list of model components determining the parameters to be estimated for the associated linear mixed-effects model. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{lme}}, \code{\link{residuals.lmeStruct}}, \code{\link{reStruct}}, \code{\link{varFunc}} } \examples{ lms1 <- lmeStruct(reStruct(~age), corAR1(), varPower()) } \keyword{models} nlme/man/logLik.lme.Rd0000644000176000001440000000362714251721455014312 0ustar ripleyusers% File nlme/man/logLik.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.lme} \title{Log-Likelihood of an lme Object} \usage{ \method{logLik}{lme}(object, REML, \dots) } \alias{logLik.lme} \alias{logLik.gls} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{REML}{an optional logical value. If \code{TRUE} the restricted log-likelihood is returned, else, if \code{FALSE}, the log-likelihood is returned. Defaults to the method of estimation used, that is \code{TRUE} if and only \code{object} was fitted with \code{method = "REML"} (the default for these fitting functions) . } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ If \code{REML=FALSE}, returns the log-likelihood value of the linear mixed-effects model represented by \code{object} evaluated at the estimated coefficients; else, the restricted log-likelihood evaluated at the estimated coefficients is returned. } \value{ the (restricted) log-likelihood of the model represented by \code{object} evaluated at the estimated coefficients. } \references{ Harville, D.A. (1974) ``Bayesian Inference for Variance Components Using Only Error Contrasts'', \emph{Biometrika}, \bold{61}, 383--385. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates} \seealso{\code{\link{lme}},\code{\link{gls}}, \code{\link{logLik.corStruct}}, \code{\link{logLik.glsStruct}}, \code{\link{logLik.lmeStruct}}, \code{\link{logLik.lmList}}, \code{\link{logLik.reStruct}}, \code{\link{logLik.varFunc}}, } \examples{ fm1 <- lme(distance ~ Sex * age, Orthodont, random = ~ age, method = "ML") logLik(fm1) logLik(fm1, REML = TRUE) } \keyword{models} nlme/man/Covariate.varFunc.Rd0000644000176000001440000000214614251721455015630 0ustar ripleyusers% File nlme/man/Covariate.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Covariate.varFunc} \title{Assign varFunc Covariate} \usage{ \method{covariate}{varFunc}(object) <- value } \alias{covariate<-.varFunc} \arguments{ \item{object}{an object inheriting from class \code{"\link{varFunc}"}, representing a variance function structure.} \item{value}{a value to be assigned to the covariate associated with \code{object}.} } \description{ The covariate(s) used in the calculation of the weights of the variance function represented by \code{object} is (are) replaced by \code{value}. If \code{object} has been initialized, \code{value} must have the same dimensions as \code{getCovariate(object)}. } \value{ a \code{varFunc} object similar to \code{object}, but with its \code{covariate} attribute replaced by \code{value}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{getCovariate.varFunc}}} \examples{ vf1 <- varPower(1.1, form = ~age) covariate(vf1) <- Orthodont[["age"]] } \keyword{models} nlme/man/Tetracycline1.Rd0000644000176000001440000000164014251721455015015 0ustar ripleyusers% File nlme/man/Tetracycline1.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Tetracycline1} \alias{Tetracycline1} \title{Pharmacokinetics of tetracycline} \description{ The \code{Tetracycline1} data frame has 40 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{conc}{ a numeric vector } \item{Time}{ a numeric vector } \item{Subject}{ an ordered factor with levels \code{5} < \code{3} < \code{2} < \code{4} < \code{1} } \item{Formulation}{ a factor with levels \code{tetrachel} \code{tetracyn} } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/varComb.Rd0000644000176000001440000000212614251721455013677 0ustar ripleyusers% File nlme/man/varComb.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varComb} \title{Combination of Variance Functions} \usage{ varComb(\dots) } \alias{varComb} \arguments{ \item{\dots}{objects inheriting from class \code{varFunc} representing variance function structures.} } \description{ This function is a constructor for the \code{varComb} class, representing a combination of variance functions. The corresponding variance function is equal to the product of the variance functions of the \code{varFunc} objects listed in \code{\dots}. } \value{ a \code{varComb} object representing a combination of variance functions, also inheriting from class \code{varFunc}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{varClasses}}, \code{\link{varWeights.varComb}}, \code{\link{coef.varComb}}} \examples{ vf1 <- varComb(varIdent(form = ~1|Sex), varPower()) } \keyword{models} nlme/man/predict.lme.Rd0000644000176000001440000000623414251721455014520 0ustar ripleyusers% File nlme/man/predict.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{predict.lme} \title{Predictions from an lme Object} \usage{ \method{predict}{lme}(object, newdata, level = Q, asList = FALSE, na.action = na.fail, \dots) } \alias{predict.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{newdata}{an optional data frame to be used for obtaining the predictions. All variables used in the fixed and random effects models, as well as the grouping factors, must be present in the data frame. If missing, the fitted values are returned.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in obtaining the predictions. Level values increase from outermost to innermost grouping, with level zero corresponding to the population predictions. Defaults to the highest or innermost level of grouping.} \item{asList}{an optional logical value. If \code{TRUE} and a single value is given in \code{level}, the returned object is a list with the predictions split by groups; else the returned value is either a vector or a data frame, according to the length of \code{level}. } \item{na.action}{a function that indicates what should happen when \code{newdata} contains \code{NA}s. The default action (\code{na.fail}) causes the function to print an error message and terminate if there are any incomplete observations.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The predictions at level \eqn{i} are obtained by adding together the population predictions (based only on the fixed effects estimates) and the estimated contributions of the random effects to the predictions at grouping levels less or equal to \eqn{i}. The resulting values estimate the best linear unbiased predictions (BLUPs) at level \eqn{i}. If group values not included in the original grouping factors are present in \code{newdata}, the corresponding predictions will be set to \code{NA} for levels greater or equal to the level at which the unknown groups occur. } \value{ if a single level of grouping is specified in \code{level}, the returned value is either a list with the predictions split by groups (\code{asList = TRUE}) or a vector with the predictions (\code{asList = FALSE}); else, when multiple grouping levels are specified in \code{level}, the returned object is a data frame with columns given by the predictions at different levels and the grouping factors. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{fitted.lme}}} \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) newOrth <- data.frame(Sex = c("Male","Male","Female","Female","Male","Male"), age = c(15, 20, 10, 12, 2, 4), Subject = c("M01","M01","F30","F30","M04","M04")) ## The 'Orthodont' data has *no* 'F30', so predict NA at level 1 : predict(fm1, newOrth, level = 0:1) } \keyword{models} nlme/man/getData.lme.Rd0000644000176000001440000000252714251721455014440 0ustar ripleyusers% File nlme/man/getData.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getData.lme} \title{Extract lme Object Data} \usage{ \method{getData}{lme}(object) } \alias{getData.lme} \alias{getData.nlme} \alias{getData.nls} \arguments{ \item{object}{an object inheriting from class \code{lme}, representing a linear mixed-effects fitted model.} } \description{ If present in the calling sequence used to produce \code{object}, the data frame used to fit the model is obtained. } \value{ if a \code{data} argument is present in the calling sequence that produced \code{object}, the corresponding data frame (with \code{na.action} and \code{subset} applied to it, if also present in the call that produced \code{object}) is returned; else, \code{NULL} is returned. Note that as from version 3.1-102, this only omits rows omitted in the fit if \code{na.action = na.omit}, and does not omit at all if \code{na.action = na.exclude}. That is generally what is wanted for plotting, the main use of this function. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{getData}} } \examples{ fm1 <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), data = Ovary, random = ~ sin(2*pi*Time)) getData(fm1) } \keyword{models} nlme/man/print.varFunc.Rd0000644000176000001440000000146514251721455015052 0ustar ripleyusers% File nlme/man/print.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{print.varFunc} \title{Print a varFunc Object} \usage{ \method{print}{varFunc}(x, \dots) } \alias{print.varFunc} \alias{print.varComb} \arguments{ \item{x}{an object inheriting from class \code{"\link{varFunc}"}, representing a variance function structure.} \item{\dots}{optional arguments passed to \code{print.default}; see the documentation on that method function.} } \description{ The class and the coefficients associated with \code{x} are printed. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{summary.varFunc}}} \examples{ vf1 <- varPower(0.3, form = ~age) vf1 <- Initialize(vf1, Orthodont) print(vf1) } \keyword{models} nlme/man/getGroups.lmList.Rd0000644000176000001440000000313114251721456015526 0ustar ripleyusers% File nlme/man/getGroups.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroups.lmList} \title{Extract lmList Object Groups} \usage{ \method{getGroups}{lmList}(object, form, level, data, sep) } \alias{getGroups.lmList} \arguments{ \item{object}{an object inheriting from class \code{lmList}, representing a list of \code{lm} objects with a common model.} \item{form}{an optional formula with a conditioning expression on its right hand side (i.e. an expression involving the \code{|} operator). Defaults to \code{formula(object)}. Not used.} \item{level}{a positive integer vector with the level(s) of grouping to be used when multiple nested levels of grouping are present. This argument is optional for most methods of this generic function and defaults to all levels of nesting. Not used.} \item{data}{a data frame in which to interpret the variables named in \code{form}. Optional for most methods. Not used.} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}. Not used.} } \description{ The grouping factor determining the partitioning of the observations used to produce the \code{lm} components of \code{object} is extracted. } \value{ a vector with the grouping factor corresponding to the \code{lm} components of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}} \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) getGroups(fm1) } \keyword{models} nlme/man/Variogram.corSpher.Rd0000644000176000001440000000373614251721455016031 0ustar ripleyusers% File nlme/man/Variogram.corSpher.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.corSpher} \title{Calculate Semi-variogram for a corSpher Object} \usage{ \method{Variogram}{corSpher}(object, distance, sig2, length.out, \dots) } \alias{Variogram.corSpher} \arguments{ \item{object}{an object inheriting from class \code{"\link{corSpher}"}, representing an Spherical spatial correlation structure.} \item{distance}{an optional numeric vector with the distances at which the semi-variogram is to be calculated. Defaults to \code{NULL}, in which case a sequence of length \code{length.out} between the minimum and maximum values of \code{getCovariate(object)} is used.} \item{sig2}{an optional numeric value representing the process variance. Defaults to \code{1}.} \item{length.out}{an optional integer specifying the length of the sequence of distances to be used for calculating the semi-variogram, when \code{distance = NULL}. Defaults to \code{50}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram values corresponding to the Spherical correlation model, using the estimated coefficients corresponding to \code{object}, at the distances defined by \code{distance}. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corSpher}}, \code{\link{plot.Variogram}}, \code{\link{Variogram}} } \examples{ cs1 <- corSpher(15, form = ~ Time | Rat) cs1 <- Initialize(cs1, BodyWeight) Variogram(cs1)[1:10,] } \keyword{models} nlme/man/getGroups.data.frame.Rd0000644000176000001440000000371714251721455016275 0ustar ripleyusers% File nlme/man/getGroups.data.frame.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroups.data.frame} \title{Extract Groups from a Data Frame} \usage{ \method{getGroups}{data.frame}(object, form, level, data, sep) } \alias{getGroups.data.frame} \arguments{ \item{object}{an object inheriting from class \code{data.frame}.} \item{form}{an optional formula with a conditioning expression on its right hand side (i.e. an expression involving the \code{|} operator). Defaults to \code{formula(object)}.} \item{level}{a positive integer vector with the level(s) of grouping to be used when multiple nested levels of grouping are present. Defaults to all levels of nesting.} \item{data}{unused} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}.} } \description{ Each variable named in the expression after the \code{|} operator on the right hand side of \code{form} is evaluated in \code{object}. If more than one variable is indicated in \code{level} they are combined into a data frame; else the selected variable is returned as a vector. When multiple grouping levels are defined in \code{form} and \code{level > 1}, the levels of the returned factor are obtained by pasting together the levels of the grouping factors of level greater or equal to \code{level}, to ensure their uniqueness. } \value{ either a data frame with columns given by the grouping factors indicated in \code{level}, from outer to inner, or, when a single level is requested, a factor representing the selected grouping factor. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 100, 461. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{getGroupsFormula}}} \examples{ getGroups(Pixel) getGroups(Pixel, level = 2) } \keyword{models} nlme/man/nlsList.Rd0000644000176000001440000001242314363200201013720 0ustar ripleyusers% File nlme/man/nlsList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlsList} \title{List of nls Objects with a Common Model} \alias{nlsList} \alias{nlsList.formula}% + ./nlsList.selfStart.Rd \alias{update.nlsList} \usage{ nlsList(model, data, start, control, level, subset, na.action = na.fail, pool = TRUE, warn.nls = NA) \method{nlsList}{formula}(model, data, start, control, level, subset, na.action = na.fail, pool = TRUE, warn.nls = NA) \method{update}{nlsList}(object, model., \dots, evaluate = TRUE) } \arguments{ \item{object}{an object inheriting from class \code{nlsList}, representing a list of fitted \code{nls} objects.} \item{model}{either a nonlinear model formula, with the response on the left of a \code{~} operator and an expression involving parameters, covariates, and a grouping factor separated by the \code{|} operator on the right, or a \code{selfStart} function. The method function \code{\link{nlsList.selfStart}} is documented separately. } \item{model.}{changes to the model -- see \code{\link{update.formula}} for details.} \item{data}{a data frame in which to interpret the variables named in \code{model}. } \item{start}{an optional named list with initial values for the parameters to be estimated in \code{model}. It is passed as the \code{start} argument to each \code{nls} call and is required when the nonlinear function in \code{model} does not inherit from class \code{selfStart}. } \item{control}{a list of control values passed as the \code{control} argument to \code{nls}. Defaults to an empty list. } \item{level}{an optional integer specifying the level of grouping to be used when multiple nested levels of grouping are present.} \item{subset}{an optional expression indicating the subset of the rows of \code{data} that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{nlsList} to print an error message and terminate if there are any incomplete observations. } \item{pool}{ an optional logical value that is preserved as an attribute of the returned value. This will be used as the default for \code{pool} in calculations of standard deviations or standard errors for summaries. } \item{warn.nls}{\code{\link{logical}} indicating if \code{\link{nls}()} errors (all of which are caught by \code{\link{tryCatch}}) should be signalled as a \dQuote{summarizing} \code{\link{warning}}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} \item{evaluate}{If \code{TRUE} evaluate the new call else return the call.} } \description{ \code{Data} is partitioned according to the levels of the grouping factor defined in \code{model} and individual \code{nls} fits are obtained for each \code{data} partition, using the model defined in \code{model}. } \details{ As \code{\link{nls}(.)} is called on each sub group, and convergence of these may be problematic, these calls happen with error catching. Since \pkg{nlme} version \code{3.1-127} (2016-04), all the errors are caught (via \code{\link{tryCatch}}) and if present, a \dQuote{summarizing} \code{\link{warning}} is stored as attribute of the resulting \code{"nlsList"} object and signalled unless suppressed by \code{warn.nls = FALSE} or currently also when \code{warn.nls = NA} (default) \emph{and} \code{\link{getOption}("show.error.messages")} is false. \code{nlsList()} originally had used \code{\link{try}(*)} (with its default \code{silent=FALSE)} and hence all errors were printed to the console \emph{unless} the global option \code{show.error.messages} was set to true. This still works, but has been \emph{deprecated}.% For 3.1-127, April 14, 2016 } \value{ a list of \code{nls} objects with as many components as the number of groups defined by the grouping factor. Generic functions such as \code{coef}, \code{fixed.effects}, \code{lme}, \code{pairs}, \code{plot}, \code{predict}, \code{random.effects}, \code{summary}, and \code{update} have methods that can be applied to an \code{nlsList} object. } \references{ Pinheiro, J.C., and Bates, D.M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer. } \seealso{ \code{\link{nls}}, \code{\link{nlme.nlsList}}, \code{\link{nlsList.selfStart}}, \code{\link{summary.nlsList}} } \examples{ fm1 <- nlsList(uptake ~ SSasympOff(conc, Asym, lrc, c0), data = CO2, start = c(Asym = 30, lrc = -4.5, c0 = 52)) summary(fm1) cfm1 <- confint(fm1) # via profiling each % FIXME: only *one* message instead of one *each* mat.class <- class(matrix(1)) # ("matrix", "array") for R >= 4.0.0; ("matrix" in older R) i.ok <- which(vapply(cfm1, function(r) identical(class(r), mat.class), NA)) stopifnot(length(i.ok) > 0, !anyNA(match(c(2:4, 6:9, 12), i.ok))) ## where as (some of) the others gave errors during profile re-fitting : str(cfm1[- i.ok]) } \keyword{models} nlme/man/getGroups.lme.Rd0000644000176000001440000000311014251721455015033 0ustar ripleyusers% File nlme/man/getGroups.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroups.lme} \title{Extract lme Object Groups} \usage{ \method{getGroups}{lme}(object, form, level, data, sep) } \alias{getGroups.lme} \arguments{ \item{object}{an object inheriting from class \code{lme}, representing a fitted linear mixed-effects model.} \item{form}{this argument is included to make the method function compatible with the generic and is ignored in this method.} \item{level}{an optional integer vector giving the level(s) of grouping to be extracted from \code{object}. Defaults to the highest or innermost level of grouping.} \item{data}{unused} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}.} } \description{ The grouping factors corresponding to the linear mixed-effects model represented by \code{object} are extracted. If more than one level is indicated in \code{level}, the corresponding grouping factors are combined into a data frame; else the selected grouping factor is returned as a vector. } \value{ either a data frame with columns given by the grouping factors indicated in \code{level}, or, when a single level is requested, a factor representing the selected grouping factor. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}} \examples{ fm1 <- lme(pixel ~ day + day^2, Pixel, random = list(Dog = ~day, Side = ~1)) getGroups(fm1, level = 1:2) } \keyword{models} nlme/man/logLik.varFunc.Rd0000644000176000001440000000240014251721455015125 0ustar ripleyusers% File nlme/man/logLik.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.varFunc} \title{Extract varFunc logLik} \usage{ \method{logLik}{varFunc}(object, data, \dots) } \alias{logLik.varFunc} \alias{logLik.varComb} \arguments{ \item{object}{an object inheriting from class \code{"\link{varFunc}"}, representing a variance function structure.} \item{data}{this argument is included to make this method function compatible with other \code{logLik} methods and will be ignored.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the component of a Gaussian log-likelihood associated with the variance function structure represented by \code{object}, which is equal to the sum of the logarithms of the corresponding weights. } \value{ the sum of the logarithms of the weights corresponding to the variance function structure represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{logLik.lme}} } \examples{ vf1 <- varPower(form = ~age) vf1 <- Initialize(vf1, Orthodont) coef(vf1) <- 0.1 logLik(vf1) } \keyword{models} nlme/man/corFactor.corStruct.Rd0000644000176000001440000000442214251721456016221 0ustar ripleyusers% File nlme/man/corFactor.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corFactor.corStruct} \title{Factor of a corStruct Object Matrix} \usage{ \method{corFactor}{corStruct}(object, \dots) } \alias{corFactor.corCompSymm} \alias{corFactor.corAR1} \alias{corFactor.corARMA} \alias{corFactor.corCAR1} \alias{corFactor.corNatural} \alias{corFactor.corSpatial} \alias{corFactor.corStruct} \alias{corFactor.corSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"} representing a correlation structure, which must have been initialized (using \code{Initialize}).} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts a transpose inverse square-root factor, or a series of transpose inverse square-root factors, of the correlation matrix, or list of correlation matrices, represented by \code{object}. Letting \eqn{\Sigma}{S} denote a correlation matrix, a square-root factor of \eqn{\Sigma}{S} is any square matrix \eqn{L}{L} such that \eqn{\Sigma = L'L}{S = L'L}. This method extracts \eqn{L^{-t}}{L^(-t)}. } \value{ If the correlation structure does not include a grouping factor, the returned value will be a vector with a transpose inverse square-root factor of the correlation matrix associated with \code{object} stacked column-wise. If the correlation structure includes a grouping factor, the returned value will be a vector with transpose inverse square-root factors of the correlation matrices for each group, stacked by group and stacked column-wise within each group. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu} } \note{ This method function is used intensively in optimization algorithms and its value is returned as a vector for efficiency reasons. The \code{corMatrix} method function can be used to obtain transpose inverse square-root factors in matrix form. } \seealso{ \code{\link{corFactor}}, \code{\link{corMatrix.corStruct}}, \code{\link{recalc.corStruct}}, \code{\link{Initialize.corStruct}} } \examples{ cs1 <- corAR1(form = ~1 | Subject) cs1 <- Initialize(cs1, data = Orthodont) corFactor(cs1) } \keyword{models} nlme/man/ACF.Rd0000644000176000001440000000236714657640762012721 0ustar ripleyusers% File nlme/man/ACF.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{ACF} \title{Autocorrelation Function} \usage{ ACF(object, maxLag, \dots) } \alias{ACF} \arguments{ \item{object}{any object from which an autocorrelation function can be obtained. Generally an object resulting from a model fit, from which residuals can be extracted.} \item{maxLag}{maximum lag for which the autocorrelation should be calculated.} \item{\dots}{some methods for this generic require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{gls} and \code{lme}. } \value{ will depend on the method function used; see the appropriate documentation. } \references{ Box, 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. } \author{José Pinheiro and Douglas Bates \email{Bates@stat.wisc.edu}} \seealso{\code{\link{ACF.gls}}, \code{\link{ACF.lme}}, \code{\link{plot.ACF}} } \keyword{models} nlme/man/qqnorm.gls.Rd0000644000176000001440000000665114251721455014416 0ustar ripleyusers% File nlme/man/qqnorm.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{qqnorm.gls} \title{Normal Plot of Residuals from a gls Object} \usage{ \method{qqnorm}{gls}(y, form, abline, id, idLabels, grid, \dots) } \alias{qqnorm.gls} \arguments{ \item{y}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted model.} \item{form}{an optional one-sided formula specifying the desired type of plot. Any variable present in the original data frame used to obtain \code{y} can be referenced. In addition, \code{y} itself can be referenced in the formula using the symbol \code{"."}. Conditional expressions on the right of a \code{|} operator can be used to define separate panels in a Trellis display. The expression on the right hand side of \code{form} and to the left of a \code{|} operator must evaluate to a residuals vector. Default is \code{~ resid(., type = "p")}, corresponding to a normal plot of the standardized residuals.} \item{abline}{an optional numeric value, or numeric vector of length two. If given as a single value, a horizontal line will be added to the plot at that coordinate; else, if given as a vector, its values are used as the intercept and slope for a line added to the plot. If missing, no lines are added to the plot.} \item{id}{an optional numeric value, or one-sided formula. If given as a value, it is used as a significance level for a two-sided outlier test for the standardized residuals (random effects). Observations with absolute standardized residuals (random effects) greater than the \eqn{1 - value/2} quantile of the standard normal distribution are identified in the plot using \code{idLabels}. If given as a one-sided formula, its right hand side must evaluate to a logical, integer, or character vector which is used to identify observations in the plot. If missing, no observations are identified.} \item{idLabels}{an optional vector, or one-sided formula. If given as a vector, it is converted to character and used to label the observations identified according to \code{id}. If given as a one-sided formula, its right hand side must evaluate to a vector which is converted to character and used to label the identified observations. Default is the innermost grouping factor.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default depends on the type of Trellis plot used: if \code{xyplot} defaults to \code{TRUE}, else defaults to \code{FALSE}.} \item{\dots}{optional arguments passed to the Trellis plot function.} } \description{ Diagnostic plots for assessing the normality of residuals the generalized least squares fit are obtained. The \code{form} argument gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a \code{|} operator) always implies that different panels are used for each level of the conditioning factor, according to a Trellis display. } \value{ a diagnostic Trellis plot for assessing normality of residuals. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link{plot.gls}}} \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) qqnorm(fm1, abline = c(0,1)) } \keyword{models} nlme/man/gnls.Rd0000644000176000001440000001420314363200201013231 0ustar ripleyusers% File nlme/man/gnls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gnls} \title{Fit Nonlinear Model Using Generalized Least Squares} \usage{ gnls(model, data, params, start, correlation, weights, subset, na.action, naPattern, control, verbose) %\method{update}{gnls}(object, model., ..., evaluate = TRUE) } \alias{gnls} %\alias{update.gnls} \arguments{ \item{model}{a two-sided formula object describing the model, with the response on the left of a \code{~} operator and a nonlinear expression involving parameters and covariates on the right. If \code{data} is given, all names used in the formula should be defined as parameters or variables in the data frame.} \item{data}{an optional data frame containing the variables named in \code{model}, \code{correlation}, \code{weights}, \code{subset}, and \code{naPattern}. By default the variables are taken from the environment from which \code{gnls} is called.} \item{params}{an optional two-sided linear formula of the form \code{p1+...+pn~x1+...+xm}, or list of two-sided formulas of the form \code{p1~x1+...+xm}, with possibly different models for each parameter. The \code{p1,\dots,pn} represent parameters included on the right hand side of \code{model} and \code{x1+...+xm} define a linear model for the parameters (when the left hand side of the formula contains several parameters, they are all assumed to follow the same linear model described by the right hand side expression). A \code{1} on the right hand side of the formula(s) indicates a single fixed effects for the corresponding parameter(s). By default, the parameters are obtained from the names of \code{start}.} \item{start}{an optional named list, or numeric vector, with the initial values for the parameters in \code{model}. It can be omitted when a \code{selfStarting} function is used in \code{model}, in which case the starting estimates will be obtained from a single call to the \code{nls} function.} \item{correlation}{an optional \code{corStruct} object describing the within-group correlation structure. See the documentation of \code{\link{corClasses}} for a description of the available \code{corStruct} classes. If a grouping variable is to be used, it must be specified in the \code{form} argument to the \code{corStruct} constructor. Defaults to \code{NULL}, corresponding to uncorrelated errors.} \item{weights}{an optional \code{varFunc} object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to \code{varFixed}, corresponding to fixed variance weights. See the documentation on \code{\link{varClasses}} for a description of the available \code{varFunc} classes. Defaults to \code{NULL}, corresponding to homoscedastic errors.} \item{subset}{an optional expression indicating which subset of the rows of \code{data} should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{gnls} to print an error message and terminate if there are any incomplete observations.} \item{naPattern}{an expression or formula object, specifying which returned values are to be regarded as missing.} \item{control}{a list of control values for the estimation algorithm to replace the default values returned by the function \code{gnlsControl}. Defaults to an empty list.} \item{verbose}{an optional logical value. If \code{TRUE} information on the evolution of the iterative algorithm is printed. Default is \code{FALSE}.} % \item{\dots}{some methods for this generic require additional % arguments. None are used in this method.} } \description{ This function fits a nonlinear model using generalized least squares. The errors are allowed to be correlated and/or have unequal variances. } \value{ an object of class \code{gnls}, also inheriting from class \code{gls}, representing the nonlinear model fit. Generic functions such as \code{print}, \code{plot} and \code{summary} have methods to show the results of the fit. See \code{gnlsObject} for the components of the fit. The functions \code{resid}, \code{coef}, and \code{fitted} can be used to extract some of its components. } \references{ The different correlation structures available for the \code{correlation} argument are described in Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994), Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996), and Venables, W.N. and Ripley, B.D. (2002). The use of variance functions for linear and nonlinear models is presented in detail in Carrol, R.J. and Rupert, D. (1988) and Davidian, M. and Giltinan, D.M. (1995). Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day. Carrol, R.J. and Rupert, D. (1988) "Transformation and Weighting in Regression", Chapman and Hall. Davidian, M. and Giltinan, D.M. (1995) "Nonlinear Mixed Effects Models for Repeated Measurement Data", Chapman and Hall. Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996) "SAS Systems for Mixed Models", SAS Institute. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{gnlsControl}}, \code{\link{gnlsObject}}, \code{\link{gnlsStruct}}, \code{\link{predict.gnls}}, \code{\link{varClasses}}, \code{\link{varFunc}} } \examples{ # variance increases with a power of the absolute fitted values fm1 <- gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean, weights = varPower()) summary(fm1) } \keyword{models} nlme/man/nlmeControl.Rd0000644000176000001440000001150714251721455014605 0ustar ripleyusers% File nlme/man/nlmeControl.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlmeControl} \title{Control Values for nlme Fit} \usage{ nlmeControl(maxIter, pnlsMaxIter, msMaxIter, minScale, tolerance, niterEM, pnlsTol, msTol, returnObject, msVerbose, msWarnNoConv, gradHess, apVar, .relStep, minAbsParApVar = 0.05, opt = c("nlminb", "nlm"), natural = TRUE, sigma = NULL, \dots) } \alias{nlmeControl} \arguments{ \item{maxIter}{maximum number of iterations for the \code{nlme} optimization algorithm. Default is 50.} \item{pnlsMaxIter}{maximum number of iterations for the \code{PNLS} optimization step inside the \code{nlme} optimization. Default is 7.} \item{msMaxIter}{maximum number of iterations for \code{\link{nlminb}} (\code{iter.max}) or the \code{\link{nlm}} (\code{iterlim}, from the 10-th step) optimization step inside the \code{nlme} optimization. Default is 50 (which may be too small for e.g. for overparametrized cases).} \item{minScale}{minimum factor by which to shrink the default step size in an attempt to decrease the sum of squares in the \code{PNLS} step. Default \code{0.001}.} \item{tolerance}{tolerance for the convergence criterion in the \code{nlme} algorithm. Default is \code{1e-6}.} \item{niterEM}{number of iterations for the EM algorithm used to refine the initial estimates of the random effects variance-covariance coefficients. Default is 25.} \item{pnlsTol}{tolerance for the convergence criterion in \code{PNLS} step. Default is \code{1e-3}.} \item{msTol}{tolerance for the convergence criterion in \code{nlm}, passed as the \code{gradtol} argument to the function (see documentation on \code{nlm}). Default is \code{1e-7}. } \item{returnObject}{a logical value indicating whether the fitted object should be returned when the maximum number of iterations is reached without convergence of the algorithm. Default is \code{FALSE}.} \item{msVerbose}{a logical value passed as the \code{trace} to \code{\link{nlminb}(.., control= list(trace = *, ..))} or as argument \code{print.level} to \code{\link{nlm}()}. Default is \code{FALSE}.} \item{msWarnNoConv}{logical indicating if a \code{\link{warning}} should be signalled whenever the minimization (by \code{opt}) in the LME step does not converge; defaults to \code{TRUE}.} \item{gradHess}{a logical value indicating whether numerical gradient vectors and Hessian matrices of the log-likelihood function should be used in the \code{nlm} optimization. This option is only available when the correlation structure (\code{corStruct}) and the variance function structure (\code{varFunc}) have no "varying" parameters and the \code{pdMat} classes used in the random effects structure are \code{pdSymm} (general positive-definite), \code{pdDiag} (diagonal), \code{pdIdent} (multiple of the identity), or \code{pdCompSymm} (compound symmetry). Default is \code{TRUE}.} \item{apVar}{a logical value indicating whether the approximate covariance matrix of the variance-covariance parameters should be calculated. Default is \code{TRUE}.} \item{.relStep}{relative step for numerical derivatives calculations. Default is \code{.Machine$double.eps^(1/3)}.} \item{minAbsParApVar}{numeric value - minimum absolute parameter value in the approximate variance calculation. The default is \code{0.05}.} \item{opt}{the optimizer to be used, either \code{"\link{nlminb}"} (the default) or \code{"\link{nlm}"}.} \item{natural}{a logical value indicating whether the \code{pdNatural} parametrization should be used for general positive-definite matrices (\code{pdSymm}) in \code{reStruct}, when the approximate covariance matrix of the estimators is calculated. Default is \code{TRUE}.} \item{sigma}{optionally a positive number to fix the residual error at. If \code{NULL}, as by default, or \code{0}, sigma is estimated.} \item{\dots}{Further, named control arguments to be passed to \code{\link{nlminb}} (apart from \code{trace} and \code{iter.max} mentioned above), where used (\code{eval.max} and those from \code{abs.tol} down).} } \description{ The values supplied in the function call replace the defaults and a list with all possible arguments is returned. The returned list is used as the \code{control} argument to the \code{nlme} function. } \value{ a list with components for each of the possible arguments. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}; the \code{sigma} option: Siem Heisterkamp and Bert van Willigen.} \seealso{\code{\link{nlme}}, \code{\link{nlm}}, \code{\link{optim}}, \code{\link{nlmeStruct}}} \examples{ # decrease the maximum number of iterations and request tracing nlmeControl(msMaxIter = 20, msVerbose = TRUE) } \keyword{models} nlme/man/summary.pdMat.Rd0000644000176000001440000000403714251721455015052 0ustar ripleyusers% File nlme/man/summary.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.pdMat} \title{Summarize a pdMat Object} \usage{ \method{summary}{pdMat}(object, structName, noCorrelation, \dots) } \alias{summary.pdMat} \alias{summary.pdBlocked} \alias{summary.pdCompSymm} \alias{summary.pdDiag} \alias{summary.pdIdent} \alias{summary.pdNatural} \alias{summary.pdSymm} \alias{summary.pdLogChol} \arguments{ \item{object}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive definite matrix.} \item{structName}{an optional character string with a description of the \code{pdMat} class. Default depends on the method function: \code{"Blocked"} for \code{pdBlocked}, \code{"Compound Symmetry"} for \code{pdCompSymm}, \code{"Diagonal"} for \code{pdDiag}, \code{"Multiple of an Identity"} for \code{pdIdent}, \code{"General Positive-Definite, Natural Parametrization"} for \code{pdNatural}, \code{"General Positive-Definite"} for \code{pdSymm}, and \code{data.class(object)} for \code{pdMat}.} \item{noCorrelation}{an optional logical value indicating whether correlations are to be printed in \code{print.summary.pdMat}. Default depends on the method function: \code{FALSE} for \code{pdDiag} and \code{pdIdent}, and \code{TRUE} for all other classes.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Attributes \code{structName} and \code{noCorrelation}, with the values of the corresponding arguments to the method function, are appended to \code{object} and its class is changed to \code{summary.pdMat}. } \value{ an object similar to \code{object}, with additional attributes \code{structName} and \code{noCorrelation}, inheriting from class \code{summary.pdMat}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{print.summary.pdMat}}, \code{\link{pdMat}}} \examples{ summary(pdSymm(diag(4))) } \keyword{models} nlme/man/Assay.Rd0000644000176000001440000000402314251721455013364 0ustar ripleyusers% File nlme/man/Assay.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Assay} \alias{Assay} \title{Bioassay on Cell Culture Plate} \description{ The \code{Assay} data frame has 60 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Block}{ an ordered factor with levels \code{2} < \code{1} identifying the block where the wells are measured. } \item{sample}{ a factor with levels \code{a} to \code{f} identifying the sample corresponding to the well. } \item{dilut}{ a factor with levels \code{1} to \code{5} indicating the dilution applied to the well } \item{logDens}{ a numeric vector of the log-optical density } } } \details{ These data, courtesy of Rich Wolfe and David Lansky from Searle, Inc., come from a bioassay run on a 96-well cell culture plate. The assay is performed using a split-block design. The 8 rows on the plate are labeled A--H from top to bottom and the 12 columns on the plate are labeled 1--12 from left to right. Only the central 60 wells of the plate are used for the bioassay (the intersection of rows B--G and columns 2--11). There are two blocks in the design: Block 1 contains columns 2--6 and Block 2 contains columns 7--11. Within each block, six samples are assigned randomly to rows and five (serial) dilutions are assigned randomly to columns. The response variable is the logarithm of the optical density. The cells are treated with a compound that they metabolize to produce the stain. Only live cells can make the stain, so the optical density is a measure of the number of cells that are alive and healthy.} \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.2) } %\examples{} \keyword{datasets} nlme/man/phenoModel.Rd0000644000176000001440000000267514251721455014411 0ustar ripleyusers% File nlme/man/phenoModel.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{phenoModel} \alias{phenoModel} \title{Model function for the Phenobarb data} \description{ A model function for a model used with the \code{Phenobarb} data. This function uses compiled C code to improve execution speed. } \usage{ phenoModel(Subject, time, dose, lCl, lV) } \arguments{ \item{Subject}{an integer vector of subject identifiers. These should be sorted in increasing order.} \item{time}{numeric. A vector of the times at which the sample was drawn or the drug administered (hr). } \item{dose}{numeric. A vector of doses of drug administered (\eqn{u}{\mu}g/kg). } \item{lCl}{numeric. A vector of values of the natural log of the clearance parameter according to \code{Subject} and \code{time}.} \item{lV}{numeric. A vector of values of the natural log of the effective volume of distribution according to \code{Subject} and \code{time}.} } \details{ See the details section of \code{\link{Phenobarb}} for a description of the model function that \code{phenoModel} evaluates. } \value{ a numeric vector of predicted phenobarbital concentrations. } \references{ Pinheiro, J. C. and Bates, D. M. (2000) \emph{Mixed-effects Models in S and S-PLUS}, Springer. (section 6.4) } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu} } \keyword{models} nlme/man/lme.Rd0000644000176000001440000002154314462162644013072 0ustar ripleyusers% File nlme/man/lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{lme} \title{Linear Mixed-Effects Models} \usage{ lme(fixed, data, random, correlation, weights, subset, method, na.action, control, contrasts = NULL, keep.data = TRUE) \method{lme}{formula}(fixed, data, random, correlation, weights, subset, method, na.action, control, contrasts = NULL, keep.data = TRUE) \method{update}{lme}(object, fixed., \dots, evaluate = TRUE) } \alias{lme} \alias{lme.formula} \alias{update.lme} \arguments{ \item{object}{an object inheriting from class \code{lme}, representing a fitted linear mixed-effects model.} \item{fixed}{a two-sided linear formula object describing the fixed-effects part of the model, with the response on the left of a \code{~} operator and the terms, separated by \code{+} operators, on the right, an \code{"\link{lmList}"} object, or a \code{"\link{groupedData}"} object. There is limited support for formulae such as \code{resp ~ 1} and \code{resp ~ 0}, and less prior to version \samp{3.1-112}. } \item{fixed.}{Changes to the fixed-effects formula -- see \code{\link{update.formula}} for details.} \item{data}{an optional data frame containing the variables named in \code{fixed}, \code{random}, \code{correlation}, \code{weights}, and \code{subset}. By default the variables are taken from the environment from which \code{lme} is called.} \item{random}{optionally, any of the following: (i) a one-sided formula of the form \code{~ x1 + ... + xn | g1/.../gm}, with \code{x1 + ... + xn} specifying the model for the random effects and \code{g1/.../gm} the grouping structure (\code{m} may be equal to 1, in which case no \code{/} is required). The random effects formula will be repeated for all levels of grouping, in the case of multiple levels of grouping; (ii) a list of one-sided formulas of the form \code{~ x1 + ... + xn | g}, with possibly different random effects models for each grouping level. The order of nesting will be assumed the same as the order of the elements in the list; (iii) a one-sided formula of the form \code{~ x1 + ... + xn}, or a \code{\link{pdMat}} object with a formula (i.e. a non-\code{NULL} value for \code{formula(object)}), or a list of such formulas or \code{\link{pdMat}} objects. In this case, the grouping structure formula will be derived from the data used to fit the linear mixed-effects model, which should inherit from class \code{"\link{groupedData}"}; (iv) a named list of formulas or \code{\link{pdMat}} objects as in (iii), with the grouping factors as names. The order of nesting will be assumed the same as the order of the order of the elements in the list; (v) an \code{\link{reStruct}} object. See the documentation on \code{pdClasses} for a description of the available \code{\link{pdMat}} classes. Defaults to a formula consisting of the right hand side of \code{fixed}.} \item{correlation}{an optional \code{\link{corStruct}} object describing the within-group correlation structure. See the documentation of \code{\link{corClasses}} for a description of the available \code{corStruct} classes. Defaults to \code{NULL}, corresponding to no within-group correlations.} \item{weights}{an optional \code{\link{varFunc}} object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to \code{\link{varFixed}}, corresponding to fixed variance weights. See the documentation on \code{\link{varClasses}} for a description of the available \code{\link{varFunc}} classes. Defaults to \code{NULL}, corresponding to homoscedastic within-group errors.} \item{subset}{an optional expression indicating the subset of the rows of \code{data} that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{method}{a character string. If \code{"REML"} the model is fit by maximizing the restricted log-likelihood. If \code{"ML"} the log-likelihood is maximized. Defaults to \code{"REML"}.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{\link{na.fail}}) causes \code{lme} to print an error message and terminate if there are any incomplete observations.} \item{control}{a list of control values for the estimation algorithm to replace the default values returned by the function \code{\link{lmeControl}}. Defaults to an empty list.} \item{contrasts}{an optional list. See the \code{contrasts.arg} of \code{\link{model.matrix.default}}.} \item{keep.data}{logical: should the \code{data} argument (if supplied and a data frame) be saved as part of the model object?} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} \item{evaluate}{If \code{TRUE} evaluate the new call else return the call.} } \description{ This generic function fits a linear mixed-effects model in the formulation described in Laird and Ware (1982) but allowing for nested random effects. The within-group errors are allowed to be correlated and/or have unequal variances. This page describes the formula method; the methods \code{\link{lme.lmList}} and \code{\link{lme.groupedData}} are documented separately. } \details{ \code{\link{offset}} terms in \code{fixed} are an error since 3.1-157 (2022-03): previously they were silently ignored. } \value{ An object of class \code{"lme"} representing the linear mixed-effects model fit. Generic functions such as \code{print}, \code{plot} and \code{summary} have methods to show the results of the fit. See \code{\link{lmeObject}} for the components of the fit. The functions \code{\link{resid}}, \code{\link{coef}}, \code{\link{fitted}}, \code{\link{fixed.effects}}, and \code{\link{random.effects}} can be used to extract some of its components. } \note{ The function does not do any scaling internally: the optimization will work best when the response is scaled so its variance is of the order of one. } \references{ The computational methods follow the general framework of Lindstrom and Bates (1988). The model formulation is described in Laird and Ware (1982). The variance-covariance parametrizations are described in Pinheiro and Bates (1996). The different correlation structures available for the \code{correlation} argument are described in Box, Jenkins and Reinsel (1994), Littell \emph{et al} (1996), and Venables and Ripley (2002). The use of variance functions for linear and nonlinear mixed effects models is presented in detail in Davidian and Giltinan (1995). Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994). \emph{Time Series Analysis: Forecasting and Control}, 3rd Edition, Holden--Day. % FIXME? many book *reviews*, but not the book \doi{...}. Davidian, M. and Giltinan, D.M. (1995). \emph{Nonlinear Mixed Effects Models for Repeated Measurement Data}, Chapman and Hall. \doi{10.1201/9780203745502}. Laird, N.M. and Ware, J.H. (1982). Random-Effects Models for Longitudinal Data. \emph{Biometrics} \bold{38}, 963--974. \doi{10.2307/2529876}. Lindstrom, M.J. and Bates, D.M. (1988). Newton-Raphson and EM Algorithms for Linear Mixed-Effects Models for Repeated-Measures Data. \emph{Journal of the American Statistical Association} \bold{83}, 1014--1022. \doi{10.2307/2290128}. Littell, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996). \emph{SAS Systems for Mixed Models}, SAS Institute. Pinheiro, J.C. and Bates., D.M. (1996). Unconstrained Parametrizations for Variance-Covariance Matrices. \emph{Statistics and Computing} \bold{6}, 289--296. \doi{10.1007/BF00140873}. Pinheiro, J.C., and Bates, D.M. (2000). \emph{Mixed-Effects Models in S and S-PLUS}, Springer. \doi{10.1007/b98882}. Venables, W.N. and Ripley, B.D. (2002). \emph{Modern Applied Statistics with S}, 4th Edition, Springer-Verlag. \doi{10.1007/978-0-387-21706-2}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{lme.lmList}}, \code{\link{lme.groupedData}}, \code{\link{lmeControl}}, \code{\link{lmeObject}}, \code{\link{lmeStruct}}, \code{\link{lmList}}, \code{\link{pdClasses}}, \code{\link{plot.lme}}, \code{\link{predict.lme}}, \code{\link{qqnorm.lme}}, \code{\link{residuals.lme}}, \code{\link{reStruct}}, \code{\link{simulate.lme}}, \code{\link{summary.lme}}, \code{\link{varClasses}}, \code{\link{varFunc}} } \examples{ fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) summary(fm1) summary(fm2) } \keyword{models} nlme/man/bdf.Rd0000644000176000001440000000437214662037430013045 0ustar ripleyusers% File nlme/man/bdf.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{bdf} \docType{data} \alias{bdf} \title{Language scores} \usage{bdf} \description{ The \code{bdf} data frame has 2287 rows and 25 columns of language scores from grade 8 pupils in elementary schools in The Netherlands. } \format{ \describe{ \item{schoolNR}{a factor denoting the school.} \item{pupilNR}{a factor denoting the pupil.} \item{IQ.verb}{a numeric vector of verbal IQ scores} \item{IQ.perf}{a numeric vector of IQ scores.} \item{sex}{Sex of the student.} \item{Minority}{a factor indicating if the student is a member of a minority group.} \item{repeatgr}{an ordered factor indicating if one or more grades have been repeated.} \item{aritPRET}{a numeric vector} \item{classNR}{a numeric vector} \item{aritPOST}{a numeric vector} \item{langPRET}{a numeric vector} \item{langPOST}{a numeric vector} \item{ses}{a numeric vector of socioeconomic status indicators.} \item{denomina}{a factor indicating of the school is a public school, a Protestant private school, a Catholic private school, or a non-denominational private school.} \item{schoolSES}{a numeric vector} \item{satiprin}{a numeric vector} \item{natitest}{a factor with levels \code{0} and \code{1}} \item{meetings}{a numeric vector} \item{currmeet}{a numeric vector} \item{mixedgra}{a factor indicating if the class is a mixed-grade class.} \item{percmino}{a numeric vector} \item{aritdiff}{a numeric vector} \item{homework}{a numeric vector} \item{classsiz}{a numeric vector} \item{groupsiz}{a numeric vector} } } \source{ \samp{http://stat.gamma.rug.nl/snijders/multilevel.htm}, the first edition of \url{http://www.stats.ox.ac.uk/~snijders/mlbook.htm}. } \references{ Snijders, Tom and Bosker, Roel (1999), \emph{Multilevel Analysis: An Introduction to Basic and Advanced Multilevel Modeling}, Sage. } \examples{ summary(bdf) ## More examples, including lme() fits reproducing parts in the above ## book, are available in the R script files system.file("mlbook", "ch04.R", package ="nlme") # and system.file("mlbook", "ch05.R", package ="nlme") } \keyword{datasets} nlme/man/Variogram.Rd0000644000176000001440000000356114657640762014254 0ustar ripleyusers% File nlme/man/Variogram.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram} \title{Calculate Semi-variogram} \usage{ Variogram(object, distance, \dots) } \alias{Variogram} \arguments{ \item{object}{a numeric vector with the values to be used for calculating the semi-variogram, usually a residual vector from a fitted model.} \item{distance}{a numeric vector with the pairwise distances corresponding to the elements of \code{object}. The order of the elements in \code{distance} must correspond to the pairs \code{(1,2), (1,3), \dots, (n-1,n)}, with \code{n} representing the length of \code{object}, and must have length \code{n(n-1)/2}.} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{"gls"} and \code{"lme"}; there is also a default method for arbitrary vectors (of residuals). See the appropriate method documentation for a description of the arguments. } \value{ will depend on the method function used; see the appropriate documentation. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Variogram.corExp}}, \code{\link{Variogram.corGaus}}, \code{\link{Variogram.corLin}}, \code{\link{Variogram.corRatio}}, \code{\link{Variogram.corSpatial}}, \code{\link{Variogram.corSpher}}, \code{\link{Variogram.default}}, \code{\link{Variogram.gls}}, \code{\link{Variogram.lme}}, \code{\link{plot.Variogram}} } \keyword{models} nlme/man/summary.varFunc.Rd0000644000176000001440000000370014251721455015405 0ustar ripleyusers% File nlme/man/summary.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.varFunc} \title{Summarize "varFunc" Object} \usage{ \method{summary}{varFunc}(object, structName, \dots) } \alias{summary.varFunc} \alias{summary.varComb} \alias{summary.varConstPower} \alias{summary.varConstProp} \alias{summary.varExp} \alias{summary.varFixed} \alias{summary.varIdent} \alias{summary.varPower} \arguments{ \item{object}{an object inheriting from class \code{"\link{varFunc}"}, representing a variance function structure.} \item{structName}{an optional character string with a description of the \code{varFunc} class. Default depends on the method function: \describe{ \item{for \code{varComb}:}{\code{"Combination of variance functions"},} \item{for \code{varConstPower}:}{\code{"Constant plus power of variance covariate"},} \item{for \code{varConstProp}:}{\code{"Constant plus proportion of variance covariate"},} \item{for \code{varExp}:}{\code{"Exponential of variance covariate"},} \item{for \code{varIdent}:}{\code{"Different standard deviations per stratum"},} \item{for \code{varPower}:}{\code{"Power of variance covariate"},} \item{for \code{varFunc}:}{\code{data.class(object)}.} } } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ A \code{structName} attribute, with the value of corresponding argument, is appended to \code{object} and its class is changed to \code{summary.varFunc}. } \value{ an object similar to \code{object}, with an additional attribute \code{structName}, inheriting from class \code{summary.varFunc}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{varClasses}}, \code{\link{varFunc}} } \examples{ vf1 <- varPower(0.3, form = ~age) vf1 <- Initialize(vf1, Orthodont) summary(vf1) } \keyword{models} nlme/man/pdMatrix.Rd0000644000176000001440000000336514335655115014106 0ustar ripleyusers% File nlme/man/pdMatrix.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdMatrix} \title{Extract Matrix or Square-Root Factor from a pdMat Object} \usage{ pdMatrix(object, factor) } \alias{pdMatrix} \alias{pdMatrix.pdBlocked} \alias{pdMatrix.pdCompSymm} \alias{pdMatrix.pdDiag} \alias{pdMatrix.pdIdent} \alias{pdMatrix.pdMat} \alias{pdMatrix.pdSymm} \alias{pdMatrix.pdNatural} \arguments{ \item{object}{an object inheriting from class \code{pdMat}, representing a positive definite matrix.} \item{factor}{an optional logical value. If \code{TRUE}, a square-root factor of the positive-definite matrix represented by \code{object} is returned; else, if \code{FALSE}, the positive-definite matrix is returned. Defaults to \code{FALSE}.} } \description{ The positive-definite matrix represented by \code{object}, or a square-root factor of it is obtained. Letting \eqn{\Sigma}{S} denote a positive-definite matrix, a square-root factor of \eqn{\Sigma}{S} is any square matrix \eqn{L}{L} such that \eqn{\Sigma = L'L}{S = L'L}. This function extracts \eqn{\Sigma}{S} or \eqn{L}. } \value{ if \code{factor} is \code{FALSE} the positive-definite matrix represented by \code{object} is returned; else a square-root of the positive-definite matrix is returned. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. p. 162. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{pdClasses}}, \code{\link{pdFactor}}, \code{\link{pdMat}}, \code{\link{pdMatrix.reStruct}}, \code{\link{corMatrix}} } \examples{ pd1 <- pdSymm(diag(1:4)) pdMatrix(pd1) } \keyword{models} nlme/man/formula.reStruct.Rd0000644000176000001440000000205314627671725015577 0ustar ripleyusers% File nlme/man/formula.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{formula.reStruct} \title{Extract reStruct Object Formula} \usage{ \method{formula}{reStruct}(x, asList, \dots) } \alias{formula.reStruct} \arguments{ \item{x}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{asList}{logical. Should the \code{asList} argument be applied to each of the components?} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts a formula from each of the components of \code{x}, returning a list of formulas. } \value{ a list with the formulas of each component of \code{x}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{formula}}} \examples{ rs1 <- reStruct(list(A = pdDiag(diag(2), ~age), B = ~1)) formula(rs1) } \keyword{models} nlme/man/varPower.Rd0000644000176000001440000000675714251721455014131 0ustar ripleyusers% File nlme/man/varPower.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varPower} \title{Power Variance Function} \usage{ varPower(value, form, fixed) } \alias{varPower} \arguments{ \item{value}{an optional numeric vector, or list of numeric values, with the variance function coefficients. \code{Value} must have length one, unless a grouping factor is specified in \code{form}. If \code{value} has length greater than one, it must have names which identify its elements to the levels of the grouping factor defined in \code{form}. If a grouping factor is present in \code{form} and \code{value} has length one, its value will be assigned to all grouping levels. Default is \code{numeric(0)}, which results in a vector of zeros of appropriate length being assigned to the coefficients when \code{object} is initialized (corresponding to constant variance equal to one).} \item{form}{an optional one-sided formula of the form \code{~ v}, or \code{~ v | g}, specifying a variance covariate \code{v} and, optionally, a grouping factor \code{g} for the coefficients. The variance covariate must evaluate to a numeric vector and may involve expressions using \code{"."}, representing a fitted model object from which fitted values (\code{fitted(.)}) and residuals (\code{resid(.)}) can be extracted (this allows the variance covariate to be updated during the optimization of an object function). When a grouping factor is present in \code{form}, a different coefficient value is used for each of its levels. Several grouping variables may be simultaneously specified, separated by the \code{*} operator, like in \code{~ v | g1 * g2 * g3}. In this case, the levels of each grouping variable are pasted together and the resulting factor is used to group the observations. Defaults to \code{~ fitted(.)} representing a variance covariate given by the fitted values of a fitted model object and no grouping factor. } \item{fixed}{an optional numeric vector, or list of numeric values, specifying the values at which some or all of the coefficients in the variance function should be fixed. If a grouping factor is specified in \code{form}, \code{fixed} must have names identifying which coefficients are to be fixed. Coefficients included in \code{fixed} are not allowed to vary during the optimization of an objective function. Defaults to \code{NULL}, corresponding to no fixed coefficients.} } \description{ This function is a constructor for the \code{varPower} class, representing a power variance function structure. Letting \eqn{v} denote the variance covariate and \eqn{\sigma^2(v)}{s2(v)} denote the variance function evaluated at \eqn{v}, the power variance function is defined as \eqn{\sigma^2(v) = |v|^{2\theta}}{s2(v) = |v|^(2*t)}, where \eqn{\theta}{t} is the variance function coefficient. When a grouping factor is present, a different \eqn{\theta}{t} is used for each factor level. } \value{ a \code{varPower} object representing a power variance function structure, also inheriting from class \code{varFunc}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{varWeights.varFunc}}, \code{\link{coef.varPower}}} \examples{ vf1 <- varPower(0.2, form = ~age|Sex) } \keyword{models} nlme/man/coef.lmList.Rd0000644000176000001440000000743114251721456014472 0ustar ripleyusers% File nlme/man/coef.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.lmList} \title{Extract lmList Coefficients} \usage{ \method{coef}{lmList}(object, augFrame, data, which, FUN, omitGroupingFactor, \dots) } \alias{coef.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{augFrame}{an optional logical value. If \code{TRUE}, the returned data frame is augmented with variables defined in the data frame used to produce \code{object}; else, if \code{FALSE}, only the coefficients are returned. Defaults to \code{FALSE}. } \item{data}{an optional data frame with the variables to be used for augmenting the returned data frame when \code{augFrame = TRUE}. Defaults to the data frame used to fit \code{object}.} \item{which}{an optional positive integer or character vector specifying which columns of the data frame used to produce \code{object} should be used in the augmentation of the returned data frame. Defaults to all variables in the data. } \item{FUN}{an optional summary function or a list of summary functions to be applied to group-varying variables, when collapsing the data by groups. Group-invariant variables are always summarized by the unique value that they assume within that group. If \code{FUN} is a single function it will be applied to each non-invariant variable by group to produce the summary for that variable. If \code{FUN} is a list of functions, the names in the list should designate classes of variables in the frame such as \code{ordered}, \code{factor}, or \code{numeric}. The indicated function will be applied to any group-varying variables of that class. The default functions to be used are \code{mean} for numeric factors, and \code{Mode} for both \code{factor} and \code{ordered}. The \code{Mode} function, defined internally in \code{gsummary}, returns the modal or most popular value of the variable. It is different from the \code{mode} function that returns the S-language mode of the variable. } \item{omitGroupingFactor}{an optional logical value. When \code{TRUE} the grouping factor itself will be omitted from the group-wise summary of \code{data} but the levels of the grouping factor will continue to be used as the row names for the returned data frame. Defaults to \code{FALSE}. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The coefficients of each \code{lm} object in the \code{object} list are extracted and organized into a data frame, with rows corresponding to the \code{lm} components and columns corresponding to the coefficients. Optionally, the returned data frame may be augmented with covariates summarized over the groups associated with the \code{lm} components. } \value{ a data frame inheriting from class \code{"coef.lmList"} with the estimated coefficients for each \code{"lm"} component of \code{object} and, optionally, other covariates summarized over the groups corresponding to the \code{"lm"} components. The returned object also inherits from classes \code{"ranef.lmList"} and \code{"data.frame"}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York, esp. pp. 457-458. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{fixed.effects.lmList}}, \code{\link{ranef.lmList}}, \code{\link{plot.ranef.lmList}}, \code{\link{gsummary}}} \examples{ fm1 <- lmList(distance ~ age|Subject, data = Orthodont) coef(fm1) coef(fm1, augFrame = TRUE) } \keyword{models} nlme/man/plot.ranef.lme.Rd0000644000176000001440000001204414543113774015135 0ustar ripleyusers% File nlme/man/plot.ranef.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.ranef.lme} \title{Plot a ranef.lme Object} \description{ Plots (class \code{"Trellis"} from package \CRANpkg{lattice}) of the random effects from linear mixed effects model, i.e., the result of \code{\link{ranef}(\link{lme}(*))} (of class \code{"\link{ranef.lme}"}). } \usage{ \method{plot}{ranef.lme}(x, form = NULL, omitFixed = TRUE, level = Q, grid = TRUE, control, xlab, ylab, strip, \dots) } \alias{plot.ranef.lme} \arguments{ \item{x}{an object inheriting from class \code{"\link{ranef.lme}"}, representing the estimated coefficients or estimated random effects for the \code{lme} object from which it was produced.} \item{form}{an optional formula specifying the desired type of plot. \itemize{ \item If given as a one-sided formula, a \code{\link[lattice:xyplot]{dotplot}()} of the estimated random effects (coefficients) grouped according to all combinations of the levels of the factors named in \code{form} is returned. \item If given as a two-sided formula (or by default, \code{NULL}), an \code{\link[lattice]{xyplot}()} Trellis display of the random effect (coefficient) versus the named covariates is returned. In \code{NULL} case the row names of the random effects (coefficients) are used (as covariates). } See also \sQuote{Details:}. } \item{omitFixed}{an optional logical value indicating whether columns with values that are constant across groups should be omitted. Default is \code{TRUE}.} \item{level}{an optional integer value giving the level of grouping to be used for \code{x}. Only used when \code{x} is a list with different components for each grouping level. Defaults to the highest or innermost level of grouping.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Only applies to plots associated with two-sided formulas in \code{form}. Default is \code{TRUE}.} \item{control}{an optional list with control values for the plot, when \code{form} is given as a two-sided formula. The control values are referenced by name in the \code{control} list and only the ones to be modified from the default need to be specified. Available values include: \code{drawLine}, a logical value indicating whether a \code{loess} smoother should be added to the scatter plots and a line connecting the medians should be added to the boxplots (default is \code{TRUE}); \code{span.loess}, used as the \code{span} argument in the call to \code{panel.loess} (default is \code{2/3}); \code{degree.loess}, used as the \code{degree} argument in the call to \code{panel.loess} (default is \code{1}); \code{cex.axis}, the character expansion factor for the x-axis (default is \code{0.8}); \code{srt.axis}, the rotation factor for the x-axis (default is \code{0}); and \code{mgp.axis}, the margin parameters for the x-axis (default is \code{c(2, 0.5, 0)}).} \item{xlab, ylab}{axis labels, each with a sensible default.} \item{strip}{a \code{\link{function}} or \code{FALSE}, see \code{\link[lattice:xyplot]{dotplot}()} from package \CRANpkg{lattice}.} \item{\dots}{optional arguments passed to the Trellis \code{dotplot} function.} } \details{ If \code{form} is missing, or is given as a one-sided formula, a Trellis dot-plot (via \code{\link[lattice:xyplot]{dotplot}()} from pkg \CRANpkg{lattice}) of the random effects is generated, with a different panel for each random effect (coefficient). Rows in the dot-plot are determined by the \code{form} argument (if not missing) or by the row names of the random effects (coefficients). Single factors (\code{~g}) or crossed factors (\code{~g1*g2}) are allowed. For a single factor, its levels determine the dot-plot rows (with possibly multiple dots per row); otherwise, if \code{form} specifies a crossing of factors, the dot-plot rows are determined by all combinations of the levels of the individual factors in the formula. If \code{form} is a two-sided formula, the left hand side must be a single random effect (coefficient) and the right hand side is formed by covariates in \code{x} separated by \code{+}. An \code{\link[lattice]{xyplot}()} Trellis display is generated, with a different panel for each variable listed in the right hand side of \code{form}. Scatter plots are generated for numeric variables and boxplots are generated for categorical (\code{factor} or \code{ordered}) variables. } \value{ a Trellis plot of the estimated random-effects (coefficients) versus covariates, or groups. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{ranef.lme}}, \code{\link{lme}}, \code{\link{dotplot}}. } \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) plot(ranef(fm1)) fm1RE <- ranef(fm1, augFrame = TRUE) plot(fm1RE, form = ~ Sex) plot(fm1RE, form = age ~ Sex) # "connected" boxplots } \keyword{models} nlme/man/coef.reStruct.Rd0000644000176000001440000000336314251721455015040 0ustar ripleyusers% File nlme/man/coef.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.reStruct} \title{reStruct Object Coefficients} \usage{ \method{coef}{reStruct}(object, unconstrained, \dots) \method{coef}{reStruct}(object, \dots) <- value } \alias{coef.reStruct} \alias{coef<-.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{unconstrained}{a logical value. If \code{TRUE} the coefficients are returned in unconstrained form (the same used in the optimization algorithm). If \code{FALSE} the coefficients are returned in "natural", possibly constrained, form. Defaults to \code{TRUE}.} \item{value}{a vector with the replacement values for the coefficients associated with \code{object}. It must be a vector with the same length of \code{coef(object)} and must be given in unconstrained form.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the coefficients associated with the positive-definite matrix represented by \code{object}. } \value{ a vector with the coefficients corresponding to \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \section{SIDE EFFECTS}{ On the left side of an assignment, sets the values of the coefficients of \code{object} to \code{value}. } \seealso{\code{\link{coef.pdMat}}, \code{\link{reStruct}}, \code{\link{pdMat}}} \examples{ rs1 <- reStruct(list(A = pdSymm(diag(1:3), form = ~Score), B = pdDiag(2 * diag(4), form = ~Educ))) coef(rs1) } \keyword{models} nlme/man/varWeights.glsStruct.Rd0000644000176000001440000000232314251721455016421 0ustar ripleyusers% File nlme/man/varWeights.glsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varWeights.glsStruct} \title{Variance Weights for glsStruct Object} \usage{ \method{varWeights}{glsStruct}(object) } \alias{varWeights.glsStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{glsStruct}"}, representing a list of linear model components, such as \code{corStruct} and \code{"\link{varFunc}"} objects.} } \description{ If \code{object} includes a \code{varStruct} component, the inverse of the standard deviations of the variance function structure represented by the corresponding \code{varFunc} object are returned; else, a vector of ones of length equal to the number of observations in the data frame used to fit the associated linear model is returned. } \value{ if \code{object} includes a \code{varStruct} component, a vector with the corresponding variance weights; else, or a vector of ones. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{varWeights}}} \keyword{models} nlme/man/predict.gnls.Rd0000644000176000001440000000314214251721456014702 0ustar ripleyusers% File nlme/man/predict.gnls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{predict.gnls} \title{Predictions from a gnls Object} \usage{ \method{predict}{gnls}(object, newdata, na.action, naPattern, \dots) } \alias{predict.gnls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gnls}"}, representing a generalized nonlinear least squares fitted model.} \item{newdata}{an optional data frame to be used for obtaining the predictions. All variables used in the nonlinear model must be present in the data frame. If missing, the fitted values are returned.} \item{na.action}{a function that indicates what should happen when \code{newdata} contains \code{NA}s. The default action (\code{na.fail}) causes the function to print an error message and terminate if there are any incomplete observations.} \item{naPattern}{an expression or formula object, specifying which returned values are to be regarded as missing.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The predictions for the nonlinear model represented by \code{object} are obtained at the covariate values defined in \code{newdata}. } \value{ a vector with the predicted values. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gnls}}} \examples{ fm1 <- gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean, weights = varPower()) newSoybean <- data.frame(Time = c(10,30,50,80,100)) predict(fm1, newSoybean) } \keyword{models} nlme/man/pdConstruct.Rd0000644000176000001440000000541214251721455014617 0ustar ripleyusers% File nlme/man/pdConstruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdConstruct} \title{Construct pdMat Objects} \usage{ pdConstruct(object, value, form, nam, data, \dots) } \alias{pdConstruct} \alias{pdConstruct.pdCompSymm} \alias{pdConstruct.pdDiag} \alias{pdConstruct.pdIdent} \alias{pdConstruct.pdMat} \alias{pdConstruct.pdNatural} \alias{pdConstruct.pdSymm} \alias{pdConstruct.pdLogChol} \arguments{ \item{object}{an object inheriting from class \code{pdMat}, representing a positive definite matrix.} \item{value}{an optional initialization value, which can be any of the following: a \code{pdMat} object, a positive-definite matrix, a one-sided linear formula (with variables separated by \code{+}), a vector of character strings, or a numeric vector. Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional one-sided linear formula specifying the row/column names for the matrix represented by \code{object}. Because factors may be present in \code{form}, the formula needs to be evaluated on a data.frame to resolve the names it defines. This argument is ignored when \code{value} is a one-sided formula. Defaults to \code{NULL}.} \item{nam}{an optional vector of character strings specifying the row/column names for the matrix represented by object. It must have length equal to the dimension of the underlying positive-definite matrix and unreplicated elements. This argument is ignored when \code{value} is a vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} \item{\dots}{optional arguments for some methods.} } \description{ This function is an alternative constructor for the \code{pdMat} class associated with \code{object} and is mostly used internally in other functions. See the documentation on the principal constructor function, generally with the same name as the \code{pdMat} class of object. } \value{ a \code{pdMat} object representing a positive-definite matrix, inheriting from the same classes as \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{pdCompSymm}}, \code{\link{pdDiag}}, \code{\link{pdIdent}}, \code{\link{pdNatural}}, \code{\link{pdSymm}}} \examples{ pd1 <- pdSymm() pdConstruct(pd1, diag(1:4)) } \keyword{models} nlme/man/intervals.gls.Rd0000644000176000001440000000551314251721455015104 0ustar ripleyusers% File nlme/man/intervals.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{intervals.gls} \title{Confidence Intervals on gls Parameters} \usage{ \method{intervals}{gls}(object, level, which, \dots) } \alias{intervals.gls} \alias{print.intervals.gls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted linear model.} \item{level}{an optional numeric value for the interval confidence level. Defaults to 0.95.} \item{which}{an optional character string specifying the subset of parameters for which to construct the confidence intervals. Possible values are \code{"all"} for all parameters, \code{"var-cov"} for the variance-covariance parameters only, and \code{"coef"} for the linear model coefficients only. Defaults to \code{"all"}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Approximate confidence intervals for the parameters in the linear model represented by \code{object} are obtained, using a normal approximation to the distribution of the (restricted) maximum likelihood estimators (the estimators are assumed to have a normal distribution centered at the true parameter values and with covariance matrix equal to the negative inverse Hessian matrix of the (restricted) log-likelihood evaluated at the estimated parameters). Confidence intervals are obtained in an unconstrained scale first, using the normal approximation, and, if necessary, transformed to the constrained scale. } \value{ a list with components given by data frames with rows corresponding to parameters and columns \code{lower}, \code{est.}, and \code{upper} representing respectively lower confidence limits, the estimated values, and upper confidence limits for the parameters. Possible components are: \item{coef}{linear model coefficients, only present when \code{which} is not equal to \code{"var-cov"}.} \item{corStruct}{correlation parameters, only present when \code{which} is not equal to \code{"coef"} and a correlation structure is used in \code{object}.} \item{varFunc}{variance function parameters, only present when \code{which} is not equal to \code{"coef"} and a variance function structure is used in \code{object}.} \item{sigma}{residual standard error.} } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link{intervals}}, \code{\link{print.intervals.gls}} } \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) intervals(fm1) } \keyword{models} nlme/man/pdMatrix.reStruct.Rd0000644000176000001440000000312714251721455015712 0ustar ripleyusers% File nlme/man/pdMatrix.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdMatrix.reStruct} \title{Extract Matrix or Square-Root Factor from Components of an reStruct Object} \usage{ \method{pdMatrix}{reStruct}(object, factor) } \alias{pdMatrix.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{factor}{an optional logical value. If \code{TRUE}, square-root factors of the positive-definite matrices represented by the elements of \code{object} are returned; else, if \code{FALSE}, the positive-definite matrices are returned. Defaults to \code{FALSE}.} } \description{ This method function extracts the positive-definite matrices corresponding to the \code{pdMat} elements of \code{object}, or square-root factors of the positive-definite matrices. } \value{ a list with components given by the positive-definite matrices corresponding to the elements of \code{object}, or square-root factors of the positive-definite matrices. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. p. 162. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.reStruct}}, \code{\link{reStruct}}, \code{\link{pdMat}}, \code{\link{pdMatrix}}, \code{\link{pdMatrix.pdMat}} } \examples{ rs1 <- reStruct(pdSymm(diag(3), ~age+Sex, data = Orthodont)) pdMatrix(rs1) } \keyword{models} nlme/man/BodyWeight.Rd0000644000176000001440000000363114251721455014355 0ustar ripleyusers% File nlme/man/BodyWeight.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{BodyWeight} \alias{BodyWeight} \title{Rat weight over time for different diets} \description{ The \code{BodyWeight} data frame has 176 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{weight}{ a numeric vector giving the body weight of the rat (grams). } \item{Time}{ a numeric vector giving the time at which the measurement is made (days). } \item{Rat}{ an ordered factor with levels \code{2} < \code{3} < \code{4} < \code{1} < \code{8} < \code{5} < \code{6} < \code{7} < \code{11} < \code{9} < \code{10} < \code{12} < \code{13} < \code{15} < \code{14} < \code{16} identifying the rat whose weight is measured. } \item{Diet}{ a factor with levels \code{1} to \code{3} indicating the diet that the rat receives. } } } \details{ Hand and Crowder (1996) describe data on the body weights of rats measured over 64 days. These data also appear in Table 2.4 of Crowder and Hand (1990). The body weights of the rats (in grams) are measured on day 1 and every seven days thereafter until day 64, with an extra measurement on day 44. The experiment started several weeks before ``day 1.'' There are three groups of rats, each on a different diet. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.3) Crowder, M. and Hand, D. (1990), \emph{Analysis of Repeated Measures}, Chapman and Hall, London. Hand, D. and Crowder, M. (1996), \emph{Practical Longitudinal Data Analysis}, Chapman and Hall, London. } %\examples{} \keyword{datasets} nlme/man/logLik.glsStruct.Rd0000644000176000001440000000320714251721455015521 0ustar ripleyusers% File nlme/man/logLik.glsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.glsStruct} \title{Log-Likelihood of a glsStruct Object} \usage{ \method{logLik}{glsStruct}(object, Pars, conLin, \dots) } \alias{logLik.glsStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{glsStruct}"}, representing a list of linear model components, such as \code{corStruct} and \code{"\link{varFunc}"} objects.} \item{Pars}{the parameter values at which the (restricted) log-likelihood is to be evaluated.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying linear model. Defaults to \code{attr(object, "conLin")}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ \code{Pars} is used to update the coefficients of the model components of \code{object} and the individual (restricted) log-likelihood contributions of each component are added together. The type of log-likelihood (restricted or not) is determined by the \code{settings} attribute of \code{object}. } \value{ the (restricted) log-likelihood for the linear model described by \code{object}, evaluated at \code{Pars}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link{glsStruct}}, \code{\link{logLik.lme}} } \keyword{models} nlme/man/collapse.Rd0000644000176000001440000000142014657640762014117 0ustar ripleyusers% File nlme/man/collapse.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{collapse} \title{Collapse According to Groups} \usage{ collapse(object, \dots) } \alias{collapse} \arguments{ \item{object}{an object to be collapsed, usually a data frame.} \item{\dots}{some methods for the generic may require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Currently, only a \code{groupedData} method is available. } \value{ will depend on the method function used; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{collapse.groupedData}}} \keyword{models} nlme/man/formula.pdMat.Rd0000644000176000001440000000240614627671725015033 0ustar ripleyusers% File nlme/man/formula.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{formula.pdMat} \title{Extract pdMat Formula} \usage{ \method{formula}{pdMat}(x, asList, \dots) } \alias{formula.pdMat} \arguments{ \item{x}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive definite matrix.} \item{asList}{logical. Should the \code{asList} argument be applied to each of the components? Never used.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the formula associated with a \code{pdMat} object, in which the column and row names are specified. } \value{ if \code{x} has a \code{formula} attribute, its value is returned, else \code{NULL} is returned. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ Because factors may be present in \code{formula(x)}, the \code{pdMat} object needs to have access to a data frame where the variables named in the formula can be evaluated, before it can resolve its row and column names from the formula. } \seealso{\code{\link{pdMat}}} \examples{ pd1 <- pdSymm(~Sex*age) formula(pd1) } \keyword{models} nlme/man/gnlsStruct.Rd0000644000176000001440000000236614251721456014465 0ustar ripleyusers% File nlme/man/gnlsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gnlsStruct} \title{Generalized Nonlinear Least Squares Structure} \usage{ gnlsStruct(corStruct, varStruct) } \alias{gnlsStruct} \alias{Initialize.gnlsStruct} \arguments{ \item{corStruct}{an optional \code{corStruct} object, representing a correlation structure. Default is \code{NULL}.} \item{varStruct}{an optional \code{varFunc} object, representing a variance function structure. Default is \code{NULL}.} } \description{ A generalized nonlinear least squares structure is a list of model components representing different sets of parameters in the nonlinear model. A \code{gnlsStruct} may contain \code{corStruct} and \code{varFunc} objects. \code{NULL} arguments are not included in the \code{gnlsStruct} list. } \value{ a list of model variance-covariance components determining the parameters to be estimated for the associated nonlinear model. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gnls}}, \code{\link{corClasses}}, \code{\link{residuals.gnlsStruct}} \code{\link{varFunc}} } \examples{ gnls1 <- gnlsStruct(corAR1(), varPower()) } \keyword{models} nlme/man/logLik.gnlsStruct.Rd0000644000176000001440000000307414251721455015701 0ustar ripleyusers% File nlme/man/logLik.gnlsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.gnlsStruct} \title{Log-Likelihood of a gnlsStruct Object} \usage{ \method{logLik}{gnlsStruct}(object, Pars, conLin, \dots) } \alias{logLik.gnlsStruct} \arguments{ \item{object}{an object inheriting from class \code{gnlsStruct}, representing a list of model components, such as \code{corStruct} and \code{varFunc} objects, and attributes specifying the underlying nonlinear model and the response variable.} \item{Pars}{the parameter values at which the log-likelihood is to be evaluated.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying nonlinear model. Defaults to \code{attr(object, "conLin")}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ \code{Pars} is used to update the coefficients of the model components of \code{object} and the individual log-likelihood contributions of each component are added together. } \value{ the log-likelihood for the linear model described by \code{object}, evaluated at \code{Pars}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gnls}}, \code{\link{gnlsStruct}}, \code{\link{logLik.gnls}} } \keyword{models} nlme/man/as.matrix.corStruct.Rd0000644000176000001440000000237114251721455016205 0ustar ripleyusers% File nlme/man/as.matrix.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{as.matrix.corStruct} \title{Matrix of a corStruct Object} \usage{ \method{as.matrix}{corStruct}(x, \dots) } \alias{as.matrix.corStruct} \arguments{ \item{x}{an object inheriting from class \code{"\link{corStruct}"}, representing a correlation structure.} \item{\dots}{further arguments passed from other methods.} } \description{ This method function extracts the correlation matrix, or list of correlation matrices, associated with \code{object}. } \value{ If the correlation structure includes a grouping factor, the returned value will be a list with components given by the correlation matrices for each group. Otherwise, the returned value will be a matrix representing the correlation structure associated with \code{object}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{corClasses}}, \code{\link{corMatrix}}} \examples{ cst1 <- corAR1(form = ~1|Subject) cst1 <- Initialize(cst1, data = Orthodont) as.matrix(cst1) } \keyword{models} nlme/man/nlsList.selfStart.Rd0000644000176000001440000000603414627671725015721 0ustar ripleyusers% File nlme/man/nlsList.selfStart.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlsList.selfStart} \title{nlsList Fit from a selfStart Function} \usage{ \method{nlsList}{selfStart}(model, data, start, control, level, subset, na.action = na.fail, pool = TRUE, warn.nls = NA) } \alias{nlsList.selfStart} \arguments{ \item{model}{a \code{"\link{selfStart}"} model function, which calculates initial estimates for the model parameters from \code{data}.} \item{data}{a data frame in which to interpret the variables in \code{model}. Because no grouping factor can be specified in \code{model}, \code{data} must inherit from class \code{"\link{groupedData}"}. } \item{start}{an optional named list with initial values for the parameters to be estimated in \code{model}. It is passed as the \code{start} argument to each \code{nls} call and is required when the nonlinear function in \code{model} does not inherit from class \code{selfStart}. } \item{control}{a list of control values passed as the \code{control} argument to \code{nls}. Defaults to an empty list. } \item{level}{an optional integer specifying the level of grouping to be used when multiple nested levels of grouping are present.} \item{subset}{an optional expression indicating the subset of the rows of \code{data} that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{nlsList} to print an error message and terminate if there are any incomplete observations. } \item{pool, warn.nls}{optional \code{\link{logical}}s, see \code{\link{nlsList}}.} } \description{ The response variable and primary covariate in \code{formula(data)} are used together with \code{model} to construct the nonlinear model formula. This is used in the \code{nls} calls and, because a self-starting model function can calculate initial estimates for its parameters from the data, no starting estimates need to be provided. } \value{ a list of \code{nls} objects with as many components as the number of groups defined by the grouping factor. A \code{NULL} value is assigned to the components corresponding to clusters for which the \code{nls} algorithm failed to converge. Generic functions such as \code{coef}, \code{fixed.effects}, \code{lme}, \code{pairs}, \code{plot}, \code{predict}, \code{random.effects}, \code{summary}, and \code{update} have methods that can be applied to an \code{nlsList} object. } \seealso{ \code{\link{selfStart}}, \code{\link{groupedData}}, \code{\link{nls}}, \code{\link{nlsList}}, \code{\link{nlme.nlsList}}, \code{\link{nlsList.formula}} } \examples{ fm1 <- nlsList(SSasympOff, CO2) summary(fm1) } \keyword{models} nlme/man/varConstProp.Rd0000644000176000001440000001624314251721455014753 0ustar ripleyusers\name{varConstProp} \title{Constant Plus Proportion Variance Function} \usage{ varConstProp(const, prop, form, fixed) } \alias{varConstProp} \arguments{ \item{const, prop}{optional numeric vectors, or lists of numeric values, with, respectively, the coefficients for the constant and the proportional error terms. Both arguments must have length one, unless a grouping factor is specified in \code{form}. If either argument has length greater than one, it must have names which identify its elements to the levels of the grouping factor defined in \code{form}. If a grouping factor is present in \code{form} and the argument has length one, its value will be assigned to all grouping levels. Only positive values are allowed for \code{const}. Default is 0.1 for both \code{const} and \code{prop}. } \item{form}{an optional one-sided formula of the form \code{~ v}, or \code{~ v | g}, specifying a variance covariate \code{v} and, optionally, a grouping factor \code{g} for the coefficients. The variance covariate must evaluate to a numeric vector and may involve expressions using \code{"."}, representing a fitted model object from which fitted values (\code{fitted(.)}) and residuals (\code{resid(.)}) can be extracted (this allows the variance covariate to be updated during the optimization of an object function). When a grouping factor is present in \code{form}, a different coefficient value is used for each of its levels. Several grouping variables may be simultaneously specified, separated by the \code{*} operator, as in \code{~ v | g1 * g2 * g3}. In this case, the levels of each grouping variable are pasted together and the resulting factor is used to group the observations. Defaults to \code{~ fitted(.)} representing a variance covariate given by the fitted values of a fitted model object and no grouping factor. } \item{fixed}{an optional list with components \code{const} and/or \code{power}, consisting of numeric vectors, or lists of numeric values, specifying the values at which some or all of the coefficients in the variance function should be fixed. If a grouping factor is specified in \code{form}, the components of \code{fixed} must have names identifying which coefficients are to be fixed. Coefficients included in \code{fixed} are not allowed to vary during the optimization of an objective function. Defaults to \code{NULL}, corresponding to no fixed coefficients.} } \description{ This function is a constructor for the \code{varConstProp} class, representing a variance function structure corresponding to a two-component error model (additive and proportional error). Letting \eqn{v} denote the variance covariate and \eqn{\sigma^2(v)}{s2(v)} denote the variance function evaluated at \eqn{v}, the two-component variance function is defined as \eqn{\sigma^2(v) = a^2 + b^2 * v^{2}}{s2(v) = a^2 + b^2 * v^2)}, where a is the additive component and b is the relative error component. In order to avoid overparameterisation of the model, it is recommended to use the possibility to fix sigma, preferably to a value of 1 (see examples). } \note{ The error model underlying this variance function structure can be understood to result from two uncorrelated sequences of standardized random variables (Lavielle(2015), p. 55) and has been proposed for use in analytical chemistry (Werner et al. (1978), Wilson et al. (2004)) and chemical degradation kinetics (Ranke and Meinecke (2019)). Note that the two-component error model proposed by Rocke and Lorenzato (1995) assumed a log-normal distribution of residuals at high absolute values, which is not compatible with the \code{\link{varFunc}} structures in package \pkg{nlme}. } \value{ a \code{varConstProp} object representing a constant plus proportion variance function structure, also inheriting from class \code{varFunc}. } \references{ Lavielle, M. (2015) \emph{Mixed Effects Models for the Population Approach: Models, Tasks, Methods and Tools}, Chapman and Hall/CRC. \doi{10.1201/b17203} Pinheiro, J.C., and Bates, D.M. (2000) \emph{Mixed-Effects Models in S and S-PLUS}, Springer. \doi{10.1007/b98882} Ranke, J., and Meinecke, S. (2019) Error Models for the Kinetic Evaluation of Chemical Degradation Data. \emph{Environments} \bold{6}(12), 124 \doi{10.3390/environments6120124} Rocke, David M. and Lorenzato, Stefan (1995) A Two-Component Model for Measurement Error in Analytical Chemistry. \emph{Technometrics} \bold{37}(2), 176--184. \doi{10.1080/00401706.1995.10484302} Werner, Mario, Brooks, Samuel H., and Knott, Lancaster B. (1978) Additive, Multiplicative, and Mixed Analytical Errors. \emph{Clinical Chemistry} \bold{24}(11), 1895--1898. \doi{10.1093/clinchem/24.11.1895} Wilson, M.D., Rocke, D.M., Durbin, B. and Kahn, H.D (2004) Detection Limits and Goodness-of-Fit Measures for the Two-Component Model of Chemical Analytical Error. \emph{Analytica Chimica Acta} 2004, 509, 197--208 \doi{10.1016/j.aca.2003.12.047} } \author{José Pinheiro and Douglas Bates (for \code{\link{varConstPower}}) and Johannes Ranke (adaptation to \code{varConstProp()}). } \seealso{ \code{\link{varClasses}}, \code{\link{varWeights.varFunc}}, \code{\link{coef.varFunc}}} \examples{ # Generate some synthetic data using the two-component error model and use # different variance functions, also with fixed sigma in order to avoid # overparameterisation in the case of a constant term in the variance function times <- c(0, 1, 3, 7, 14, 28, 56, 120) pred <- 100 * exp(- 0.03 * times) sd_pred <- sqrt(3^2 + 0.07^2 * pred^2) n_replicates <- 2 set.seed(123456) syn_data <- data.frame( time = rep(times, each = n_replicates), value = rnorm(length(times) * n_replicates, rep(pred, each = n_replicates), rep(sd_pred, each = n_replicates))) syn_data$value <- ifelse(syn_data$value < 0, NA, syn_data$value) f_const <- gnls(value ~ SSasymp(time, 0, parent_0, lrc), data = syn_data, na.action = na.omit, start = list(parent_0 = 100, lrc = -3)) f_varPower <- gnls(value ~ SSasymp(time, 0, parent_0, lrc), data = syn_data, na.action = na.omit, start = list(parent_0 = 100, lrc = -3), weights = varPower()) f_varConstPower <- gnls(value ~ SSasymp(time, 0, parent_0, lrc), data = syn_data, na.action = na.omit, start = list(parent_0 = 100, lrc = -3), weights = varConstPower()) f_varConstPower_sf <- gnls(value ~ SSasymp(time, 0, parent_0, lrc), data = syn_data, na.action = na.omit, control = list(sigma = 1), start = list(parent_0 = 100, lrc = -3), weights = varConstPower()) f_varConstProp <- gnls(value ~ SSasymp(time, 0, parent_0, lrc), data = syn_data, na.action = na.omit, start = list(parent_0 = 100, lrc = -3), weights = varConstProp()) f_varConstProp_sf <- gnls(value ~ SSasymp(time, 0, parent_0, lrc), data = syn_data, na.action = na.omit, start = list(parent_0 = 100, lrc = -3), control = list(sigma = 1), weights = varConstProp()) AIC(f_const, f_varPower, f_varConstPower, f_varConstPower_sf, f_varConstProp, f_varConstProp_sf) # The error model parameters 3 and 0.07 are approximately recovered intervals(f_varConstProp_sf) } \keyword{models} nlme/man/fixed.effects.Rd0000644000176000001440000000200414657640762015031 0ustar ripleyusers% File nlme/man/fixed.effects.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fixed.effects} \title{Extract Fixed Effects} \usage{ fixed.effects(object, \dots) fixef(object, \dots) } \alias{fixed.effects} \alias{fixef} \arguments{ \item{object}{any fitted model object from which fixed effects estimates can be extracted.} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{lmList} and \code{lme}. \code{fixed.effects} is an alias for \code{fixef}; methods are implemented for the latter. } \value{ will depend on the method function used; see the appropriate documentation. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \seealso{\code{\link{fixef.lmList}}} \keyword{models} nlme/man/glsControl.Rd0000644000176000001440000000615514251721455014442 0ustar ripleyusers% File nlme/man/glsControl.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{glsControl} \title{Control Values for gls Fit} \usage{ glsControl(maxIter, msMaxIter, tolerance, msTol, msVerbose, singular.ok, returnObject = FALSE, apVar, .relStep, opt = c("nlminb", "optim"), optimMethod, minAbsParApVar, natural, sigma = NULL) } \alias{glsControl} \arguments{ \item{maxIter}{maximum number of iterations for the \code{gls} optimization algorithm. Default is 50.} \item{msMaxIter}{maximum number of iterations for the \code{opt}imization step inside the \code{gls} optimization. Default is 50.} \item{tolerance}{tolerance for the convergence criterion in the \code{gls} algorithm. Default is 1e-6.} \item{msTol}{tolerance for the convergence criterion of the first outer iteration when \code{optim} is used. Default is 1e-7.} \item{msVerbose}{a logical value passed as the \code{trace} control value to the chosen \code{opt}imizer (see documentation on that function). Default is \code{FALSE}.} \item{singular.ok}{a logical value indicating whether non-estimable coefficients (resulting from linear dependencies among the columns of the regression matrix) should be allowed. Default is \code{FALSE}.} \item{returnObject}{a logical value indicating whether the fitted object should be returned when the maximum number of iterations is reached without convergence of the algorithm. Default is \code{FALSE}.} \item{apVar}{a logical value indicating whether the approximate covariance matrix of the variance-covariance parameters should be calculated. Default is \code{TRUE}.} \item{.relStep}{relative step for numerical derivatives calculations. Default is \code{.Machine$double.eps^(1/3)}.} \item{opt}{the optimizer to be used, either \code{"\link{nlminb}"} (the current default) or \code{"\link{optim}"} (the previous default).} \item{optimMethod}{character - the optimization method to be used with the \code{\link{optim}} optimizer. The default is \code{"BFGS"}. An alternative is \code{"L-BFGS-B"}.} \item{minAbsParApVar}{numeric value - minimum absolute parameter value in the approximate variance calculation. The default is \code{0.05}.} \item{natural}{logical. Should the natural parameterization be used for the approximate variance calculations? Default is \code{TRUE}.} \item{sigma}{optionally a positive number to fix the residual error at. If \code{NULL}, as by default, or \code{0}, sigma is estimated.} } \description{ The values supplied in the function call replace the defaults and a list with all possible arguments is returned. The returned list is used as the \code{control} argument to the \code{gls} function. } \value{ a list with components for each of the possible arguments. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}; the \code{sigma} option: Siem Heisterkamp and Bert van Willigen.} \seealso{\code{\link{gls}}} \examples{ # decrease the maximum number of iterations and request tracing glsControl(msMaxIter = 20, msVerbose = TRUE) } \keyword{models} nlme/man/recalc.reStruct.Rd0000644000176000001440000000330614251721455015352 0ustar ripleyusers% File nlme/man/recalc.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{recalc.reStruct} \title{Recalculate for an reStruct Object} \usage{ \method{recalc}{reStruct}(object, conLin, \dots) } \alias{recalc.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{conLin}{a condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying model.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The log-likelihood, or restricted log-likelihood, of the Gaussian linear mixed-effects model represented by \code{object} and \code{conLin} (assuming spherical within-group covariance structure), evaluated at \code{coef(object)} is calculated and added to the \code{logLik} component of \code{conLin}. The \code{settings} attribute of \code{object} determines whether the log-likelihood, or the restricted log-likelihood, is to be calculated. The computational methods for the (restricted) log-likelihood calculations are described in Bates and Pinheiro (1998). } \value{ the condensed linear model with its \code{logLik} component updated. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{logLik}}, \code{\link{lme}}, \code{\link{recalc}}, \code{\link{reStruct}} } \keyword{models} nlme/man/plot.augPred.Rd0000644000176000001440000000311514633640310014643 0ustar ripleyusers% File nlme/man/plot.augPred.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.augPred} \title{Plot an augPred Object} \usage{ \method{plot}{augPred}(x, key, grid, \dots) } \alias{plot.augPred} \arguments{ \item{x}{an object of class \code{"\link{augPred}"}.} \item{key}{an optional logical value, or list. If \code{TRUE}, a legend is included at the top of the plot indicating which symbols (colors) correspond to which prediction levels. If \code{FALSE}, no legend is included. If given as a list, \code{key} is passed down as an argument to the \code{trellis} function generating the plots (\code{xyplot}). Defaults to \code{TRUE}.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{FALSE}.} \item{\dots}{optional arguments passed down to the \code{trellis} function generating the plots.} } \description{ A Trellis \code{xyplot} of predictions versus the primary covariate is generated, with a different panel for each value of the grouping factor. Predicted values are joined by lines, with different line types (colors) being used for each level of grouping. Original observations are represented by circles. } \value{ A Trellis plot of predictions versus the primary covariate, with panels determined by the grouping factor. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{augPred}}, \code{\link[lattice]{xyplot}}} \examples{ fm1 <- lme(Orthodont) plot(augPred(fm1, level = 0:1, length.out = 2)) } \keyword{models} nlme/man/varIdent.Rd0000644000176000001440000000701514612020577014062 0ustar ripleyusers% File nlme/man/varIdent.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varIdent} \title{Constant Variance Function} \usage{ varIdent(value, form, fixed) } \alias{varIdent} \arguments{ \item{value}{an optional numeric vector, or list of numeric values, with the variance function coefficients. If no grouping factor is present in \code{form}, this argument is ignored, as the resulting variance function contains no coefficients. If \code{value} has length one, its value is repeated for all coefficients in the variance function. If \code{value} has length greater than one, it must have length equal to the number of grouping levels minus one and names which identify its elements to the levels of the grouping factor. Only positive values are allowed for this argument. Default is \code{numeric(0)}, which results in a vector of zeros of appropriate length being assigned to the coefficients when \code{object} is initialized (corresponding to constant variance equal to one).} \item{form}{an optional one-sided formula of the form \code{~ v}, or \code{~ v | g}, specifying a variance covariate \code{v} and, optionally, a grouping factor \code{g} for the coefficients. The variance covariate is ignored in this variance function. When a grouping factor is present in \code{form}, a different coefficient value is used for each of its levels less one reference level. Several grouping variables may be simultaneously specified, separated by the \code{*} operator, like in \code{~ v | g1 * g2 * g3}. In this case, the levels of each grouping variable are pasted together and the resulting factor is used to group the observations. Defaults to \code{~ 1}. } \item{fixed}{an optional numeric vector, or list of numeric values, specifying the values at which some or all of the coefficients in the variance function should be fixed. It must have names identifying which coefficients are to be fixed. Coefficients included in \code{fixed} are not allowed to vary during the optimization of an objective function. Defaults to \code{NULL}, corresponding to no fixed coefficients.} } \description{ This function is a constructor for the \code{varIdent} class, representing a constant variance function structure. If no grouping factor is present in \code{form}, the variance function is constant and equal to one, and no coefficients required to represent it. When \code{form} includes a grouping factor with \eqn{M > 1} levels, the variance function allows M different variances, one for each level of the factor. For identifiability reasons, the coefficients of the variance function represent the ratios between the variances and a reference variance (corresponding to a reference group level). Therefore, only \eqn{M-1} coefficients are needed to represent the variance function. By default, if the elements in \code{value} are unnamed, the first group level is taken as the reference level. } \value{ a \code{varIdent} object representing a constant variance function structure, also inheriting from class \code{varFunc}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{varClasses}}, \code{\link{varWeights.varFunc}}, \code{\link{coef.varIdent}}} \examples{ vf1 <- varIdent(c(Female = 0.5), form = ~ 1 | Sex) } \keyword{models} nlme/man/predict.nlme.Rd0000644000176000001440000000736614251721455014705 0ustar ripleyusers% File nlme/man/predict.nlme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{predict.nlme} \title{Predictions from an nlme Object} \usage{ \method{predict}{nlme}(object, newdata, level = Q, asList = FALSE, na.action = na.fail, naPattern = NULL, \dots) } \alias{predict.nlme} \arguments{ \item{object}{an object inheriting from class \code{"\link{nlme}"}, representing a fitted nonlinear mixed-effects model.} \item{newdata}{an optional data frame to be used for obtaining the predictions. All variables used in the nonlinear model, the fixed and the random effects models, as well as the grouping factors, must be present in the data frame. If missing, the fitted values are returned.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in obtaining the predictions. Level values increase from outermost to innermost grouping, with level zero corresponding to the population predictions. Defaults to the highest or innermost level of grouping (and is \code{object$dims$Q}).} \item{asList}{an optional logical value. If \code{TRUE} and a single value is given in \code{level}, the returned object is a list with the predictions split by groups; else the returned value is either a vector or a data frame, according to the length of \code{level}.} \item{na.action}{a function that indicates what should happen when \code{newdata} contains \code{NA}s. The default action (\code{na.fail}) causes the function to print an error message and terminate if there are any incomplete observations.} \item{naPattern}{an expression or formula object, specifying which returned values are to be regarded as missing.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The predictions at level \eqn{i} are obtained by adding together the contributions from the estimated fixed effects and the estimated random effects at levels less or equal to \eqn{i} and evaluating the model function at the resulting estimated parameters. If group values not included in the original grouping factors are present in \code{newdata}, the corresponding predictions will be set to \code{NA} for levels greater or equal to the level at which the unknown groups occur. } \value{ if a single level of grouping is specified in \code{level}, the returned value is either a list with the predictions split by groups (\code{asList = TRUE}) or a vector with the predictions (\code{asList = FALSE}); else, when multiple grouping levels are specified in \code{level}, the returned object is a data frame with columns given by the predictions at different levels and the grouping factors. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{nlme}}, \code{\link{fitted.lme}}} \examples{ head(Loblolly) # groupedData w/ 'Seed' is grouping variable : ## Grouped Data: height ~ age | Seed ## height age Seed ## 1 4.51 3 301 ## 15 10.89 5 301 ## .. ..... . ... fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc), data = Loblolly, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1, ## <---grouping---> Asym ~ 1 | Seed start = c(Asym = 103, R0 = -8.5, lrc = -3.3)) fm1 age. <- seq(from = 2, to = 30, by = 2) newLL.301 <- data.frame(age = age., Seed = 301) newLL.329 <- data.frame(age = age., Seed = 329) (p301 <- predict(fm1, newLL.301, level = 0:1)) (p329 <- predict(fm1, newLL.329, level = 0:1)) ## Prediction are the same at level 0 : all.equal(p301[,"predict.fixed"], p329[,"predict.fixed"]) ## and differ by the 'Seed' effect at level 1 : p301[,"predict.Seed"] - p329[,"predict.Seed"] } \keyword{models} nlme/man/Variogram.corRatio.Rd0000644000176000001440000000375614251721455016030 0ustar ripleyusers% File nlme/man/Variogram.corRatio.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.corRatio} \title{Calculate Semi-variogram for a corRatio Object} \usage{ \method{Variogram}{corRatio}(object, distance, sig2, length.out, \dots) } \alias{Variogram.corRatio} \arguments{ \item{object}{an object inheriting from class \code{"\link{corRatio}"}, representing an Rational Quadratic spatial correlation structure.} \item{distance}{an optional numeric vector with the distances at which the semi-variogram is to be calculated. Defaults to \code{NULL}, in which case a sequence of length \code{length.out} between the minimum and maximum values of \code{getCovariate(object)} is used.} \item{sig2}{an optional numeric value representing the process variance. Defaults to \code{1}.} \item{length.out}{an optional integer specifying the length of the sequence of distances to be used for calculating the semi-variogram, when \code{distance = NULL}. Defaults to \code{50}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram values corresponding to the Rational Quadratic correlation model, using the estimated coefficients corresponding to \code{object}, at the distances defined by \code{distance}. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corRatio}}, \code{\link{plot.Variogram}} \code{\link{Variogram}} } \examples{ cs1 <- corRatio(7, form = ~ Time | Rat) cs1 <- Initialize(cs1, BodyWeight) Variogram(cs1)[1:10,] } \keyword{models} nlme/man/solve.pdMat.Rd0000644000176000001440000000230514251721455014501 0ustar ripleyusers% File nlme/man/solve.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{solve.pdMat} \title{Calculate Inverse of a Positive-Definite Matrix} \usage{ \method{solve}{pdMat}(a, b, \dots) } \alias{solve.pdMat} \alias{solve.pdBlocked} \alias{solve.pdDiag} \alias{solve.pdIdent} \alias{solve.pdLogChol} \alias{solve.pdNatural} \alias{solve.pdSymm} \arguments{ \item{a}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive definite matrix.} \item{b}{this argument is only included for consistency with the generic function and is not used in this method function.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The positive-definite matrix represented by \code{a} is inverted and assigned to \code{a}. } \value{ a \code{pdMat} object similar to \code{a}, but with coefficients corresponding to the inverse of the positive-definite matrix represented by \code{a}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{pdMat}}} \examples{ pd1 <- pdCompSymm(3 * diag(3) + 1) solve(pd1) } \keyword{models} nlme/man/summary.lme.Rd0000644000176000001440000000601114632316272014554 0ustar ripleyusers% File nlme/man/summary.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.lme} \title{Summarize an lme Object} \alias{summary.lme} %\alias{coef.summary.lme} \alias{print.summary.lme} \usage{ \method{summary}{lme}(object, adjustSigma, verbose, \dots) \method{print}{summary.lme}(x, verbose = FALSE, \dots) } \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{adjustSigma}{an optional logical value. If \code{TRUE} and the estimation method used to obtain \code{object} was maximum likelihood, the residual standard error is multiplied by \eqn{\sqrt{n_{obs}/(n_{obs} - n_{par})}}{sqrt(nobs/(nobs - npar))}, converting it to a REML-like estimate. This argument is only used when a single fitted object is passed to the function. Default is \code{TRUE}.} \item{verbose}{an optional logical value used to control the amount of output in the \code{print.summary.lme} method. Defaults to \code{FALSE}.} \item{\dots}{additional optional arguments passed to methods, mainly for the \code{\link{print}} method.} \item{x}{a \code{"summary.lme"} object.} } \description{ Additional information about the linear mixed-effects fit represented by \code{object} is extracted and included as components of \code{object}. The returned object has a \code{\link{print}} and a \code{\link{coef}} method, the latter returning the coefficient's \code{tTtable}. } \value{ an object inheriting from class \code{summary.lme} with all components included in \code{object} (see \code{\link{lmeObject}} for a full description of the components) plus the following components: \item{corFixed}{approximate correlation matrix for the fixed effects estimates.} \item{tTable}{a matrix with columns named \code{Value}, \code{Std. Error}, \code{DF}, \code{t-value}, and \code{p-value} representing respectively the fixed effects estimates, their approximate standard errors, the denominator degrees of freedom, the ratios between the estimates and their standard errors, and the associated p-value from a t distribution. Rows correspond to the different fixed effects.} \item{residuals}{if more than five observations are used in the \code{lme} fit, a vector with the minimum, first quartile, median, third quartile, and maximum of the innermost grouping level residuals distribution; else the innermost grouping level residuals.} \item{AIC}{the Akaike Information Criterion corresponding to \code{object}.} \item{BIC}{the Bayesian Information Criterion corresponding to \code{object}.} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{AIC}}, \code{\link{BIC}}, \code{\link{lme}}. } \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) (s1 <- summary(fm1)) coef(s1) # the (coef | Std.E | t | P-v ) matrix \dontshow{stopifnot(is.matrix(coef(s1)))} } \keyword{models} nlme/man/coef.modelStruct.Rd0000644000176000001440000000354514251721456015535 0ustar ripleyusers% File nlme/man/coef.modelStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.modelStruct} \title{Extract modelStruct Object Coefficients} \usage{ \method{coef}{modelStruct}(object, unconstrained, \dots) \method{coef}{modelStruct}(object, \dots) <- value } \alias{coef.modelStruct} \alias{coef<-.modelStruct} \arguments{ \item{object}{an object inheriting from class \code{"modelStruct"}, representing a list of model components, such as \code{"\link{corStruct}"} and \code{"\link{varFunc}"} objects.} \item{unconstrained}{a logical value. If \code{TRUE} the coefficients are returned in unconstrained form (the same used in the optimization algorithm). If \code{FALSE} the coefficients are returned in "natural", possibly constrained, form. Defaults to \code{TRUE}.} \item{value}{a vector with the replacement values for the coefficients associated with \code{object}. It must be a vector with the same length of \code{coef{object}} and must be given in unconstrained form.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the coefficients associated with each component of the \code{modelStruct} list. } \value{ a vector with all coefficients corresponding to the components of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \section{SIDE EFFECTS}{ On the left side of an assignment, sets the values of the coefficients of \code{object} to \code{value}. \code{Object} must be initialized (using \code{Initialize}) before new values can be assigned to its coefficients. } \seealso{\code{\link{Initialize}}} \examples{ lms1 <- lmeStruct(reStruct = reStruct(pdDiag(diag(2), ~age)), corStruct = corAR1(0.3)) coef(lms1) } \keyword{models} nlme/man/Names.pdBlocked.Rd0000644000176000001440000000302514251721455015236 0ustar ripleyusers% File nlme/man/Names.pdBlocked.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Names.pdBlocked} \title{Names of a pdBlocked Object} \usage{ \method{Names}{pdBlocked}(object, asList, \dots) } \alias{Names.pdBlocked} \alias{Names<-.pdBlocked} \arguments{ \item{object}{an object inheriting from class \code{"\link{pdBlocked}"} representing a positive-definite matrix with block diagonal structure} \item{asList}{a logical value. If \code{TRUE} a \code{list} with the names for each block diagonal element is returned. If \code{FALSE} a character vector with all column names is returned. Defaults to \code{FALSE}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the first element of the \code{Dimnames} attribute, which contains the column names, for each block diagonal element in the matrix represented by \code{object}. } \value{ if \code{asList} is \code{FALSE}, a character vector with column names of the matrix represented by \code{object}; otherwise, if \code{asList} is \code{TRUE}, a list with components given by the column names of the individual block diagonal elements in the matrix represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Names}}, \code{\link{Names.pdMat}}} \examples{ pd1 <- pdBlocked(list(~Sex - 1, ~age - 1), data = Orthodont) Names(pd1) } \keyword{models} nlme/man/corCAR1.Rd0000644000176000001440000000502614251721455013502 0ustar ripleyusers% File nlme/man/corCAR1.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corCAR1} \title{Continuous AR(1) Correlation Structure} \usage{ corCAR1(value, form, fixed) } \alias{corCAR1} \arguments{ \item{value}{the correlation between two observations one unit of time apart. Must be between 0 and 1. Defaults to 0.2.} \item{form}{a one sided formula of the form \code{~ t}, or \code{~ t | g}, specifying a time covariate \code{t} and, optionally, a grouping factor \code{g}. Covariates for this correlation structure need not be integer valued. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corCAR1} class, representing an autocorrelation structure of order 1, with a continuous time covariate. Objects created using this constructor must be later initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corCAR1}, representing an autocorrelation structure of order 1, with a continuous time covariate. } \references{ Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day. Jones, R.H. (1993) "Longitudinal Data with Serial Correlation: A State-space Approach", Chapman and Hall. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 236, 243. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}} } \examples{ ## covariate is Time and grouping factor is Mare cs1 <- corCAR1(0.2, form = ~ Time | Mare) # Pinheiro and Bates, pp. 240, 243 fm1Ovar.lme <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), data = Ovary, random = pdDiag(~sin(2*pi*Time))) fm4Ovar.lme <- update(fm1Ovar.lme, correlation = corCAR1(form = ~Time)) } \keyword{models} nlme/man/random.effects.Rd0000644000176000001440000000211314657640762015213 0ustar ripleyusers% File nlme/man/random.effects.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{random.effects} \title{Extract Random Effects} \usage{ random.effects(object, \dots) ranef(object, \dots) } \alias{random.effects} \alias{ranef} %% \alias{print.ranef} \arguments{ \item{object}{any fitted model object from which random effects estimates can be extracted.} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{lmList} and \code{lme}. \code{random.effects} is an alias for \code{ranef}; methods are implemented for the latter. } \value{ will depend on the method function used; see the appropriate documentation. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 100, 461. } \seealso{\code{\link{ranef.lmList}}, \code{\link{ranef.lme}}} \keyword{models} nlme/man/recalc.corStruct.Rd0000644000176000001440000000331014660073244015522 0ustar ripleyusers% File nlme/man/recalc.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{recalc.corStruct} \title{Recalculate for corStruct Object} \usage{ \method{recalc}{corStruct}(object, conLin, \dots) } \alias{recalc.corStruct} \alias{recalc.corAR1} \alias{recalc.corARMA} \alias{recalc.corCAR1} \alias{recalc.corCompSymm} %\alias{recalc.corHF} % not implemented \alias{recalc.corNatural} \alias{recalc.corSpatial} \alias{recalc.corSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"}, representing a correlation structure.} \item{conLin}{a condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying model.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function pre-multiples the \code{"Xy"} component of \code{conLin} by the transpose square-root factor(s) of the correlation matrix (matrices) associated with \code{object} and adds the log-likelihood contribution of \code{object}, given by \code{logLik(object)}, to the \code{"logLik"} component of \code{conLin}. } \value{ the recalculated condensed linear model object. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{This method function is only used inside model fitting functions, such as \code{lme} and \code{gls}, that allow correlated error terms.} \seealso{\code{\link{corFactor}}, \code{\link{logLik.corStruct}} } \keyword{models} nlme/man/nlme-deprecated.Rd0000644000176000001440000000235314630066234015337 0ustar ripleyusers% File nlme/man/nlme-deprecated.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlme-deprecated} \alias{nlme-deprecated} \title{Deprecated Functions in Package \pkg{nlme}} %% deprecation announced in 2018-08, with warning since 2023-01 \alias{nfGroupedData} \alias{nmGroupedData} %% deprecated 2023-01: \alias{corIdent} \usage{ ## internal functions wrapped by groupedData() nfGroupedData(formula, data, order.groups, FUN, outer, inner, labels, units) nmGroupedData(formula, data, order.groups, FUN, outer, inner, labels, units) ## trivial "identity" correlation, never usefully implemented: corIdent(form = NULL) } \description{ These functions are provided for compatibility with older versions of \pkg{nlme} only, and may be defunct as soon as the next release. } \examples{ assertDeprecation <- function(expr) tools::assertCondition(expr, "deprecatedWarning", verbose = TRUE) assertDeprecation( nlme::nfGroupedData(height ~ age | Subject, as.data.frame(Oxboys)) ) assertDeprecation( csId <- corIdent(~ 1 | Subject) ) assertDeprecation( csI. <- Initialize(csId, data = Orthodont) ) assertDeprecation( corMatrix(csI.) ) # actually errors } \keyword{internal} nlme/man/pdDiag.Rd0000644000176000001440000000640014251721456013476 0ustar ripleyusers% File nlme/man/pdDiag.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdDiag} \title{Diagonal Positive-Definite Matrix} \usage{ pdDiag(value, form, nam, data) } \alias{pdDiag} \arguments{ \item{value}{an optional initialization value, which can be any of the following: a \code{pdMat} object, a positive-definite matrix, a one-sided linear formula (with variables separated by \code{+}), a vector of character strings, or a numeric vector of length equal to the dimension of the underlying positive-definite matrix. Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional one-sided linear formula specifying the row/column names for the matrix represented by \code{object}. Because factors may be present in \code{form}, the formula needs to be evaluated on a data.frame to resolve the names it defines. This argument is ignored when \code{value} is a one-sided formula. Defaults to \code{NULL}.} \item{nam}{an optional vector of character strings specifying the row/column names for the matrix represented by object. It must have length equal to the dimension of the underlying positive-definite matrix and unreplicated elements. This argument is ignored when \code{value} is a vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} } \description{ This function is a constructor for the \code{pdDiag} class, representing a diagonal positive-definite matrix. If the matrix associated with \code{object} is of dimension \eqn{n}, it is represented by \eqn{n} unrestricted parameters, given by the logarithm of the square-root of the diagonal values. When \code{value} is \code{numeric(0)}, an uninitialized \code{pdMat} object, a one-sided formula, or a vector of character strings, \code{object} is returned as an uninitialized \code{pdDiag} object (with just some of its attributes and its class defined) and needs to have its coefficients assigned later, generally using the \code{coef} or \code{matrix} replacement functions. If \code{value} is an initialized \code{pdMat} object, \code{object} will be constructed from \code{as.matrix(value)}. Finally, if \code{value} is a numeric vector, it is assumed to represent the unrestricted coefficients of the underlying positive-definite matrix. } \value{ a \code{pdDiag} object representing a diagonal positive-definite matrix, also inheriting from class \code{pdMat}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{coef.pdMat}}, \code{\link{pdClasses}}, \code{\link{matrix<-.pdMat}}} \examples{ pd1 <- pdDiag(diag(1:3), nam = c("A","B","C")) pd1 } \keyword{models} nlme/man/anova.lme.Rd0000644000176000001440000001513414251721455014171 0ustar ripleyusers% File nlme/man/anova.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see ../LICENCE.note \name{anova.lme} \alias{anova.lme} \alias{print.anova.lme} \title{Compare Likelihoods of Fitted Objects} \usage{ \method{anova}{lme}(object, \dots, test, type, adjustSigma, Terms, L, verbose) \method{print}{anova.lme}(x, verbose, \dots) } \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{\dots}{other optional fitted model objects inheriting from classes \code{"gls"}, \code{"gnls"}, \code{"lm"}, \code{"lme"}, \code{"lmList"}, \code{"nlme"}, \code{"nlsList"}, or \code{"nls"}.} \item{test}{an optional logical value controlling whether likelihood ratio tests should be used to compare the fitted models represented by \code{object} and the objects in \code{\dots}. Defaults to \code{TRUE}.} \item{type}{an optional character string specifying the type of sum of squares to be used in F-tests for the terms in the model. If \code{"sequential"}, the sequential sum of squares obtained by including the terms in the order they appear in the model is used; else, if \code{"marginal"}, the marginal sum of squares obtained by deleting a term from the model at a time is used. This argument is only used when a single fitted object is passed to the function. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"sequential"}.} \item{adjustSigma}{an optional logical value. If \code{TRUE} and the estimation method used to obtain \code{object} was maximum likelihood, the residual standard error is multiplied by \eqn{\sqrt{n_{obs}/(n_{obs} - n_{par})}}{sqrt(nobs/(nobs - npar))}, converting it to a REML-like estimate. This argument is only used when a single fitted object is passed to the function. Default is \code{TRUE}.} \item{Terms}{an optional integer or character vector specifying which terms in the model should be jointly tested to be zero using a Wald F-test. If given as a character vector, its elements must correspond to term names; else, if given as an integer vector, its elements must correspond to the order in which terms are included in the model. This argument is only used when a single fitted object is passed to the function. Default is \code{NULL}.} \item{L}{an 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 rows define the linear combinations to be tested. If names are assigned to the vector elements (array columns), they must correspond to coefficients names and will be used to map the linear combination(s) to the coefficients; else, if no names are available, the vector elements (array columns) are assumed in the same order as the coefficients appear in the model. This argument is only used when a single fitted object is passed to the function. Default is \code{NULL}.} \item{x}{an object inheriting from class \code{"anova.lme"}} \item{verbose}{an optional logical value. If \code{TRUE}, the calling sequences for each fitted model object are printed with the rest of the output, being omitted if \code{verbose = FALSE}. Defaults to \code{FALSE}.} } \description{ When only one fitted model object is present, a data frame with the numerator degrees of freedom, denominator degrees of freedom, F-values, and P-values for Wald tests for the terms in the model (when \code{Terms} and \code{L} are \code{NULL}), a combination of model terms (when \code{Terms} in not \code{NULL}), or linear combinations of the model coefficients (when \code{L} is not \code{NULL}). Otherwise, when multiple fitted objects are being compared, 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 \code{test=TRUE}, whenever two consecutive objects have different number of degrees of freedom, a likelihood ratio statistic with the associated p-value is included in the returned data frame. } \value{ a data frame inheriting from class \code{"anova.lme"}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ Likelihood comparisons are not meaningful for objects fit using restricted maximum likelihood and with different fixed effects. } \seealso{\code{\link{gls}}, \code{\link{gnls}}, \code{\link{nlme}}, \code{\link{lme}}, \code{\link{AIC}}, \code{\link{BIC}}, \code{\link{print.anova.lme}}, \code{\link{logLik.lme}}, } \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) anova(fm1) fm2 <- update(fm1, random = pdDiag(~age)) anova(fm1, fm2) ## Pinheiro and Bates, pp. 251-254 ------------------------------------------ fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont, correlation = corSymm(form = ~ 1 | Subject), weights = varIdent(form = ~ 1 | age)) fm2Orth.gls <- update(fm1Orth.gls, corr = corCompSymm(form = ~ 1 | Subject)) ## anova.gls examples: anova(fm1Orth.gls, fm2Orth.gls) fm3Orth.gls <- update(fm2Orth.gls, weights = NULL) anova(fm2Orth.gls, fm3Orth.gls) fm4Orth.gls <- update(fm3Orth.gls, weights = varIdent(form = ~ 1 | Sex)) anova(fm3Orth.gls, fm4Orth.gls) # not in book but needed for the following command fm3Orth.lme <- lme(distance ~ Sex*I(age-11), data = Orthodont, random = ~ I(age-11) | Subject, weights = varIdent(form = ~ 1 | Sex)) # Compare an "lme" object with a "gls" object (test would be non-sensical!) anova(fm3Orth.lme, fm4Orth.gls, test = FALSE) ## Pinheiro and Bates, pp. 222-225 ------------------------------------------ op <- options(contrasts = c("contr.treatment", "contr.poly")) fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight, random = ~ Time) fm2BW.lme <- update(fm1BW.lme, weights = varPower()) # Test a specific contrast anova(fm2BW.lme, L = c("Time:Diet2" = 1, "Time:Diet3" = -1)) ## Pinheiro and Bates, pp. 352-365 ------------------------------------------ fm1Theo.lis <- nlsList( conc ~ SSfol(Dose, Time, lKe, lKa, lCl), data=Theoph) fm1Theo.lis fm1Theo.nlme <- nlme(fm1Theo.lis) fm2Theo.nlme <- update(fm1Theo.nlme, random= pdDiag(lKe+lKa+lCl~1) ) fm3Theo.nlme <- update(fm2Theo.nlme, random= pdDiag( lKa+lCl~1) ) # Comparing the 3 nlme models anova(fm1Theo.nlme, fm3Theo.nlme, fm2Theo.nlme) options(op) # (set back to previous state) } \keyword{models} nlme/man/Pixel.Rd0000644000176000001440000000226214251721455013370 0ustar ripleyusers% File nlme/man/Pixel.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Pixel} \alias{Pixel} \title{X-ray pixel intensities over time} \description{ The \code{Pixel} data frame has 102 rows and 4 columns of data on the pixel intensities of CT scans of dogs over time } \format{ This data frame contains the following columns: \describe{ \item{Dog}{ a factor with levels \code{1} to \code{10} designating the dog on which the scan was made } \item{Side}{ a factor with levels \code{L} and \code{R} designating the side of the dog being scanned } \item{day}{ a numeric vector giving the day post injection of the contrast on which the scan was made } \item{pixel}{ a numeric vector of pixel intensities } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000) \emph{Mixed-effects Models in S and S-PLUS}, Springer. } \examples{ fm1 <- lme(pixel ~ day + I(day^2), data = Pixel, random = list(Dog = ~ day, Side = ~ 1)) summary(fm1) VarCorr(fm1) } \keyword{datasets} nlme/man/ACF.gls.Rd0000644000176000001440000000664314251721456013474 0ustar ripleyusers% File nlme/man/ACF.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{ACF.gls} \title{Autocorrelation Function for gls Residuals} \usage{ \method{ACF}{gls}(object, maxLag, resType, form, na.action, \dots) } \alias{ACF.gls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted model.} \item{maxLag}{an optional integer giving the maximum lag for which the autocorrelation should be calculated. Defaults to maximum lag in the residuals.} \item{resType}{an optional character string specifying the type of residuals to be used. If \code{"response"}, the "raw" residuals (observed - fitted) are used; else, if \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"pearson"}.} \item{form}{an optional one sided formula of the form \code{~ t}, or \code{~ t | g}, specifying a time covariate \code{t} and, optionally, a grouping factor \code{g}. The time covariate must be integer valued. When a grouping factor is present in \code{form}, the autocorrelations are calculated using residual pairs within the same group. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{ACF.gls} to print an error message and terminate if there are any incomplete observations.} \item{\dots}{some methods for this generic require additional arguments.} } \description{ This method function calculates the empirical autocorrelation function for the residuals from a \code{gls} fit. If a grouping variable is specified in \code{form}, the autocorrelation values are calculated using pairs of residuals within the same group; otherwise all possible residual pairs are used. The autocorrelation function is useful for investigating serial correlation models for equally spaced data. } \value{ a data frame with columns \code{lag} and \code{ACF} representing, respectively, the lag between residuals within a pair and the corresponding empirical autocorrelation. The returned value inherits from class \code{ACF}. } \references{ Box, 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. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{ACF.lme}}, \code{\link{plot.ACF}}} \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary) ACF(fm1, form = ~ 1 | Mare) # Pinheiro and Bates, p. 255-257 fm1Dial.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) } \keyword{models} nlme/man/isBalanced.Rd0000644000176000001440000000436114251721456014337 0ustar ripleyusers% File nlme/man/isBalanced.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{isBalanced} \alias{isBalanced} \alias{isBalanced.groupedData} %- Also NEED an `\alias' for EACH other topic documented here. \title{Check a Design for Balance} \usage{ isBalanced(object, countOnly, level) } \arguments{ \item{object}{A \code{groupedData} object containing a data frame and a formula that describes the roles of variables in the data frame. The object will have one or more nested grouping factors and a primary covariate.} \item{countOnly}{A logical value indicating if the check for balance should only consider the number of observations at each level of the grouping factor(s). Defaults to \code{FALSE}.} \item{level}{an optional integer vector specifying the desired prediction levels. Levels increase from outermost to innermost grouping, with level 0 representing the population (fixed effects) predictions. Defaults to the innermost level.} } \description{ Check the design of the experiment or study for balance. } \details{ A design is balanced with respect to the grouping factor(s) if there are the same number of observations at each distinct value of the grouping factor or each combination of distinct levels of the nested grouping factors. If \code{countOnly} is \code{FALSE} the design is also checked for balance with respect to the primary covariate, which is often the time of the observation. A design is balanced with respect to the grouping factor and the covariate if the number of observations at each distinct level (or combination of levels for nested factors) is constant and the times at which the observations are taken (in general, the values of the primary covariates) also are constant. } \value{ \code{TRUE} or \code{FALSE} according to whether the data are balanced or not } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{table}}, \code{\link{groupedData}}} \examples{ isBalanced(Orthodont) # should return TRUE isBalanced(Orthodont, countOnly = TRUE) # should return TRUE isBalanced(Pixel) # should return FALSE isBalanced(Pixel, level = 1) # should return FALSE } \keyword{data} nlme/man/coef.gnls.Rd0000644000176000001440000000170314251721455014164 0ustar ripleyusers% File nlme/man/coef.gnls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.gnls} \title{Extract gnls Coefficients} \usage{ \method{coef}{gnls}(object, \dots) } \alias{coef.gnls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gnls}"}, representing a generalized nonlinear least squares fitted model.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The estimated coefficients for the nonlinear model represented by \code{object} are extracted. } \value{ a vector with the estimated coefficients for the nonlinear model represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gnls}}} \examples{ fm1 <- gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean, weights = varPower()) coef(fm1) } \keyword{models} nlme/man/gapply.Rd0000644000176000001440000000445214251721455013606 0ustar ripleyusers% File nlme/man/gapply.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gapply} \title{Apply a Function by Groups} \usage{ gapply(object, which, FUN, form, level, groups, \dots) } \alias{gapply} \arguments{ \item{object}{an object to which the function will be applied - usually a \code{groupedData} object or a \code{data.frame}. Must inherit from class \code{"data.frame"}. } \item{which}{an optional character or positive integer vector specifying which columns of \code{object} should be used with \code{FUN}. Defaults to all columns in \code{object}. } \item{FUN}{function to apply to the distinct sets of rows of the data frame \code{object} defined by the values of \code{groups}. } \item{form}{an optional one-sided formula that defines the groups. When this formula is given the right-hand side is evaluated in \code{object}, converted to a factor if necessary, and the unique levels are used to define the groups. Defaults to \code{formula(object)}. } \item{level}{an optional positive integer giving the level of grouping to be used in an object with multiple nested grouping levels. Defaults to the highest or innermost level of grouping. } \item{groups}{an optional factor that will be used to split the rows into groups. Defaults to \code{getGroups(object, form, level)}. } \item{\dots}{optional additional arguments to the summary function \code{FUN}. Often it is helpful to specify \code{na.rm = TRUE}. } } \description{ Applies the function to the distinct sets of rows of the data frame defined by \code{groups}. } \value{ Returns a data frame with as many rows as there are levels in the \code{groups} argument. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. sec. 3.4. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gsummary}}} \examples{ ## Find number of non-missing "conc" observations for each Subject gapply( Phenobarb, FUN = function(x) sum(!is.na(x$conc)) ) # Pinheiro and Bates, p. 127 table( gapply(Quinidine, "conc", function(x) sum(!is.na(x))) ) changeRecords <- gapply( Quinidine, FUN = function(frm) any(is.na(frm[["conc"]]) & is.na(frm[["dose"]])) ) } \keyword{data} nlme/man/balancedGrouped.Rd0000644000176000001440000000442414251721455015370 0ustar ripleyusers% File nlme/man/balancedGrouped.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{balancedGrouped} \alias{balancedGrouped} \title{Create a groupedData object from a matrix} \usage{ balancedGrouped(form, data, labels=NULL, units=NULL) } \arguments{ \item{form}{A formula of the form \code{y ~ x | g} giving the name of the response, the primary covariate, and the grouping factor.} \item{data}{A matrix or data frame containing the values of the response grouped according to the levels of the grouping factor (rows) and the distinct levels of the primary covariate (columns). The \code{dimnames} of the matrix are used to construct the levels of the grouping factor and the primary covariate.} \item{labels}{an optional list of character strings giving labels for the response and the primary covariate. The label for the primary covariate is named \code{x} and that for the response is named \code{y}. Either label can be omitted.} \item{units}{an optional list of character strings giving the units for the response and the primary covariate. The units string for the primary covariate is named \code{x} and that for the response is named \code{y}. Either units string can be omitted.} } \description{ Create a \code{groupedData} object from a data matrix. This function can be used only with balanced data. The opposite conversion, from a \code{groupedData} object to a \code{matrix}, is done with \code{asTable}. } \value{ A balanced \code{groupedData} object. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{groupedData}}, \code{\link{isBalanced}}, \code{\link{asTable}}} \examples{ OrthoMat <- asTable( Orthodont ) Orth2 <- balancedGrouped(distance ~ age | Subject, data = OrthoMat, labels = list(x = "Age", y = "Distance from pituitary to pterygomaxillary fissure"), units = list(x = "(yr)", y = "(mm)")) Orth2[ 1:10, ] ## check the first few entries # Pinheiro and Bates, p. 109 ergoStool.mat <- asTable(ergoStool) balancedGrouped(effort~Type|Subject, data=ergoStool.mat) } \keyword{data} nlme/man/Machines.Rd0000644000176000001440000000246714251721455014045 0ustar ripleyusers% File nlme/man/Machines.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Machines} \alias{Machines} \title{Productivity Scores for Machines and Workers} \description{ The \code{Machines} data frame has 54 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{Worker}{ an ordered factor giving the unique identifier for the worker. } \item{Machine}{ a factor with levels \code{A}, \code{B}, and \code{C} identifying the machine brand. } \item{score}{ a productivity score. } } } \details{ Data on an experiment to compare three brands of machines used in an industrial process are presented in Milliken and Johnson (p. 285, 1992). Six workers were chosen randomly among the employees of a factory to operate each machine three times. The response is an overall productivity score taking into account the number and quality of components produced.} \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.14) Milliken, G. A. and Johnson, D. E. (1992), \emph{Analysis of Messy Data, Volume I: Designed Experiments}, Chapman and Hall, London. } %\examples{} \keyword{datasets} nlme/man/pdClasses.Rd0000644000176000001440000000354314737242620014234 0ustar ripleyusers% File nlme/man/pdClasses.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdClasses} \title{Positive-Definite Matrix Classes} \alias{pdClasses} \description{ Standard classes of positive-definite matrices (\code{pdMat}) available in the \pkg{nlme} package. } \value{ Available standard classes: \item{pdSymm}{general positive-definite matrix, with no additional structure} \item{pdLogChol}{general positive-definite matrix, with no additional structure, using a log-Cholesky parameterization} \item{pdDiag}{diagonal} \item{pdIdent}{multiple of an identity} \item{pdCompSymm}{compound symmetry structure (constant diagonal and constant off-diagonal elements)} \item{pdBlocked}{block-diagonal matrix, with diagonal blocks of any "atomic" \code{pdMat} class} \item{pdNatural}{general positive-definite matrix in natural parametrization (i.e. parametrized in terms of standard deviations and correlations). The underlying coefficients are not unrestricted, so this class should NOT be used for optimization.} } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ Users may define their own \code{pdMat} classes by specifying a constructor function and, at a minimum, methods for the functions \code{\link{pdConstruct}}, \code{\link{pdMatrix}}, and \code{\link{coef}}. For examples of these functions, see the methods for classes \code{pdSymm} and \code{pdDiag}. } \seealso{ \code{\link{pdBlocked}}, \code{\link{pdCompSymm}}, \code{\link{pdDiag}}, \code{\link{pdFactor}}, \code{\link{pdIdent}}, \code{\link{pdMat}}, \code{\link{pdMatrix}}, \code{\link{pdNatural}}, \code{\link{pdSymm}}, \code{\link{pdLogChol}} } \keyword{models} nlme/man/fitted.nlmeStruct.Rd0000644000176000001440000000465214251721455015732 0ustar ripleyusers% File nlme/man/fitted.nlmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fitted.nlmeStruct} \title{Calculate nlmeStruct Fitted Values} \usage{ \method{fitted}{nlmeStruct}(object, level, conLin, \dots) } \alias{fitted.nlmeStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{nlmeStruct}"}, representing a list of mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects, plus attributes specifying the underlying nonlinear model and the response variable.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in extracting the fitted values from \code{object}. Level values increase from outermost to innermost grouping, with level zero corresponding to the population fitted values. Defaults to the highest or innermost level of grouping.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying nlme model. Defaults to \code{attr(object, "conLin")}.} \item{\dots}{additional arguments that could be given to this method. None are used.} } \description{ The fitted values at level \eqn{i} are obtained by adding together the contributions from the estimated fixed effects and the estimated random effects at levels less or equal to \eqn{i} and evaluating the model function at the resulting estimated parameters. The resulting values estimate the predictions at level \eqn{i}. } \value{ if a single level of grouping is specified in \code{level}, the returned value is a vector with the fitted values at the desired level; else, when multiple grouping levels are specified in \code{level}, the returned object is a matrix with columns given by the fitted values at different levels. } \references{ Bates, D.M. and Pinheiro, J.C. (1998) "Computational methods for multilevel models" available in PostScript or PDF formats at http://nlme.stat.wisc.edu/pub/NLME/ } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is generally only used inside \code{nlme} and \code{fitted.nlme}. } \seealso{\code{\link{nlme}}, \code{\link{residuals.nlmeStruct}}} \keyword{models} nlme/man/asTable.Rd0000644000176000001440000000255514627671725013702 0ustar ripleyusers% File nlme/man/asTable.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{asTable} \alias{asTable} \alias{asTable.groupedData} \title{Convert groupedData to a matrix} \usage{ asTable(object) } \arguments{ \item{object}{A balanced \code{groupedData} object} } \description{ Create a tabular representation of the response in a balanced \code{groupedData} object. } \details{ A balanced \code{groupedData} object can be represented as a matrix or table of response values corresponding to the values of a primary covariate for each level of a grouping factor. This function creates such a matrix representation of the data in \code{object}. } \value{ A matrix. The data in the matrix are the values of the response. The columns correspond to the distinct values of the primary covariate and are labelled as such. The rows correspond to the distinct levels of the grouping factor and are labelled as such. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{groupedData}}, \code{\link{isBalanced}}, \code{\link{balancedGrouped}}} \examples{ asTable(Orthodont) # Pinheiro and Bates, p. 109 ergoStool.mat <- asTable(ergoStool) } \keyword{manip} nlme/man/varExp.Rd0000644000176000001440000000703114251721455013553 0ustar ripleyusers% File nlme/man/varExp.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varExp} \title{Exponential Variance Function} \usage{ varExp(value, form, fixed) } \alias{varExp} \arguments{ \item{value}{an optional numeric vector, or list of numeric values, with the variance function coefficients. \code{Value} must have length one, unless a grouping factor is specified in \code{form}. If \code{value} has length greater than one, it must have names which identify its elements to the levels of the grouping factor defined in \code{form}. If a grouping factor is present in \code{form} and \code{value} has length one, its value will be assigned to all grouping levels. Default is \code{numeric(0)}, which results in a vector of zeros of appropriate length being assigned to the coefficients when \code{object} is initialized (corresponding to constant variance equal to one).} \item{form}{an optional one-sided formula of the form \code{~ v}, or \code{~ v | g}, specifying a variance covariate \code{v} and, optionally, a grouping factor \code{g} for the coefficients. The variance covariate must evaluate to a numeric vector and may involve expressions using \code{"."}, representing a fitted model object from which fitted values (\code{fitted(.)}) and residuals (\code{resid(.)}) can be extracted (this allows the variance covariate to be updated during the optimization of an object function). When a grouping factor is present in \code{form}, a different coefficient value is used for each of its levels. Several grouping variables may be simultaneously specified, separated by the \code{*} operator, like in \code{~ v | g1 * g2 * g3}. In this case, the levels of each grouping variable are pasted together and the resulting factor is used to group the observations. Defaults to \code{~ fitted(.)} representing a variance covariate given by the fitted values of a fitted model object and no grouping factor. } \item{fixed}{an optional numeric vector, or list of numeric values, specifying the values at which some or all of the coefficients in the variance function should be fixed. If a grouping factor is specified in \code{form}, \code{fixed} must have names identifying which coefficients are to be fixed. Coefficients included in \code{fixed} are not allowed to vary during the optimization of an objective function. Defaults to \code{NULL}, corresponding to no fixed coefficients.} } \description{ This function is a constructor for the \code{varExp} class, representing an exponential variance function structure. Letting \eqn{v} denote the variance covariate and \eqn{\sigma^2(v)}{s2(v)} denote the variance function evaluated at \eqn{v}, the exponential variance function is defined as \eqn{\sigma^2(v) = \exp(2\theta v)}{s2(v) = exp(2* t * v)}, where \eqn{\theta}{t} is the variance function coefficient. When a grouping factor is present, a different \eqn{\theta}{t} is used for each factor level. } \value{ a \code{varExp} object representing an exponential variance function structure, also inheriting from class \code{varFunc}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{varClasses}}, \code{\link{varWeights.varFunc}}, \code{\link{coef.varExp}}} \examples{ vf1 <- varExp(0.2, form = ~age|Sex) } \keyword{models} nlme/man/Variogram.corGaus.Rd0000644000176000001440000000372314251721455015643 0ustar ripleyusers% File nlme/man/Variogram.corGaus.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.corGaus} \title{Calculate Semi-variogram for a corGaus Object} \usage{ \method{Variogram}{corGaus}(object, distance, sig2, length.out, \dots) } \alias{Variogram.corGaus} \arguments{ \item{object}{an object inheriting from class \code{"\link{corGaus}"}, representing an Gaussian spatial correlation structure.} \item{distance}{an optional numeric vector with the distances at which the semi-variogram is to be calculated. Defaults to \code{NULL}, in which case a sequence of length \code{length.out} between the minimum and maximum values of \code{getCovariate(object)} is used.} \item{sig2}{an optional numeric value representing the process variance. Defaults to \code{1}.} \item{length.out}{an optional integer specifying the length of the sequence of distances to be used for calculating the semi-variogram, when \code{distance = NULL}. Defaults to \code{50}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram values corresponding to the Gaussian correlation model, using the estimated coefficients corresponding to \code{object}, at the distances defined by \code{distance}. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corGaus}}, \code{\link{plot.Variogram}}, \code{\link{Variogram}} } \examples{ cs1 <- corGaus(3, form = ~ Time | Rat) cs1 <- Initialize(cs1, BodyWeight) Variogram(cs1)[1:10,] } \keyword{models} nlme/man/residuals.lme.Rd0000644000176000001440000000615014251721455015056 0ustar ripleyusers% File nlme/man/residuals.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{residuals.lme} \title{Extract lme Residuals} \usage{ \method{residuals}{lme}(object, level = Q, type = c("response", "pearson", "normalized"), asList = FALSE, \dots) } \alias{residuals.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in extracting the residuals from \code{object}. Level values increase from outermost to innermost grouping, with level zero corresponding to the population residuals. Defaults to the highest or innermost level of grouping.} \item{type}{an optional character string specifying the type of residuals to be used. If \code{"response"}, as by default, the \dQuote{raw} residuals (observed - fitted) are used; else, if \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided.} \item{asList}{an optional logical value. If \code{TRUE} and a single value is given in \code{level}, the returned object is a list with the residuals split by groups; else the returned value is either a vector or a data frame, according to the length of \code{level}. Defaults to \code{FALSE}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The residuals at level \eqn{i} are obtained by subtracting the fitted levels at that level from the response vector (and dividing by the estimated within-group standard error, if \code{type="pearson"}). The fitted values at level \eqn{i} are obtained by adding together the population fitted values (based only on the fixed effects estimates) and the estimated contributions of the random effects to the fitted values at grouping levels less or equal to \eqn{i}. } \value{ if a single level of grouping is specified in \code{level}, the returned value is either a list with the residuals split by groups (\code{asList = TRUE}) or a vector with the residuals (\code{asList = FALSE}); else, when multiple grouping levels are specified in \code{level}, the returned object is a data frame with columns given by the residuals at different levels and the grouping factors. For a vector or data frame result the \code{\link{naresid}} method is applied. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{fitted.lme}} } \examples{ fm1 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) head(residuals(fm1, level = 0:1)) summary(residuals(fm1) / residuals(fm1, type = "p")) # constant scaling factor 1.432 } \keyword{models} nlme/man/isInitialized.Rd0000644000176000001440000000144214251721456015110 0ustar ripleyusers% File nlme/man/isInitialized.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{isInitialized} \title{Check if Object is Initialized} \usage{ isInitialized(object) } \alias{isInitialized} \alias{isInitialized.pdMat} \alias{isInitialized.pdBlocked} \arguments{ \item{object}{any object requiring initialization.} } \description{ Checks if \code{object} has been initialized (generally through a call to \code{Initialize}), by searching for components and attributes which are modified during initialization. } \value{ a logical value indicating whether \code{object} has been initialized. } \author{José Pinheiro and Douglas Bates } \seealso{\code{\link{Initialize}}} \examples{ pd1 <- pdDiag(~age) isInitialized(pd1) } \keyword{models} nlme/man/predict.gls.Rd0000644000176000001440000000275014251721455014527 0ustar ripleyusers% File nlme/man/predict.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{predict.gls} \title{Predictions from a gls Object} \usage{ \method{predict}{gls}(object, newdata, na.action, \dots) } \alias{predict.gls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted linear model.} \item{newdata}{an optional data frame to be used for obtaining the predictions. All variables used in the linear model must be present in the data frame. If missing, the fitted values are returned.} \item{na.action}{a function that indicates what should happen when \code{newdata} contains \code{NA}s. The default action (\code{na.fail}) causes the function to print an error message and terminate if there are any incomplete observations.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The predictions for the linear model represented by \code{object} are obtained at the covariate values defined in \code{newdata}. } \value{ a vector with the predicted values. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}} \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) newOvary <- data.frame(Time = c(-0.75, -0.5, 0, 0.5, 0.75)) predict(fm1, newOvary) } \keyword{models} nlme/man/anova.gls.Rd0000644000176000001440000001433114251721456014200 0ustar ripleyusers% File nlme/man/anova.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see ../LICENCE.note \name{anova.gls} \title{Compare Likelihoods of Fitted Objects} \usage{ \method{anova}{gls}(object, \dots, test, type, adjustSigma, Terms, L, verbose) } \alias{anova.gls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fit.} \item{\dots}{other optional fitted model objects inheriting from classes \code{"gls"}, \code{"gnls"}, \code{"lm"}, \code{"lme"}, \code{"lmList"}, \code{"nlme"}, \code{"nlsList"}, or \code{"nls"}.} \item{test}{an optional logical value controlling whether likelihood ratio tests should be used to compare the fitted models represented by \code{object} and the objects in \code{\dots}. Defaults to \code{TRUE}.} \item{type}{an optional character string specifying the type of sum of squares to be used in F-tests for the terms in the model. If \code{"sequential"}, the sequential sum of squares obtained by including the terms in the order they appear in the model is used; else, if \code{"marginal"}, the marginal sum of squares obtained by deleting a term from the model at a time is used. This argument is only used when a single fitted object is passed to the function. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"sequential"}.} \item{adjustSigma}{an optional logical value. If \code{TRUE} and the estimation method used to obtain \code{object} was maximum likelihood, the residual standard error is multiplied by \eqn{\sqrt{n_{obs}/(n_{obs} - n_{par})}}{sqrt(nobs/(nobs - npar))}, converting it to a REML-like estimate. This argument is only used when a single fitted object is passed to the function. Default is \code{TRUE}.} \item{Terms}{an optional integer or character vector specifying which terms in the model should be jointly tested to be zero using a Wald F-test. If given as a character vector, its elements must correspond to term names; else, if given as an integer vector, its elements must correspond to the order in which terms are included in the model. This argument is only used when a single fitted object is passed to the function. Default is \code{NULL}.} \item{L}{an 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 rows define the linear combinations to be tested. If names are assigned to the vector elements (array columns), they must correspond to coefficients names and will be used to map the linear combination(s) to the coefficients; else, if no names are available, the vector elements (array columns) are assumed in the same order as the coefficients appear in the model. This argument is only used when a single fitted object is passed to the function. Default is \code{NULL}.} \item{verbose}{an optional logical value. If \code{TRUE}, the calling sequences for each fitted model object are printed with the rest of the output, being omitted if \code{verbose = FALSE}. Defaults to \code{FALSE}.} } \description{ When only one fitted model object is present, a data frame with the numerator degrees of freedom, F-values, and P-values for Wald tests for the terms in the model (when \code{Terms} and \code{L} are \code{NULL}), a combination of model terms (when \code{Terms} in not \code{NULL}), or linear combinations of the model coefficients (when \code{L} is not \code{NULL}). Otherwise, when multiple fitted objects are being compared, 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 \code{test=TRUE}, whenever two consecutive objects have different number of degrees of freedom, a likelihood ratio statistic with the associated p-value is included in the returned data frame. } \value{ a data frame inheriting from class \code{"anova.lme"}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ Likelihood comparisons are not meaningful for objects fit using restricted maximum likelihood and with different fixed effects. } \seealso{\code{\link{gls}}, \code{\link{gnls}}, \code{\link{nlme}}, \code{\link{lme}}, \code{\link{logLik.gls}}, \code{\link{AIC}}, \code{\link{BIC}}, \code{\link{print.anova.lme}} } \examples{ # AR(1) errors within each Mare fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) anova(fm1) # variance changes with a power of the absolute fitted values? fm2 <- update(fm1, weights = varPower()) anova(fm1, fm2) # Pinheiro and Bates, p. 251-252 fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont, correlation = corSymm(form = ~ 1 | Subject), weights = varIdent(form = ~ 1 | age)) fm2Orth.gls <- update(fm1Orth.gls, corr = corCompSymm(form = ~ 1 | Subject)) anova(fm1Orth.gls, fm2Orth.gls) # Pinheiro and Bates, pp. 215-215, 255-260 #p. 215 fm1Dial.lme <- lme(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, Dialyzer, ~ pressure + I(pressure^2)) # p. 216 fm2Dial.lme <- update(fm1Dial.lme, weights = varPower(form = ~ pressure)) # p. 255 fm1Dial.gls <- gls(rate ~ (pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, Dialyzer) fm2Dial.gls <- update(fm1Dial.gls, weights = varPower(form = ~ pressure)) anova(fm1Dial.gls, fm2Dial.gls) fm3Dial.gls <- update(fm2Dial.gls, corr = corAR1(0.771, form = ~ 1 | Subject)) anova(fm2Dial.gls, fm3Dial.gls) # anova.gls to compare a gls and an lme fit anova(fm3Dial.gls, fm2Dial.lme, test = FALSE) # Pinheiro and Bates, pp. 261-266 fm1Wheat2 <- gls(yield ~ variety - 1, Wheat2) fm3Wheat2 <- update(fm1Wheat2, corr = corRatio(c(12.5, 0.2), form = ~ latitude + longitude, nugget = TRUE)) # Test a specific contrast anova(fm3Wheat2, L = c(-1, 0, 1)) } \keyword{models} nlme/man/nlme.Rd0000644000176000001440000002134214363200201013223 0ustar ripleyusers% File nlme/man/nlme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlme} \title{Nonlinear Mixed-Effects Models} \usage{ nlme(model, data, fixed, random, groups, start, correlation, weights, subset, method, na.action, naPattern, control, verbose) \method{nlme}{formula}(model, data, fixed, random, groups, start, correlation, weights, subset, method, na.action, naPattern, control, verbose) } \alias{nlme} \alias{nlme.formula} \arguments{ \item{model}{a nonlinear model formula, with the response on the left of a \code{~} operator and an expression involving parameters and covariates on the right, or an \code{nlsList} object. If \code{data} is given, all names used in the formula should be defined as parameters or variables in the data frame. The method function \code{\link{nlme.nlsList}} is documented separately.} \item{data}{an optional data frame containing the variables named in \code{model}, \code{fixed}, \code{random}, \code{correlation}, \code{weights}, \code{subset}, and \code{naPattern}. By default the variables are taken from the environment from which \code{nlme} is called.} \item{fixed}{a two-sided linear formula of the form \code{f1+...+fn~x1+...+xm}, or a list of two-sided formulas of the form \code{f1~x1+...+xm}, with possibly different models for different parameters. The \code{f1,...,fn} are the names of parameters included on the right hand side of \code{model} and the \code{x1+...+xm} expressions define linear models for these parameters (when the left hand side of the formula contains several parameters, they all are assumed to follow the same linear model, described by the right hand side expression). A \code{1} on the right hand side of the formula(s) indicates a single fixed effects for the corresponding parameter(s).} \item{random}{optionally, any of the following: (i) a two-sided formula of the form \code{r1+...+rn~x1+...+xm | g1/.../gQ}, with \code{r1,...,rn} naming parameters included on the right hand side of \code{model}, \code{x1+...+xm} specifying the random-effects model for these parameters and \code{g1/.../gQ} the grouping structure (\code{Q} may be equal to 1, in which case no \code{/} is required). The random effects formula will be repeated for all levels of grouping, in the case of multiple levels of grouping; (ii) a two-sided formula of the form \code{r1+...+rn~x1+..+xm}, a list of two-sided formulas of the form \code{r1~x1+...+xm}, with possibly different random-effects models for different parameters, a \code{pdMat} object with a two-sided formula, or list of two-sided formulas (i.e. a non-\code{NULL} value for \code{formula(random)}), or a list of pdMat objects with two-sided formulas, or lists of two-sided formulas. In this case, the grouping structure formula will be given in \code{groups}, or derived from the data used to fit the nonlinear mixed-effects model, which should inherit from class \code{groupedData},; (iii) a named list of formulas, lists of formulas, or \code{pdMat} objects as in (ii), with the grouping factors as names. The order of nesting will be assumed the same as the order of the order of the elements in the list; (iv) an \code{reStruct} object. See the documentation on \code{\link{pdClasses}} for a description of the available \code{pdMat} classes. Defaults to \code{fixed}, resulting in all fixed effects having also random effects.} \item{groups}{an optional one-sided formula of the form \code{~g1} (single level of nesting) or \code{~g1/.../gQ} (multiple levels of nesting), specifying the partitions of the data over which the random effects vary. \code{g1,...,gQ} must evaluate to factors in \code{data}. The order of nesting, when multiple levels are present, is taken from left to right (i.e. \code{g1} is the first level, \code{g2} the second, etc.).} \item{start}{an optional numeric vector, or list of initial estimates for the fixed effects and random effects. If declared as a numeric vector, it is converted internally to a list with a single component \code{fixed}, given by the vector. The \code{fixed} component is required, unless the model function inherits from class \code{selfStart}, in which case initial values will be derived from a call to \code{nlsList}. An optional \code{random} component is used to specify initial values for the random effects and should consist of a matrix, or a list of matrices with length equal to the number of grouping levels. Each matrix should have as many rows as the number of groups at the corresponding level and as many columns as the number of random effects in that level.} \item{correlation}{an optional \code{corStruct} object describing the within-group correlation structure. See the documentation of \code{\link{corClasses}} for a description of the available \code{corStruct} classes. Defaults to \code{NULL}, corresponding to no within-group correlations.} \item{weights}{an optional \code{varFunc} object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to \code{varFixed}, corresponding to fixed variance weights. See the documentation on \code{\link{varClasses}} for a description of the available \code{varFunc} classes. Defaults to \code{NULL}, corresponding to homoscedastic within-group errors.} \item{subset}{an optional expression indicating the subset of the rows of \code{data} that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{method}{a character string. If \code{"REML"} the model is fit by maximizing the restricted log-likelihood. If \code{"ML"} the log-likelihood is maximized. Defaults to \code{"ML"}.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{nlme} to print an error message and terminate if there are any incomplete observations.} \item{naPattern}{an expression or formula object, specifying which returned values are to be regarded as missing.} \item{control}{a list of control values for the estimation algorithm to replace the default values returned by the function \code{nlmeControl}. Defaults to an empty list.} \item{verbose}{an optional logical value. If \code{TRUE} information on the evolution of the iterative algorithm is printed. Default is \code{FALSE}.} } \description{ This generic function fits a nonlinear mixed-effects model in the formulation described in Lindstrom and Bates (1990) but allowing for nested random effects. The within-group errors are allowed to be correlated and/or have unequal variances. } \value{ an object of class \code{nlme} representing the nonlinear mixed-effects model fit. Generic functions such as \code{print}, \code{plot} and \code{summary} have methods to show the results of the fit. See \code{nlmeObject} for the components of the fit. The functions \code{resid}, \code{coef}, \code{fitted}, \code{fixed.effects}, and \code{random.effects} can be used to extract some of its components. } \note{ The function does not do any scaling internally: the optimization will work best when the response is scaled so its variance is of the order of one. } \references{ The model formulation and computational methods are described in Lindstrom, M.J. and Bates, D.M. (1990). The variance-covariance parametrizations are described in Pinheiro and Bates (1996). Lindstrom, M.J. and Bates, D.M. (1990) "Nonlinear Mixed Effects Models for Repeated Measures Data", Biometrics, 46, 673-687. Pinheiro, J.C. and Bates., D.M. (1996) "Unconstrained Parametrizations for Variance-Covariance Matrices", Statistics and Computing, 6, 289-296. For the different correlation structures, variance functions and links, see \sQuote{References} in \code{\link{lme}}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{nlmeControl}}, \code{\link{nlme.nlsList}}, \code{\link{nlmeObject}}, \code{\link{nlsList}}, \code{\link{nlmeStruct}}, \code{\link{pdClasses}}, \code{\link{reStruct}}, \code{\link{varFunc}}, \code{\link{corClasses}}, \code{\link{varClasses}} } \examples{ fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc), data = Loblolly, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1, start = c(Asym = 103, R0 = -8.5, lrc = -3.3)) summary(fm1) fm2 <- update(fm1, random = pdDiag(Asym + lrc ~ 1)) summary(fm2) } \keyword{models} nlme/man/recalc.varFunc.Rd0000644000176000001440000000310614251721455015141 0ustar ripleyusers% File nlme/man/recalc.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{recalc.varFunc} \title{Recalculate for varFunc Object} \usage{ \method{recalc}{varFunc}(object, conLin, \dots) } \alias{recalc.varFunc} \alias{recalc.varIdent} \arguments{ \item{object}{an object inheriting from class \code{"\link{varFunc}"}, representing a variance function structure.} \item{conLin}{a condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying model.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function pre-multiples the \code{"Xy"} component of \code{conLin} by a diagonal matrix with diagonal elements given by the weights corresponding to the variance structure represented by \code{object}e and adds the log-likelihood contribution of \code{object}, given by \code{logLik(object)}, to the \code{"logLik"} component of \code{conLin}. } \value{ the recalculated condensed linear model object. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{This method function is only used inside model fitting functions, such as \code{lme} and \code{gls}, that allow heteroscedastic error terms.} \seealso{ \code{\link{recalc}}, \code{\link{varWeights}}, \code{\link{logLik.varFunc}}} \keyword{models} nlme/man/fitted.glsStruct.Rd0000644000176000001440000000260014251721455015553 0ustar ripleyusers% File nlme/man/fitted.glsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fitted.glsStruct} \title{Calculate glsStruct Fitted Values} \usage{ \method{fitted}{glsStruct}(object, glsFit, \dots) } \alias{fitted.glsStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{glsStruct}"}, representing a list of linear model components, such as \code{corStruct} and \code{"\link{varFunc}"} objects.} \item{glsFit}{an optional list with components \code{logLik} (log-likelihood), \code{beta} (coefficients), \code{sigma} (standard deviation for error term), \code{varBeta} (coefficients' covariance matrix), \code{fitted} (fitted values), and \code{residuals} (residuals). Defaults to \code{attr(object, "glsFit")}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The fitted values for the linear model represented by \code{object} are extracted. } \value{ a vector with the fitted values for the linear model represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is generally only used inside \code{gls} and \code{fitted.gls}. } \seealso{\code{\link{gls}}, %\code{\link{fitted.gls}}, \code{\link{residuals.glsStruct}} } \keyword{models} nlme/man/Nitrendipene.Rd0000644000176000001440000000150714251721455014734 0ustar ripleyusers% File nlme/man/Nitrendipene.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Nitrendipene} \alias{Nitrendipene} \title{Assay of nitrendipene} \description{ The \code{Nitrendipene} data frame has 89 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{activity}{ a numeric vector } \item{NIF}{ a numeric vector } \item{Tissue}{ an ordered factor with levels \code{2} < \code{1} < \code{3} < \code{4} } \item{log.NIF}{ a numeric vector } } } \source{ Bates, D. M. and Watts, D. G. (1988), \emph{Nonlinear Regression Analysis and Its Applications}, Wiley, New York. } %\examples{} \keyword{datasets} nlme/man/getGroups.Rd0000644000176000001440000000342114657640762014277 0ustar ripleyusers% File nlme/man/getGroups.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroups} \title{Extract Grouping Factors from an Object} \usage{ getGroups(object, form, level, data, sep) } \alias{getGroups} \arguments{ \item{object}{any object} \item{form}{an optional formula with a conditioning expression on its right hand side (i.e. an expression involving the \code{|} operator). Defaults to \code{formula(object)}.} \item{level}{a positive integer vector with the level(s) of grouping to be used when multiple nested levels of grouping are present. This argument is optional for most methods of this generic function and defaults to all levels of nesting.} \item{data}{a data frame in which to interpret the variables named in \code{form}. Optional for most methods.} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{corStruct}, \code{data.frame}, \code{gls}, \code{lme}, \code{lmList}, and \code{varFunc}. } \value{ will depend on the method function used; see the appropriate documentation. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 100, 461. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{getGroupsFormula}} \code{\link{getGroups.corStruct}}, \code{\link{getGroups.data.frame}}, \code{\link{getGroups.gls}}, \code{\link{getGroups.lmList}}, \code{\link{getGroups.lme}}, \code{\link{getGroups.varFunc}} } \keyword{models} nlme/man/lmeControl.Rd0000644000176000001440000001211014627671725014431 0ustar ripleyusers% File nlme/man/lmeControl.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see ../LICENCE.note \name{lmeControl} \title{Specifying Control Values for lme Fit} \alias{lmeControl} \description{ The values supplied in the \code{lmeControl()} call replace the defaults, and a \code{\link{list}} with all settings (i.e., values for all possible arguments) is returned. The returned list is used as the \code{control} argument to the \code{lme} function. } \usage{ lmeControl(maxIter = 50, msMaxIter = 50, tolerance = 1e-6, niterEM = 25, msMaxEval = 200, msTol = 1e-7, msVerbose = FALSE, returnObject = FALSE, gradHess = TRUE, apVar = TRUE, .relStep = .Machine$double.eps^(1/3), minAbsParApVar = 0.05, opt = c("nlminb", "optim"), optimMethod = "BFGS", natural = TRUE, sigma = NULL, allow.n.lt.q = FALSE, \dots) } \arguments{ \item{maxIter}{maximum number of iterations for the \code{lme} optimization algorithm. Default is \code{50}.} \item{msMaxIter}{maximum number of iterations for the optimization step inside the \code{lme} optimization. Default is \code{50}.} \item{tolerance}{tolerance for the convergence criterion in the \code{lme} algorithm. Default is \code{1e-6}.} \item{niterEM}{number of iterations for the EM algorithm used to refine the initial estimates of the random effects variance-covariance coefficients. Default is \code{25}.} \item{msMaxEval}{maximum number of evaluations of the objective function permitted for \code{\link{nlminb}}. Default is \code{200}.} \item{msTol}{tolerance for the convergence criterion on the first iteration when \code{optim} is used. Default is \code{1e-7}.} \item{msVerbose}{a logical value passed as the \code{trace} argument to \code{\link{nlminb}} or \code{\link{optim}}. Default is \code{FALSE}.} \item{returnObject}{a logical value indicating whether the fitted object should be returned with a \code{\link{warning}} (instead of an error via \code{\link{stop}()}) when the maximum number of iterations is reached without convergence of the algorithm. Default is \code{FALSE}.} \item{gradHess}{a logical value indicating whether numerical gradient vectors and Hessian matrices of the log-likelihood function should be used in the internal optimization. This option is only available when the correlation structure (\code{corStruct}) and the variance function structure (\code{varFunc}) have no "varying" parameters and the \code{pdMat} classes used in the random effects structure are \code{pdSymm} (general positive-definite), \code{pdDiag} (diagonal), \code{pdIdent} (multiple of the identity), or \code{pdCompSymm} (compound symmetry). Default is \code{TRUE}.} \item{apVar}{a logical value indicating whether the approximate covariance matrix of the variance-covariance parameters should be calculated. Default is \code{TRUE}.} \item{.relStep}{relative step for numerical derivatives calculations. Default is \code{.Machine$double.eps^(1/3)}.} \item{opt}{the optimizer to be used, either \code{"\link{nlminb}"} (the default) or \code{"\link{optim}"}.} \item{optimMethod}{character - the optimization method to be used with the \code{\link{optim}} optimizer. The default is \code{"BFGS"}. An alternative is \code{"L-BFGS-B"}.} \item{minAbsParApVar}{numeric value - minimum absolute parameter value in the approximate variance calculation. The default is \code{0.05}.} \item{natural}{a logical value indicating whether the \code{pdNatural} parametrization should be used for general positive-definite matrices (\code{pdSymm}) in \code{reStruct}, when the approximate covariance matrix of the estimators is calculated. Default is \code{TRUE}.} \item{sigma}{optionally a positive number to fix the residual error at. If \code{NULL}, as by default, or \code{0}, sigma is estimated.} \item{allow.n.lt.q}{\code{\link{logical}} indicating if it is ok to have less observations than random effects for each group. The default, \code{FALSE} signals an error; if \code{NA}, such a situation only gives a warning, as in \pkg{nlme} versions prior to 2019; if true, no message is given at all.} %% msg: "fewer observations than random effects in all level groups" \item{\dots}{further named control arguments to be passed, depending on \code{opt}, to \code{\link{nlminb}} (those from \code{abs.tol} down) or \code{\link{optim}} (those except \code{trace} and \code{maxit}; \code{reltol} is used only from the second iteration).} } \value{ a list with components for each of the possible arguments. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}; the \code{sigma} option: Siem Heisterkamp and Bert van Willigen.} \seealso{\code{\link{lme}}, \code{\link{nlminb}}, \code{\link{optim}}} \examples{ # decrease the maximum number iterations in the ms call and # request that information on the evolution of the ms iterations be printed str(lCtr <- lmeControl(msMaxIter = 20, msVerbose = TRUE)) ## This should always work: do.call(lmeControl, lCtr) } \keyword{models} nlme/man/logLik.lmList.Rd0000644000176000001440000000334414251721455014775 0ustar ripleyusers% File nlme/man/logLik.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.lmList} \title{Log-Likelihood of an lmList Object} \usage{ \method{logLik}{lmList}(object, REML, pool, \dots) } \alias{logLik.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{REML}{an optional logical value. If \code{TRUE} the restricted log-likelihood is returned, else, if \code{FALSE}, the log-likelihood is returned. Defaults to \code{FALSE}. } \item{pool}{an optional logical value indicating whether all \code{lm} components of \code{object} may be assumed to have the same error variance. Default is \code{attr(object, "pool")}. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ If \code{pool=FALSE}, the (restricted) log-likelihoods of the \code{lm} components of \code{object} are summed together. Else, the (restricted) log-likelihood of the \code{lm} fit with different coefficients for each level of the grouping factor associated with the partitioning of the \code{object} components is obtained. } \value{ either the sum of the (restricted) log-likelihoods of each \code{lm} component in \code{object}, or the (restricted) log-likelihood for the \code{lm} fit with separate coefficients for each component of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{logLik.lme}}, } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) logLik(fm1) # returns NA when it should not } \keyword{models} nlme/man/getData.lmList.Rd0000644000176000001440000000203314251721456015120 0ustar ripleyusers% File nlme/man/getData.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getData.lmList} \title{Extract lmList Object Data} \usage{ \method{getData}{lmList}(object) } \alias{getData.lmList} \arguments{ \item{object}{an object inheriting from class \code{lmList}, representing a list of \code{lm} objects with a common model. } } \description{ If present in the calling sequence used to produce \code{object}, the data frame used to fit the model is obtained. } \value{ if a \code{data} argument is present in the calling sequence that produced \code{object}, the corresponding data frame (with \code{na.action} and \code{subset} applied to it, if also present in the call that produced \code{object}) is returned; else, \code{NULL} is returned. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{getData}} } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) getData(fm1) } \keyword{models} nlme/man/summary.corStruct.Rd0000644000176000001440000000325614365320302015767 0ustar ripleyusers% File nlme/man/summary.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.corStruct} \title{Summarize a corStruct Object} \usage{ \method{summary}{corStruct}(object, structName, \dots) } \alias{summary.corStruct} \alias{summary.corAR1} \alias{summary.corARMA} \alias{summary.corCAR1} \alias{summary.corCompSymm} \alias{summary.corExp} \alias{summary.corGaus} \alias{summary.corLin} \alias{summary.corNatural} \alias{summary.corRatio} \alias{summary.corSpher} \alias{summary.corSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"}, representing a correlation structure.} \item{structName}{an optional character string defining the type of correlation structure associated with \code{object}, to be used in the \code{print.summary} method. Defaults to \code{class(object)[1]}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function prepares \code{object} to be printed using the \code{print.summary} method, by changing its class and adding a \code{structName} attribute to it. } \value{ an object identical to \code{object}, but with its class changed to \code{summary.corStruct} and an additional attribute \code{structName}. The returned value inherits from the same classes as \code{object}. } \author{José Pinheiro and Douglas Bates } \seealso{ \code{\link{corClasses}}, \code{\link{corNatural}}, \code{\link{Initialize.corStruct}}, \code{\link{summary}} } %\seealso{\code{\link{print.summary.corStruct}}} \examples{ cs1 <- corAR1(0.2) summary(cs1) } \keyword{models} nlme/man/pairs.compareFits.Rd0000644000176000001440000000363514633640310015677 0ustar ripleyusers% File nlme/man/pairs.compareFits.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pairs.compareFits} \title{Pairs Plot of compareFits Object} \usage{ \method{pairs}{compareFits}(x, subset, key, \dots) } \alias{pairs.compareFits} \arguments{ \item{x}{an object of class \code{compareFits}.} \item{subset}{an optional logical or integer vector specifying which rows of \code{x} should be used in the plots. If missing, all rows are used.} \item{key}{an optional logical value, or list. If \code{TRUE}, a legend is included at the top of the plot indicating which symbols (colors) correspond to which objects being compared. If \code{FALSE}, no legend is included. If given as a list, \code{key} is passed down as an argument to the \code{trellis} function generating the plots (\code{splom} or \code{xyplot}). Defaults to \code{TRUE}.} \item{\dots}{optional arguments passed down to the \code{trellis} function generating the plots.} } \description{ Scatter plots of the values being compared are generated for each pair of coefficients in \code{x}. Different symbols (colors) are used for each object being compared and values corresponding to the same group are joined by a line, to facilitate comparison of fits. If only two coefficients are present, the \code{trellis} function \code{xyplot} is used; otherwise the \code{trellis} function \code{splom} is used. } \value{ Pairwise scatter plots of the values being compared, with different symbols (colors) used for each object under comparison. } \author{José Pinheiro and Douglas Bates } \seealso{ \code{\link{compareFits}}, \code{\link{plot.compareFits}}, \code{\link{pairs.lme}}, \code{\link{pairs.lmList}}, \code{\link[lattice]{xyplot}}, \code{\link[lattice]{splom}} } \examples{ example(compareFits) # cF12 <- compareFits(coef(lmList(Orthodont)), .. lme(*)) pairs(cF12) } \keyword{models} nlme/man/logDet.Rd0000644000176000001440000000172214657640762013540 0ustar ripleyusers% File nlme/man/logDet.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logDet} \title{Extract the Logarithm of the Determinant} \usage{ logDet(object, \dots) } \alias{logDet} \arguments{ \item{object}{any object from which a matrix, or list of matrices, can be extracted} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{corStruct}, several \code{pdMat} classes, and \code{reStruct}. } \value{ will depend on the method function used; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{logLik}}, \code{\link{logDet.corStruct}}, \code{\link{logDet.pdMat}}, \code{\link{logDet.reStruct}} } \keyword{models} nlme/man/corSymm.Rd0000644000176000001440000000632714251721455013746 0ustar ripleyusers% File nlme/man/corSymm.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corSymm} \title{General Correlation Structure} \usage{ corSymm(value, form, fixed) } \alias{corSymm} \arguments{ \item{value}{an optional vector with the parameter values. Default is \code{numeric(0)}, which results in a vector of zeros of appropriate dimension being assigned to the parameters when \code{object} is initialized (corresponding to an identity correlation structure).} \item{form}{a one sided formula of the form \code{~ t}, or \code{~ t | g}, specifying a time covariate \code{t} and, optionally, a grouping factor \code{g}. A covariate for this correlation structure must be integer valued. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corSymm} class, representing a general correlation structure. The internal representation of this structure, in terms of unconstrained parameters, uses the spherical parametrization defined in Pinheiro and Bates (1996). Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corSymm} representing a general correlation structure. } \references{ Pinheiro, J.C. and Bates., D.M. (1996) "Unconstrained Parametrizations for Variance-Covariance Matrices", Statistics and Computing, 6, 289-296. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Initialize.corSymm}}, \code{\link{summary.corSymm}} } \examples{ ## covariate is observation order and grouping factor is Subject cs1 <- corSymm(form = ~ 1 | Subject) # Pinheiro and Bates, p. 225 cs1CompSymm <- corCompSymm(value = 0.3, form = ~ 1 | Subject) cs1CompSymm <- Initialize(cs1CompSymm, data = Orthodont) corMatrix(cs1CompSymm) # Pinheiro and Bates, p. 226 cs1Symm <- corSymm(value = c(0.2, 0.1, -0.1, 0, 0.2, 0), form = ~ 1 | Subject) cs1Symm <- Initialize(cs1Symm, data = Orthodont) corMatrix(cs1Symm) # example gls(..., corSpher ...) # Pinheiro and Bates, pp. 261, 263 fm1Wheat2 <- gls(yield ~ variety - 1, Wheat2) # p. 262 fm2Wheat2 <- update(fm1Wheat2, corr = corSpher(c(28, 0.2), form = ~ latitude + longitude, nugget = TRUE)) # example gls(..., corSymm ... ) # Pinheiro and Bates, p. 251 fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont, correlation = corSymm(form = ~ 1 | Subject), weights = varIdent(form = ~ 1 | age)) } \keyword{models} nlme/man/Spruce.Rd0000644000176000001440000000233614251721456013553 0ustar ripleyusers% File nlme/man/Spruce.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Spruce} \alias{Spruce} \title{Growth of Spruce Trees} \description{ The \code{Spruce} data frame has 1027 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Tree}{ a factor giving a unique identifier for each tree. } \item{days}{ a numeric vector giving the number of days since the beginning of the experiment. } \item{logSize}{ a numeric vector giving the logarithm of an estimate of the volume of the tree trunk. } \item{plot}{ a factor identifying the plot in which the tree was grown. } } } \details{ Diggle, Liang, and Zeger (1994, Example 1.3, page 5) describe data on the growth of spruce trees that have been exposed to an ozone-rich atmosphere or to a normal atmosphere. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.28) Diggle, Peter J., Liang, Kung-Yee and Zeger, Scott L. (1994), \emph{Analysis of longitudinal data}, Oxford University Press, Oxford. } %\examples{} \keyword{datasets} nlme/man/pdCompSymm.Rd0000644000176000001440000000640114251721456014377 0ustar ripleyusers% File nlme/man/pdCompSymm.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdCompSymm} \title{Positive-Definite Matrix with Compound Symmetry Structure} \usage{ pdCompSymm(value, form, nam, data) } \alias{pdCompSymm} \arguments{ \item{value}{an optional initialization value, which can be any of the following: a \code{pdMat} object, a positive-definite matrix, a one-sided linear formula (with variables separated by \code{+}), a vector of character strings, or a numeric vector of length 2. Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional one-sided linear formula specifying the row/column names for the matrix represented by \code{object}. Because factors may be present in \code{form}, the formula needs to be evaluated on a data.frame to resolve the names it defines. This argument is ignored when \code{value} is a one-sided formula. Defaults to \code{NULL}.} \item{nam}{an optional vector of character strings specifying the row/column names for the matrix represented by object. It must have length equal to the dimension of the underlying positive-definite matrix and unreplicated elements. This argument is ignored when \code{value} is a vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} } \description{ This function is a constructor for the \code{pdCompSymm} class, representing a positive-definite matrix with compound symmetry structure (constant diagonal and constant off-diagonal elements). The underlying matrix is represented by 2 unrestricted parameters. When \code{value} is \code{numeric(0)}, an uninitialized \code{pdMat} object, a one-sided formula, or a vector of character strings, \code{object} is returned as an uninitialized \code{pdCompSymm} object (with just some of its attributes and its class defined) and needs to have its coefficients assigned later, generally using the \code{coef} or \code{matrix} replacement functions. If \code{value} is an initialized \code{pdMat} object, \code{object} will be constructed from \code{as.matrix(value)}. Finally, if \code{value} is a numeric vector of length 2, it is assumed to represent the unrestricted coefficients of the underlying positive-definite matrix. } \value{ a \code{pdCompSymm} object representing a positive-definite matrix with compound symmetry structure, also inheriting from class \code{pdMat}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. p. 161. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{coef.pdMat}}, \code{\link{matrix<-.pdMat}}, \code{\link{pdClasses}} } \examples{ pd1 <- pdCompSymm(diag(3) + 1, nam = c("A","B","C")) pd1 } \keyword{models} nlme/man/pdFactor.reStruct.Rd0000644000176000001440000000260514251721456015665 0ustar ripleyusers% File nlme/man/pdFactor.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdFactor.reStruct} \title{Extract Square-Root Factor from Components of an reStruct Object} \usage{ \method{pdFactor}{reStruct}(object) } \alias{pdFactor.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} } \description{ This method function extracts square-root factors of the positive-definite matrices corresponding to the \code{pdMat} elements of \code{object}. } \value{ a vector with square-root factors of the positive-definite matrices corresponding to the elements of \code{object} stacked column-wise. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This function is used intensively in optimization algorithms and its value is returned as a vector for efficiency reasons. The \code{pdMatrix} function can be used to obtain square-root factors in matrix form. } \seealso{\code{\link{pdFactor}}, \code{\link{pdMatrix.reStruct}}, \code{\link{pdFactor.pdMat}}} \examples{ rs1 <- reStruct(pdSymm(diag(3), ~age+Sex, data = Orthodont)) pdFactor(rs1) } \keyword{models} nlme/man/Variogram.lme.Rd0000644000176000001440000001446114251721456015017 0ustar ripleyusers% File nlme/man/Variogram.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.lme} \title{Calculate Semi-variogram for Residuals from an lme Object} \usage{ \method{Variogram}{lme}(object, distance, form, resType, data, na.action, maxDist, length.out, collapse, nint, breaks, robust, metric, \dots) } \alias{Variogram.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{distance}{an optional numeric vector with the distances between residual pairs. If a grouping variable is present, only the distances between residual pairs within the same group should be given. If missing, the distances are calculated based on the values of the arguments \code{form}, \code{data}, and \code{metric}, unless \code{object} includes a \code{corSpatial} element, in which case the associated covariate (obtained with the \code{getCovariate} method) is used.} \item{form}{an optional one-sided formula specifying the covariate(s) to be used for calculating the distances between residual pairs and, optionally, a grouping factor for partitioning the residuals (which must appear to the right of a \code{|} operator in \code{form}). Default is \code{~1}, implying that the observation order within the groups is used to obtain the distances.} \item{resType}{an optional character string specifying the type of residuals to be used. If \code{"response"}, the "raw" residuals (observed - fitted) are used; else, if \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"pearson"}.} \item{data}{an optional data frame in which to interpret the variables in \code{form}. By default, the same data used to fit \code{object} is used.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes an error message to be printed and the function to terminate, if there are any incomplete observations.} \item{maxDist}{an optional numeric value for the maximum distance used for calculating the semi-variogram between two residuals. By default all residual pairs are included.} \item{length.out}{an optional integer value. When \code{object} includes a \code{corSpatial} element, its semi-variogram values are calculated and this argument is used as the \code{length.out} argument to the corresponding \code{Variogram} method. Defaults to \code{50}.} \item{collapse}{an optional character string specifying the type of collapsing to be applied to the individual semi-variogram values. If equal to \code{"quantiles"}, the semi-variogram values are split according to quantiles of the distance distribution, with equal number of observations per group, with possibly varying distance interval lengths. Else, if \code{"fixed"}, the semi-variogram values are divided according to distance intervals of equal lengths, with possibly different number of observations per interval. Else, if \code{"none"}, no collapsing is used and the individual semi-variogram values are returned. Defaults to \code{"quantiles"}.} \item{nint}{an optional integer with the number of intervals to be used when collapsing the semi-variogram values. Defaults to \code{20}.} \item{robust}{an optional logical value specifying if a robust semi-variogram estimator should be used when collapsing the individual values. If \code{TRUE} the robust estimator is used. Defaults to \code{FALSE}.} \item{breaks}{an optional numeric vector with the breakpoints for the distance intervals to be used in collapsing the semi-variogram values. If not missing, the option specified in \code{collapse} is ignored.} \item{metric}{an optional character string specifying the distance metric to be used. The currently available options are \code{"euclidean"} for the root sum-of-squares of distances; \code{"maximum"} for the maximum difference; and \code{"manhattan"} for the sum of the absolute differences. Partial matching of arguments is used, so only the first three characters need to be provided. Defaults to \code{"euclidean"}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram for the within-group residuals from an \code{lme} fit. The semi-variogram values are calculated for pairs of residuals within the same group. If \code{collapse} is different from \code{"none"}, the individual semi-variogram values are collapsed using either a robust estimator (\code{robust = TRUE}) defined in Cressie (1993), or the average of the values within the same distance interval. The semi-variogram is useful for modeling the error term correlation structure. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. If the semi-variogram values are collapsed, an extra column, \code{n.pairs}, with the number of residual pairs used in each semi-variogram calculation, is included in the returned data frame. If \code{object} includes a \code{corSpatial} element, a data frame with its corresponding semi-variogram is included in the returned value, as an attribute \code{"modelVariog"}. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{lme}}, \code{\link{Variogram}}, \code{\link{Variogram.default}}, \code{\link{Variogram.gls}}, \code{\link{plot.Variogram}} } \examples{ fm1 <- lme(weight ~ Time * Diet, data=BodyWeight, ~ Time | Rat) Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE) } \keyword{models} nlme/man/plot.gls.Rd0000644000176000001440000001132614633640310014044 0ustar ripleyusers% File nlme/man/plot.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.gls} \title{Plot a gls Object} \usage{ \method{plot}{gls}(x, form, abline, id, idLabels, idResType, grid, \dots) } \alias{plot.gls} \arguments{ \item{x}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted linear model.} \item{form}{an optional formula specifying the desired type of plot. Any variable present in the original data frame used to obtain \code{x} can be referenced. In addition, \code{x} itself can be referenced in the formula using the symbol \code{"."}. Conditional expressions on the right of a \code{|} operator can be used to define separate panels in a Trellis display. Default is \code{resid(., type = "p") ~ fitted(.) }, corresponding to a plot of the standardized residuals versus fitted values, both evaluated at the innermost level of nesting.} \item{abline}{an optional numeric value, or numeric vector of length two. If given as a single value, a horizontal line will be added to the plot at that coordinate; else, if given as a vector, its values are used as the intercept and slope for a line added to the plot. If missing, no lines are added to the plot.} \item{id}{an optional numeric value, or one-sided formula. If given as a value, it is used as a significance level for a two-sided outlier test for the standardized residuals. Observations with absolute standardized residuals greater than the \eqn{1 - value/2} quantile of the standard normal distribution are identified in the plot using \code{idLabels}. If given as a one-sided formula, its right hand side must evaluate to a logical, integer, or character vector which is used to identify observations in the plot. If missing, no observations are identified.} \item{idLabels}{an optional vector, or one-sided formula. If given as a vector, it is converted to character mode and used to label the observations identified according to \code{id}. If given as a one-sided formula, its right hand side must evaluate to a vector which is converted to character mode and used to label the identified observations. Default is the innermost grouping factor.} \item{idResType}{an optional character string specifying the type of residuals to be used in identifying outliers, when \code{id} is a numeric value. If \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"pearson"}.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default depends on the type of Trellis plot used: if \code{xyplot} defaults to \code{TRUE}, else defaults to \code{FALSE}.} \item{\dots}{optional arguments passed to the Trellis plot function.} } \description{ Diagnostic plots for the linear model fit are obtained. The \code{form} argument gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a \code{|} operator) always implies that different panels are used for each level of the conditioning factor, according to a Trellis display. If \code{form} is a one-sided formula, histograms of the variable on the right hand side of the formula, before a \code{|} operator, are displayed (the Trellis function \code{histogram} is used). If \code{form} is two-sided and both its left and right hand side variables are numeric, scatter plots are displayed (the Trellis function \code{xyplot} is used). Finally, if \code{form} is two-sided and its left had side variable is a factor, box-plots of the right hand side variable by the levels of the left hand side variable are displayed (the Trellis function \code{bwplot} is used). } \value{ a diagnostic Trellis plot. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link[lattice]{xyplot}}, \code{\link[lattice]{bwplot}}, \code{\link[lattice]{histogram}} } \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) # standardized residuals versus fitted values by Mare plot(fm1, resid(., type = "p") ~ fitted(.) | Mare, abline = 0) # box-plots of residuals by Mare plot(fm1, Mare ~ resid(.)) # observed versus fitted values by Mare plot(fm1, follicles ~ fitted(.) | Mare, abline = c(0,1)) } \keyword{models} nlme/man/Orthodont.Rd0000644000176000001440000000350114251721455014264 0ustar ripleyusers% File nlme/man/Orthodont.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Orthodont} \alias{Orthodont} \title{Growth curve data on an orthdontic measurement} \description{ The \code{Orthodont} data frame has 108 rows and 4 columns of the change in an orthdontic measurement over time for several young subjects. } \format{ This data frame contains the following columns: \describe{ \item{distance}{ a numeric vector of distances from the pituitary to the pterygomaxillary fissure (mm). These distances are measured on x-ray images of the skull. } \item{age}{ a numeric vector of ages of the subject (yr). } \item{Subject}{ an ordered factor indicating the subject on which the measurement was made. The levels are labelled \code{M01} to \code{M16} for the males and \code{F01} to \code{F13} for the females. The ordering is by increasing average distance within sex. } \item{Sex}{ a factor with levels \code{Male} and \code{Female} } } } \details{ Investigators at the University of North Carolina Dental School followed the growth of 27 children (16 males, 11 females) from age 8 until age 14. Every two years they measured the distance between the pituitary and the pterygomaxillary fissure, two points that are easily identified on x-ray exposures of the side of the head. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.17) Potthoff, R. F. and Roy, S. N. (1964), ``A generalized multivariate analysis of variance model useful especially for growth curve problems'', \emph{Biometrika}, \bold{51}, 313--326. } \examples{ formula(Orthodont) plot(Orthodont) } \keyword{datasets} nlme/man/groupedData.Rd0000644000176000001440000001634614632316272014556 0ustar ripleyusers% File nlme/man/groupedData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{groupedData} \title{Construct a groupedData Object} \usage{ groupedData(formula, data, order.groups, FUN, outer, inner, labels, units) \method{update}{groupedData}(object, formula, data, order.groups, FUN, outer, inner, labels, units, \dots) } \alias{groupedData} \alias{[.groupedData} \alias{as.data.frame.groupedData} \alias{update.groupedData} \arguments{ \item{object}{an object inheriting from class \code{groupedData}.} \item{formula}{a formula of the form \code{resp ~ cov | group} where \code{resp} is the response, \code{cov} is the primary covariate, and \code{group} is the grouping factor. The expression \code{1} can be used for the primary covariate when there is no other suitable candidate. Multiple nested grouping factors can be listed separated by the \code{/} symbol as in \code{fact1/fact2}. In an expression like this the \code{fact2} factor is nested within the \code{fact1} factor.} \item{data}{a data frame in which the expressions in \code{formula} can be evaluated. The resulting \code{groupedData} object will consist of the same data values in the same order but with additional attributes.} \item{order.groups}{an optional logical value, or list of logical values, indicating if the grouping factors should be converted to ordered factors according to the function \code{FUN} applied to the response from each group. If multiple levels of grouping are present, this argument can be either a single logical value (which will be repeated for all grouping levels) or a list of logical values. If no names are assigned to the list elements, they are assumed in the same order as the group levels (outermost to innermost grouping). Ordering within a level of grouping is done within the levels of the grouping factors which are outer to it. Changing the grouping factor to an ordered factor does not affect the ordering of the rows in the data frame but it does affect the order of the panels in a trellis display of the data or models fitted to the data. Defaults to \code{TRUE}.} \item{FUN}{an optional summary function that will be applied to the values of the response for each level of the grouping factor, when \code{order.groups = TRUE}, to determine the ordering. Defaults to the \code{max} function.} \item{outer}{an optional one-sided formula, or list of one-sided formulas, indicating covariates that are outer to the grouping factor(s). If multiple levels of grouping are present, this argument can be either a single one-sided formula, or a list of one-sided formulas. If no names are assigned to the list elements, they are assumed in the same order as the group levels (outermost to innermost grouping). An outer covariate is invariant within the sets of rows defined by the grouping factor. Ordering of the groups is done in such a way as to preserve adjacency of groups with the same value of the outer variables. When plotting a \code{groupedData} object, the argument \code{outer = TRUE} causes the panels to be determined by the \code{outer} formula. The points within the panels are associated by level of the grouping factor. Defaults to \code{NULL}, meaning that no outer covariates are present.} \item{inner}{an optional one-sided formula, or list of one-sided formulas, indicating covariates that are inner to the grouping factor(s). If multiple levels of grouping are present, this argument can be either a single one-sided formula, or a list of one-sided formulas. If no names are assigned to the list elements, they are assumed in the same order as the group levels (outermost to innermost grouping). An inner covariate can change within the sets of rows defined by the grouping factor. An inner formula can be used to associate points in a plot of a \code{groupedData} object. Defaults to \code{NULL}, meaning that no inner covariates are present.} \item{labels}{an optional list of character strings giving labels for the response and the primary covariate. The label for the primary covariate is named \code{x} and that for the response is named \code{y}. Either label can be omitted.} \item{units}{an optional list of character strings giving the units for the response and the primary covariate. The units string for the primary covariate is named \code{x} and that for the response is named \code{y}. Either units string can be omitted.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ An object of the \code{groupedData} class is constructed from the \code{formula} and \code{data} by attaching the \code{formula} as an attribute of the data, along with any of \code{outer}, \code{inner}, \code{labels}, and \code{units} that are given. If \code{order.groups} is \code{TRUE} the grouping factor is converted to an ordered factor with the ordering determined by \code{FUN}. Depending on the number of grouping levels and the type of primary covariate, the returned object will be of one of three classes: \code{nfnGroupedData} - numeric covariate, single level of nesting; \code{nffGroupedData} - factor covariate, single level of nesting; and \code{nmGroupedData} - multiple levels of nesting. Several modeling and plotting functions can use the formula stored with a \code{groupedData} object to construct default plots and models. } \value{ an object of one of the classes \code{nfnGroupedData}, \code{nffGroupedData}, or \code{nmGroupedData}, and also inheriting from classes \code{groupedData} and \code{data.frame}. } \references{ Bates, D.M. and Pinheiro, J.C. (1997), "Software Design for Longitudinal Data Analysis", in "Modelling Longitudinal and Spatially Correlated Data: Methods, Applications and Future Directions", T.G. Gregoire (ed.), Springer-Verlag, New York. \doi{10.1007/978-1-4612-0699-6_4} %% Pinheiro, J.C. and Bates, D.M. (1997) "Future Directions in %% Mixed-Effects Software: Design of NLME 3.0" (talk) %% originally available at http://nlme.stat.wisc.edu/ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{Douglas Bates and José Pinheiro} \seealso{\code{\link{formula}}, \code{\link{gapply}}, \code{\link{gsummary}}, \code{\link{lme}}, \code{\link{plot.nffGroupedData}}, \code{\link{plot.nfnGroupedData}}, \code{\link{plot.nmGroupedData}}, \code{\link{reStruct}} } \examples{ Orth.new <- # create a new copy of the groupedData object groupedData( distance ~ age | Subject, data = as.data.frame( Orthodont ), FUN = mean, outer = ~ Sex, labels = list( x = "Age", y = "Distance from pituitary to pterygomaxillary fissure" ), units = list( x = "(yr)", y = "(mm)") ) plot( Orth.new ) # trellis plot by Subject formula( Orth.new ) # extractor for the formula gsummary( Orth.new ) # apply summary by Subject fm1 <- lme( Orth.new ) # fixed and groups formulae extracted from object Orthodont2 <- update(Orthodont, FUN = mean) } \keyword{manip} \keyword{attribute} nlme/man/Variogram.default.Rd0000644000176000001440000000371614251721456015667 0ustar ripleyusers% File nlme/man/Variogram.default.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.default} \title{Calculate Semi-variogram} \usage{ \method{Variogram}{default}(object, distance, \dots) } \alias{Variogram.default} \arguments{ \item{object}{a numeric vector with the values to be used for calculating the semi-variogram, usually a residual vector from a fitted model.} \item{distance}{a numeric vector with the pairwise distances corresponding to the elements of \code{object}. The order of the elements in \code{distance} must correspond to the pairs \code{(1,2), (1,3), \dots, (n-1,n)}, with \code{n} representing the length of \code{object}, and must have length \code{n(n-1)/2}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram for an arbitrary vector \code{object}, according to the distances in \code{distance}. For each pair of elements \eqn{x,y} in \code{object}, the corresponding semi-variogram is \eqn{(x-y)^2/2}. The semi-variogram is useful for identifying and modeling spatial correlation structures in observations with constant expectation and constant variance. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Variogram}}, \code{\link{Variogram.gls}}, \code{\link{Variogram.lme}}, \code{\link{plot.Variogram}}} \examples{ fm1 <- lm(follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time), Ovary, subset = Mare == 1) Variogram(resid(fm1), dist(1:29))[1:10,] } \keyword{models} nlme/man/Names.pdMat.Rd0000644000176000001440000000310114251721455014407 0ustar ripleyusers% File nlme/man/Names.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Names.pdMat} \title{Names of a pdMat Object} \usage{ \method{Names}{pdMat}(object, \dots) \method{Names}{pdMat}(object, \dots) <- value } \alias{Names.pdMat} \alias{Names<-.pdMat} \arguments{ \item{object}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive-definite matrix.} \item{value}{a character vector with the replacement values for the column and row names of the matrix represented by \code{object}. It must have length equal to the dimension of the matrix represented by \code{object} and, if names have been previously assigned to \code{object}, it must correspond to a permutation of the original names.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function returns the fist element of the \code{Dimnames} attribute of \code{object}, which contains the column names of the matrix represented by \code{object}. } \value{ if \code{object} has a \code{Dimnames} attribute then the first element of this attribute is returned; otherwise \code{NULL}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \section{SIDE EFFECTS}{ On the left side of an assignment, sets the \code{Dimnames} attribute of \code{object} to \code{list(value, value)}. } \seealso{\code{\link{Names}}, \code{\link{Names.pdBlocked}}} \examples{ pd1 <- pdSymm(~age, data = Orthodont) Names(pd1) } \keyword{models} nlme/man/pdConstruct.pdBlocked.Rd0000644000176000001440000001057214251721455016510 0ustar ripleyusers% File nlme/man/pdConstruct.pdBlocked.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdConstruct.pdBlocked} \title{Construct pdBlocked Objects} \usage{ \method{pdConstruct}{pdBlocked}(object, value, form, nam, data, pdClass, \dots) } \alias{pdConstruct.pdBlocked} \arguments{ \item{object}{an object inheriting from class \code{"pdBlocked"}, representing a positive definite block-diagonal matrix.} \item{value}{an optional list with elements to be used as the \code{value} argument to other \code{pdMat} constructors. These include: \code{pdMat} objects, positive-definite matrices, one-sided linear formulas, vectors of character strings, or numeric vectors. All elements in the list must be similar (e.g. all one-sided formulas, or all numeric vectors). Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional list of one-sided linear formula specifying the row/column names for the block-diagonal elements of the matrix represented by \code{object}. Because factors may be present in \code{form}, the formulas needs to be evaluated on a data.frame to resolve the names they defines. This argument is ignored when \code{value} is a list of one-sided formulas. Defaults to \code{NULL}.} \item{nam}{an optional list of vector of character strings specifying the row/column names for the block-diagonal elements of the matrix represented by object. Each of its components must have length equal to the dimension of the corresponding block-diagonal element and unreplicated elements. This argument is ignored when \code{value} is a list of vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} \item{pdClass}{an optional vector of character strings naming the \code{pdMat} classes to be assigned to the individual blocks in the underlying matrix. If a single class is specified, it is used for all block-diagonal elements. This argument will only be used when \code{value} is missing, or its elements are not \code{pdMat} objects. Defaults to \code{"pdSymm"}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This function give an alternative constructor for the \code{pdBlocked} class, representing a positive-definite block-diagonal matrix. Each block-diagonal element of the underlying matrix is itself a positive-definite matrix and is represented internally as an individual \code{pdMat} object. When \code{value} is \code{numeric(0)}, a list of uninitialized \code{pdMat} objects, a list of one-sided formulas, or a list of vectors of character strings, \code{object} is returned as an uninitialized \code{pdBlocked} object (with just some of its attributes and its class defined) and needs to have its coefficients assigned later, generally using the \code{coef} or \code{matrix} replacement functions. If \code{value} is a list of initialized \code{pdMat} objects, \code{object} will be constructed from the list obtained by applying \code{as.matrix} to each of the \code{pdMat} elements of \code{value}. Finally, if \code{value} is a list of numeric vectors, they are assumed to represent the unrestricted coefficients of the block-diagonal elements of the underlying positive-definite matrix. } \value{ a \code{pdBlocked} object representing a positive-definite block-diagonal matrix, also inheriting from class \code{pdMat}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{coef.pdMat}}, \code{\link{pdBlocked}}, \code{\link{pdClasses}}, \code{\link{pdConstruct}}, \code{\link{matrix<-.pdMat}}} \examples{ pd1 <- pdBlocked(list(c("A","B"), c("a1", "a2", "a3"))) pdConstruct(pd1, list(diag(1:2), diag(c(0.1, 0.2, 0.3)))) } \keyword{models} nlme/man/RatPupWeight.Rd0000644000176000001440000000241614251721455014673 0ustar ripleyusers% File nlme/man/RatPupWeight.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{RatPupWeight} \alias{RatPupWeight} \title{The weight of rat pups} \description{ The \code{RatPupWeight} data frame has 322 rows and 5 columns. } \format{ This data frame contains the following columns: \describe{ \item{weight}{ a numeric vector } \item{sex}{ a factor with levels \code{Male} \code{Female} } \item{Litter}{ an ordered factor with levels \code{9} < \code{8} < \code{7} < \code{4} < \code{2} < \code{10} < \code{1} < \code{3} < \code{5} < \code{6} < \code{21} < \code{22} < \code{24} < \code{27} < \code{26} < \code{25} < \code{23} < \code{17} < \code{11} < \code{14} < \code{13} < \code{15} < \code{16} < \code{20} < \code{19} < \code{18} < \code{12} } \item{Lsize}{ a numeric vector } \item{Treatment}{ an ordered factor with levels \code{Control} < \code{Low} < \code{High} } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/summary.modelStruct.Rd0000644000176000001440000000233714251721455016313 0ustar ripleyusers% File nlme/man/summary.modelStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.modelStruct} \alias{summary.modelStruct} \alias{summary.reStruct} \title{Summarize a modelStruct Object} \usage{ \method{summary}{modelStruct}(object, \dots) } \arguments{ \item{object}{an object inheriting from class \code{"modelStruct"}, representing a list of model components, such as \code{reStruct}, \code{corStruct} and \code{varFunc} objects. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function applies \code{summary} to each element of \code{object}. } \value{ a list with elements given by the summarized components of \code{object}. The returned value is of class \code{summary.modelStruct}, also inheriting from the same classes as \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{reStruct}}, \code{\link{summary}} } %\seealso{\code{\link{print.summary.modelStruct}}} \examples{ lms1 <- lmeStruct(reStruct = reStruct(pdDiag(diag(2), ~age)), corStruct = corAR1(0.3)) summary(lms1) } \keyword{models} nlme/man/LDEsysMat.Rd0000644000176000001440000000322114251721455014110 0ustar ripleyusers% File nlme/man/LDEsysMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{LDEsysMat} \alias{LDEsysMat} \title{Generate system matrix for LDEs} \description{ Generate the system matrix for the linear differential equations determined by a compartment model. } \usage{ LDEsysMat(pars, incidence) } \arguments{ \item{pars}{a numeric vector of parameter values.} \item{incidence}{an integer matrix with columns named \code{From}, \code{To}, and \code{Par}. Values in the \code{Par} column must be in the range 1 to \code{length(pars)}. Values in the \code{From} column must be between 1 and the number of compartments. Values in the \code{To} column must be between 0 and the number of compartments.} } \details{ A compartment model describes material transfer between \code{k} in a system of \code{k} compartments to a linear system of differential equations. Given a description of the system and a vector of parameter values this function returns the system matrix. This function is intended for use in a general system for solving compartment models, as described in Bates and Watts (1988). } \value{ A \code{k} by \code{k} numeric matrix. } \references{ Bates, D. M. and Watts, D. G. (1988), \emph{Nonlinear Regression Analysis and Its Applications}, Wiley, New York. } \author{Douglas Bates \email{bates@stat.wisc.edu}} \examples{ # incidence matrix for a two compartment open system incidence <- matrix(c(1,1,2,2,2,1,3,2,0), ncol = 3, byrow = TRUE, dimnames = list(NULL, c("Par", "From", "To"))) incidence LDEsysMat(c(1.2, 0.3, 0.4), incidence) } \keyword{models} nlme/man/Variogram.gls.Rd0000644000176000001440000001450414251721455015024 0ustar ripleyusers% File nlme/man/Variogram.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.gls} \title{Calculate Semi-variogram for Residuals from a gls Object} \usage{ \method{Variogram}{gls}(object, distance, form, resType, data, na.action, maxDist, length.out, collapse, nint, breaks, robust, metric, \dots) } \alias{Variogram.gls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted model.} \item{distance}{an optional numeric vector with the distances between residual pairs. If a grouping variable is present, only the distances between residual pairs within the same group should be given. If missing, the distances are calculated based on the values of the arguments \code{form}, \code{data}, and \code{metric}, unless \code{object} includes a \code{corSpatial} element, in which case the associated covariate (obtained with the \code{getCovariate} method) is used.} \item{form}{an optional one-sided formula specifying the covariate(s) to be used for calculating the distances between residual pairs and, optionally, a grouping factor for partitioning the residuals (which must appear to the right of a \code{|} operator in \code{form}). Default is \code{~1}, implying that the observation order within the groups is used to obtain the distances.} \item{resType}{an optional character string specifying the type of residuals to be used. If \code{"response"}, the "raw" residuals (observed - fitted) are used; else, if \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"pearson"}.} \item{data}{an optional data frame in which to interpret the variables in \code{form}. By default, the same data used to fit \code{object} is used.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes an error message to be printed and the function to terminate, if there are any incomplete observations.} \item{maxDist}{an optional numeric value for the maximum distance used for calculating the semi-variogram between two residuals. By default all residual pairs are included.} \item{length.out}{an optional integer value. When \code{object} includes a \code{corSpatial} element, its semi-variogram values are calculated and this argument is used as the \code{length.out} argument to the corresponding \code{Variogram} method. Defaults to \code{50}.} \item{collapse}{an optional character string specifying the type of collapsing to be applied to the individual semi-variogram values. If equal to \code{"quantiles"}, the semi-variogram values are split according to quantiles of the distance distribution, with equal number of observations per group, with possibly varying distance interval lengths. Else, if \code{"fixed"}, the semi-variogram values are divided according to distance intervals of equal lengths, with possibly different number of observations per interval. Else, if \code{"none"}, no collapsing is used and the individual semi-variogram values are returned. Defaults to \code{"quantiles"}.} \item{nint}{an optional integer with the number of intervals to be used when collapsing the semi-variogram values. Defaults to \code{20}.} \item{robust}{an optional logical value specifying if a robust semi-variogram estimator should be used when collapsing the individual values. If \code{TRUE} the robust estimator is used. Defaults to \code{FALSE}.} \item{breaks}{an optional numeric vector with the breakpoints for the distance intervals to be used in collapsing the semi-variogram values. If not missing, the option specified in \code{collapse} is ignored.} \item{metric}{an optional character string specifying the distance metric to be used. The currently available options are \code{"euclidean"} for the root sum-of-squares of distances; \code{"maximum"} for the maximum difference; and \code{"manhattan"} for the sum of the absolute differences. Partial matching of arguments is used, so only the first three characters need to be provided. Defaults to \code{"euclidean"}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram for the residuals from a \code{gls} fit. The semi-variogram values are calculated for pairs of residuals within the same group level, if a grouping factor is present. If \code{collapse} is different from \code{"none"}, the individual semi-variogram values are collapsed using either a robust estimator (\code{robust = TRUE}) defined in Cressie (1993), or the average of the values within the same distance interval. The semi-variogram is useful for modeling the error term correlation structure. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. If the semi-variogram values are collapsed, an extra column, \code{n.pairs}, with the number of residual pairs used in each semi-variogram calculation, is included in the returned data frame. If \code{object} includes a \code{corSpatial} element, a data frame with its corresponding semi-variogram is included in the returned value, as an attribute \code{"modelVariog"}. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{gls}}, \code{\link{Variogram}}, \code{\link{Variogram.default}}, \code{\link{Variogram.lme}}, \code{\link{plot.Variogram}}} \examples{ fm1 <- gls(weight ~ Time * Diet, BodyWeight) Vm1 <- Variogram(fm1, form = ~ Time | Rat) print(head(Vm1), digits = 3) } \keyword{models} nlme/man/ranef.lmList.Rd0000644000176000001440000000667014251721455014654 0ustar ripleyusers% File nlme/man/ranef.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{ranef.lmList} \title{Extract lmList Random Effects} \usage{ \method{ranef}{lmList}(object, augFrame, data, which, FUN, standard, omitGroupingFactor, \dots) } \alias{random.effects.lmList} \alias{ranef.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{augFrame}{an optional logical value. If \code{TRUE}, the returned data frame is augmented with variables defined in \code{data}; else, if \code{FALSE}, only the coefficients are returned. Defaults to \code{FALSE}.} \item{data}{an optional data frame with the variables to be used for augmenting the returned data frame when \code{augFrame = TRUE}. Defaults to the data frame used to fit \code{object}.} \item{which}{an optional positive integer vector specifying which columns of \code{data} should be used in the augmentation of the returned data frame. Defaults to all columns in \code{data}.} \item{FUN}{an optional summary function or a list of summary functions to be applied to group-varying variables, when collapsing \code{data} by groups. Group-invariant variables are always summarized by the unique value that they assume within that group. If \code{FUN} is a single function it will be applied to each non-invariant variable by group to produce the summary for that variable. If \code{FUN} is a list of functions, the names in the list should designate classes of variables in the frame such as \code{ordered}, \code{factor}, or \code{numeric}. The indicated function will be applied to any group-varying variables of that class. The default functions to be used are \code{mean} for numeric factors, and \code{Mode} for both \code{factor} and \code{ordered}. The \code{Mode} function, defined internally in \code{gsummary}, returns the modal or most popular value of the variable. It is different from the \code{mode} function that returns the S-language mode of the variable.} \item{standard}{an optional logical value indicating whether the estimated random effects should be "standardized" (i.e. divided by the corresponding estimated standard error). Defaults to \code{FALSE}.} \item{omitGroupingFactor}{an optional logical value. When \code{TRUE} the grouping factor itself will be omitted from the group-wise summary of \code{data} but the levels of the grouping factor will continue to be used as the row names for the returned data frame. Defaults to \code{FALSE}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The difference between the individual \code{lm} components coefficients and their average is calculated. } \value{ a vector with the differences between the individual \code{lm} coefficients in \code{object} and their average. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 100, 461. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{fixed.effects.lmList}}, \code{\link{lmList}}, \code{\link{random.effects}} } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) ranef(fm1) random.effects(fm1) # same as above } \keyword{models} nlme/man/Matrix.pdMat.Rd0000644000176000001440000000245614251721455014624 0ustar ripleyusers% File nlme/man/Matrix.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Matrix.pdMat} \title{Assign Matrix to a pdMat or pdBlocked Object} \alias{matrix<-.pdMat} \alias{matrix<-.pdBlocked} \usage{ \method{matrix}{pdMat}(object) <- value \method{matrix}{pdBlocked}(object) <- value } \arguments{ \item{object}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive definite matrix.} \item{value}{a matrix with the new values to be assigned to the positive-definite matrix represented by \code{object}. Must have the same dimensions as \code{as.matrix(object)}.} } \description{ The positive-definite matrix represented by \code{object} is replaced by \code{value}. If the original matrix had row and/or column names, the corresponding names for \code{value} can either be \code{NULL}, or a permutation of the original names. } \value{ a \code{pdMat} or \code{pdBlocked} object similar to \code{object}, but with its coefficients modified to produce the matrix in \code{value}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{pdMat}}, \code{"\link{matrix<-}"} } \examples{ class(pd1 <- pdSymm(diag(3))) # "pdSymm" "pdMat" matrix(pd1) <- diag(1:3) pd1 } \keyword{models} nlme/man/getCovariateFormula.Rd0000644000176000001440000000147614251721456016261 0ustar ripleyusers% File nlme/man/getCovariateFormula.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getCovariateFormula} \title{Extract Covariates Formula} \usage{ getCovariateFormula(object) } \alias{getCovariateFormula} \arguments{ \item{object}{any object from which a formula can be extracted.} } \description{ The right hand side of \code{formula(object)}, without any conditioning expressions (i.e. any expressions after a \code{|} operator) is returned as a one-sided formula. } \value{ a one-sided formula describing the covariates associated with \code{formula(object)}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{getCovariate}}} \examples{ getCovariateFormula(y ~ x | g) getCovariateFormula(y ~ x) } \keyword{models} nlme/man/logDet.corStruct.Rd0000644000176000001440000000303414365320302015502 0ustar ripleyusers% File nlme/man/logDet.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logDet.corStruct} \title{Extract corStruct Log-Determinant} \usage{ \method{logDet}{corStruct}(object, covariate, \dots) } \alias{logDet.corStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"}, representing a correlation structure.} \item{covariate}{an optional covariate vector (matrix), or list of covariate vectors (matrices), at which values the correlation matrix, or list of correlation matrices, are to be evaluated. Defaults to \code{getCovariate(object)}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the logarithm of the determinant of a square-root factor of the correlation matrix associated with \code{object}, or the sum of the log-determinants of square-root factors of the list of correlation matrices associated with \code{object}. } \value{ the log-determinant of a square-root factor of the correlation matrix associated with \code{object}, or the sum of the log-determinants of square-root factors of the list of correlation matrices associated with \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{logLik.corStruct}}, \code{\link{corMatrix.corStruct}}, \code{\link{logDet}} } \examples{ cs1 <- corAR1(0.3) logDet(cs1, covariate = 1:4) } \keyword{models} nlme/man/ergoStool.Rd0000644000176000001440000000262714251721455014271 0ustar ripleyusers% File nlme/man/ergoStool.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{ergoStool} \alias{ergoStool} \title{Ergometrics experiment with stool types} \description{ The \code{ergoStool} data frame has 36 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{effort}{ a numeric vector giving the effort (Borg scale) required to arise from a stool. } \item{Type}{ a factor with levels \code{T1}, \code{T2}, \code{T3}, and \code{T4} giving the stool type. } \item{Subject}{ an ordered factor giving a unique identifier for the subject in the experiment. } } } \details{ Devore (2000) cites data from an article in \emph{Ergometrics} (1993, pp. 519-535) on ``The Effects of a Pneumatic Stool and a One-Legged Stool on Lower Limb Joint Load and Muscular Activity.'' } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.9) Devore, J. L. (2000), \emph{Probability and Statistics for Engineering and the Sciences (5th ed)}, Duxbury, Boston, MA. } \examples{ fm1 <- lme(effort ~ Type, data = ergoStool, random = ~ 1 | Subject) anova( fm1 ) } \keyword{datasets} nlme/man/gsummary.Rd0000644000176000001440000001022414543113774014153 0ustar ripleyusers% File nlme/man/gsummary.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gsummary} \title{Summarize by Groups} \usage{ gsummary(object, FUN, omitGroupingFactor, form, level, groups, invariantsOnly, \dots) } \alias{gsummary} \arguments{ \item{object}{an object to be summarized - usually a \code{groupedData} object or a \code{data.frame}. } \item{FUN}{an optional summary function or a list of summary functions to be applied to each variable in the frame. The function or functions are applied only to variables in \code{object} that vary within the groups defined by \code{groups}. Invariant variables are always summarized by group using the unique value that they assume within that group. If \code{FUN} is a single function it will be applied to each non-invariant variable by group to produce the summary for that variable. If \code{FUN} is a list of functions, the names in the list should designate classes of variables in the frame such as \code{ordered}, \code{factor}, or \code{numeric}. The indicated function will be applied to any non-invariant variables of that class. The default functions to be used are \code{mean} for numeric factors, and \code{Mode} for both \code{factor} and \code{ordered}. The \code{Mode} function, defined internally in \code{gsummary}, returns the modal or most popular value of the variable. It is different from the \code{mode} function that returns the S-language mode of the variable. } \item{omitGroupingFactor}{an optional logical value. When \code{TRUE} the grouping factor itself will be omitted from the group-wise summary but the levels of the grouping factor will continue to be used as the row names for the data frame that is produced by the summary. Defaults to \code{FALSE}. } \item{form}{an optional one-sided formula that defines the groups. When this formula is given, the right-hand side is evaluated in \code{object}, converted to a factor if necessary, and the unique levels are used to define the groups. Defaults to \code{formula(object)}. } \item{level}{an optional positive integer giving the level of grouping to be used in an object with multiple nested grouping levels. Defaults to the highest or innermost level of grouping.} \item{groups}{an optional factor that will be used to split the rows into groups. Defaults to \code{getGroups(object, form, level)}. } \item{invariantsOnly}{an optional logical value. When \code{TRUE} only those covariates that are invariant within each group will be summarized. The summary value for the group is always the unique value taken on by that covariate within the group. The columns in the summary are of the same class as the corresponding columns in \code{object}. By definition, the grouping factor itself must be an invariant. When combined with \code{omitGroupingFactor = TRUE}, this option can be used to discover is there are invariant covariates in the data frame. Defaults to \code{FALSE}. } \item{\dots}{optional additional arguments to the summary functions that are invoked on the variables by group. Often it is helpful to specify \code{na.rm = TRUE}. } } \description{ Provide a summary of the variables in a data frame by groups of rows. This is most useful with a \code{groupedData} object to examine the variables by group. } \value{ A \code{data.frame} with one row for each level of the grouping factor. The number of columns is at most the number of columns in \code{object}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{summary}}, \code{\link{groupedData}}, \code{\link{getGroups}}} \examples{ gsummary(Orthodont) # default summary by Subject ## gsummary with invariantsOnly = TRUE and omitGroupingFactor = TRUE ## determines whether there are covariates like Sex that are invariant ## within the repeated observations on the same Subject. gsummary(Orthodont, invariantsOnly = TRUE, omitGroupingFactor = TRUE) } \keyword{manip} nlme/man/print.summary.pdMat.Rd0000644000176000001440000000373614251721455016212 0ustar ripleyusers% File nlme/man/print.summary.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{print.summary.pdMat} \title{Print a summary.pdMat Object} \usage{ \method{print}{summary.pdMat}(x, sigma, rdig, Level, resid, \dots) } \alias{print.summary.pdMat} \arguments{ \item{x}{an object inheriting from class \code{"\link{summary.pdMat}"}, generally resulting from applying \code{\link{summary}} to an object inheriting from class \code{"\link{pdMat}"}.} \item{sigma}{an optional numeric value used as a multiplier for the square-root factor of the positive-definite matrix represented by \code{object} (usually the estimated within-group standard deviation from a mixed-effects model). Defaults to 1.} \item{rdig}{an optional integer value with the number of significant digits to be used in printing correlations. Defaults to 3.} \item{Level}{an optional character string with a description of the grouping level associated with \code{object} (generally corresponding to levels of grouping in a mixed-effects model). Defaults to NULL.} \item{resid}{an optional logical value. If \code{TRUE} an extra row with the \code{"residual"} standard deviation given in \code{sigma} will be included in the output. Defaults to \code{FALSE}.} \item{\dots}{optional arguments passed to \code{print.default}; see the documentation on that method function.} } \description{ The standard deviations and correlations associated with the positive-definite matrix represented by \code{object} (considered as a variance-covariance matrix) are printed, together with the formula and the grouping level associated \code{object}, if any are present. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{summary.pdMat}},\code{\link{pdMat}}} \examples{ pd1 <- pdCompSymm(3 * diag(2) + 1, form = ~age + age^2, data = Orthodont) print(summary(pd1), sigma = 1.2, resid = TRUE) } \keyword{models} nlme/man/getData.gls.Rd0000644000176000001440000000214014251721455014437 0ustar ripleyusers% File nlme/man/getData.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getData.gls} \title{Extract gls Object Data} \usage{ \method{getData}{gls}(object) } \alias{getData.gls} \alias{getData.gnls} \arguments{ \item{object}{an object inheriting from class \code{gls}, representing a generalized least squares fitted linear model.} } \description{ If present in the calling sequence used to produce \code{object}, the data frame used to fit the model is obtained. } \value{ if a \code{data} argument is present in the calling sequence that produced \code{object}, the corresponding data frame (with \code{na.action} and \code{subset} applied to it, if also present in the call that produced \code{object}) is returned; else, \code{NULL} is returned. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link{getData}} } \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), data = Ovary, correlation = corAR1(form = ~ 1 | Mare)) getData(fm1) } \keyword{models} nlme/man/Relaxin.Rd0000644000176000001440000000144014251721455013706 0ustar ripleyusers% File nlme/man/Relaxin.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Relaxin} \alias{Relaxin} \title{Assay for Relaxin} \description{ The \code{Relaxin} data frame has 198 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{Run}{ an ordered factor with levels \code{5} < \code{8} < \code{9} < \code{3} < \code{4} < \code{2} < \code{7} < \code{1} < \code{6} } \item{conc}{ a numeric vector } \item{cAMP}{ a numeric vector } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/getGroupsFormula.Rd0000644000176000001440000000344014251721456015614 0ustar ripleyusers% File nlme/man/getGroupsFormula.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroupsFormula} \title{Extract Grouping Formula} \usage{ getGroupsFormula(object, asList, sep) } \alias{getGroupsFormula} \alias{getGroupsFormula.default} \alias{getGroupsFormula.gls} \alias{getGroupsFormula.lmList} \alias{getGroupsFormula.lme} \alias{getGroupsFormula.reStruct} \arguments{ \item{object}{any object from which a formula can be extracted.} \item{asList}{an optional logical value. If \code{TRUE} the returned value with be a list of formulas; else, if \code{FALSE} the returned value will be a one-sided formula. Defaults to \code{FALSE}.} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}.} } \description{ The conditioning expression associated with \code{formula(object)} (i.e. the expression after the \code{|} operator) is returned either as a named list of one-sided formulas, or a single one-sided formula, depending on the value of \code{asList}. The components of the returned list are ordered from outermost to innermost level and are named after the grouping factor expression. } \value{ a one-sided formula, or a list of one-sided formulas, with the grouping structure associated with \code{formula(object)}. If no conditioning expression is present in \code{formula(object)} a \code{NULL} value is returned. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{getGroupsFormula.gls}}, \code{\link{getGroupsFormula.lmList}}, \code{\link{getGroupsFormula.lme}}, \code{\link{getGroupsFormula.reStruct}}, \code{\link{getGroups}} } \examples{ getGroupsFormula(y ~ x | g1/g2) } \keyword{models} nlme/man/Oats.Rd0000644000176000001440000000302514251721455013213 0ustar ripleyusers% File nlme/man/Oats.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Oats} \alias{Oats} \title{Split-plot Experiment on Varieties of Oats} \description{ The \code{Oats} data frame has 72 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Block}{ an ordered factor with levels \code{VI} < \code{V} < \code{III} < \code{IV} < \code{II} < \code{I} } \item{Variety}{ a factor with levels \code{Golden Rain} \code{Marvellous} \code{Victory} } \item{nitro}{ a numeric vector } \item{yield}{ a numeric vector } } } \details{ These data have been introduced by Yates (1935) as an example of a split-plot design. The treatment structure used in the experiment was a \eqn{3 \times 4}{3 x 4} full factorial, with three varieties of oats and four concentrations of nitrogen. The experimental units were arranged into six blocks, each with three whole-plots subdivided into four subplots. The varieties of oats were assigned randomly to the whole-plots and the concentrations of nitrogen to the subplots. All four concentrations of nitrogen were used on each whole-plot. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.15) Venables, W. N. and Ripley, B. D. (2002) \emph{Modern Applied Statistics with S. (4th ed)}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/comparePred.Rd0000644000176000001440000000640314251721455014551 0ustar ripleyusers% File nlme/man/comparePred.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{comparePred} \title{Compare Predictions} \usage{ comparePred(object1, object2, primary, minimum, maximum, length.out, level, \dots) } \alias{comparePred} \alias{comparePred.gls} \alias{comparePred.lme} \alias{comparePred.lmList} \arguments{ \item{object1,object2}{fitted model objects, from which predictions can be extracted using the \code{predict} method.} \item{primary}{an optional one-sided formula specifying the primary covariate to be used to generate the augmented predictions. By default, if a covariate can be extracted from the data used to generate the objects (using \code{getCovariate}), it will be used as \code{primary}.} \item{minimum}{an optional lower limit for the primary covariate. Defaults to \code{min(primary)}, after \code{primary} is evaluated in the \code{data} used in fitting \code{object1}.} \item{maximum}{an optional upper limit for the primary covariate. Defaults to \code{max(primary)}, after \code{primary} is evaluated in the \code{data} used in fitting \code{object1}.} \item{length.out}{an optional integer with the number of primary covariate values at which to evaluate the predictions. Defaults to 51.} \item{level}{an optional integer specifying the desired prediction level. Levels increase from outermost to innermost grouping, with level 0 representing the population (fixed effects) predictions. Only one level can be specified. Defaults to the innermost level.} \item{\dots}{some methods for the generic may require additional arguments.} } \description{ Predicted values are obtained at the specified values of \code{primary} for each object. If either \code{object1} or \code{object2} have a grouping structure (i.e. \code{getGroups(object)} is not \code{NULL}), predicted values are obtained for each group. When both objects determine groups, the group levels must be the same. If other covariates besides \code{primary} are used in the prediction model, their group-wise averages (numeric covariates) or most frequent values (categorical covariates) are used to obtain the predicted values. The original observations are also included in the returned object. } \value{ a data frame with four columns representing, respectively, the values of the primary covariate, the groups (if \code{object} does not have a grouping structure, all elements will be \code{1}), the predicted or observed values, and the type of value in the third column: the objects' names are used to classify the predicted values and \code{original} is used for the observed values. The returned object inherits from classes \code{comparePred} and \code{augPred}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{gls}, \code{lme}, and \code{lmList}. } \seealso{\code{\link{augPred}}, \code{\link{getGroups}}} \examples{ fm1 <- lme(distance ~ age * Sex, data = Orthodont, random = ~ age) fm2 <- update(fm1, distance ~ age) comparePred(fm1, fm2, length.out = 2) } \keyword{models} nlme/man/Covariate.Rd0000644000176000001440000000156714657640762014246 0ustar ripleyusers% File nlme/man/Covariate.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Covariate} \title{Assign Covariate Values} \usage{ covariate(object) <- value } \alias{covariate<-} \arguments{ \item{object}{any object with a \code{covariate} component.} \item{value}{a value to be assigned to the covariate associated with \code{object}.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include all \code{"\link{varFunc}"} classes, see \sQuote{\link{varClasses}}. } \value{ will depend on the method function; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{covariate<-.varFunc}}, \code{\link{getCovariate}}} \keyword{models} nlme/man/corAR1.Rd0000644000176000001440000000663314543113774013407 0ustar ripleyusers% File nlme/man/corAR1.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corAR1} \title{AR(1) Correlation Structure} \usage{ corAR1(value, form, fixed) } \alias{corAR1} \arguments{ \item{value}{the value of the lag 1 autocorrelation, which must be between -1 and 1. Defaults to 0 (no autocorrelation).} \item{form}{a one sided formula of the form \code{~ t}, or \code{~ t | g}, specifying a time covariate \code{t} and, optionally, a grouping factor \code{g}. A covariate for this correlation structure must be integer valued. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corAR1} class, representing an autocorrelation structure of order 1. Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corAR1}, representing an autocorrelation structure of order 1. } \references{ Box, 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, esp. pp. 235, 397. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{ACF.lme}}, \code{\link{corARMA}}, \code{\link{corClasses}}, \code{\link{Dim.corSpatial}}, \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}} } \examples{ ## covariate is observation order and grouping factor is Mare cs1 <- corAR1(0.2, form = ~ 1 | Mare) # Pinheiro and Bates, p. 236 cs1AR1 <- corAR1(0.8, form = ~ 1 | Subject) cs1AR1. <- Initialize(cs1AR1, data = Orthodont) corMatrix(cs1AR1.) # Pinheiro and Bates, p. 240 fm1Ovar.lme <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), data = Ovary, random = pdDiag(~sin(2*pi*Time))) fm2Ovar.lme <- update(fm1Ovar.lme, correlation = corAR1()) # Pinheiro and Bates, pp. 255-258: use in gls fm1Dial.gls <- gls(rate ~(pressure + I(pressure^2) + I(pressure^3) + I(pressure^4))*QB, Dialyzer) fm2Dial.gls <- update(fm1Dial.gls, weights = varPower(form = ~ pressure)) fm3Dial.gls <- update(fm2Dial.gls, corr = corAR1(0.771, form = ~ 1 | Subject)) # Pinheiro and Bates use in nlme: # from p. 240 needed on p. 396 fm1Ovar.lme <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), data = Ovary, random = pdDiag(~sin(2*pi*Time))) fm5Ovar.lme <- update(fm1Ovar.lme, correlation = corARMA(p = 1, q = 1)) # p. 396 fm1Ovar.nlme <- nlme(follicles~ A+B*sin(2*pi*w*Time)+C*cos(2*pi*w*Time), data=Ovary, fixed=A+B+C+w~1, random=pdDiag(A+B+w~1), start=c(fixef(fm5Ovar.lme), 1) ) # p. 397 fm2Ovar.nlme <- update(fm1Ovar.nlme, correlation=corAR1(0.311) ) } \keyword{models} nlme/man/Wheat.Rd0000644000176000001440000000162214251721456013357 0ustar ripleyusers% File nlme/man/Wheat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Wheat} \alias{Wheat} \title{Yields by growing conditions} \description{ The \code{Wheat} data frame has 48 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Tray}{ an ordered factor with levels \code{3} < \code{1} < \code{2} < \code{4} < \code{5} < \code{6} < \code{8} < \code{9} < \code{7} < \code{12} < \code{11} < \code{10} } \item{Moisture}{ a numeric vector } \item{fertilizer}{ a numeric vector } \item{DryMatter}{ a numeric vector } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/Soybean.Rd0000644000176000001440000000264614251721455013715 0ustar ripleyusers% File nlme/man/Soybean.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Soybean} \alias{Soybean} \title{Growth of soybean plants} \description{ The \code{Soybean} data frame has 412 rows and 5 columns. } \format{ This data frame contains the following columns: \describe{ \item{Plot}{ a factor giving a unique identifier for each plot. } \item{Variety}{ a factor indicating the variety; Forrest (F) or Plant Introduction #416937 (P). } \item{Year}{ a factor indicating the year the plot was planted. } \item{Time}{ a numeric vector giving the time the sample was taken (days after planting). } \item{weight}{ a numeric vector giving the average leaf weight per plant (g). } } } \details{ These data are described in Davidian and Giltinan (1995, 1.1.3, p.7) as ``Data from an experiment to compare growth patterns of two genotypes of soybeans: Plant Introduction #416937 (P), an experimental strain, and Forrest (F), a commercial variety.'' } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.27) Davidian, M. and Giltinan, D. M. (1995), \emph{Nonlinear Models for Repeated Measurement Data}, Chapman and Hall, London. } \examples{ summary(fm1 <- nlsList(SSlogis, data = Soybean)) } \keyword{datasets} nlme/man/MathAchieve.Rd0000644000176000001440000000226514251721455014470 0ustar ripleyusers% File nlme/man/MathAchieve.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{MathAchieve} \alias{MathAchieve} \title{Mathematics achievement scores} \description{ The \code{MathAchieve} data frame has 7185 rows and 6 columns. } \format{ This data frame contains the following columns: \describe{ \item{School}{ an ordered factor identifying the school that the student attends } \item{Minority}{ a factor with levels \code{No} \code{Yes} indicating if the student is a member of a minority racial group. } \item{Sex}{ a factor with levels \code{Male} \code{Female} } \item{SES}{ a numeric vector of socio-economic status. } \item{MathAch}{ a numeric vector of mathematics achievement scores. } \item{MEANSES}{ a numeric vector of the mean SES for the school. } } } \details{ Each row in this data frame contains the data for one student. } %\source{} \examples{ summary(MathAchieve) } \keyword{datasets} nlme/man/qqnorm.lme.Rd0000644000176000001440000000747014251721455014406 0ustar ripleyusers% File nlme/man/qqnorm.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{qqnorm.lme} \title{Normal Plot of Residuals or Random Effects from an lme Object} \usage{ \method{qqnorm}{lme}(y, form, abline, id, idLabels, grid, \dots) } \alias{qqnorm.lm} \alias{qqnorm.lme} \alias{qqnorm.lmList} \alias{qqnorm.nls} \arguments{ \item{y}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model or from class \code{"\link{lmList}"}, representing a list of \code{lm} objects, or from class \code{"lm"}, representing a fitted linear model, or from class \code{"nls"}, representing a nonlinear least squares fitted model.} \item{form}{an optional one-sided formula specifying the desired type of plot. Any variable present in the original data frame used to obtain \code{y} can be referenced. In addition, \code{y} itself can be referenced in the formula using the symbol \code{"."}. Conditional expressions on the right of a \code{|} operator can be used to define separate panels in a Trellis display. The expression on the right hand side of \code{form} and to the left of a \code{|} operator must evaluate to a residuals vector, or a random effects matrix. Default is \code{~ resid(., type = "p")}, corresponding to a normal plot of the standardized residuals evaluated at the innermost level of nesting.} \item{abline}{an optional numeric value, or numeric vector of length two. If given as a single value, a horizontal line will be added to the plot at that coordinate; else, if given as a vector, its values are used as the intercept and slope for a line added to the plot. If missing, no lines are added to the plot.} \item{id}{an optional numeric value, or one-sided formula. If given as a value, it is used as a significance level for a two-sided outlier test for the standardized residuals (random effects). Observations with absolute standardized residuals (random effects) greater than the \eqn{1 - value/2} quantile of the standard normal distribution are identified in the plot using \code{idLabels}. If given as a one-sided formula, its right hand side must evaluate to a logical, integer, or character vector which is used to identify observations in the plot. If missing, no observations are identified.} \item{idLabels}{an optional vector, or one-sided formula. If given as a vector, it is converted to character and used to label the observations identified according to \code{id}. If given as a one-sided formula, its right hand side must evaluate to a vector which is converted to character and used to label the identified observations. Default is the innermost grouping factor.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{FALSE}.} \item{\dots}{optional arguments passed to the Trellis plot function.} } \description{ Diagnostic plots for assessing the normality of residuals and random effects in the linear mixed-effects fit are obtained. The \code{form} argument gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a \code{|} operator) always implies that different panels are used for each level of the conditioning factor, according to a Trellis display. } \value{ a diagnostic Trellis plot for assessing normality of residuals or random effects. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{plot.lme}}} \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) ## normal plot of standardized residuals by gender qqnorm(fm1, ~ resid(., type = "p") | Sex, abline = c(0, 1)) ## normal plots of random effects qqnorm(fm1, ~ranef(.)) } \keyword{models} nlme/man/Remifentanil.Rd0000644000176000001440000000750614662037430014731 0ustar ripleyusers% File nlme/man/Remifentanil.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Remifentanil} \title{Pharmacokinetics of Remifentanil} \alias{Remifentanil} \docType{data} \description{ Intravenous infusion of remifentanil (a strong analgesic) in different rates over varying time periods was applied to a total of 65 patients. Concentration measurements of remifentanil were taken along with several covariates resulting in the \code{Remifentanil} data frame with 2107 rows and 12 columns. } \usage{ Remifentanil } \format{ This data frame (of class \code{"\link{groupedData}"}, specifically \code{"nfnGroupedData"}) contains the following columns: \describe{ \item{\code{ID}:}{numerical (patient) IDs.} \item{\code{Subject}:}{an \code{\link{ordered}} factor with 65 levels (of the \code{ID}s): \code{30} < \code{21} < \code{25} < \code{23} < \code{29} < \dots \dots < \code{36} < \code{6} < \code{5} < \code{10} < \code{9}.} \item{\code{Time}:}{time from beginning of infusion in minutes (\code{\link{numeric}}).} \item{\code{conc}:}{remifentanil concentration in [ng / ml] (numeric).} \item{\code{Rate}:}{infusion rate in [µg / min].} \item{\code{Amt}:}{amount of remifentanil given in the current time interval in [µg].} \item{\code{Age}:}{age of the patient in years.} \item{\code{Sex}:}{gender of the patient, a \code{\link{factor}} with levels \code{Female} and \code{Male}.} \item{\code{Ht}:}{height of the patient in cm.} \item{\code{Wt}:}{weight of the patient in kg.} \item{\code{BSA}:}{body surface area (DuBois and DuBois 1916): \eqn{% BSA := Wt^{0.425} \cdot Ht^{0.725} \cdot 0.007184}{% BSA := Wt^0.425 * Ht^0.725 * 0.007184}.} \item{\code{LBM}:}{lean body mass (James 1976), with slightly different formula for men \eqn{LBM_m := 1.1 Wt - 128 (Wt/Ht)^2}, and women \eqn{LBM_f := 1.07 Wt - 148 (Wt/Ht)^2}.} } } \author{of this help page: Niels Hagenbuch and Martin Maechler, SfS ETH Zurich.} \source{ Pinheiro, J. C. and Bates, D. M. (2000). \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \references{ Minto CF, Schnider TW, Egan TD, Youngs E, Lemmens HJM, Gambus PL, Billard V, Hoke JF, Moore KHP, Hermann DJ, Muir KT, Mandema JW, Shafer SL (1997). Influence of age and gender on the pharmacokinetics and pharmacodynamics of remifentanil: I. Model development. \emph{Anesthesiology} \bold{86} 1, 10--23. \doi{10.1097/00000542-199701000-00004} Charles F. Minto, Thomas W. Schnider and Steven L. Shafer (1997). Pharmacokinetics and Pharmacodynamics of Remifentanil: II. Model Application. \emph{Anesthesiology} \bold{86} 1, 24--33. \doi{10.1097/00000542-199701000-00005} } \examples{ plot(Remifentanil, type = "l", lwd = 2) # shows the 65 patients' remi profiles ## The same on log-log scale (*more* sensible for modeling ?): plot(Remifentanil, type = "l", lwd = 2, scales = list(log=TRUE)) str(Remifentanil) summary(Remifentanil) plot(xtabs(~Subject, Remifentanil)) summary(unclass(table(Remifentanil$Subject))) ## between 20 and 54 measurements per patient (median: 24; mean: 32.42) ## Only first measurement of each patient : dim(Remi.1 <- Remifentanil[!duplicated(Remifentanil[,"ID"]),]) # 65 x 12 LBMfn <- function(Wt, Ht, Sex) ifelse(Sex == "Female", 1.07 * Wt - 148*(Wt/Ht)^2, 1.1 * Wt - 128*(Wt/Ht)^2) with(Remi.1, stopifnot(all.equal(BSA, Wt^{0.425} * Ht^{0.725} * 0.007184, tolerance = 1.5e-5), all.equal(LBM, LBMfn(Wt, Ht, Sex), tolerance = 7e-7) )) ## Rate: typically 3 µg / kg body weight, but : sunflowerplot(Rate ~ Wt, Remifentanil) abline(0,3, lty=2, col=adjustcolor("black", 0.5)) } \keyword{datasets} nlme/man/fitted.gnlsStruct.Rd0000644000176000001440000000220714251721455015734 0ustar ripleyusers% File nlme/man/fitted.gnlsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fitted.gnlsStruct} \title{Calculate gnlsStruct Fitted Values} \usage{ \method{fitted}{gnlsStruct}(object, \dots) } \alias{fitted.gnlsStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{gnlsStruct}"}, representing a list of model components, such as \code{corStruct} and \code{varFunc} objects, and attributes specifying the underlying nonlinear model and the response variable.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The fitted values for the nonlinear model represented by \code{object} are extracted. } \value{ a vector with the fitted values for the nonlinear model represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is generally only used inside \code{gnls} and \code{fitted.gnls}. } \seealso{\code{\link{gnls}}, %\code{\link{fitted.gnls}}, \code{\link{residuals.gnlsStruct}} } \keyword{models} nlme/man/plot.nmGroupedData.Rd0000644000176000001440000001355114543113774016024 0ustar ripleyusers% File nlme/man/plot.nmGroupedData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.nmGroupedData} \title{Plot an nmGroupedData Object} \usage{ \method{plot}{nmGroupedData}(x, collapseLevel, displayLevel, outer, inner, preserve, FUN, subset, key, grid, \dots) } \alias{plot.nmGroupedData} \arguments{ \item{x}{an object inheriting from class \code{nmGroupedData}, representing a \code{groupedData} object with multiple grouping factors. } \item{collapseLevel}{an optional positive integer or character string indicating the grouping level to use when collapsing the data. Level values increase from outermost to innermost grouping. Default is the highest or innermost level of grouping. } \item{displayLevel}{an optional positive integer or character string indicating the grouping level to use for determining the panels in the Trellis display, when \code{outer} is missing. Default is \code{collapseLevel}. } \item{outer}{an optional logical value or one-sided formula, indicating covariates that are outer to the \code{displayLevel} grouping factor, which are used to determine the panels of the Trellis plot. If equal to \code{TRUE}, the \code{displayLevel} element \code{attr(object, "outer")} is used to indicate the outer covariates. An outer covariate is invariant within the sets of rows defined by the grouping factor. Ordering of the groups is done in such a way as to preserve adjacency of groups with the same value of the outer variables. Defaults to \code{NULL}, meaning that no outer covariates are to be used. } \item{inner}{an optional logical value or one-sided formula, indicating a covariate that is inner to the \code{displayLevel} grouping factor, which is used to associate points within each panel of the Trellis plot. If equal to \code{TRUE}, \code{attr(object, "outer")} is used to indicate the inner covariate. An inner covariate can change within the sets of rows defined by the grouping factor. Defaults to \code{NULL}, meaning that no inner covariate is present. } \item{preserve}{an optional one-sided formula indicating a covariate whose levels should be preserved when collapsing the data according to the \code{collapseLevel} grouping factor. The collapsing factor is obtained by pasting together the levels of the \code{collapseLevel} grouping factor and the values of the covariate to be preserved. Default is \code{NULL}, meaning that no covariates need to be preserved. } \item{FUN}{an optional summary function or a list of summary functions to be used for collapsing the data. The function or functions are applied only to variables in \code{object} that vary within the groups defined by \code{collapseLevel}. Invariant variables are always summarized by group using the unique value that they assume within that group. If \code{FUN} is a single function it will be applied to each non-invariant variable by group to produce the summary for that variable. If \code{FUN} is a list of functions, the names in the list should designate classes of variables in the data such as \code{ordered}, \code{factor}, or \code{numeric}. The indicated function will be applied to any non-invariant variables of that class. The default functions to be used are \code{mean} for numeric factors, and \code{Mode} for both \code{factor} and \code{ordered}. The \code{Mode} function, defined internally in \code{gsummary}, returns the modal or most popular value of the variable. It is different from the \code{mode} function that returns the S-language mode of the variable.} \item{subset}{an optional named list. Names can be either positive integers representing grouping levels, or names of grouping factors. Each element in the list is a vector indicating the levels of the corresponding grouping factor to be used for plotting the data. Default is \code{NULL}, meaning that all levels are used.} \item{key}{an optional logical value, or list. If \code{TRUE}, a legend is included at the top of the plot indicating which symbols (colors) correspond to which prediction levels. If \code{FALSE}, no legend is included. If given as a list, \code{key} is passed down as an argument to the \code{trellis} function generating the plots (\code{xyplot}). Defaults to \code{TRUE}.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{TRUE}.} \item{\dots}{optional arguments passed to the Trellis plot function.} } \description{ The \code{groupedData} object is summarized by the values of the \code{displayLevel} grouping factor (or the combination of its values and the values of the covariate indicated in \code{preserve}, if any is present). The collapsed data is used to produce a new \code{groupedData} object, with grouping factor given by the \code{displayLevel} factor, which is plotted using the appropriate \code{plot} method for \code{groupedData} objects with single level of grouping. } \value{ a Trellis display of the data collapsed over the values of the \code{collapseLevel} grouping factor and grouped according to the \code{displayLevel} grouping factor. } \references{ Bates, D.M. and Pinheiro, J.C. (1997), "Software Design for Longitudinal Data", in "Modelling Longitudinal and Spatially Correlated Data: Methods, Applications and Future Directions", T.G. Gregoire (ed.), Springer-Verlag, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{groupedData}}, \code{\link{collapse.groupedData}}, \code{\link{plot.nfnGroupedData}}, \code{\link{plot.nffGroupedData}} } \examples{ # no collapsing, panels by Dog plot(Pixel, displayLevel = "Dog", inner = ~Side) # collapsing by Dog, preserving day plot(Pixel, collapseLevel = "Dog", preserve = ~day) } \keyword{models} nlme/man/glsObject.Rd0000644000176000001440000000507714611720754014233 0ustar ripleyusers% File nlme/man/glsObject.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{glsObject} \title{Fitted gls Object} \alias{glsObject} \description{ An object returned by the \code{\link{gls}} function, inheriting from class \code{"gls"} and representing a generalized least squares fitted linear model. Objects of this class have methods for the generic functions \code{anova}, \code{coef}, \code{fitted}, \code{formula}, \code{getGroups}, \code{getResponse}, \code{intervals}, \code{logLik}, \code{plot}, \code{predict}, \code{print}, \code{residuals}, \code{summary}, and \code{update}. } \value{ The following components must be included in a legitimate \code{"gls"} object. \item{apVar}{an approximate covariance matrix for the variance-covariance coefficients. If \code{apVar = FALSE} in the list of control values used in the call to \code{gls}, this component is equal to \code{NULL}.} \item{call}{a list containing an image of the \code{gls} call that produced the object.} \item{coefficients}{a vector with the estimated linear model coefficients.} \item{contrasts}{a list of the contrast matrices used to represent factors in the model formula. This information is important for making predictions from a new data frame in which not all levels of the original factors are observed. If no factors are used in the model, this component will be an empty list.} \item{dims}{a list with basic dimensions used in the model fit, including the components \code{N} - the number of observations in the data and \code{p} - the number of coefficients in the linear model.} \item{fitted}{a vector with the fitted values.} \item{modelStruct}{an object inheriting from class \code{glsStruct}, representing a list of linear model components, such as \code{corStruct} and \code{varFunc} objects.} \item{groups}{the correlation structure grouping factor, if any is present.} \item{logLik}{the log-likelihood at convergence.} \item{method}{the estimation method: either \code{"ML"} for maximum likelihood, or \code{"REML"} for restricted maximum likelihood.} \item{numIter}{the number of iterations used in the iterative algorithm.} \item{residuals}{a vector with the residuals.} \item{sigma}{the estimated residual standard error.} \item{varBeta}{an approximate covariance matrix of the coefficients estimates.} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link{glsStruct}}} \keyword{models} nlme/man/recalc.Rd0000644000176000001440000000264614657640762013561 0ustar ripleyusers% File nlme/man/recalc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{recalc} \title{Recalculate Condensed Linear Model Object} \usage{ recalc(object, conLin, \dots) } \alias{recalc} \arguments{ \item{object}{any object which induces a recalculation of the condensed linear model object \code{conLin}.} \item{conLin}{a condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying model.} \item{\dots}{some methods for this generic can take additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{corStruct}, \code{modelStruct}, \code{reStruct}, and \code{varFunc}. } \value{ the recalculated condensed linear model object. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{This function is only used inside model fitting functions, such as \code{lme} and \code{gls}, that require recalculation of a condensed linear model object.} \seealso{\code{\link{recalc.corStruct}}, \code{\link{recalc.modelStruct}}, \code{\link{recalc.reStruct}}, \code{\link{recalc.varFunc}}} \keyword{models} nlme/man/logLik.corStruct.Rd0000644000176000001440000000256414251721455015524 0ustar ripleyusers% File nlme/man/logLik.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.corStruct} \title{Extract corStruct Log-Likelihood} \usage{ \method{logLik}{corStruct}(object, data, \dots) } \alias{logLik.corStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"}, representing a correlation structure.} \item{data}{this argument is included to make this method function compatible with other \code{logLik} methods and will be ignored.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the component of a Gaussian log-likelihood associated with the correlation structure, which is equal to the negative of the logarithm of the determinant (or sum of the logarithms of the determinants) of the matrix (or matrices) represented by \code{object}. } \value{ the negative of the logarithm of the determinant (or sum of the logarithms of the determinants) of the correlation matrix (or matrices) represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{logDet.corStruct}}, \code{\link{logLik.lme}}, } \examples{ cs1 <- corAR1(0.2) cs1 <- Initialize(cs1, data = Orthodont) logLik(cs1) } \keyword{models} nlme/man/residuals.lmList.Rd0000644000176000001440000000421214251721455015542 0ustar ripleyusers% File nlme/man/residuals.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{residuals.lmList} \title{Extract lmList Residuals} \usage{ \method{residuals}{lmList}(object, type, subset, asList, \dots) } \alias{residuals.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{subset}{an optional character or integer vector naming the \code{lm} components of \code{object} from which the residuals are to be extracted. Default is \code{NULL}, in which case all components are used. } \item{type}{an optional character string specifying the type of residuals to be extracted. Options include \code{"response"} for the "raw" residuals (observed - fitted), \code{"pearson"} for the standardized residuals (raw residuals divided by the estimated residual standard error) using different standard errors for each \code{lm} fit, and \code{"pooled.pearson"} for the standardized residuals using a pooled estimate of the residual standard error. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"response"}. } \item{asList}{an optional logical value. If \code{TRUE}, the returned object is a list with the residuals split by groups; else the returned value is a vector. Defaults to \code{FALSE}. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The residuals are extracted from each \code{lm} component of \code{object} and arranged into a list with as many components as \code{object}, or combined into a single vector. } \value{ a list with components given by the residuals of each \code{lm} component of \code{object}, or a vector with the residuals for all \code{lm} components of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{fitted.lmList}}} \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) residuals(fm1) } \keyword{models} nlme/man/quinModel.Rd0000644000176000001440000000412014251721455014237 0ustar ripleyusers% File nlme/man/quinModel.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{quinModel} \alias{quinModel} \title{Model function for the Quinidine data} \description{ A model function for a model used with the \code{Quinidine} data. This function calls compiled C code. } \usage{ quinModel(Subject, time, conc, dose, interval, lV, lKa, lCl) } \arguments{ \item{Subject}{ a factor identifying the patient on whom the data were collected. } \item{time}{ a numeric vector giving the time (hr) at which the drug was administered or the blood sample drawn. This is measured from the time the patient entered the study. } \item{conc}{ a numeric vector giving the serum quinidine concentration (mg/L). } \item{dose}{ a numeric vector giving the dose of drug administered (mg). Although there were two different forms of quinidine administered, the doses were adjusted for differences in salt content by conversion to milligrams of quinidine base. } \item{interval}{ a numeric vector giving the when the drug has been given at regular intervals for a sufficiently long period of time to assume steady state behavior, the interval is recorded. } \item{lV}{numeric. A vector of values of the natural log of the effective volume of distribution according to \code{Subject} and \code{time}.} \item{lKa}{numeric. A vector of values of the natural log of the absorption rate constant according to \code{Subject} and \code{time}.} \item{lCl}{numeric. A vector of values of the natural log of the clearance parameter according to \code{Subject} and \code{time}.} } \details{ See the details section of \code{\link{Quinidine}} for a description of the model function that \code{quinModel} evaluates. } \value{ a numeric vector of predicted quinidine concentrations. } \references{ Pinheiro, J. C. and Bates, D. M. (2000) \emph{Mixed-effects Models in S and S-PLUS}, Springer. (section 8.2) } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu} } \keyword{models} nlme/man/intervals.lme.Rd0000644000176000001440000000612514251721456015075 0ustar ripleyusers% File nlme/man/intervals.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{intervals.lme} \title{Confidence Intervals on lme Parameters} \usage{ \method{intervals}{lme}(object, level = 0.95, which = c("all", "var-cov", "fixed"), \dots) } \alias{intervals.lme} \alias{print.intervals.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{level}{an optional numeric value with the confidence level for the intervals. Defaults to 0.95.} \item{which}{an optional character string specifying the subset of parameters for which to construct the confidence intervals. Possible values are \code{"all"} for all parameters, \code{"var-cov"} for the variance-covariance parameters only, and \code{"fixed"} for the fixed effects only. Defaults to \code{"all"}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Approximate confidence intervals for the parameters in the linear mixed-effects model represented by \code{object} are obtained, using a normal approximation to the distribution of the (restricted) maximum likelihood estimators (the estimators are assumed to have a normal distribution centered at the true parameter values and with covariance matrix equal to the negative inverse Hessian matrix of the (restricted) log-likelihood evaluated at the estimated parameters). Confidence intervals are obtained in an unconstrained scale first, using the normal approximation, and, if necessary, transformed to the constrained scale. The \code{pdNatural} parametrization is used for general positive-definite matrices. } \value{ a list with components given by data frames with rows corresponding to parameters and columns \code{lower}, \code{est.}, and \code{upper} representing respectively lower confidence limits, the estimated values, and upper confidence limits for the parameters. Possible components are: \item{fixed}{fixed effects, only present when \code{which} is not equal to \code{"var-cov"}.} \item{reStruct}{random effects variance-covariance parameters, only present when \code{which} is not equal to \code{"fixed"}.} \item{corStruct}{within-group correlation parameters, only present when \code{which} is not equal to \code{"fixed"} and a correlation structure is used in \code{object}.} \item{varFunc}{within-group variance function parameters, only present when \code{which} is not equal to \code{"fixed"} and a variance function structure is used in \code{object}.} \item{sigma}{within-group standard deviation.} } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{intervals}}, \code{\link{print.intervals.lme}}, \code{\link{pdNatural}}} \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) intervals(fm1) } \keyword{models} nlme/man/corSpatial.Rd0000644000176000001440000001064014251721455014407 0ustar ripleyusers% File nlme/man/corSpatial.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corSpatial} \title{Spatial Correlation Structure} \usage{ corSpatial(value, form, nugget, type, metric, fixed) } \alias{corSpatial} \arguments{ \item{value}{an optional vector with the parameter values in constrained form. If \code{nugget} is \code{FALSE}, \code{value} can have only one element, corresponding to the "range" of the spatial correlation structure, which must be greater than zero. If \code{nugget} is \code{TRUE}, meaning that a nugget effect is present, \code{value} can contain one or two elements, the first being the "range" and the second the "nugget effect" (one minus the correlation between two observations taken arbitrarily close together); the first must be greater than zero and the second must be between zero and one. Defaults to \code{numeric(0)}, which results in a range of 90\% of the minimum distance and a nugget effect of 0.1 being assigned to the parameters when \code{object} is initialized.} \item{form}{a one sided formula of the form \code{~ S1+...+Sp}, or \code{~ S1+...+Sp | g}, specifying spatial covariates \code{S1} through \code{Sp} and, optionally, a grouping factor \code{g}. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{nugget}{an optional logical value indicating whether a nugget effect is present. Defaults to \code{FALSE}.} \item{type}{an optional character string specifying the desired type of correlation structure. Available types include \code{"spherical"}, \code{"exponential"}, \code{"gaussian"}, \code{"linear"}, and \code{"rational"}. See the documentation on the functions \code{corSpher}, \code{corExp}, \code{corGaus}, \code{corLin}, and \code{corRatio} for a description of these correlation structures. Partial matching of arguments is used, so only the first character needs to be provided.Defaults to \code{"spherical"}.} \item{metric}{an optional character string specifying the distance metric to be used. The currently available options are \code{"euclidean"} for the root sum-of-squares of distances; \code{"maximum"} for the maximum difference; and \code{"manhattan"} for the sum of the absolute differences. Partial matching of arguments is used, so only the first three characters need to be provided. Defaults to \code{"euclidean"}.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corSpatial} class, representing a spatial correlation structure. This class is "virtual", having four "real" classes, corresponding to specific spatial correlation structures, associated with it: \code{corExp}, \code{corGaus}, \code{corLin}, \code{corRatio}, and \code{corSpher}. The returned object will inherit from one of these "real" classes, determined by the \code{type} argument, and from the "virtual" \code{corSpatial} class. Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class determined by the \code{type} argument and also inheriting from class \code{corSpatial}, representing a spatial correlation structure. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. Littel, Milliken, Stroup, and Wolfinger (1996) "SAS Systems for Mixed Models", SAS Institute. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corExp}}, \code{\link{corGaus}}, \code{\link{corLin}}, \code{\link{corRatio}}, \code{\link{corSpher}}, \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}}, \code{\link{dist}} } \examples{ sp1 <- corSpatial(form = ~ x + y + z, type = "g", metric = "man") } \keyword{models} nlme/man/getCovariate.corStruct.Rd0000644000176000001440000000326614611720754016721 0ustar ripleyusers% File nlme/man/getCovariate.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getCovariate.corStruct} \title{Extract corStruct Object Covariate} \usage{ \method{getCovariate}{corStruct}(object, form, data) } \alias{getCovariate.corStruct} \alias{getCovariate.corSpatial} \arguments{ \item{object}{an object inheriting from class \code{corStruct} representing a correlation structure.} \item{form}{this argument is included to make the method function compatible with the generic. It will be assigned the value of \code{formula(object)} and should not be modified.} \item{data}{an optional data frame in which to evaluate the variables defined in \code{form}, in case \code{object} is not initialized and the covariate needs to be evaluated.} } \description{ This method function extracts the covariate(s) associated with \code{object}. } \value{ when the correlation structure does not include a grouping factor, the returned value will be a vector or a matrix with the covariate(s) associated with \code{object}. If a grouping factor is present, the returned value will be a list of vectors or matrices with the covariate(s) corresponding to each grouping level. For spatial correlation structures, this extracts the \emph{distances} implied by the covariates, and excludes 1-observation groups. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{getCovariate}}} \examples{ cs1 <- corAR1(form = ~ 1 | Subject) getCovariate(cs1, data = Orthodont) } \keyword{models} nlme/man/Wafer.Rd0000644000176000001440000000220514251721455013350 0ustar ripleyusers% File nlme/man/Wafer.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Wafer} \alias{Wafer} \title{Modeling of Analog MOS Circuits} \description{ The \code{Wafer} data frame has 400 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Wafer}{ a factor with levels \code{1} \code{2} \code{3} \code{4} \code{5} \code{6} \code{7} \code{8} \code{9} \code{10} } \item{Site}{ a factor with levels \code{1} \code{2} \code{3} \code{4} \code{5} \code{6} \code{7} \code{8} } \item{voltage}{ a numeric vector } \item{current}{ a numeric vector } } } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/lme.groupedData.Rd0000644000176000001440000001530114363200201015301 0ustar ripleyusers% File nlme/man/lme.groupedData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{lme.groupedData} \title{LME fit from groupedData Object} \usage{ \method{lme}{groupedData}(fixed, data, random, correlation, weights, subset, method, na.action, control, contrasts, keep.data = TRUE) } \alias{lme.groupedData} \arguments{ \item{fixed}{a data frame inheriting from class \code{"\link{groupedData}"}.} \item{data}{this argument is included for consistency with the generic function. It is ignored in this method function.} \item{random}{optionally, any of the following: (i) a one-sided formula of the form \code{~x1+...+xn | g1/.../gm}, with \code{x1+...+xn} specifying the model for the random effects and \code{g1/.../gm} the grouping structure (\code{m} may be equal to 1, in which case no \code{/} is required). The random effects formula will be repeated for all levels of grouping, in the case of multiple levels of grouping; (ii) a list of one-sided formulas of the form \code{~x1+...+xn | g}, with possibly different random effects models for each grouping level. The order of nesting will be assumed the same as the order of the elements in the list; (iii) a one-sided formula of the form \code{~x1+...+xn}, or a \code{pdMat} object with a formula (i.e. a non-\code{NULL} value for \code{formula(object)}), or a list of such formulas or \code{pdMat} objects. In this case, the grouping structure formula will be derived from the data used to fit the linear mixed-effects model, which should inherit from class \code{groupedData}; (iv) a named list of formulas or \code{pdMat} objects as in (iii), with the grouping factors as names. The order of nesting will be assumed the same as the order of the order of the elements in the list; (v) an \code{reStruct} object. See the documentation on \code{pdClasses} for a description of the available \code{pdMat} classes. Defaults to a formula consisting of the right hand side of \code{fixed}.} \item{correlation}{an optional \code{corStruct} object describing the within-group correlation structure. See the documentation of \code{\link{corClasses}} for a description of the available \code{corStruct} classes. Defaults to \code{NULL}, corresponding to no within-group correlations.} \item{weights}{an optional \code{varFunc} object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to \code{varFixed}, corresponding to fixed variance weights. See the documentation on \code{\link{varClasses}} for a description of the available \code{varFunc} classes. Defaults to \code{NULL}, corresponding to homoscedastic within-group errors.} \item{subset}{an optional expression indicating the subset of the rows of \code{data} that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{method}{a character string. If \code{"REML"} the model is fit by maximizing the restricted log-likelihood. If \code{"ML"} the log-likelihood is maximized. Defaults to \code{"REML"}.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{lme} to print an error message and terminate if there are any incomplete observations.} \item{control}{a list of control values for the estimation algorithm to replace the default values returned by the function \code{lmeControl}. Defaults to an empty list.} \item{contrasts}{an optional list. See the \code{contrasts.arg} of \code{model.matrix.default}.} \item{keep.data}{logical: should the \code{data} argument (if supplied and a data frame) be saved as part of the model object?} } \description{ The response variable and primary covariate in \code{formula(fixed)} are used to construct the fixed effects model formula. This formula and the \code{groupedData} object are passed as the \code{fixed} and \code{data} arguments to \code{lme.formula}, together with any other additional arguments in the function call. See the documentation on \code{\link{lme.formula}} for a description of that function. } \value{ an object of class \code{lme} representing the linear mixed-effects model fit. Generic functions such as \code{print}, \code{plot} and \code{summary} have methods to show the results of the fit. See \code{lmeObject} for the components of the fit. The functions \code{resid}, \code{coef}, \code{fitted}, \code{fixed.effects}, and \code{random.effects} can be used to extract some of its components. } \references{ The computational methods follow on the general framework of Lindstrom, M.J. and Bates, D.M. (1988). The model formulation is described in Laird, N.M. and Ware, J.H. (1982). The variance-covariance parametrizations are described in Pinheiro, J.C. and Bates., D.M. (1996). The different correlation structures available for the \code{correlation} argument are described in Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994), Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996), and Venables, W.N. and Ripley, B.D. (2002). The use of variance functions for linear and nonlinear mixed effects models is presented in detail in Davidian, M. and Giltinan, D.M. (1995). Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day. Davidian, M. and Giltinan, D.M. (1995) "Nonlinear Mixed Effects Models for Repeated Measurement Data", Chapman and Hall. Laird, N.M. and Ware, J.H. (1982) "Random-Effects Models for Longitudinal Data", Biometrics, 38, 963-974. Lindstrom, M.J. and Bates, D.M. (1988) "Newton-Raphson and EM Algorithms for Linear Mixed-Effects Models for Repeated-Measures Data", Journal of the American Statistical Association, 83, 1014-1022. Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C. and Bates., D.M. (1996) "Unconstrained Parametrizations for Variance-Covariance Matrices", Statistics and Computing, 6, 289-296. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{groupedData}}, \code{\link{lmeObject}} } \examples{ fm1 <- lme(Orthodont) summary(fm1) } \keyword{models} nlme/man/Phenobarb.Rd0000644000176000001440000000460514251721456014213 0ustar ripleyusers% File nlme/man/Phenobarb.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Phenobarb} \alias{Phenobarb} \title{Phenobarbitol Kinetics} \description{ The \code{Phenobarb} data frame has 744 rows and 7 columns. } \format{ This data frame contains the following columns: \describe{ \item{Subject}{ an ordered factor identifying the infant. } \item{Wt}{ a numeric vector giving the birth weight of the infant (kg). } \item{Apgar}{ an ordered factor giving the 5-minute Apgar score for the infant. This is an indication of health of the newborn infant. } \item{ApgarInd}{ a factor indicating whether the 5-minute Apgar score is \code{< 5} or \code{>= 5}. } \item{time}{ a numeric vector giving the time when the sample is drawn or drug administered (hr). } \item{dose}{ a numeric vector giving the dose of drug administered (\eqn{u}{\mu}g/kg). } \item{conc}{ a numeric vector giving the phenobarbital concentration in the serum (\eqn{u}{\mu}g/L). } } } \details{ Data from a pharmacokinetics study of phenobarbital in neonatal infants. During the first few days of life the infants receive multiple doses of phenobarbital for prevention of seizures. At irregular intervals blood samples are drawn and serum phenobarbital concentrations are determined. The data were originally given in Grasela and Donn(1985) and are analyzed in Boeckmann, Sheiner and Beal (1994), in Davidian and Giltinan (1995), and in Littell et al. (1996). } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.23) Davidian, M. and Giltinan, D. M. (1995), \emph{Nonlinear Models for Repeated Measurement Data}, Chapman and Hall, London. (section 6.6) Grasela and Donn (1985), Neonatal population pharmacokinetics of phenobarbital derived from routine clinical data, \emph{Developmental Pharmacology and Therapeutics}, \bold{8}, 374-383. Boeckmann, A. J., Sheiner, L. B., and Beal, S. L. (1994), \emph{NONMEM Users Guide: Part V}, University of California, San Francisco. Littell, R. C., Milliken, G. A., Stroup, W. W. and Wolfinger, R. D. (1996), \emph{SAS System for Mixed Models}, SAS Institute, Cary, NC. } %\examples{} \keyword{datasets} nlme/man/Matrix.reStruct.Rd0000644000176000001440000000246114251721455015366 0ustar ripleyusers% File nlme/man/Matrix.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Matrix.reStruct} \title{Assign reStruct Matrices} \usage{ \method{matrix}{reStruct}(object) <- value } \alias{matrix<-.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{value}{a matrix, or list of matrices, with the new values to be assigned to the matrices associated with the \code{pdMat} components of \code{object}.} } \description{ The individual matrices in \code{value} are assigned to each \code{pdMat} component of \code{object}, in the order they are listed. The new matrices must have the same dimensions as the matrices they are meant to replace. } \value{ an \code{reStruct} object similar to \code{object}, but with the coefficients of the individual \code{pdMat} components modified to produce the matrices listed in \code{value}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{reStruct}}, \code{\link{pdMat}}, \code{"\link{matrix<-}"} } \examples{ rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) matrix(rs1) <- list(diag(2), 3) } \keyword{models} nlme/man/getGroups.corStruct.Rd0000644000176000001440000000303314251721456016253 0ustar ripleyusers% File nlme/man/getGroups.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroups.corStruct} \title{Extract corStruct Groups} \usage{ \method{getGroups}{corStruct}(object, form, level, data, sep) } \alias{getGroups.corStruct} \arguments{ \item{object}{an object inheriting from class \code{corStruct} representing a correlation structure.} \item{form}{this argument is included to make the method function compatible with the generic. It will be assigned the value of \code{formula(object)} and should not be modified.} \item{level}{this argument is included to make the method function compatible with the generic and is not used.} \item{data}{an optional data frame in which to evaluate the variables defined in \code{form}, in case \code{object} is not initialized and the grouping factor needs to be evaluated.} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}.} } \description{ This method function extracts the grouping factor associated with \code{object}, if any is present. } \value{ if a grouping factor is present in the correlation structure represented by \code{object}, the function returns the corresponding factor vector; else the function returns \code{NULL}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{getGroups}}} \examples{ cs1 <- corAR1(form = ~ 1 | Subject) getGroups(cs1, data = Orthodont) } \keyword{models} nlme/man/Milk.Rd0000644000176000001440000000242314251721456013203 0ustar ripleyusers% File nlme/man/Milk.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Milk} \alias{Milk} \title{Protein content of cows' milk} \description{ The \code{Milk} data frame has 1337 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{protein}{ a numeric vector giving the protein content of the milk. } \item{Time}{ a numeric vector giving the time since calving (weeks). } \item{Cow}{ an ordered factor giving a unique identifier for each cow. } \item{Diet}{ a factor with levels \code{barley}, \code{barley+lupins}, and \code{lupins} identifying the diet for each cow. } } } \details{ Diggle, Liang, and Zeger (1994) describe data on the protein content of cows' milk in the weeks following calving. The cattle are grouped according to whether they are fed a diet with barley alone, with barley and lupins, or with lupins alone. } \source{ Diggle, Peter J., Liang, Kung-Yee and Zeger, Scott L. (1994), \emph{Analysis of longitudinal data}, Oxford University Press, Oxford. } %\examples{} \keyword{datasets} nlme/man/as.matrix.pdMat.Rd0000644000176000001440000000166714251721455015271 0ustar ripleyusers% File nlme/man/as.matrix.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{as.matrix.pdMat} \title{Matrix of a pdMat Object} \usage{ \method{as.matrix}{pdMat}(x, \dots) } \alias{as.matrix.pdMat} \arguments{ \item{x}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive-definite matrix.} \item{\dots}{further arguments passed from other methods.} } \description{ This method function extracts the positive-definite matrix represented by \code{x}. } \value{ a matrix corresponding to the positive-definite matrix represented by \code{x}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{pdMat}}, \code{\link{corMatrix}}} \examples{ as.matrix(pdSymm(diag(4))) } \keyword{models} nlme/man/Dim.Rd0000644000176000001440000000213014657640762013025 0ustar ripleyusers% File nlme/man/Dim.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Dim} \title{Extract Dimensions from an Object} \usage{ Dim(object, \dots) } \alias{Dim} \alias{Dim.default} \arguments{ \item{object}{any object for which dimensions can be extracted.} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{"\link{corSpatial}"}, \code{"\link{corStruct}"}, \code{"pdCompSymm"}, \code{"pdDiag"}, \code{"pdIdent"}, \code{"pdMat"}, and \code{"pdSymm"}. } \value{ will depend on the method function used; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ If \code{dim} allowed more than one argument, there would be no need for this generic function. } \seealso{ \code{\link{Dim.corSpatial}}, \code{\link{Dim.pdMat}}, \code{\link{Dim.corStruct}} } \keyword{models} nlme/man/varConstPower.Rd0000644000176000001440000000756514251721455015136 0ustar ripleyusers% File nlme/man/varConstPower.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varConstPower} \title{Constant Plus Power Variance Function} \usage{ varConstPower(const, power, form, fixed) } \alias{varConstPower} \arguments{ \item{const, power}{optional numeric vectors, or lists of numeric values, with, respectively, the coefficients for the constant and the power terms. Both arguments must have length one, unless a grouping factor is specified in \code{form}. If either argument has length greater than one, it must have names which identify its elements to the levels of the grouping factor defined in \code{form}. If a grouping factor is present in \code{form} and the argument has length one, its value will be assigned to all grouping levels. Only positive values are allowed for \code{const}. Default is \code{numeric(0)}, which results in a vector of zeros of appropriate length being assigned to the coefficients when \code{object} is initialized (corresponding to constant variance equal to one).} \item{form}{an optional one-sided formula of the form \code{~ v}, or \code{~ v | g}, specifying a variance covariate \code{v} and, optionally, a grouping factor \code{g} for the coefficients. The variance covariate must evaluate to a numeric vector and may involve expressions using \code{"."}, representing a fitted model object from which fitted values (\code{fitted(.)}) and residuals (\code{resid(.)}) can be extracted (this allows the variance covariate to be updated during the optimization of an object function). When a grouping factor is present in \code{form}, a different coefficient value is used for each of its levels. Several grouping variables may be simultaneously specified, separated by the \code{*} operator, as in \code{~ v | g1 * g2 * g3}. In this case, the levels of each grouping variable are pasted together and the resulting factor is used to group the observations. Defaults to \code{~ fitted(.)} representing a variance covariate given by the fitted values of a fitted model object and no grouping factor. } \item{fixed}{an optional list with components \code{const} and/or \code{power}, consisting of numeric vectors, or lists of numeric values, specifying the values at which some or all of the coefficients in the variance function should be fixed. If a grouping factor is specified in \code{form}, the components of \code{fixed} must have names identifying which coefficients are to be fixed. Coefficients included in \code{fixed} are not allowed to vary during the optimization of an objective function. Defaults to \code{NULL}, corresponding to no fixed coefficients.} } \description{ This function is a constructor for the \code{varConstPower} class, representing a constant plus power variance function structure. Letting \eqn{v} denote the variance covariate and \eqn{\sigma^2(v)}{s2(v)} denote the variance function evaluated at \eqn{v}, the constant plus power variance function is defined as \eqn{\sigma^2(v) = (\theta_1 + |v|^\theta_2)^2}{s2(v) = (t1 + |v|^t2)^2}, where \eqn{\theta_1,\theta_2}{t1, t2} are the variance function coefficients. When a grouping factor is present, different \eqn{\theta_1,\theta_2}{t1, t2} are used for each factor level. } \value{ a \code{varConstPower} object representing a constant plus power variance function structure, also inheriting from class \code{varFunc}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{varClasses}}, \code{\link{varWeights.varFunc}}, \code{\link{coef.varConstPower}}} \examples{ vf1 <- varConstPower(1.2, 0.2, form = ~age|Sex) } \keyword{models} nlme/man/Dialyzer.Rd0000644000176000001440000000422414251721455014072 0ustar ripleyusers% File nlme/man/Dialyzer.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Dialyzer} \alias{Dialyzer} \title{High-Flux Hemodialyzer} \description{ The \code{Dialyzer} data frame has 140 rows and 5 columns. } \format{ This data frame contains the following columns: \describe{ \item{Subject}{ an ordered factor with levels \code{10} < \code{8} < \code{2} < \code{6} < \code{3} < \code{5} < \code{9} < \code{7} < \code{1} < \code{4} < \code{17} < \code{20} < \code{11} < \code{12} < \code{16} < \code{13} < \code{14} < \code{18} < \code{15} < \code{19} giving the unique identifier for each subject } \item{QB}{ a factor with levels \code{200} and \code{300} giving the bovine blood flow rate (dL/min). } \item{pressure}{ a numeric vector giving the transmembrane pressure (dmHg). } \item{rate}{ the hemodialyzer ultrafiltration rate (mL/hr). } \item{index}{ index of observation within subject---1 through 7. } } } \details{ Vonesh and Carter (1992) describe data measured on high-flux hemodialyzers to assess their \emph{in vivo} ultrafiltration characteristics. The ultrafiltration rates (in mL/hr) of 20 high-flux dialyzers were measured at seven different transmembrane pressures (in dmHg). The \emph{in vitro} evaluation of the dialyzers used bovine blood at flow rates of either 200~dl/min or 300~dl/min. The data, are also analyzed in Littell, Milliken, Stroup, and Wolfinger (1996). } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.6) Vonesh, E. F. and Carter, R. L. (1992), Mixed-effects nonlinear regression for unbalanced repeated measures, \emph{Biometrics}, \bold{48}, 1-18. Littell, R. C., Milliken, G. A., Stroup, W. W. and Wolfinger, R. D. (1996), \emph{SAS System for Mixed Models}, SAS Institute, Cary, NC. } %\examples{} \keyword{datasets} nlme/man/getCovariate.Rd0000644000176000001440000000237314657640762014742 0ustar ripleyusers% File nlme/man/getCovariate.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getCovariate} \title{Extract Covariate from an Object} \usage{ getCovariate(object, form, data) } \alias{getCovariate} \arguments{ \item{object}{any object with a \code{covariate} component} \item{form}{an optional one-sided formula specifying the covariate(s) to be extracted. Defaults to \code{formula(object)}.} \item{data}{a data frame in which to evaluate the variables defined in \code{form}. } } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{corStruct}, \code{corSpatial}, \code{data.frame}, and \code{varFunc}. } \value{ will depend on the method function used; see the appropriate documentation. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. p. 100. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{getCovariate.corStruct}}, \code{\link{getCovariate.data.frame}}, \code{\link{getCovariate.varFunc}}, \code{\link{getCovariateFormula}} } \keyword{models} nlme/man/getGroups.gls.Rd0000644000176000001440000000344214251721455015053 0ustar ripleyusers% File nlme/man/getGroups.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getGroups.gls} \title{Extract gls Object Groups} \usage{ \method{getGroups}{gls}(object, form, level, data, sep) } \alias{getGroups.gls} \arguments{ \item{object}{an object inheriting from class \code{gls}, representing a generalized least squares fitted linear model.} \item{form}{an optional formula with a conditioning expression on its right hand side (i.e. an expression involving the \code{|} operator). Defaults to \code{formula(object)}. Not used.} \item{level}{a positive integer vector with the level(s) of grouping to be used when multiple nested levels of grouping are present. This argument is optional for most methods of this generic function and defaults to all levels of nesting. Not used.} \item{data}{a data frame in which to interpret the variables named in \code{form}. Optional for most methods. Not used.} \item{sep}{character, the separator to use between group levels when multiple levels are collapsed. The default is \code{'/'}. Not used.} } \description{ If present, the grouping factor associated to the correlation structure for the linear model represented by \code{object} is extracted. } \value{ if the linear model represented by \code{object} incorporates a correlation structure and the corresponding \code{corStruct} object has a grouping factor, a vector with the group values is returned; else, \code{NULL} is returned. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gls}}, \code{\link{corClasses}}} \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) getGroups(fm1) } \keyword{models} nlme/man/residuals.gnlsStruct.Rd0000644000176000001440000000220314251721455016444 0ustar ripleyusers% File nlme/man/residuals.gnlsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{residuals.gnlsStruct} \title{Calculate gnlsStruct Residuals} \usage{ \method{residuals}{gnlsStruct}(object, \dots) } \alias{residuals.gnlsStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{gnlsStruct}"}, representing a list of model components, such as \code{corStruct} and \code{varFunc} objects, and attributes specifying the underlying nonlinear model and the response variable.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The residuals for the nonlinear model represented by \code{object} are extracted. } \value{ a vector with the residuals for the nonlinear model represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is primarily used inside \code{gnls} and \code{residuals.gnls}. } \seealso{\code{\link{gnls}}, \code{\link{residuals.gnls}}, \code{\link{fitted.gnlsStruct}} } \keyword{models} nlme/man/Names.Rd0000644000176000001440000000245714657640762013373 0ustar ripleyusers% File nlme/man/Names.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Names} \title{Names Associated with an Object} \usage{ Names(object, \dots) Names(object, \dots) <- value } \alias{Names} \alias{Names<-} \arguments{ \item{object}{any object for which names can be extracted and/or assigned.} \item{\dots}{some methods for this generic function require additional arguments.} \item{value}{names to be assigned to \code{object}.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{formula}, \code{pdBlocked}, \code{pdMat}, and \code{reStruct}. } \value{ will depend on the method function used; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \section{SIDE EFFECTS}{ On the left side of an assignment, sets the names associated with \code{object} to \code{value}, which must have an appropriate length. } %% \note{ %% If \code{names} were generic, there would be no need for this generic %% function. %% } \seealso{ \code{\link{Names.formula}}, \code{\link{Names.pdBlocked}}, \code{\link{Names.pdMat}}, \code{\link{Names.reStruct}} } \keyword{models} nlme/man/plot.ACF.Rd0000644000176000001440000000323714633640310013652 0ustar ripleyusers% File nlme/man/plot.ACF.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.ACF} \title{Plot an ACF Object} \usage{ \method{plot}{ACF}(x, alpha, xlab, ylab, grid, \dots) } \alias{plot.ACF} \arguments{ \item{x}{an object inheriting from class \code{ACF}, consisting of a data frame with two columns named \code{lag} and \code{ACF}, representing the autocorrelation values and the corresponding lags. } \item{alpha}{an optional numeric value with the significance level for testing if the autocorrelations are zero. Lines corresponding to the lower and upper critical values for a test of level \code{alpha} are added to the plot. Default is \code{0}, in which case no lines are plotted. } \item{xlab,ylab}{optional character strings with the x- and y-axis labels. Default respectively to \code{"Lag"} and \code{"Autocorrelation"}. } \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{FALSE}.} \item{\dots}{optional arguments passed to the \code{xyplot} function.} } \description{ an \code{xyplot} of the autocorrelations versus the lags, with \code{type = "h"}, is produced. If \code{alpha > 0}, curves representing the critical limits for a two-sided test of level \code{alpha} for the autocorrelations are added to the plot. } \value{ an \code{xyplot} Trellis plot. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{ACF}}, \code{\link[lattice]{xyplot}}} \examples{ fm1 <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary) plot(ACF(fm1, maxLag = 10), alpha = 0.01) } \keyword{models} nlme/man/Initialize.Rd0000644000176000001440000000263414657640762014426 0ustar ripleyusers% File nlme/man/Initialize.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Initialize} \title{Initialize Object} \usage{ Initialize(object, data, \dots) } \alias{Initialize} \arguments{ \item{object}{any object requiring initialization, e.g. "plug-in" structures such as \code{corStruct} and \code{varFunc} objects. } \item{data}{a data frame to be used in the initialization procedure.} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{corStruct}, \code{glsStruct}, \code{lmeStruct}, \code{reStruct}, and \code{varFunc}. } \value{ an initialized object with the same class as \code{object}. Changes introduced by the initialization procedure will depend on the method function used; see the appropriate documentation. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Initialize.corStruct}}, \code{\link{Initialize.glsStruct}}, \code{\link{Initialize.lmeStruct}}, \code{\link{Initialize.reStruct}}, \code{\link{Initialize.varFunc}}, \code{\link{isInitialized}} } \keyword{models} nlme/man/varFunc.Rd0000644000176000001440000000205314657640762013724 0ustar ripleyusers% File nlme/man/varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varFunc} \title{Variance Function Structure} \usage{ varFunc(object) } \alias{varFunc} \arguments{ \item{object}{either an one-sided formula specifying a variance covariate, or an object inheriting from class \code{"varFunc"}, representing a variance function structure.} } \description{ If \code{object} is a one-sided formula, it is used as the argument to \code{\link{varFixed}} and the resulting object is returned. Else, if \code{object} already inherits from class \code{"varFunc"}, such as all standard \sQuote{\link{varClasses}}, it is returned unchanged. } \value{ an object from class \code{"varFunc"}, representing a variance function structure. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{summary.varFunc}}, \code{\link{varFixed}}, \code{\link{varWeights.varFunc}}, \code{\link{coef.varFunc}}} \examples{ vf1 <- varFunc(~age) } \keyword{models} nlme/man/coef.varFunc.Rd0000644000176000001440000000422714251721456014632 0ustar ripleyusers% File nlme/man/coef.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.varFunc} \title{varFunc Object Coefficients} \usage{ \method{coef}{varFunc}(object, unconstrained, allCoef, \dots) \method{coef}{varIdent}(object, \dots) <- value } \alias{coef.varFunc} \alias{coef.varComb} \alias{coef.varConstPower} \alias{coef.varConstProp} \alias{coef.varExp} \alias{coef.varFixed} \alias{coef.varIdent} \alias{coef.varPower} \alias{coef<-.varComb} \alias{coef<-.varConstPower} \alias{coef<-.varConstProp} \alias{coef<-.varExp} \alias{coef<-.varFixed} \alias{coef<-.varIdent} \alias{coef<-.varPower} \arguments{ \item{object}{an object inheriting from class \code{"\link{varFunc}"} representing a variance function structure.} \item{unconstrained}{a logical value. If \code{TRUE} the coefficients are returned in unconstrained form (the same used in the optimization algorithm). If \code{FALSE} the coefficients are returned in "natural", generally constrained form. Defaults to \code{TRUE}.} \item{allCoef}{a logical value. If \code{FALSE} only the coefficients which may vary during the optimization are returned. If \code{TRUE} all coefficients are returned. Defaults to \code{FALSE}.} \item{value}{a vector with the replacement values for the coefficients associated with \code{object}. It must be have the same length of \code{coef{object}} and must be given in unconstrained form. \code{Object} must be initialized before new values can be assigned to its coefficients.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the coefficients associated with the variance function structure represented by \code{object}. } \value{ a vector with the coefficients corresponding to \code{object}. } \author{José Pinheiro and Douglas Bates } \section{SIDE EFFECTS}{ On the left side of an assignment, sets the values of the coefficients of \code{object} to \code{value}. } \seealso{\code{\link{varFunc}}} \examples{ vf1 <- varPower(1) coef(vf1) %\dontrun{ coef(vf1) <- 2 %} } \keyword{models} nlme/man/pdMat.Rd0000644000176000001440000000605114335517423013355 0ustar ripleyusers% File nlme/man/pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdMat} \title{Positive-Definite Matrix} \usage{ pdMat(value, form, nam, data, pdClass) } \alias{pdMat} \alias{plot.pdMat} \arguments{ \item{value}{an optional initialization value, which can be any of the following: a \code{pdMat} object, a positive-definite matrix, a one-sided linear formula (with variables separated by \code{+}), a vector of character strings, or a numeric vector. Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional one-sided linear formula specifying the row/column names for the matrix represented by \code{object}. Because factors may be present in \code{form}, the formula needs to be evaluated on a data.frame to resolve the names it defines. This argument is ignored when \code{value} is a one-sided formula. Defaults to \code{NULL}.} \item{nam}{an optional vector of character strings specifying the row/column names for the matrix represented by object. It must have length equal to the dimension of the underlying positive-definite matrix and unreplicated elements. This argument is ignored when \code{value} is a vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} \item{pdClass}{an optional character string naming the \code{pdMat} class to be assigned to the returned object. This argument will only be used when \code{value} is not a \code{pdMat} object. Defaults to \code{"pdSymm"}.} } \description{ This function gives an alternative way of constructing an object inheriting from the \code{pdMat} class named in \code{pdClass}, or from \code{data.class(object)} if \code{object} inherits from \code{pdMat}, and is mostly used internally in other functions. See the documentation on the principal constructor function, generally with the same name as the \code{pdMat} class of object. } \value{ a \code{pdMat} object representing a positive-definite matrix, inheriting from the class named in \code{pdClass}, or from \code{class(object)}, if \code{object} inherits from \code{pdMat}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{pdClasses}}, \code{\link{pdCompSymm}}, \code{\link{pdDiag}}, \code{\link{pdIdent}}, \code{\link{pdNatural}}, \code{\link{pdSymm}}, \code{\link{reStruct}}, \code{\link{solve.pdMat}}, \code{\link{summary.pdMat}} } \examples{ pd1 <- pdMat(diag(1:4), pdClass = "pdDiag") pd1 str(pd1) } \keyword{models} nlme/man/Dim.corStruct.Rd0000644000176000001440000000274114251721455015011 0ustar ripleyusers% File nlme/man/Dim.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Dim.corStruct} \title{Dimensions of a corStruct Object} \usage{ \method{Dim}{corStruct}(object, groups, \dots) } \alias{Dim.corStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"}, representing a correlation structure.} \item{groups}{an optional factor defining the grouping of the observations; observations within a group are correlated and observations in different groups are uncorrelated.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ if \code{groups} is missing, it returns the \code{Dim} attribute of \code{object}; otherwise, calculates the dimensions associated with the grouping factor. } \value{ a list with components: \item{N}{length of \code{groups}} \item{M}{number of groups} \item{maxLen}{maximum number of observations in a group} \item{sumLenSq}{sum of the squares of the number of observations per group} \item{len}{an integer vector with the number of observations per group} \item{start}{an integer vector with the starting position for the observations in each group, beginning from zero} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Dim}}, \code{\link{Dim.corSpatial}}} \examples{ Dim(corAR1(), getGroups(Orthodont)) } \keyword{models} nlme/man/as.matrix.reStruct.Rd0000644000176000001440000000222414251721455016025 0ustar ripleyusers% File nlme/man/as.matrix.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{as.matrix.reStruct} \title{Matrices of an reStruct Object} \usage{ \method{as.matrix}{reStruct}(x, \dots) } \alias{as.matrix.reStruct} \arguments{ \item{x}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{\dots}{further arguments passed from other methods.} } \description{ This method function extracts the positive-definite matrices corresponding to the \code{pdMat} elements of \code{object}. } \value{ a list with components given by the positive-definite matrices corresponding to the elements of \code{object}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{reStruct}}, \code{\link{pdMat}}} \examples{ rs1 <- reStruct(pdSymm(diag(3), ~age+Sex, data = Orthodont)) as.matrix(rs1) } \keyword{models} nlme/man/fixef.lmList.Rd0000644000176000001440000000204014657640762014660 0ustar ripleyusers% File nlme/man/fixef.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fixef.lmList} \title{Extract lmList Fixed Effects} \usage{ \method{fixef}{lmList}(object, \dots) } \alias{fixed.effects.lmList} \alias{fixef.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The average of the coefficients corresponding to the \code{lm} components of \code{object} is calculated. } \value{ a vector with the average of the individual \code{lm} coefficients in \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{random.effects.lmList}}} \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) fixef(fm1) fixed.effects(fm1) # the same, using the longer alias } \keyword{models} nlme/man/plot.nfnGroupedData.Rd0000644000176000001440000001050314633640310016154 0ustar ripleyusers% File nlme/man/plot.nfnGroupedData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.nfnGroupedData} \title{Plot an nfnGroupedData Object} \usage{ \method{plot}{nfnGroupedData}(x, outer, inner, innerGroups, xlab, ylab, strip, aspect, panel, key, grid, \dots) } \alias{plot.nfnGroupedData} \arguments{ \item{x}{an object inheriting from class \code{nfnGroupedData}, representing a \code{groupedData} object with a numeric primary covariate and a single grouping level. } \item{outer}{an optional logical value or one-sided formula, indicating covariates that are outer to the grouping factor, which are used to determine the panels of the Trellis plot. If equal to \code{TRUE}, \code{attr(object, "outer")} is used to indicate the outer covariates. An outer covariate is invariant within the sets of rows defined by the grouping factor. Ordering of the groups is done in such a way as to preserve adjacency of groups with the same value of the outer variables. Defaults to \code{NULL}, meaning that no outer covariates are to be used. } \item{inner}{an optional logical value or one-sided formula, indicating a covariate that is inner to the grouping factor, which is used to associate points within each panel of the Trellis plot. If equal to \code{TRUE}, \code{attr(object, "inner")} is used to indicate the inner covariate. An inner covariate can change within the sets of rows defined by the grouping factor. Defaults to \code{NULL}, meaning that no inner covariate is present. } \item{innerGroups}{an optional one-sided formula specifying a factor to be used for grouping the levels of the \code{inner} covariate. Different colors, or line types, are used for each level of the \code{innerGroups} factor. Default is \code{NULL}, meaning that no \code{innerGroups} covariate is present. } \item{xlab, ylab}{optional character strings with the labels for the plot. Default is the corresponding elements of \code{attr(object, "labels")} and \code{attr(object, "units")} pasted together. } \item{strip}{an optional function passed as the \code{strip} argument to the \code{xyplot} function. Default is \code{strip.default(\dots, style = 1)} (see \code{trellis.args}). } \item{aspect}{an optional character string indicating the aspect ratio for the plot passed as the \code{aspect} argument to the \code{xyplot} function. Default is \code{"xy"} (see \code{trellis.args}). } \item{panel}{an optional function used to generate the individual panels in the Trellis display, passed as the \code{panel} argument to the \code{xyplot} function.} \item{key}{an optional logical function or function. If \code{TRUE} and \code{innerGroups} is non-\code{NULL}, a legend for the different \code{innerGroups} levels is included at the top of the plot. If given as a function, it is passed as the \code{key} argument to the \code{xyplot} function. Default is \code{TRUE} if \code{innerGroups} is non-\code{NULL} and \code{FALSE} otherwise. } \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{TRUE}.} \item{\dots}{optional arguments passed to the \code{xyplot} function.} } \description{ A Trellis plot of the response versus the primary covariate is generated. If outer variables are specified, the combination of their levels are used to determine the panels of the Trellis display. Otherwise, the levels of the grouping variable determine the panels. A scatter plot of the response versus the primary covariate is displayed in each panel, with observations corresponding to same inner group joined by line segments. The Trellis function \code{xyplot} is used. } \value{ a Trellis plot of the response versus the primary covariate. } \references{ Bates, D.M. and Pinheiro, J.C. (1997), "Software Design for Longitudinal Data", in "Modelling Longitudinal and Spatially Correlated Data: Methods, Applications and Future Directions", T.G. Gregoire (ed.), Springer-Verlag, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{groupedData}}, \code{\link[lattice]{xyplot}}} \examples{ # different panels per Subject plot(Orthodont) # different panels per gender plot(Orthodont, outer = TRUE) } \keyword{models} nlme/man/Rail.Rd0000644000176000001440000000234614251721455013201 0ustar ripleyusers% File nlme/man/Rail.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Rail} \alias{Rail} \title{Evaluation of Stress in Railway Rails} \description{ The \code{Rail} data frame has 18 rows and 2 columns. } \format{ This data frame contains the following columns: \describe{ \item{Rail}{ an ordered factor identifying the rail on which the measurement was made. } \item{travel}{ a numeric vector giving the travel time for ultrasonic head-waves in the rail (nanoseconds). The value given is the original travel time minus 36,100 nanoseconds. } } } \details{ Devore (2000, Example 10.10, p. 427) cites data from an article in \emph{Materials Evaluation} on ``a study of travel time for a certain type of wave that results from longitudinal stress of rails used for railroad track.'' } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.26) Devore, J. L. (2000), \emph{Probability and Statistics for Engineering and the Sciences (5th ed)}, Duxbury, Boston, MA. } %\examples{} \keyword{datasets} nlme/man/corClasses.Rd0000644000176000001440000000365214737242620014415 0ustar ripleyusers% File nlme/man/corClasses.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corClasses} \title{Correlation Structure Classes} \alias{corClasses} \alias{corStruct} \description{ Standard classes of correlation structures (\code{corStruct}) available in the \pkg{nlme} package. } \value{ Available standard classes: \item{corAR1}{autoregressive process of order 1.} \item{corARMA}{autoregressive moving average process, with arbitrary orders for the autoregressive and moving average components.} \item{corCAR1}{continuous autoregressive process (AR(1) process for a continuous time covariate).} \item{corCompSymm}{compound symmetry structure corresponding to a constant correlation.} \item{corExp}{exponential spatial correlation.} \item{corGaus}{Gaussian spatial correlation.} % \item{corIdent}{Identity matrix (trivial zero) correlation. \bold{Deprecated}.} \item{corLin}{linear spatial correlation.} \item{corRatio}{Rational quadratics spatial correlation.} \item{corSpher}{spherical spatial correlation.} \item{corSymm}{general correlation matrix, with no additional structure.} } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ Users may define their own \code{corStruct} classes by specifying a constructor function and, at a minimum, methods for the functions \code{\link{corMatrix}} and \code{\link{coef}}. For examples of these functions, see the methods for classes \code{corSymm} and \code{corAR1}. } \seealso{ \code{\link{corAR1}}, \code{\link{corARMA}}, \code{\link{corCAR1}}, \code{\link{corCompSymm}}, \code{\link{corExp}}, \code{\link{corGaus}}, \code{\link{corLin}}, \code{\link{corRatio}}, \code{\link{corSpher}}, \code{\link{corSymm}}, \code{\link{summary.corStruct}} } \keyword{models} nlme/man/corGaus.Rd0000644000176000001440000001014514251721455013711 0ustar ripleyusers% File nlme/man/corGaus.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corGaus} \title{Gaussian Correlation Structure} \usage{ corGaus(value, form, nugget, metric, fixed) } \alias{corGaus} \arguments{ \item{value}{an optional vector with the parameter values in constrained form. If \code{nugget} is \code{FALSE}, \code{value} can have only one element, corresponding to the "range" of the Gaussian correlation structure, which must be greater than zero. If \code{nugget} is \code{TRUE}, meaning that a nugget effect is present, \code{value} can contain one or two elements, the first being the "range" and the second the "nugget effect" (one minus the correlation between two observations taken arbitrarily close together); the first must be greater than zero and the second must be between zero and one. Defaults to \code{numeric(0)}, which results in a range of 90\% of the minimum distance and a nugget effect of 0.1 being assigned to the parameters when \code{object} is initialized.} \item{form}{a one sided formula of the form \code{~ S1+...+Sp}, or \code{~ S1+...+Sp | g}, specifying spatial covariates \code{S1} through \code{Sp} and, optionally, a grouping factor \code{g}. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{nugget}{an optional logical value indicating whether a nugget effect is present. Defaults to \code{FALSE}.} \item{metric}{an optional character string specifying the distance metric to be used. The currently available options are \code{"euclidean"} for the root sum-of-squares of distances; \code{"maximum"} for the maximum difference; and \code{"manhattan"} for the sum of the absolute differences. Partial matching of arguments is used, so only the first three characters need to be provided. Defaults to \code{"euclidean"}.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corGaus} class, representing a Gaussian spatial correlation structure. Letting \eqn{d} denote the range and \eqn{n} denote the nugget effect, the correlation between two observations a distance \eqn{r} apart is \eqn{\exp(-(r/d)^2)}{exp(-(r/d)^2)} when no nugget effect is present and \eqn{(1-n) \exp(-(r/d)^2)}{(1-n)*exp(-(r/d)^2)} when a nugget effect is assumed. Objects created using this constructor must later be initialized using the appropriate ` \code{Initialize} method. } \value{ an object of class \code{corGaus}, also inheriting from class \code{corSpatial}, representing a Gaussian spatial correlation structure. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. Littel, Milliken, Stroup, and Wolfinger (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}}, \code{\link{dist}} } \examples{ sp1 <- corGaus(form = ~ x + y + z) # example lme(..., corGaus ...) # Pinheiro and Bates, pp. 222-249 fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight, random = ~ Time) # p. 223 fm2BW.lme <- update(fm1BW.lme, weights = varPower()) # p 246 fm3BW.lme <- update(fm2BW.lme, correlation = corExp(form = ~ Time)) # p. 249 fm8BW.lme <- update(fm3BW.lme, correlation = corGaus(form = ~ Time)) } \keyword{models} nlme/man/pdFactor.Rd0000644000176000001440000000311514251721455014047 0ustar ripleyusers% File nlme/man/pdFactor.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdFactor} \title{Square-Root Factor of a Positive-Definite Matrix} \usage{ pdFactor(object) } \alias{pdFactor} \alias{pdFactor.pdBlocked} \alias{pdFactor.pdCompSymm} \alias{pdFactor.pdDiag} \alias{pdFactor.pdIdent} \alias{pdFactor.pdMat} \alias{pdFactor.pdNatural} \alias{pdFactor.pdSymm} \alias{pdFactor.pdLogChol} \arguments{ \item{object}{an object inheriting from class \code{pdMat}, representing a positive definite matrix, which must have been initialized (i.e. \code{length(coef(object)) > 0}).} } \description{ A square-root factor of the positive-definite matrix represented by \code{object} is obtained. Letting \eqn{\Sigma}{S} denote a positive-definite matrix, a square-root factor of \eqn{\Sigma}{S} is any square matrix \eqn{L}{L} such that \eqn{\Sigma = L'L}{S = L'L}. This function extracts \eqn{L}. } \value{ a vector with a square-root factor of the positive-definite matrix associated with \code{object} stacked column-wise. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This function is used intensively in optimization algorithms and its value is returned as a vector for efficiency reasons. The \code{pdMatrix} function can be used to obtain square-root factors in matrix form. } \seealso{\code{\link{pdMatrix}}} \examples{ pd1 <- pdCompSymm(4 * diag(3) + 1) pdFactor(pd1) } \keyword{models} nlme/man/needUpdate.modelStruct.Rd0000644000176000001440000000222414251721455016667 0ustar ripleyusers% File nlme/man/needUpdate.modelStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{needUpdate.modelStruct} \title{Check if a modelStruct Object Needs Updating} \usage{ \method{needUpdate}{modelStruct}(object) } \alias{needUpdate.modelStruct} \alias{needUpdate.corStruct} \alias{needUpdate.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"modelStruct"}, representing a list of model components, such as \code{corStruct} and \code{varFunc} objects.} } \description{ This method function checks if any of the elements of \code{object} needs to be updated. Updating of objects usually takes place in iterative algorithms in which auxiliary quantities associated with the object, and not being optimized over, may change. } \value{ a logical value indicating whether any element of \code{object} needs to be updated. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{needUpdate}} } \examples{ lms1 <- lmeStruct(reStruct = reStruct(pdDiag(diag(2), ~age)), varStruct = varPower(form = ~age)) needUpdate(lms1) } \keyword{models} nlme/man/Fatigue.Rd0000644000176000001440000000335014251721456013673 0ustar ripleyusers% File nlme/man/Fatigue.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Fatigue} \alias{Fatigue} \title{Cracks caused by metal fatigue} \description{ The \code{Fatigue} data frame has 262 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{Path}{ an ordered factor with levels \code{1} < \code{2} < \code{3} < \code{4} < \code{5} < \code{6} < \code{7} < \code{8} < \code{9} < \code{10} < \code{11} < \code{12} < \code{13} < \code{14} < \code{15} < \code{16} < \code{17} < \code{18} < \code{19} < \code{20} < \code{21} giving the test path (or test unit) number. The order is in terms of increasing failure time or decreasing terminal crack length. } \item{cycles}{ number of test cycles at which the measurement is made (millions of cycles). } \item{relLength}{ relative crack length (dimensionless). } } } \details{ These data are given in Lu and Meeker (1993) where they state ``We obtained the data in Table 1 visually from figure 4.5.2 on page 242 of Bogdanoff and Kozin (1985).'' The data represent the growth of cracks in metal for 21 test units. An initial notch of length 0.90 inches was made on each unit which then was subjected to several thousand test cycles. After every 10,000 test cycles the crack length was measured. Testing was stopped if the crack length exceeded 1.60 inches, defined as a failure, or at 120,000 cycles. } \source{ Lu, C. Joséph , and Meeker, William Q. (1993), Using degradation measures to estimate a time-to-failure distribution, \emph{Technometrics}, \bold{35}, 161-174 } %\examples{} \keyword{datasets} nlme/man/fdHess.Rd0000644000176000001440000000336314251721455013526 0ustar ripleyusers% File nlme/man/fdHess.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fdHess} \alias{fdHess} \title{Finite difference Hessian} \description{ Evaluate an approximate Hessian and gradient of a scalar function using finite differences. } \usage{ fdHess(pars, fun, \dots, .relStep = .Machine$double.eps^(1/3), minAbsPar = 0) } \arguments{ \item{pars}{the numeric values of the parameters at which to evaluate the function \code{fun} and its derivatives.} \item{fun}{a function depending on the parameters \code{pars} that returns a numeric scalar.} \item{\dots}{Optional additional arguments to \code{fun}} \item{.relStep}{The relative step size to use in the finite differences. It defaults to the cube root of \code{.Machine$double.eps}} \item{minAbsPar}{The minimum magnitude of a parameter value that is considered non-zero. It defaults to zero meaning that any non-zero value will be considered different from zero.} } \details{ This function uses a second-order response surface design known as a \dQuote{Koschal design} to determine the parameter values at which the function is evaluated. } \value{ A list with components \item{mean}{the value of function \code{fun} evaluated at the parameter values \code{pars}} \item{gradient}{an approximate gradient (of length \code{length(pars)}).} \item{Hessian}{a matrix whose upper triangle contains an approximate Hessian.} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \examples{ (fdH <- fdHess(c(12.3, 2.34), function(x) x[1]*(1-exp(-0.4*x[2])))) stopifnot(length(fdH$ mean) == 1, length(fdH$ gradient) == 2, identical(dim(fdH$ Hessian), c(2L, 2L))) } \keyword{models} nlme/man/Names.formula.Rd0000644000176000001440000000266314251721455015023 0ustar ripleyusers% File nlme/man/Names.formula.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Names.formula} \title{Extract Names from a formula} \usage{ \method{Names}{formula}(object, data, exclude, \dots) } \alias{Names.formula} \alias{Names.listForm} \arguments{ \item{object}{an object inheriting from class \code{"\link{formula}"}.} \item{data}{an optional data frame containing the variables specified in \code{object}. By default the variables are taken from the environment from which \code{Names.formula} is called.} \item{exclude}{an optional character vector with names to be excluded from the returned value. Default is \code{c("pi",".")}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function returns the names of the terms corresponding to the right hand side of \code{object} (treated as a linear formula), obtained as the column names of the corresponding \code{model.matrix}. } \value{ a character vector with the column names of the \code{model.matrix} corresponding to the right hand side of \code{object} which are not listed in \code{excluded}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{model.matrix}}, \code{\link{terms}}, \code{\link{Names}} } \examples{ Names(distance ~ Sex * age, data = Orthodont) } \keyword{models} nlme/man/plot.nffGroupedData.Rd0000644000176000001440000000777714251721455016175 0ustar ripleyusers% File nlme/man/plot.nffGroupedData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.nffGroupedData} \title{Plot an nffGroupedData Object} \usage{ \method{plot}{nffGroupedData}(x, outer, inner, innerGroups, xlab, ylab, strip, panel, key, grid, \dots) } \alias{plot.nffGroupedData} \arguments{ \item{x}{an object inheriting from class \code{nffGroupedData}, representing a \code{groupedData} object with a factor primary covariate and a single grouping level. } \item{outer}{an optional logical value or one-sided formula, indicating covariates that are outer to the grouping factor, which are used to determine the panels of the Trellis plot. If equal to \code{TRUE}, \code{attr(object, "outer")} is used to indicate the outer covariates. An outer covariate is invariant within the sets of rows defined by the grouping factor. Ordering of the groups is done in such a way as to preserve adjacency of groups with the same value of the outer variables. Defaults to \code{NULL}, meaning that no outer covariates are to be used. } \item{inner}{an optional logical value or one-sided formula, indicating a covariate that is inner to the grouping factor, which is used to associate points within each panel of the Trellis plot. If equal to \code{TRUE}, \code{attr(object, "inner")} is used to indicate the inner covariate. An inner covariate can change within the sets of rows defined by the grouping factor. Defaults to \code{NULL}, meaning that no inner covariate is present. } \item{innerGroups}{an optional one-sided formula specifying a factor to be used for grouping the levels of the \code{inner} covariate. Different colors, or symbols, are used for each level of the \code{innerGroups} factor. Default is \code{NULL}, meaning that no \code{innerGroups} covariate is present. } \item{xlab}{an optional character string with the label for the horizontal axis. Default is the \code{y} elements of \code{attr(object, "labels")} and \code{attr(object, "units")} pasted together. } \item{ylab}{an optional character string with the label for the vertical axis. Default is the grouping factor name. } \item{strip}{an optional function passed as the \code{strip} argument to the \code{dotplot} function. Default is \code{strip.default(..., style = 1)} (see \code{trellis.args}). } \item{panel}{an optional function used to generate the individual panels in the Trellis display, passed as the \code{panel} argument to the \code{dotplot} function. } \item{key}{an optional logical function or function. If \code{TRUE} and either \code{inner} or \code{innerGroups} are non-\code{NULL}, a legend for the different \code{inner} (\code{innerGroups}) levels is included at the top of the plot. If given as a function, it is passed as the \code{key} argument to the \code{dotplot} function. Default is \code{TRUE} is either \code{inner} or \code{innerGroups} are non-\code{NULL} and \code{FALSE} otherwise. } \item{grid}{this argument is included for consistency with the \code{plot.nfnGroupedData} method calling sequence. It is ignored in this method function.} \item{\dots}{optional arguments passed to the \code{dotplot} function.} } \description{ A Trellis dot-plot of the response by group is generated. If outer variables are specified, the combination of their levels are used to determine the panels of the Trellis display. The Trellis function \code{dotplot} is used. } \value{ a Trellis dot-plot of the response by group. } \references{ Bates, D.M. and Pinheiro, J.C. (1997), "Software Design for Longitudinal Data", in "Modelling Longitudinal and Spatially Correlated Data: Methods, Applications and Future Directions", T.G. Gregoire (ed.), Springer-Verlag, New York. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{groupedData}}, \code{\link{dotplot}}} \examples{ plot(Machines) plot(Machines, inner = TRUE) } \keyword{models} nlme/man/needUpdate.Rd0000644000176000001440000000213214251721455014361 0ustar ripleyusers% File nlme/man/needUpdate.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{needUpdate} \title{Check if Update is Needed} \usage{ needUpdate(object) } \alias{needUpdate} \alias{needUpdate.default} \alias{needUpdate.varComb} \alias{needUpdate.varIdent} \arguments{ \item{object}{any object} } \description{ This function is generic; method functions can be written to handle specific classes of objects. By default, it tries to extract a \code{needUpdate} attribute of \code{object}. If this is \code{NULL} or \code{FALSE} it returns \code{FALSE}; else it returns \code{TRUE}. Updating of objects usually takes place in iterative algorithms in which auxiliary quantities associated with the object, and not being optimized over, may change. } \value{ a logical value indicating whether \code{object} needs to be updated. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{needUpdate.modelStruct}} } \examples{ vf1 <- varExp() vf1 <- Initialize(vf1, data = Orthodont) needUpdate(vf1) } \keyword{models} nlme/man/ranef.lme.Rd0000644000176000001440000001057314251721455014162 0ustar ripleyusers% File nlme/man/ranef.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{ranef.lme} \title{Extract lme Random Effects} \usage{ \method{ranef}{lme}(object, augFrame, level, data, which, FUN, standard, omitGroupingFactor, subset, \dots) } \alias{ranef.lme} \alias{random.effects.lme} \alias{print.ranef.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{augFrame}{an optional logical value. If \code{TRUE}, the returned data frame is augmented with variables defined in \code{data}; else, if \code{FALSE}, only the coefficients are returned. Defaults to \code{FALSE}.} \item{level}{an optional vector of positive integers giving the levels of grouping to be used in extracting the random effects from an object with multiple nested grouping levels. Defaults to all levels of grouping.} \item{data}{an optional data frame with the variables to be used for augmenting the returned data frame when \code{augFrame = TRUE}. Defaults to the data frame used to fit \code{object}.} \item{which}{an optional positive integer vector specifying which columns of \code{data} should be used in the augmentation of the returned data frame. Defaults to all columns in \code{data}.} \item{FUN}{an optional summary function or a list of summary functions to be applied to group-varying variables, when collapsing \code{data} by groups. Group-invariant variables are always summarized by the unique value that they assume within that group. If \code{FUN} is a single function it will be applied to each non-invariant variable by group to produce the summary for that variable. If \code{FUN} is a list of functions, the names in the list should designate classes of variables in the frame such as \code{ordered}, \code{factor}, or \code{numeric}. The indicated function will be applied to any group-varying variables of that class. The default functions to be used are \code{mean} for numeric factors, and \code{Mode} for both \code{factor} and \code{ordered}. The \code{Mode} function, defined internally in \code{gsummary}, returns the modal or most popular value of the variable. It is different from the \code{mode} function that returns the S-language mode of the variable.} \item{standard}{an optional logical value indicating whether the estimated random effects should be "standardized" (i.e. divided by the estimate of the standard deviation of that group of random effects). Defaults to \code{FALSE}.} \item{omitGroupingFactor}{an optional logical value. When \code{TRUE} the grouping factor itself will be omitted from the group-wise summary of \code{data} but the levels of the grouping factor will continue to be used as the row names for the returned data frame. Defaults to \code{FALSE}.} \item{subset}{an optional expression indicating for which rows the random effects should be extracted.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The estimated random effects at level \eqn{i} are represented as a data frame with rows given by the different groups at that level and columns given by the random effects. If a single level of grouping is specified, the returned object is a data frame; else, the returned object is a list of such data frames. Optionally, the returned data frame(s) may be augmented with covariates summarized over groups. } \value{ a data frame, or list of data frames, with the estimated random effects at the grouping level(s) specified in \code{level} and, optionally, other covariates summarized over groups. The returned object inherits from classes \code{random.effects.lme} and \code{data.frame}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 100, 461. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{coef.lme}}, \code{\link{gsummary}}, \code{\link{lme}}, %\code{\link{fixed.effects.lme}}, \code{\link{plot.ranef.lme}}, \code{\link{random.effects}} } \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) ranef(fm1) random.effects(fm1) # same as above random.effects(fm1, augFrame = TRUE) } \keyword{models} nlme/man/Muscle.Rd0000644000176000001440000000221114251721455013531 0ustar ripleyusers% File nlme/man/Muscle.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Muscle} \alias{Muscle} \title{Contraction of heart muscle sections} \description{ The \code{Muscle} data frame has 60 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{Strip}{ an ordered factor indicating the strip of muscle being measured. } \item{conc}{ a numeric vector giving the concentration of CaCl2 } \item{length}{ a numeric vector giving the shortening of the heart muscle strip. } } } \details{ Baumann and Waldvogel (1963) describe data on the shortening of heart muscle strips dipped in a \eqn{\mbox{CaCl}{}_2}{CaCl_2} solution. The muscle strips are taken from the left auricle of a rat's heart.} \source{ Baumann, F. and Waldvogel, F. (1963), La restitution pastsystolique de la contraction de l'oreillette gauche du rat. Effets de divers ions et de l'acetylcholine, \emph{Helvetica Physiologica Acta}, \bold{21}. } %\examples{} \keyword{datasets} nlme/man/getCovariate.varFunc.Rd0000644000176000001440000000220114251721455016320 0ustar ripleyusers% File nlme/man/getCovariate.varFunc.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getCovariate.varFunc} \title{Extract varFunc Covariate} \usage{ \method{getCovariate}{varFunc}(object, form, data) } \alias{getCovariate.varFunc} \arguments{ \item{object}{an object inheriting from class \code{varFunc}, representing a variance function structure.} \item{form}{an optional formula specifying the covariate to be evaluated in \code{object}. Defaults to \code{formula(object)}.} \item{data}{some methods for this generic require a \code{data} object. Not used in this method.} } \description{ This method function extracts the covariate(s) associated with the variance function represented by \code{object}, if any is present. } \value{ if \code{object} has a \code{covariate} attribute, its value is returned; else \code{NULL} is returned. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{covariate<-.varFunc}}} \examples{ vf1 <- varPower(1.1, form = ~age) covariate(vf1) <- Orthodont[["age"]] getCovariate(vf1) } \keyword{models} nlme/man/corMatrix.corStruct.Rd0000644000176000001440000000656114723306730016253 0ustar ripleyusers% File nlme/man/corMatrix.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corMatrix.corStruct} \title{Matrix of a corStruct Object} \usage{ \method{corMatrix}{corStruct}(object, covariate, corr, \dots) } \alias{corMatrix.corStruct} \alias{corMatrix.corAR1} \alias{corMatrix.corARMA} \alias{corMatrix.corCAR1} \alias{corMatrix.corCompSymm} \alias{corMatrix.corNatural} \alias{corMatrix.corSpatial} \alias{corMatrix.corSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"} representing a correlation structure.} \item{covariate}{an optional covariate vector (matrix), or list of covariate vectors (matrices), at which values the correlation matrix, or list of correlation matrices, are to be evaluated. Defaults to \code{getCovariate(object)}.} \item{corr}{a logical value. If \code{TRUE} the function returns the correlation matrix, or list of correlation matrices, represented by \code{object}. If \code{FALSE} the function returns a transpose inverse square-root of the correlation matrix, or a list of transpose inverse square-root factors of the correlation matrices.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the correlation matrix (or its transpose inverse square-root factor), or list of correlation matrices (or their transpose inverse square-root factors) corresponding to \code{covariate} and \code{object}. Letting \eqn{\Sigma}{S} denote a correlation matrix, a square-root factor of \eqn{\Sigma}{S} is any square matrix \eqn{L} such that \eqn{\Sigma = L'L}{S=L'L}. When \code{corr = FALSE}, this method extracts \eqn{L^{-t}}{L^(-t)}. } \value{ If \code{covariate} is a vector (matrix), the returned value will be an array with the corresponding correlation matrix (or its transpose inverse square-root factor). If the \code{covariate} is a list of vectors (matrices), the returned value will be a list with the correlation matrices (or their transpose inverse square-root factors) corresponding to each component of \code{covariate}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{corFactor.corStruct}}, \code{\link{Initialize.corStruct}}} \examples{ cs1 <- corAR1(0.3) corMatrix(cs1, covariate = 1:4) corMatrix(cs1, covariate = 1:4, corr = FALSE) # Pinheiro and Bates, p. 225 cs1CompSymm <- corCompSymm(value = 0.3, form = ~ 1 | Subject) cs1CompSymm <- Initialize(cs1CompSymm, data = Orthodont) corMatrix(cs1CompSymm) # Pinheiro and Bates, p. 226 cs1Symm <- corSymm(value = c(0.2, 0.1, -0.1, 0, 0.2, 0), form = ~ 1 | Subject) cs1Symm <- Initialize(cs1Symm, data = Orthodont) corMatrix(cs1Symm) # Pinheiro and Bates, p. 236 cs1AR1 <- corAR1(0.8, form = ~ 1 | Subject) cs1AR1 <- Initialize(cs1AR1, data = Orthodont) corMatrix(cs1AR1) # Pinheiro and Bates, p. 237 cs1ARMA <- corARMA(0.4, form = ~ 1 | Subject, q = 1) cs1ARMA <- Initialize(cs1ARMA, data = Orthodont) corMatrix(cs1ARMA) # Pinheiro and Bates, p. 238 spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Exp <- corExp(1, form = ~ x + y) cs1Exp <- Initialize(cs1Exp, spatDat) corMatrix(cs1Exp) } \keyword{models} nlme/man/model.matrix.reStruct.Rd0000644000176000001440000000361114251721455016523 0ustar ripleyusers% File nlme/man/model.matrix.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{model.matrix.reStruct} \title{reStruct Model Matrix} \usage{ \method{model.matrix}{reStruct}(object, data, contrast, \dots) } \alias{model.matrix.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{data}{a data frame in which to evaluate the variables defined in \code{formula(object)}.} \item{contrast}{an optional named list specifying the contrasts to be used for representing the \code{factor} variables in \code{data}. The components names should match the names of the variables in \code{data} for which the contrasts are to be specified. The components of this list will be used as the \code{contrasts} attribute of the corresponding factor. If missing, the default contrast specification is used.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The model matrices for each element of \code{formula(object)}, calculated using \code{data}, are bound together column-wise. When multiple grouping levels are present (i.e. when \code{length(object) > 1}), the individual model matrices are combined from innermost (at the leftmost position) to outermost (at the rightmost position). } \value{ a matrix obtained by binding together, column-wise, the model matrices for each element of \code{formula(object)}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{model.matrix}}, \code{\link{contrasts}}, \code{\link{reStruct}}, \code{\link{formula.reStruct}}} \examples{ rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) model.matrix(rs1, Pixel) } \keyword{models} nlme/man/Extract.pdMat.Rd0000644000176000001440000000312614251721455014765 0ustar ripleyusers% File nlme/man/Extract.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{[.pdMat} \title{Subscript a pdMat Object} \usage{ \method{[}{pdMat}(x, i, j, drop = TRUE) \method{[}{pdMat}(x, i, j) <- value } \alias{[.pdMat} \alias{[.pdBlocked} \alias{[<-.pdMat} \arguments{ \item{x}{an object inheriting from class \code{"\link{pdMat}"} representing a positive-definite matrix.} \item{i, j}{optional subscripts applying respectively to the rows and columns of the positive-definite matrix represented by \code{object}. When \code{i} (\code{j}) is omitted, all rows (columns) are extracted.} \item{drop}{a logical value. If \code{TRUE}, single rows or columns are converted to vectors. If \code{FALSE} the returned value retains its matrix representation.} \item{value}{a vector, or matrix, with the replacement values for the relevant piece of the matrix represented by \code{x}.} } \description{ This method function extracts sub-matrices from the positive-definite matrix represented by \code{x}. } \value{ if \code{i} and \code{j} are identical, the returned value will be \code{pdMat} object with the same class as \code{x}. Otherwise, the returned value will be a matrix. In the case a single row (or column) is selected, the returned value may be converted to a vector, according to the rules above. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{[}}, \code{\link{pdMat}}} \examples{ pd1 <- pdSymm(diag(3)) pd1[1, , drop = FALSE] pd1[1:2, 1:2] <- 3 * diag(2) } \keyword{models} nlme/man/coef.corStruct.Rd0000644000176000001440000000512514660073244015213 0ustar ripleyusers% File nlme/man/coef.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.corStruct} \title{Coefficients of a corStruct Object} \usage{ \method{coef}{corStruct}(object, unconstrained, \dots) \method{coef}{corStruct}(object, \dots) <- value } \alias{coef.corStruct} \alias{coef.corAR1} \alias{coef.corARMAd} \alias{coef.corCAR1} \alias{coef.corCompSymm} %\alias{coef.corHF} % not implemented \alias{coef.corLin} \alias{coef.corNatural} \alias{coef.corSpatial} \alias{coef.corSpher} \alias{coef.corSymm} \alias{coef<-.corStruct} \alias{coef<-.corAR1} \alias{coef<-.corARMA} \alias{coef<-.corCAR1} \alias{coef<-.corCompSymm} \alias{coef<-.corNatural} %\alias{coef<-.corHF} % not implemented \alias{coef<-.corLin} \alias{coef<-.corSpatial} \alias{coef<-.corSpher} \alias{coef<-.corSymm} \alias{coef.summary.nlsList} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"}, representing a correlation structure.} \item{unconstrained}{a logical value. If \code{TRUE} the coefficients are returned in unconstrained form (the same used in the optimization algorithm). If \code{FALSE} the coefficients are returned in "natural", possibly constrained, form. Defaults to \code{TRUE}.} \item{value}{a vector with the replacement values for the coefficients associated with \code{object}. It must be a vector with the same length of \code{coef{object}} and must be given in unconstrained form.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the coefficients associated with the correlation structure represented by \code{object}. } \value{ a vector with the coefficients corresponding to \code{object}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. } \author{José Pinheiro and Douglas Bates } \section{SIDE EFFECTS}{ On the left side of an assignment, sets the values of the coefficients of \code{object} to \code{value}. \code{Object} must be initialized (using \code{Initialize}) before new values can be assigned to its coefficients. } \seealso{\code{\link{corAR1}}, \code{\link{corARMA}}, \code{\link{corCAR1}}, \code{\link{corCompSymm}}, \code{\link{corExp}}, \code{\link{corGaus}}, \code{\link{corLin}}, \code{\link{corRatio}}, \code{\link{corSpatial}}, \code{\link{corSpher}}, \code{\link{corSymm}},\code{\link{Initialize}}} \examples{ cst1 <- corARMA(p = 1, q = 1) coef(cst1) } \keyword{models} nlme/man/plot.lme.Rd0000644000176000001440000001160114633640310014030 0ustar ripleyusers% File nlme/man/plot.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.lme} \title{Plot an lme or nls object} \alias{plot.lme} \alias{plot.nls} \usage{ \method{plot}{lme}(x, form, abline, id, idLabels, idResType, grid, \dots) \method{plot}{nls}(x, form, abline, id, idLabels, idResType, grid, \dots) } \arguments{ \item{x}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model, or from \code{nls}, representing an fitted nonlinear least squares model.} \item{form}{an optional formula specifying the desired type of plot. Any variable present in the original data frame used to obtain \code{x} can be referenced. In addition, \code{x} itself can be referenced in the formula using the symbol \code{"."}. Conditional expressions on the right of a \code{|} operator can be used to define separate panels in a Trellis display. Default is \code{resid(., type = "p") ~ fitted(.) }, corresponding to a plot of the standardized residuals versus fitted values, both evaluated at the innermost level of nesting.} \item{abline}{an optional numeric value, or numeric vector of length two. If given as a single value, a horizontal line will be added to the plot at that coordinate; else, if given as a vector, its values are used as the intercept and slope for a line added to the plot. If missing, no lines are added to the plot.} \item{id}{an optional numeric value, or one-sided formula. If given as a value, it is used as a significance level for a two-sided outlier test for the standardized, or normalized residuals. Observations with absolute standardized (normalized) residuals greater than the \eqn{1 - value/2} quantile of the standard normal distribution are identified in the plot using \code{idLabels}. If given as a one-sided formula, its right hand side must evaluate to a logical, integer, or character vector which is used to identify observations in the plot. If missing, no observations are identified.} \item{idLabels}{an optional vector, or one-sided formula. If given as a vector, it is converted to character and used to label the observations identified according to \code{id}. If given as a one-sided formula, its right hand side must evaluate to a vector which is converted to character and used to label the identified observations. Default is the innermost grouping factor.} \item{idResType}{an optional character string specifying the type of residuals to be used in identifying outliers, when \code{id} is a numeric value. If \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"pearson"}.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default depends on the type of Trellis plot used: if \code{xyplot} defaults to \code{TRUE}, else defaults to \code{FALSE}.} \item{\dots}{optional arguments passed to the Trellis plot function.} } \description{ Diagnostic plots for the linear mixed-effects fit are obtained. The \code{form} argument gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a \code{|} operator) always implies that different panels are used for each level of the conditioning factor, according to a Trellis display. If \code{form} is a one-sided formula, histograms of the variable on the right hand side of the formula, before a \code{|} operator, are displayed (the Trellis function \code{histogram} is used). If \code{form} is two-sided and both its left and right hand side variables are numeric, scatter plots are displayed (the Trellis function \code{xyplot} is used). Finally, if \code{form} is two-sided and its left had side variable is a factor, box-plots of the right hand side variable by the levels of the left hand side variable are displayed (the Trellis function \code{bwplot} is used). } \value{ a diagnostic Trellis plot. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link[lattice]{xyplot}}, \code{\link[lattice]{bwplot}}, \code{\link[lattice]{histogram}}} \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) # standardized residuals versus fitted values by gender plot(fm1, resid(., type = "p") ~ fitted(.) | Sex, abline = 0) # box-plots of residuals by Subject plot(fm1, Subject ~ resid(.)) # observed versus fitted values by Subject plot(fm1, distance ~ fitted(.) | Subject, abline = c(0,1)) } \keyword{models} \keyword{hplot} nlme/man/ACF.lme.Rd0000644000176000001440000000513614251721455013457 0ustar ripleyusers% File nlme/man/ACF.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{ACF.lme} \title{Autocorrelation Function for lme Residuals} \usage{ \method{ACF}{lme}(object, maxLag, resType, \dots) } \alias{ACF.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{maxLag}{an optional integer giving the maximum lag for which the autocorrelation should be calculated. Defaults to maximum lag in the within-group residuals.} \item{resType}{an optional character string specifying the type of residuals to be used. If \code{"response"}, the "raw" residuals (observed - fitted) are used; else, if \code{"pearson"}, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if \code{"normalized"}, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided. Defaults to \code{"pearson"}.} \item{\dots}{some methods for this generic require additional arguments -- not used.} } \description{ This method function calculates the empirical autocorrelation function for the within-group residuals from an \code{lme} fit. The autocorrelation values are calculated using pairs of residuals within the innermost group level. The autocorrelation function is useful for investigating serial correlation models for equally spaced data. } \value{ a data frame with columns \code{lag} and \code{ACF} representing, respectively, the lag between residuals within a pair and the corresponding empirical autocorrelation. The returned value inherits from class \code{ACF}. } \references{ Box, 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. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{ACF.gls}}, \code{\link{plot.ACF}}} \examples{ fm1 <- 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-241 fm1Over.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) } \keyword{models} nlme/man/varFixed.Rd0000644000176000001440000000243114251721455014055 0ustar ripleyusers% File nlme/man/varFixed.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varFixed} \title{Fixed Variance Function} \usage{ varFixed(value) } \alias{varFixed} \arguments{ \item{value}{a one-sided formula of the form \code{~ v} specifying a variance covariate \code{v}. Grouping factors are ignored.} } \description{ This function is a constructor for the \code{varFixed} class, representing a variance function with fixed variances. Letting \eqn{v} denote the variance covariate defined in \code{value}, the variance function \eqn{\sigma^2(v)}{s2(v)} for this class is \eqn{\sigma^2(v)=|v|}{s2(v)=|v|}. The variance covariate \eqn{v} is evaluated once at initialization and remains fixed thereafter. No coefficients are required to represent this variance function. } \value{ a \code{varFixed} object representing a fixed variance function structure, also inheriting from class \code{varFunc}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{varClasses}}, \code{\link{varWeights.varFunc}}, \code{\link{varFunc}}} \examples{ vf1 <- varFixed(~age) } \keyword{models} nlme/man/gnlsObject.Rd0000644000176000001440000000477614251721456014416 0ustar ripleyusers% File nlme/man/gnlsObject.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gnlsObject} \title{Fitted gnls Object} \alias{gnlsObject} \description{ An object returned by the \code{gnls} function, inheriting from class \code{"gnls"} and also from class \code{"gls"}, and representing a generalized nonlinear least squares fitted model. Objects of this class have methods for the generic functions \code{anova}, \code{coef}, \code{fitted}, \code{formula}, \code{getGroups}, \code{getResponse}, \code{intervals}, \code{logLik}, \code{plot}, \code{predict}, \code{print}, \code{residuals}, \code{summary}, and \code{update}. } \value{ The following components must be included in a legitimate \code{"gnls"} object. \item{apVar}{an approximate covariance matrix for the variance-covariance coefficients. If \code{apVar = FALSE} in the control values used in the call to \code{gnls}, this component is equal to \code{NULL}.} \item{call}{a list containing an image of the \code{gnls} call that produced the object.} \item{coefficients}{a vector with the estimated nonlinear model coefficients.} \item{contrasts}{a list of the contrast matrices used to represent factors in the model formula. This information is important for making predictions from a new data frame in which not all levels of the original factors are observed. If no factors are used in the model, this component will be an empty list.} \item{dims}{a list with basic dimensions used in the model fit, including the components \code{N} - the number of observations used in the fit and \code{p} - the number of coefficients in the nonlinear model.} \item{fitted}{a vector with the fitted values.} \item{modelStruct}{an object inheriting from class \code{gnlsStruct}, representing a list of model components, such as \code{corStruct} and \code{varFunc} objects.} \item{groups}{a vector with the correlation structure grouping factor, if any is present.} \item{logLik}{the log-likelihood at convergence.} \item{numIter}{the number of iterations used in the iterative algorithm.} \item{plist}{} \item{pmap}{} \item{residuals}{a vector with the residuals.} \item{sigma}{the estimated residual standard error.} \item{varBeta}{an approximate covariance matrix of the coefficients estimates.} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gnls}}, \code{gnlsStruct}} \keyword{models} nlme/man/varClasses.Rd0000644000176000001440000000347414737242620014424 0ustar ripleyusers% File nlme/man/varClasses.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varClasses} \title{Variance Function Classes} \alias{varClasses} \description{ Standard classes of variance function structures (\code{varFunc}) available in the \pkg{nlme} package. Covariates included in the variance function, denoted by variance covariates, may involve functions of the fitted model object, such as the fitted values and the residuals. Different coefficients may be assigned to the levels of a classification factor. } \value{ Available standard classes: \item{varExp}{exponential of a variance covariate.} \item{varPower}{power of a variance covariate.} \item{varConstPower}{constant plus power of a variance covariate.} \item{varConstProp}{constant plus proportion of a variance covariate.} \item{varIdent}{constant variance(s), generally used to allow different variances according to the levels of a classification factor.} \item{varFixed}{fixed weights, determined by a variance covariate.} \item{varComb}{combination of variance functions.} } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ Users may define their own \code{varFunc} classes by specifying a constructor function and, at a minimum, methods for the functions \code{\link{coef}}, \code{coef<-}, and \code{\link{Initialize}}. For examples of these functions, see the methods for class \code{varPower}. } \seealso{ \code{\link{varComb}}, \code{\link{varConstPower}}, \code{\link{varConstProp}}, \code{\link{varExp}}, \code{\link{varFixed}}, \code{\link{varIdent}}, \code{\link{varPower}}, \code{\link{summary.varFunc}} } \keyword{models} nlme/man/nlmeObject.Rd0000644000176000001440000001064114251721455014371 0ustar ripleyusers% File nlme/man/nlmeObject.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{nlmeObject} \title{Fitted nlme Object} \alias{nlmeObject} \description{ An object returned by the \code{\link{nlme}} function, inheriting from class \code{"nlme"}, also inheriting from class \code{"lme"}, and representing a fitted nonlinear mixed-effects model. Objects of this class have methods for the generic functions \code{anova}, \code{coef}, \code{fitted}, \code{fixed.effects}, \code{formula}, \code{getGroups}, \code{getResponse}, \code{intervals}, \code{logLik}, \code{pairs}, \code{plot}, \code{predict}, \code{print}, \code{random.effects}, \code{residuals}, \code{summary}, and \code{update}. } \value{ The following components must be included in a legitimate \code{"nlme"} object. \item{apVar}{an approximate covariance matrix for the variance-covariance coefficients. If \code{apVar = FALSE} in the control values used in the call to \code{nlme}, this component is \code{NULL}.} \item{call}{a list containing an image of the \code{nlme} call that produced the object.} \item{coefficients}{a list with two components, \code{fixed} and \code{random}, where the first is a vector containing the estimated fixed effects and the second is a list of matrices with the estimated random effects for each level of grouping. For each matrix in the \code{random} list, the columns refer to the random effects and the rows to the groups.} \item{contrasts}{a list of the contrast matrices used to represent factors in the fixed effects formula and/or random effects formula. This information is important for making predictions from a new data frame in which not all levels of the original factors are observed. If no factors are used in the nlme model, this component will be an empty list.} \item{dims}{a list with basic dimensions used in the nlme fit, including the components \code{N} - the number of observations in the data, \code{Q} - the number of grouping levels, \code{qvec} - the number of random effects at each level from innermost to outermost (last two values are equal to zero and correspond to the fixed effects and the response), \code{ngrps} - the number of groups at each level from innermost to outermost (last two values are one and correspond to the fixed effects and the response), and \code{ncol} - the number of columns in the model matrix for each level of grouping from innermost to outermost (last two values are equal to the number of fixed effects and one).} \item{fitted}{a data frame with the fitted values as columns. The leftmost column corresponds to the population fixed effects (corresponding to the fixed effects only) and successive columns from left to right correspond to increasing levels of grouping.} \item{fixDF}{a list with components \code{X} and \code{terms} specifying the denominator degrees of freedom for, respectively, t-tests for the individual fixed effects and F-tests for the fixed-effects terms in the models.} \item{groups}{a data frame with the grouping factors as columns. The grouping level increases from left to right.} \item{logLik}{the (restricted) log-likelihood at convergence.} \item{map}{a list with components \code{fmap}, \code{rmap}, \code{rmapRel}, and \code{bmap}, specifying various mappings for the fixed and random effects, used to generate predictions from the fitted object.} \item{method}{the estimation method: either \code{"ML"} for maximum likelihood, or \code{"REML"} for restricted maximum likelihood.} \item{modelStruct}{an object inheriting from class \code{nlmeStruct}, representing a list of mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} \item{numIter}{the number of iterations used in the iterative algorithm.} \item{residuals}{a data frame with the residuals as columns. The leftmost column corresponds to the population residuals and successive columns from left to right correspond to increasing levels of grouping.} \item{sigma}{the estimated within-group error standard deviation.} \item{varFix}{an approximate covariance matrix of the fixed effects estimates.} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{nlme}}, \code{nlmeStruct}} \keyword{models} nlme/man/corFactor.Rd0000644000176000001440000000162114657640762014242 0ustar ripleyusers% File nlme/man/corFactor.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corFactor} \title{Factor of a Correlation Matrix} \usage{ corFactor(object, \dots) } \alias{corFactor} \arguments{ \item{object}{an object from which a correlation matrix can be extracted.} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include all \code{"corStruct"} classes, see \sQuote{\link{corClasses}}. } \value{ will depend on the method function used; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{corFactor.corStruct}}, \code{\link{recalc.corStruct}} } \keyword{models} nlme/man/getData.Rd0000644000176000001440000000150714657640762013674 0ustar ripleyusers% File nlme/man/getData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getData} \title{Extract Data from an Object} \usage{ getData(object) } \alias{getData} \arguments{ \item{object}{an object from which a data frame can be extracted, generally a fitted model object.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{gls}, \code{lme}, and \code{lmList}. } \value{ will depend on the method function used; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{getData.gls}}, \code{\link{getData.lme}}, \code{\link{getData.lmList}} } \keyword{models} nlme/man/asOneFormula.Rd0000644000176000001440000000207614251721455014705 0ustar ripleyusers% File nlme/man/asOneFormula.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{asOneFormula} \title{Combine Formulas of a Set of Objects} \usage{ asOneFormula(\dots, omit) } \alias{asOneFormula} \arguments{ \item{\dots}{objects, or lists of objects, from which a formula can be extracted.} \item{omit}{an optional character vector with the names of variables to be omitted from the returned formula. Defaults to c(".", "pi").} } \description{ The names of all variables used in the formulas extracted from the objects defined in \code{\dots} are converted into a single linear formula, with the variables names separated by \code{+}. } \value{ a one-sided linear formula with all variables named in the formulas extracted from the objects in \code{\dots}, except the ones listed in \code{omit}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{formula}}, \code{\link{all.vars}}} \examples{ asOneFormula(y ~ x + z | g, list(~ w, ~ t * sin(2 * pi))) } \keyword{models} nlme/man/summary.gls.Rd0000644000176000001440000000437314251721455014575 0ustar ripleyusers% File nlme/man/summary.gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.gls} \title{Summarize a Generalized Least Squares \code{gls} Object} \alias{summary.gls} %\alias{coef.summary.gls} \usage{ \method{summary}{gls}(object, verbose, \dots) } \arguments{ \item{object}{an object inheriting from class \code{"\link{gls}"}, representing a generalized least squares fitted linear model.} \item{verbose}{an optional logical value used to control the amount of output when the object is printed. Defaults to \code{FALSE}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Additional information about the linear model fit represented by \code{object} is extracted and included as components of \code{object}. } \value{ an object inheriting from class \code{summary.gls} with all components included in \code{object} (see \code{\link{glsObject}} for a full description of the components) plus the following components: \item{corBeta}{approximate correlation matrix for the coefficients estimates} \item{tTable}{a matrix with columns \code{Value}, \code{Std. Error}, \code{t-value}, and \code{p-value} representing respectively the coefficients estimates, their approximate standard errors, the ratios between the estimates and their standard errors, and the associated p-value under a \eqn{t} approximation. Rows correspond to the different coefficients.} \item{residuals}{if more than five observations are used in the \code{gls} fit, a vector with the minimum, first quartile, median, third quartile, and maximum of the residuals distribution; else the residuals.} \item{AIC}{the Akaike Information Criterion corresponding to \code{object}.} \item{BIC}{the Bayesian Information Criterion corresponding to \code{object}.} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{AIC}}, \code{\link{BIC}}, \code{\link{gls}}, \code{\link{summary}} } \examples{ fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) summary(fm1) coef(summary(fm1)) # "the matrix" } \keyword{models} nlme/man/varWeights.Rd0000644000176000001440000000204014251721455014424 0ustar ripleyusers% File nlme/man/varWeights.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{varWeights} \title{Extract Variance Function Weights} \usage{ varWeights(object) } \alias{varWeights} \alias{varWeights.varComb} \alias{varWeights.varFunc} \arguments{ \item{object}{an object inheriting from class \code{varFunc}, representing a variance function structure.} } \description{ The inverse of the standard deviations corresponding to the variance function structure represented by \code{object} are returned. } \value{ if \code{object} has a \code{weights} attribute, its value is returned; else \code{NULL} is returned. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{logLik.varFunc}}, \code{\link{varWeights}} } \examples{ vf1 <- varPower(form=~age) vf1 <- Initialize(vf1, Orthodont) coef(vf1) <- 0.3 varWeights(vf1)[1:10] } \keyword{models} nlme/man/fitted.lme.Rd0000644000176000001440000000503714251721455014345 0ustar ripleyusers% File nlme/man/fitted.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fitted.lme} \title{Extract lme Fitted Values} \usage{ \method{fitted}{lme}(object, level, asList, \dots) } \alias{fitted.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in extracting the fitted values from \code{object}. Level values increase from outermost to innermost grouping, with level zero corresponding to the population fitted values. Defaults to the highest or innermost level of grouping.} \item{asList}{an optional logical value. If \code{TRUE} and a single value is given in \code{level}, the returned object is a list with the fitted values split by groups; else the returned value is either a vector or a data frame, according to the length of \code{level}. Defaults to \code{FALSE}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The fitted values at level \eqn{i} are obtained by adding together the population fitted values (based only on the fixed effects estimates) and the estimated contributions of the random effects to the fitted values at grouping levels less or equal to \eqn{i}. The resulting values estimate the best linear unbiased predictions (BLUPs) at level \eqn{i}. } \value{ If a single level of grouping is specified in \code{level}, the returned value is either a list with the fitted values split by groups (\code{asList = TRUE}) or a vector with the fitted values (\code{asList = FALSE}); else, when multiple grouping levels are specified in \code{level}, the returned object is a data frame with columns given by the fitted values at different levels and the grouping factors. For a vector or data frame result the \code{\link{napredict}} method is applied. } \references{ Bates, D.M. and Pinheiro, J.C. (1998) "Computational methods for multilevel models" available in PostScript or PDF formats at http://nlme.stat.wisc.edu/pub/NLME/ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 235, 397. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{residuals.lme}} } \examples{ fm1 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) fitted(fm1, level = 0:1) } \keyword{models} nlme/man/Meat.Rd0000644000176000001440000000337414251721455013202 0ustar ripleyusers% File nlme/man/Meat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Meat} \alias{Meat} \title{Tenderness of meat} \description{ The \code{Meat} data frame has 30 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Storage}{ an ordered factor specifying the storage treatment - 1 (0 days), 2 (1 day), 3 (2 days), 4 (4 days), 5 (9 days), and 6 (18 days) } \item{score}{ a numeric vector giving the tenderness score of beef roast. } \item{Block}{ an ordered factor identifying the muscle from which the roast was extracted with levels \code{II} < \code{V} < \code{I} < \code{III} < \code{IV} } \item{Pair}{ an ordered factor giving the unique identifier for each pair of beef roasts with levels \code{II-1} < \dots{} < \code{IV-1} } } } \details{ Cochran and Cox (section 11.51, 1957) describe data from an experiment conducted at Iowa State College (Paul, 1943) to compare the effects of length of cold storage on the tenderness of beef roasts. Six storage periods ranging from 0 to 18 days were used. Thirty roasts were scored by four judges on a scale from 0 to 10, with the score increasing with tenderness. The response was the sum of all four scores. Left and right roasts from the same animal were grouped into pairs, which were further grouped into five blocks, according to the muscle from which they were extracted. Different storage periods were applied to each roast within a pair according to a balanced incomplete block design.} \source{ Cochran, W. G. and Cox, G. M. (1957), \emph{Experimental Designs}, Wiley, New York. } %\examples{} \keyword{datasets} nlme/man/gls.Rd0000644000176000001440000001321314261034214013061 0ustar ripleyusers% File nlme/man/gls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gls} \title{Fit Linear Model Using Generalized Least Squares} \alias{gls} \alias{update.gls} \usage{ gls(model, data, correlation, weights, subset, method, na.action, control, verbose) \method{update}{gls}(object, model., \dots, evaluate = TRUE) } \arguments{ \item{object}{an object inheriting from class \code{"gls"}, representing a generalized least squares fitted linear model.} \item{model}{a two-sided linear formula object describing the model, with the response on the left of a \code{~} operator and the terms, separated by \code{+} operators, on the right.} \item{model.}{Changes to the model -- see \code{\link{update.formula}} for details.} \item{data}{an optional data frame containing the variables named in \code{model}, \code{correlation}, \code{weights}, and \code{subset}. By default the variables are taken from the environment from which \code{gls} is called.} \item{correlation}{an optional \code{\link{corStruct}} object describing the within-group correlation structure. See the documentation of \code{\link{corClasses}} for a description of the available \code{corStruct} classes. If a grouping variable is to be used, it must be specified in the \code{form} argument to the \code{corStruct} constructor. Defaults to \code{NULL}, corresponding to uncorrelated errors.} \item{weights}{an optional \code{\link{varFunc}} object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to \code{\link{varFixed}}, corresponding to fixed variance weights. See the documentation on \code{\link{varClasses}} for a description of the available \code{\link{varFunc}} classes. Defaults to \code{NULL}, corresponding to homoscedastic errors.} \item{subset}{an optional expression indicating which subset of the rows of \code{data} should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{method}{a character string. If \code{"REML"} the model is fit by maximizing the restricted log-likelihood. If \code{"ML"} the log-likelihood is maximized. Defaults to \code{"REML"}.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{\link{na.fail}}) causes \code{gls} to print an error message and terminate if there are any incomplete observations.} \item{control}{a list of control values for the estimation algorithm to replace the default values returned by the function \code{\link{glsControl}}. Defaults to an empty list.} \item{verbose}{an optional logical value. If \code{TRUE} information on the evolution of the iterative algorithm is printed. Default is \code{FALSE}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} \item{evaluate}{If \code{TRUE} evaluate the new call else return the call.} } \description{ This function fits a linear model using generalized least squares. The errors are allowed to be correlated and/or have unequal variances. } \details{ \code{\link{offset}} terms in \code{model} are an error since 3.1-157 (2022-03): previously they were silently ignored. } \value{ an object of class \code{"gls"} representing the linear model fit. Generic functions such as \code{print}, \code{plot}, and \code{summary} have methods to show the results of the fit. See \code{\link{glsObject}} for the components of the fit. The functions \code{\link{resid}}, \code{\link{coef}} and \code{\link{fitted}}, can be used to extract some of its components. } \references{ The different correlation structures available for the \code{correlation} argument are described in Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994), Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996), and Venables, W.N. and Ripley, B.D. (2002). The use of variance functions for linear and nonlinear models is presented in detail in Carroll, R.J. and Ruppert, D. (1988) and Davidian, M. and Giltinan, D.M. (1995). Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day. Carroll, R.J. and Ruppert, D. (1988) "Transformation and Weighting in Regression", Chapman and Hall. Davidian, M. and Giltinan, D.M. (1995) "Nonlinear Mixed Effects Models for Repeated Measurement Data", Chapman and Hall. Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 100, 461. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{glsControl}}, \code{\link{glsObject}}, \code{\link{glsStruct}}, \code{\link{plot.gls}}, \code{\link{predict.gls}}, \code{\link{qqnorm.gls}}, \code{\link{residuals.gls}}, \code{\link{summary.gls}}, \code{\link{varClasses}}, \code{\link{varFunc}} } \examples{ # AR(1) errors within each Mare fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) # variance increases as a power of the absolute fitted values fm2 <- update(fm1, weights = varPower()) } \keyword{models} nlme/man/Variogram.corSpatial.Rd0000644000176000001440000000455514251721456016346 0ustar ripleyusers% File nlme/man/Variogram.corSpatial.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.corSpatial} \title{Calculate Semi-variogram for a corSpatial Object} \usage{ \method{Variogram}{corSpatial}(object, distance, sig2, length.out, FUN, \dots) } \alias{Variogram.corSpatial} \arguments{ \item{object}{an object inheriting from class \code{"\link{corSpatial}"}, representing spatial correlation structure.} \item{distance}{an optional numeric vector with the distances at which the semi-variogram is to be calculated. Defaults to \code{NULL}, in which case a sequence of length \code{length.out} between the minimum and maximum values of \code{getCovariate(object)} is used.} \item{sig2}{an optional numeric value representing the process variance. Defaults to \code{1}.} \item{length.out}{an optional integer specifying the length of the sequence of distances to be used for calculating the semi-variogram, when \code{distance = NULL}. Defaults to \code{50}.} \item{FUN}{a function of two arguments, the distance and the range corresponding to \code{object}, specifying the semi-variogram model.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram values corresponding to the model defined in \code{FUN}, using the estimated coefficients corresponding to \code{object}, at the distances defined by \code{distance}. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corSpatial}}, \code{\link{Variogram}}, \code{\link{Variogram.default}}, \code{\link{Variogram.corExp}}, \code{\link{Variogram.corGaus}}, \code{\link{Variogram.corLin}}, \code{\link{Variogram.corRatio}}, \code{\link{Variogram.corSpher}}, \code{\link{plot.Variogram}} } \examples{ cs1 <- corExp(3, form = ~ Time | Rat) cs1 <- Initialize(cs1, BodyWeight) Variogram(cs1, FUN = function(x, y) (1 - exp(-x/y)))[1:10,] } \keyword{models} nlme/man/pdBlocked.Rd0000644000176000001440000001004614251721455014175 0ustar ripleyusers% File nlme/man/pdBlocked.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdBlocked} \title{Positive-Definite Block Diagonal Matrix} \usage{ pdBlocked(value, form, nam, data, pdClass) } \alias{pdBlocked} \arguments{ \item{value}{an optional list with elements to be used as the \code{value} argument to other \code{pdMat} constructors. These include: \code{pdMat} objects, positive-definite matrices, one-sided linear formulas, vectors of character strings, or numeric vectors. All elements in the list must be similar (e.g. all one-sided formulas, or all numeric vectors). Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional list of one-sided linear formulas specifying the row/column names for the block-diagonal elements of the matrix represented by \code{object}. Because factors may be present in \code{form}, the formulas needs to be evaluated on a data.frame to resolve the names they define. This argument is ignored when \code{value} is a list of one-sided formulas. Defaults to \code{NULL}.} \item{nam}{an optional list of vector of character strings specifying the row/column names for the block-diagonal elements of the matrix represented by object. Each of its components must have length equal to the dimension of the corresponding block-diagonal element and unreplicated elements. This argument is ignored when \code{value} is a list of vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on any \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} \item{pdClass}{an optional vector of character strings naming the \code{pdMat} classes to be assigned to the individual blocks in the underlying matrix. If a single class is specified, it is used for all block-diagonal elements. This argument will only be used when \code{value} is missing, or its elements are not \code{pdMat} objects. Defaults to \code{"pdSymm"}.} } \description{ This function is a constructor for the \code{pdBlocked} class, representing a positive-definite block-diagonal matrix. Each block-diagonal element of the underlying matrix is itself a positive-definite matrix and is represented internally as an individual \code{pdMat} object. When \code{value} is \code{numeric(0)}, a list of uninitialized \code{pdMat} objects, a list of one-sided formulas, or a list of vectors of character strings, \code{object} is returned as an uninitialized \code{pdBlocked} object (with just some of its attributes and its class defined) and needs to have its coefficients assigned later, generally using the \code{coef} or \code{matrix} replacement functions. If \code{value} is a list of initialized \code{pdMat} objects, \code{object} will be constructed from the list obtained by applying \code{as.matrix} to each of the \code{pdMat} elements of \code{value}. Finally, if \code{value} is a list of numeric vectors, they are assumed to represent the unrestricted coefficients of the block-diagonal elements of the underlying positive-definite matrix. } \value{ a \code{pdBlocked} object representing a positive-definite block-diagonal matrix, also inheriting from class \code{pdMat}. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. p. 162. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{coef.pdMat}}, \code{\link{pdClasses}}, \code{\link{matrix<-.pdMat}} } \examples{ pd1 <- pdBlocked(list(diag(1:2), diag(c(0.1, 0.2, 0.3))), nam = list(c("A","B"), c("a1", "a2", "a3"))) pd1 } \keyword{models} nlme/man/plot.intervals.lmList.Rd0000644000176000001440000000354114251721456016540 0ustar ripleyusers% File nlme/man/plot.intervals.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.intervals.lmList} \title{Plot lmList Confidence Intervals} \usage{ \method{plot}{intervals.lmList}(x, xlab = "", ylab = attr(x, "groupsName"), strip = function(...) strip.default(..., style = 1), \dots) } \alias{plot.intervals.lmList} \arguments{ \item{x}{an object inheriting from class \code{"\link{intervals.lmList}"}, representing confidence intervals and estimates for the coefficients in the \code{lm} components of the \code{lmList} object used to produce \code{x}. } \item{xlab, ylab}{axis labels, each with a sensible default.} \item{strip}{a \code{\link{function}} or \code{FALSE}, see \code{\link[lattice:xyplot]{dotplot}()} from package \CRANpkg{lattice}.} \item{\dots}{optional arguments passed to the \code{dotplot} function (see above).} } \description{ A Trellis dot-plot of the confidence intervals on the linear model coefficients is generated, with a different panel for each coefficient. Rows in the dot-plot correspond to the names of the \code{lm} components of the \code{lmList} object used to produce \code{x}. The lower and upper confidence limits are connected by a line segment and the estimated coefficients are marked with a \code{"+"}. This is based on function \code{\link[lattice:xyplot]{dotplot}()} from package \CRANpkg{lattice}. } \value{ a Trellis plot with the confidence intervals on the coefficients of the individual \code{lm} components of the \code{lmList} that generated \code{x}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{intervals.lmList}}, \code{\link{lmList}}, \code{\link{dotplot}}} \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) plot(intervals(fm1)) } \keyword{models} nlme/man/pairs.lme.Rd0000644000176000001440000000730114633640310014172 0ustar ripleyusers% File nlme/man/pairs.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pairs.lme} \title{Pairs Plot of an lme Object} \usage{ \method{pairs}{lme}(x, form, label, id, idLabels, grid, \dots) } \alias{pairs.lme} \arguments{ \item{x}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{form}{an optional one-sided formula specifying the desired type of plot. Any variable present in the original data frame used to obtain \code{x} can be referenced. In addition, \code{x} itself can be referenced in the formula using the symbol \code{"."}. Conditional expressions on the right of a \code{|} operator can be used to define separate panels in a Trellis display. The expression on the right hand side of \code{form}, and to the left of the \code{|} operator, must evaluate to a data frame with at least two columns. Default is \code{~ coef(.) }, corresponding to a pairs plot of the coefficients evaluated at the innermost level of nesting.} \item{label}{an optional character vector of labels for the variables in the pairs plot.} \item{id}{an optional numeric value, or one-sided formula. If given as a value, it is used as a significance level for an outlier test based on the Mahalanobis distances of the estimated random effects. Groups with random effects distances greater than the \eqn{1-value} percentile of the appropriate chi-square distribution are identified in the plot using \code{idLabels}. If given as a one-sided formula, its right hand side must evaluate to a logical, integer, or character vector which is used to identify points in the plot. If missing, no points are identified.} \item{idLabels}{an optional vector, or one-sided formula. If given as a vector, it is converted to character and used to label the points identified according to \code{id}. If given as a one-sided formula, its right hand side must evaluate to a vector which is converted to character and used to label the identified points. Default is the innermost grouping factor. } \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{FALSE}.} \item{\dots}{optional arguments passed to the Trellis plot function.} } \description{ Diagnostic plots for the linear mixed-effects fit are obtained. The \code{form} argument gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a \code{|} operator) always implies that different panels are used for each level of the conditioning factor, according to a Trellis display. The expression on the right hand side of the formula, before a \code{|} operator, must evaluate to a data frame with at least two columns. If the data frame has two columns, a scatter plot of the two variables is displayed (the Trellis function \code{xyplot} is used). Otherwise, if more than two columns are present, a scatter plot matrix with pairwise scatter plots of the columns in the data frame is displayed (the Trellis function \code{splom} is used). } \value{ a diagnostic Trellis plot. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{pairs.compareFits}}, \code{\link{pairs.lmList}}, \code{\link[lattice]{xyplot}}, \code{\link[lattice]{splom}} } \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) # scatter plot of coefficients by gender, identifying unusual subjects pairs(fm1, ~coef(., augFrame = TRUE) | Sex, id = 0.1, adj = -0.5) # scatter plot of estimated random effects : pairs(fm1, ~ranef(.)) } \keyword{models} nlme/man/Initialize.lmeStruct.Rd0000644000176000001440000000433114251721455016370 0ustar ripleyusers% File nlme/man/Initialize.lmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Initialize.lmeStruct} \title{Initialize an lmeStruct Object} \usage{ \method{Initialize}{lmeStruct}(object, data, groups, conLin, control, \dots) } \alias{Initialize.lmeStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmeStruct}"}, representing a list of linear mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} \item{data}{a data frame in which to evaluate the variables defined in \code{formula(object)}.} \item{groups}{a data frame with the grouping factors corresponding to the lme model associated with \code{object} as columns, sorted from innermost to outermost grouping level.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying lme model. Defaults to \code{attr(object, "conLin")}.} \item{control}{an optional list with control parameters for the initialization and optimization algorithms used in \code{lme}. Defaults to \code{list(niterEM=20, gradHess=TRUE)}, implying that 20 EM iterations are to be used in the derivation of initial estimates for the coefficients of the \code{reStruct} component of \code{object} and, if possible, numerical gradient vectors and Hessian matrices for the log-likelihood function are to be used in the optimization algorithm.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The individual linear mixed-effects model components of the \code{lmeStruct} list are initialized. } \value{ an \code{lmeStruct} object similar to \code{object}, but with initialized model components. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{Initialize.reStruct}}, \code{\link{Initialize.corStruct}}, \code{\link{Initialize.varFunc}}, \code{\link{Initialize}} } \keyword{models} nlme/man/gnlsControl.Rd0000644000176000001440000000653314251721455014620 0ustar ripleyusers% File nlme/man/gnlsControl.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gnlsControl} \alias{gnlsControl} \title{Control Values for gnls Fit} \usage{ gnlsControl(maxIter = 50, nlsMaxIter = 7, msMaxIter = 50, minScale = 0.001, tolerance = 1e-6, nlsTol = 0.001, msTol = 1e-7, returnObject = FALSE, msVerbose = FALSE, apVar = TRUE, .relStep =, opt = c("nlminb", "optim"), optimMethod = "BFGS", minAbsParApVar = 0.05, sigma = NULL) } \arguments{ \item{maxIter}{maximum number of iterations for the \code{gnls} optimization algorithm. Default is 50.} \item{nlsMaxIter}{maximum number of iterations for the \code{nls} optimization step \emph{inside} the \code{gnls} optimization. Default is 7.} \item{msMaxIter}{maximum number of iterations for the \code{opt}imization step inside the \code{gnls} optimization. Default is 50.} \item{minScale}{minimum factor by which to shrink the default step size in an attempt to decrease the sum of squares in the \code{nls} step. Default 0.001.} \item{tolerance}{tolerance for the convergence criterion in the \code{gnls} algorithm. Default is 1e-6.} \item{nlsTol}{tolerance for the convergence criterion in \code{nls} step. Default is 1e-3.} \item{msTol}{tolerance for the convergence criterion of the first outer iteration when \code{optim} is used. Default is 1e-7.} \item{returnObject}{a logical value indicating whether the fitted object should be returned with a \code{\link{warning}} (instead of an error via \code{\link{stop}()}) when the maximum number of iterations is reached without convergence of the algorithm.} \item{msVerbose}{a logical value passed as the \code{trace} argument to the optimizer chosen by \code{opt}; see documentation on that. Default is \code{FALSE}.} \item{apVar}{a logical value indicating whether the approximate covariance matrix of the variance-covariance parameters should be calculated. Default is \code{TRUE}.} \item{.relStep}{relative step for numerical derivatives calculations. Default is \code{.Machine$double.eps^(1/3)} (about 6e-6).} \item{opt}{the optimizer to be used, either \code{"\link{nlminb}"} (the current default) or \code{"\link{optim}"} (the previous default).} \item{optimMethod}{character - the optimization method to be used with the \code{\link{optim}} optimizer. The default is \code{"BFGS"}. An alternative is \code{"L-BFGS-B"}.} \item{minAbsParApVar}{numeric value - minimum absolute parameter value in the approximate variance calculation. The default is \code{0.05}.} \item{sigma}{optionally a positive number to fix the residual error at. If \code{NULL}, as by default, or \code{0}, sigma is estimated.} } \description{ The values supplied in the function call replace the defaults and a list with all possible arguments is returned. The returned list is used as the \code{control} argument to the \code{gnls} function. } \value{ a list with components for each of the possible arguments. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}; the \code{sigma} option: Siem Heisterkamp and Bert van Willigen.} \seealso{\code{\link{gnls}}} \examples{ # decrease the maximum number of iterations and request tracing gnlsControl(msMaxIter = 20, msVerbose = TRUE) } \keyword{models} nlme/man/getVarCov.Rd0000644000176000001440000000413614543113774014214 0ustar ripleyusers% File nlme/man/getVarCov.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getVarCov} \alias{getVarCov} \alias{getVarCov.lme} \alias{getVarCov.gls} \alias{print.VarCov} \title{Extract variance-covariance matrix} \description{ Extract the variance-covariance matrix from a fitted model, such as a mixed-effects model. } \usage{ getVarCov(obj, \dots) \method{getVarCov}{lme}(obj, individuals, type = c("random.effects", "conditional", "marginal"), \dots) \method{getVarCov}{gls}(obj, individual = 1, \dots) } \arguments{ \item{obj}{A fitted model. Methods are available for models fit by \code{\link{lme}} and by \code{\link{gls}}} \item{individuals}{For models fit by \code{\link{lme}} a vector of levels of the grouping factor can be specified for the conditional or marginal variance-covariance matrices.} \item{individual}{For models fit by \code{\link{gls}} the only type of variance-covariance matrix provided is the marginal variance-covariance of the responses by group. The optional argument \code{individual} specifies the group of responses.} \item{type}{For models fit by \code{\link{lme}} the \code{type} argument specifies the type of variance-covariance matrix, either \code{"random.effects"} for the random-effects variance-covariance (the default), or \code{"conditional"} for the conditional. variance-covariance of the responses or \code{"marginal"} for the the marginal variance-covariance of the responses.} \item{\dots}{Optional arguments for some methods, as described above} } \value{ A variance-covariance matrix or a list of variance-covariance matrices. } \author{Mary Lindstrom \email{lindstro@biostat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{gls}}} \examples{ fm1 <- lme(distance ~ age, data = Orthodont, subset = Sex == "Female") getVarCov(fm1) getVarCov(fm1, individuals = "F01", type = "marginal") getVarCov(fm1, type = "conditional") fm2 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, correlation = corAR1(form = ~ 1 | Mare)) getVarCov(fm2) } \keyword{models} nlme/man/coef.lme.Rd0000644000176000001440000000770414251721455014005 0ustar ripleyusers% File nlme/man/coef.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{coef.lme} \title{Extract lme Coefficients} \usage{ \method{coef}{lme}(object, augFrame, level, data, which, FUN, omitGroupingFactor, subset, \dots) } \alias{coef.lme} \arguments{ \item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model.} \item{augFrame}{an optional logical value. If \code{TRUE}, the returned data frame is augmented with variables defined in \code{data}; else, if \code{FALSE}, only the coefficients are returned. Defaults to \code{FALSE}.} \item{level}{an optional positive integer giving the level of grouping to be used in extracting the coefficients from an object with multiple nested grouping levels. Defaults to the highest or innermost level of grouping.} \item{data}{an optional data frame with the variables to be used for augmenting the returned data frame when \code{augFrame = TRUE}. Defaults to the data frame used to fit \code{object}.} \item{which}{an optional positive integer or character vector specifying which columns of \code{data} should be used in the augmentation of the returned data frame. Defaults to all columns in \code{data}.} \item{FUN}{an optional summary function or a list of summary functions to be applied to group-varying variables, when collapsing \code{data} by groups. Group-invariant variables are always summarized by the unique value that they assume within that group. If \code{FUN} is a single function it will be applied to each non-invariant variable by group to produce the summary for that variable. If \code{FUN} is a list of functions, the names in the list should designate classes of variables in the frame such as \code{ordered}, \code{factor}, or \code{numeric}. The indicated function will be applied to any group-varying variables of that class. The default functions to be used are \code{mean} for numeric factors, and \code{Mode} for both \code{factor} and \code{ordered}. The \code{Mode} function, defined internally in \code{gsummary}, returns the modal or most popular value of the variable. It is different from the \code{mode} function that returns the S-language mode of the variable.} \item{omitGroupingFactor}{an optional logical value. When \code{TRUE} the grouping factor itself will be omitted from the group-wise summary of \code{data} but the levels of the grouping factor will continue to be used as the row names for the returned data frame. Defaults to \code{FALSE}.} \item{subset}{an optional expression specifying a subset} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The estimated coefficients at level \eqn{i} are obtained by adding together the fixed effects estimates and the corresponding random effects estimates at grouping levels less or equal to \eqn{i}. The resulting estimates are returned as a data frame, with rows corresponding to groups and columns to coefficients. Optionally, the returned data frame may be augmented with covariates summarized over groups. } \value{ a data frame inheriting from class \code{"coef.lme"} with the estimated coefficients at level \code{level} and, optionally, other covariates summarized over groups. The returned object also inherits from classes \code{"ranef.lme"} and \code{"data.frame"}. } \references{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York, esp. pp. 455-457. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, %\code{\link{fixef.lme}}, \code{\link{ranef.lme}}, \code{\link{plot.ranef.lme}}, \code{\link{gsummary}} } \examples{ fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) coef(fm1) coef(fm1, augFrame = TRUE) } \keyword{models} nlme/man/Matrix.Rd0000644000176000001440000000200114251721455013542 0ustar ripleyusers% File nlme/man/Matrix.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Matrix} \title{Assign Matrix Values} \usage{ matrix(object) <- value } \alias{matrix<-} \arguments{ \item{object}{any object to which \code{as.matrix} can be applied.} \item{value}{a matrix, or list of matrices, with the same dimensions as \code{as.matrix(object)} with the new values to be assigned to the matrix associated with \code{object}.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{pdMat}, \code{pdBlocked}, and \code{reStruct}. } \value{ will depend on the method function; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix}}, also for examples, \code{\link{matrix<-.pdMat}},%incl .pdBlocked \code{\link{matrix<-.reStruct}}. } \keyword{models} nlme/man/Gasoline.Rd0000644000176000001440000000424114251721455014047 0ustar ripleyusers% File nlme/man/Gasoline.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Gasoline} \alias{Gasoline} \title{Refinery yield of gasoline} \description{ The \code{Gasoline} data frame has 32 rows and 6 columns. } \format{ This data frame contains the following columns: \describe{ \item{yield}{ a numeric vector giving the percentage of crude oil converted to gasoline after distillation and fractionation } \item{endpoint}{ a numeric vector giving the temperature (degrees F) at which all the gasoline is vaporized } \item{Sample}{ an ordered factor giving the inferred crude oil sample number } \item{API}{ a numeric vector giving the crude oil gravity (degrees API) } \item{vapor}{ a numeric vector giving the vapor pressure of the crude oil \eqn{(\mathrm{lbf}/\mathrm{in}^2)}{(lbf/in^2)} } \item{ASTM}{ a numeric vector giving the crude oil 10\% point ASTM---the temperature at which 10\% of the crude oil has become vapor. } } } \details{ Prater (1955) provides data on crude oil properties and gasoline yields. Atkinson (1985) uses these data to illustrate the use of diagnostics in multiple regression analysis. Three of the covariates---\code{API}, \code{vapor}, and \code{ASTM}---measure characteristics of the crude oil used to produce the gasoline. The other covariate --- \code{endpoint}---is a characteristic of the refining process. Daniel and Wood (1980) notice that the covariates characterizing the crude oil occur in only ten distinct groups and conclude that the data represent responses measured on ten different crude oil samples. } \source{ Prater, N. H. (1955), Estimate gasoline yields from crudes, \emph{Petroleum Refiner}, \bold{35} (5). Atkinson, A. C. (1985), \emph{Plots, Transformations, and Regression}, Oxford Press, New York. Daniel, C. and Wood, F. S. (1980), \emph{Fitting Equations to Data}, Wiley, New York Venables, W. N. and Ripley, B. D. (2002) \emph{Modern Applied Statistics with S (4th ed)}, Springer, New York. } %\examples{} \keyword{datasets} nlme/man/Glucose2.Rd0000644000176000001440000000265114251721455013774 0ustar ripleyusers% File nlme/man/Glucose2.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Glucose2} \alias{Glucose2} \title{Glucose Levels Following Alcohol Ingestion} \description{ The \code{Glucose2} data frame has 196 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Subject}{ a factor with levels \code{1} to \code{7} identifying the subject whose glucose level is measured. } \item{Date}{ a factor with levels \code{1} \code{2} indicating the occasion in which the experiment was conducted. } \item{Time}{ a numeric vector giving the time since alcohol ingestion (in min/10). } \item{glucose}{ a numeric vector giving the blood glucose level (in mg/dl). } } } \details{ Hand and Crowder (Table A.14, pp. 180-181, 1996) describe data on the blood glucose levels measured at 14 time points over 5 hours for 7 volunteers who took alcohol at time 0. The same experiment was repeated on a second date with the same subjects but with a dietary additive used for all subjects. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.10) Hand, D. and Crowder, M. (1996), \emph{Practical Longitudinal Data Analysis}, Chapman and Hall, London. } %\examples{} \keyword{datasets} nlme/man/summary.lmList.Rd0000644000176000001440000000770414251721455015255 0ustar ripleyusers% File nlme/man/summary.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{summary.lmList} \title{Summarize an lmList Object} \usage{ \method{summary}{lmList}(object, pool, \dots) } \alias{summary.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} fitted objects. } \item{pool}{an optional logical value indicating whether a pooled estimate of the residual standard error should be used. Default is \code{attr(object, "pool")}. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The \code{summary.lm} method is applied to each \code{lm} component of \code{object} to produce summary information on the individual fits, which is organized into a list of summary statistics. The returned object is suitable for printing with the \code{print.summary.lmList} method. } \value{ a list with summary statistics obtained by applying \code{summary.lm} to the elements of \code{object}, inheriting from class \code{summary.lmList}. The components of \code{value} are: \item{call}{a list containing an image of the \code{lmList} call that produced \code{object}. } \item{coefficients}{a three dimensional array with summary information on the \code{lm} coefficients. The first dimension corresponds to the names of the \code{object} components, the second dimension is given by \code{"Value"}, \code{"Std. Error"}, \code{"t value"}, and \code{"Pr(>|t|)"}, corresponding, respectively, to the coefficient estimates and their associated standard errors, t-values, and p-values. The third dimension is given by the coefficients names. } \item{correlation}{a three dimensional array with the correlations between the individual \code{lm} coefficient estimates. The first dimension corresponds to the names of the \code{object} components. The third dimension is given by the coefficients names. For each coefficient, the rows of the associated array give the correlations between that coefficient and the remaining coefficients, by \code{lm} component. } \item{cov.unscaled}{a three dimensional array with the unscaled variances/covariances for the individual \code{lm} coefficient estimates (giving the estimated variance/covariance for the coefficients, when multiplied by the estimated residual errors). The first dimension corresponds to the names of the \code{object} components. The third dimension is given by the coefficients names. For each coefficient, the rows of the associated array give the unscaled covariances between that coefficient and the remaining coefficients, by \code{lm} component. } \item{df}{an array with the number of degrees of freedom for the model and for residuals, for each \code{lm} component. } \item{df.residual}{the total number of degrees of freedom for residuals, corresponding to the sum of residuals df of all \code{lm} components. } \item{fstatistics}{an array with the F test statistics and corresponding degrees of freedom, for each \code{lm} component. } \item{pool}{the value of the \code{pool} argument to the function. } \item{r.squared}{a vector with the multiple R-squared statistics for each \code{lm} component. } \item{residuals}{a list with components given by the residuals from individual \code{lm} fits. } \item{RSE}{the pooled estimate of the residual standard error.} \item{sigma}{a vector with the residual standard error estimates for the individual \code{lm} fits. } \item{terms}{the terms object used in fitting the individual \code{lm} components. } } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{summary}} } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) summary(fm1) } \keyword{models} nlme/man/Quinidine.Rd0000644000176000001440000000670314251721455014240 0ustar ripleyusers% File nlme/man/Quinidine.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Quinidine} \alias{Quinidine} \title{Quinidine Kinetics} \description{ The \code{Quinidine} data frame has 1471 rows and 14 columns. } \format{ This data frame contains the following columns: \describe{ \item{Subject}{ a factor identifying the patient on whom the data were collected. } \item{time}{ a numeric vector giving the time (hr) at which the drug was administered or the blood sample drawn. This is measured from the time the patient entered the study. } \item{conc}{ a numeric vector giving the serum quinidine concentration (mg/L). } \item{dose}{ a numeric vector giving the dose of drug administered (mg). Although there were two different forms of quinidine administered, the doses were adjusted for differences in salt content by conversion to milligrams of quinidine base. } \item{interval}{ a numeric vector giving the when the drug has been given at regular intervals for a sufficiently long period of time to assume steady state behavior, the interval is recorded. } \item{Age}{ a numeric vector giving the age of the subject on entry to the study (yr). } \item{Height}{ a numeric vector giving the height of the subject on entry to the study (in.). } \item{Weight}{ a numeric vector giving the body weight of the subject (kg). } \item{Race}{ a factor with levels \code{Caucasian}, \code{Latin}, and \code{Black} identifying the race of the subject. } \item{Smoke}{ a factor with levels \code{no} and \code{yes} giving smoking status at the time of the measurement. } \item{Ethanol}{ a factor with levels \code{none}, \code{current}, \code{former} giving ethanol (alcohol) abuse status at the time of the measurement. } \item{Heart}{ a factor with levels \code{No/Mild}, \code{Moderate}, and \code{Severe} indicating congestive heart failure for the subject. } \item{Creatinine}{ an ordered factor with levels \code{< 50} < \code{>= 50} indicating the creatinine clearance (mg/min). } \item{glyco}{ a numeric vector giving the alpha-1 acid glycoprotein concentration (mg/dL). Often measured at the same time as the quinidine concentration. } } } \details{ Verme et al. (1992) analyze routine clinical data on patients receiving the drug quinidine as a treatment for cardiac arrhythmia (atrial fibrillation or ventricular arrhythmias). All patients were receiving oral quinidine doses. At irregular intervals blood samples were drawn and serum concentrations of quinidine were determined. These data are analyzed in several publications, including Davidian and Giltinan (1995, section 9.3). } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.25) Davidian, M. and Giltinan, D. M. (1995), \emph{Nonlinear Models for Repeated Measurement Data}, Chapman and Hall, London. Verme, C. N., Ludden, T. M., Clementi, W. A. and Harris, S. C. (1992), Pharmacokinetics of quinidine in male patients: A population analysis, \emph{Clinical Pharmacokinetics}, \bold{22}, 468-480. } %\examples{} \keyword{datasets} nlme/man/solve.reStruct.Rd0000644000176000001440000000243114251721455015247 0ustar ripleyusers% File nlme/man/solve.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{solve.reStruct} \title{Apply Solve to an reStruct Object} \usage{ \method{solve}{reStruct}(a, b, \dots) } \alias{solve.reStruct} \arguments{ \item{a}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{b}{this argument is only included for consistency with the generic function and is not used in this method function.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ \code{Solve} is applied to each \code{pdMat} component of \code{a}, which results in inverting the positive-definite matrices they represent. } \value{ an \code{reStruct} object similar to \code{a}, but with the \code{pdMat} components representing the inverses of the matrices represented by the components of \code{a}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{solve.pdMat}}, \code{\link{reStruct}}} \examples{ rs1 <- reStruct(list(A = pdSymm(diag(1:3), form = ~Score), B = pdDiag(2 * diag(4), form = ~Educ))) solve(rs1) } \keyword{models} nlme/man/allCoef.Rd0000644000176000001440000000207114251721455013652 0ustar ripleyusers% File nlme/man/allCoef.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{allCoef} \title{Extract Coefficients from a Set of Objects} \usage{ allCoef(\dots, extract) } \alias{allCoef} \arguments{ \item{\dots}{objects to which \code{extract} will be applied. Generally these will be model components, such as \code{corStruct} and \code{varFunc} objects.} \item{extract}{an optional extractor function. Defaults to \code{coef}.} } \description{ The extractor function is applied to each object in \code{\dots}, with the result being converted to a vector. A \code{map} attribute is included to indicate which pieces of the returned vector correspond to the original objects in \code{dots}. } \value{ a vector with all elements, generally coefficients, obtained by applying \code{extract} to the objects in \code{\dots}. } \author{José' Pinheiro and Douglas Bates} \seealso{\code{\link{lmeStruct}},\code{\link{nlmeStruct}}} \examples{ cs1 <- corAR1(0.1) vf1 <- varPower(0.5) allCoef(cs1, vf1) } \keyword{models} nlme/man/plot.ranef.lmList.Rd0000644000176000001440000000774314543113774015636 0ustar ripleyusers% File nlme/man/plot.ranef.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{plot.ranef.lmList} \title{Plot a ranef.lmList Object} \alias{plot.ranef.lmList} \usage{ \method{plot}{ranef.lmList}(x, form, grid, control, \dots) } \arguments{ \item{x}{an object inheriting from class \code{"\link{ranef.lmList}"}, representing the estimated coefficients or estimated random effects for the \code{lmList} object from which it was produced. } \item{form}{an optional formula specifying the desired type of plot. If given as a one-sided formula, a \code{dotplot} of the estimated random effects (coefficients) grouped according to all combinations of the levels of the factors named in \code{form} is returned. Single factors (\code{~g}) or crossed factors (\code{~g1*g2}) are allowed. If given as a two-sided formula, the left hand side must be a single random effects (coefficient) and the right hand side is formed by covariates in \code{x} separated by \code{+}. A Trellis display of the random effect (coefficient) versus the named covariates is returned in this case. Default is \code{NULL}, in which case the row names of the random effects (coefficients) are used.} \item{grid}{an optional logical value indicating whether a grid should be added to plot. Only applies to plots associated with two-sided formulas in \code{form}. Default is \code{FALSE}.} \item{control}{an optional list with control values for the plot, when \code{form} is given as a two-sided formula. The control values are referenced by name in the \code{control} list and only the ones to be modified from the default need to be specified. Available values include: \code{drawLine}, a logical value indicating whether a \code{loess} smoother should be added to the scatter plots and a line connecting the medians should be added to the boxplots (default is \code{TRUE}); \code{span.loess}, used as the \code{span} argument in the call to \code{panel.loess} (default is \code{2/3}); \code{degree.loess}, used as the \code{degree} argument in the call to \code{panel.loess} (default is \code{1}); \code{cex.axis}, the character expansion factor for the x-axis (default is \code{0.8}); \code{srt.axis}, the rotation factor for the x-axis (default is \code{0}); and \code{mgp.axis}, the margin parameters for the x-axis (default is \code{c(2, 0.5, 0)}).} \item{\dots}{optional arguments passed to the Trellis \code{dotplot} function. } } \description{ If \code{form} is missing, or is given as a one-sided formula, a Trellis dot-plot of the random effects is generated, with a different panel for each random effect (coefficient). Rows in the dot-plot are determined by the \code{form} argument (if not missing) or by the row names of the random effects (coefficients). If a single factor is specified in \code{form}, its levels determine the dot-plot rows (with possibly multiple dots per row); otherwise, if \code{form} specifies a crossing of factors, the dot-plot rows are determined by all combinations of the levels of the individual factors in the formula. The Trellis function \code{dotplot} is used in this method function. If \code{form} is a two-sided formula, a Trellis display is generated, with a different panel for each variable listed in the right hand side of \code{form}. Scatter plots are generated for numeric variables and boxplots are generated for categorical (\code{factor} or \code{ordered}) variables. } \value{ a Trellis plot of the estimated random-effects (coefficients) versus covariates, or groups. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{lmList}}, \code{\link{dotplot}} } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) plot(ranef(fm1)) fm1RE <- ranef(fm1, augFrame = TRUE) plot(fm1RE, form = ~ Sex) plot(fm1RE, form = age ~ Sex) } \keyword{models} nlme/man/logDet.pdMat.Rd0000644000176000001440000000216214251721455014570 0ustar ripleyusers% File nlme/man/logDet.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logDet.pdMat} \title{Extract Log-Determinant from a pdMat Object} \usage{ \method{logDet}{pdMat}(object, \dots) } \alias{logDet.pdMat} \alias{logDet.pdBlocked} \alias{logDet.pdCompSymm} \alias{logDet.pdDiag} \alias{logDet.pdIdent} \alias{logDet.pdNatural} \alias{logDet.pdSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive definite matrix.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the logarithm of the determinant of a square-root factor of the positive-definite matrix represented by \code{object}. } \value{ the log-determinant of a square-root factor of the positive-definite matrix represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{pdMat}}, \code{\link{logDet}} } \examples{ pd1 <- pdSymm(diag(1:3)) logDet(pd1) } \keyword{models} nlme/man/Initialize.corStruct.Rd0000644000176000001440000000334414660073244016401 0ustar ripleyusers% File nlme/man/Initialize.corStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Initialize.corStruct} \title{Initialize corStruct Object} \usage{ \method{Initialize}{corStruct}(object, data, \dots) } \alias{Initialize.corStruct} \alias{Initialize.corAR1} \alias{Initialize.corARMA} \alias{Initialize.corCAR1} \alias{Initialize.corCompSymm} %\alias{Initialize.corHF} % not implemented \alias{Initialize.corLin} \alias{Initialize.corNatural} \alias{Initialize.corSpatial} \alias{Initialize.corSpher} \alias{Initialize.corSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{corStruct}"} representing a correlation structure.} \item{data}{a data frame in which to evaluate the variables defined in \code{formula(object)}.} \item{\dots}{this argument is included to make this method compatible with the generic.} } \description{ This method initializes \code{object} by evaluating its associated covariate(s) and grouping factor, if any is present, in \code{data}, calculating various dimensions and constants used by optimization algorithms involving \code{corStruct} objects (see the appropriate \code{Dim} method documentation), and assigning initial values for the coefficients in \code{object}, if none were present. } \value{ an initialized object with the same class as \code{object} representing a correlation structure. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Dim.corStruct}}} \examples{ cs1 <- corAR1(form = ~ 1 | Subject) cs1 <- Initialize(cs1, data = Orthodont) } \keyword{models} nlme/man/Oxboys.Rd0000644000176000001440000000217514251721455013575 0ustar ripleyusers% File nlme/man/Oxboys.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Oxboys} \alias{Oxboys} \title{Heights of Boys in Oxford} \description{ The \code{Oxboys} data frame has 234 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Subject}{ an ordered factor giving a unique identifier for each boy in the experiment } \item{age}{ a numeric vector giving the standardized age (dimensionless) } \item{height}{ a numeric vector giving the height of the boy (cm) } \item{Occasion}{ an ordered factor - the result of converting \code{age} from a continuous variable to a count so these slightly unbalanced data can be analyzed as balanced. } } } \details{ These data are described in Goldstein (1987) as data on the height of a selection of boys from Oxford, England versus a standardized age. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.19) } %\examples{} \keyword{datasets} nlme/man/reStruct.Rd0000644000176000001440000001001414335517423014115 0ustar ripleyusers% File nlme/man/reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{reStruct} \title{Random Effects Structure} \usage{ reStruct(object, pdClass, REML, data) \method{print}{reStruct}(x, sigma, reEstimates, verbose, \dots) } \alias{reStruct} \alias{[.reStruct} \alias{print.reStruct} \arguments{ \item{object}{any of the following: (i) a one-sided formula of the form \code{~x1+...+xn | g1/.../gm}, with \code{x1+...+xn} specifying the model for the random effects and \code{g1/.../gm} the grouping structure (\code{m} may be equal to 1, in which case no \code{/} is required). The random effects formula will be repeated for all levels of grouping, in the case of multiple levels of grouping; (ii) a list of one-sided formulas of the form \code{~x1+...+xn | g}, with possibly different random effects models for each grouping level. The order of nesting will be assumed the same as the order of the elements in the list; (iii) a one-sided formula of the form \code{~x1+...+xn}, or a \code{pdMat} object with a formula (i.e. a non-\code{NULL} value for \code{formula(object)}), or a list of such formulas or \code{pdMat} objects. In this case, the grouping structure formula will be derived from the data used to to fit the mixed-effects model, which should inherit from class \code{groupedData}; (iv) a named list of formulas or \code{pdMat} objects as in (iii), with the grouping factors as names. The order of nesting will be assumed the same as the order of the order of the elements in the list; (v) an \code{reStruct} object.} \item{pdClass}{an optional character string with the name of the \code{pdMat} class to be used for the formulas in \code{object}. Defaults to \code{"pdLogChol"} which corresponds to a general positive-definite matrix (Log-Cholesky parametrization).} \item{REML}{an optional logical value. If \code{TRUE}, the associated mixed-effects model will be fitted using restricted maximum likelihood; else, if \code{FALSE}, maximum likelihood will be used. Defaults to \code{FALSE}.} \item{data}{an optional data frame in which to evaluate the variables used in the random effects formulas in \code{object}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying \code{pdMat} objects. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} \item{x}{an object inheriting from class \code{reStruct} to be printed.} \item{sigma}{an optional numeric value used as a multiplier for the square-root factors of the \code{pdMat} components (usually the estimated within-group standard deviation from a mixed-effects model). Defaults to 1.} \item{reEstimates}{an optional list with the random effects estimates for each level of grouping. Only used when \code{verbose = TRUE}.} \item{verbose}{an optional logical value determining if the random effects estimates should be printed. Defaults to \code{FALSE}.} \item{\dots}{Optional arguments can be given to other methods for this generic. None are used in this method.} } \description{ This function is a constructor for the \code{reStruct} class, representing a random effects structure and consisting of a list of \code{pdMat} objects, plus a \code{settings} attribute containing information for the optimization algorithm used to fit the associated mixed-effects model. } \value{ an object inheriting from class \code{reStruct}, representing a random effects structure. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{groupedData}}, \code{\link{lme}}, \code{\link{pdMat}}, \code{\link{solve.reStruct}}, \code{\link{summary.reStruct}}, \code{\link{update.reStruct}} } \examples{ rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) rs1 # 2 entries "Uninitialized" str(rs1) # a bit more } \keyword{models} nlme/man/lmList.groupedData.Rd0000644000176000001440000000454714363200201016002 0ustar ripleyusers% File nlme/man/lmList.groupedData.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{lmList.groupedData} \title{lmList Fit from a groupedData Object} \alias{lmList.groupedData} \usage{ \method{lmList}{groupedData}(object, data, level, subset, na.action = na.fail, pool = TRUE, warn.lm = TRUE) } \arguments{ \item{object}{a data frame inheriting from class \code{"\link{groupedData}"}.} \item{data}{this argument is included for consistency with the generic function. It is ignored in this method function.} \item{level}{ an optional integer specifying the level of grouping to be used when multiple nested levels of grouping are present. } \item{subset}{an optional expression indicating which subset of the rows of \code{data} should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{lmList} to print an error message and terminate if there are any incomplete observations. } \item{pool, warn.lm}{optional \code{\link{logical}}s, see \code{\link{lmList}}.} } \description{ The response variable and primary covariate in \code{formula(object)} are used to construct the linear model formula. This formula and the \code{groupedData} object are passed as the \code{object} and \code{data} arguments to \code{lmList.formula}, together with any other additional arguments in the function call. See the documentation on \code{\link{lmList.formula}} for a description of that function. } \value{ a list of \code{lm} objects with as many components as the number of groups defined by the grouping factor. Generic functions such as \code{coef}, \code{fixed.effects}, \code{lme}, \code{pairs}, \code{plot}, \code{predict}, \code{random.effects}, \code{summary}, and \code{update} have methods that can be applied to an \code{lmList} object. } \seealso{ \code{\link{groupedData}}, \code{\link{lm}}, \code{\link{lme.lmList}}, \code{\link{lmList}}, \code{\link{lmList.formula}} } \examples{ fm1 <- lmList(Orthodont) summary(fm1) } \keyword{models} nlme/man/pdSymm.Rd0000644000176000001440000000662414251721455013566 0ustar ripleyusers% File nlme/man/pdSymm.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pdSymm} \title{General Positive-Definite Matrix} \usage{ pdSymm(value, form, nam, data) } \alias{pdSymm} \arguments{ \item{value}{an optional initialization value, which can be any of the following: a \code{pdMat} object, a positive-definite matrix, a one-sided linear formula (with variables separated by \code{+}), a vector of character strings, or a numeric vector. Defaults to \code{numeric(0)}, corresponding to an uninitialized object.} \item{form}{an optional one-sided linear formula specifying the row/column names for the matrix represented by \code{object}. Because factors may be present in \code{form}, the formula needs to be evaluated on a data.frame to resolve the names it defines. This argument is ignored when \code{value} is a one-sided formula. Defaults to \code{NULL}.} \item{nam}{an optional vector of character strings specifying the row/column names for the matrix represented by object. It must have length equal to the dimension of the underlying positive-definite matrix and unreplicated elements. This argument is ignored when \code{value} is a vector of character strings. Defaults to \code{NULL}.} \item{data}{an optional data frame in which to evaluate the variables named in \code{value} and \code{form}. It is used to obtain the levels for \code{factors}, which affect the dimensions and the row/column names of the underlying matrix. If \code{NULL}, no attempt is made to obtain information on \code{factors} appearing in the formulas. Defaults to the parent frame from which the function was called.} } \description{ This function is a constructor for the \code{pdSymm} class, representing a general positive-definite matrix. If the matrix associated with \code{object} is of dimension \eqn{n}, it is represented by \eqn{n(n+1)/2}{n*(n+1)/2} unrestricted parameters, using the matrix-logarithm parametrization described in Pinheiro and Bates (1996). When \code{value} is \code{numeric(0)}, an uninitialized \code{pdMat} object, a one-sided formula, or a vector of character strings, \code{object} is returned as an uninitialized \code{pdSymm} object (with just some of its attributes and its class defined) and needs to have its coefficients assigned later, generally using the \code{coef} or \code{matrix} replacement functions. If \code{value} is an initialized \code{pdMat} object, \code{object} will be constructed from \code{as.matrix(value)}. Finally, if \code{value} is a numeric vector, it is assumed to represent the unrestricted coefficients of the matrix-logarithm parametrization of the underlying positive-definite matrix. } \value{ a \code{pdSymm} object representing a general positive-definite matrix, also inheriting from class \code{pdMat}. } \references{ Pinheiro, J.C. and Bates., D.M. (1996) "Unconstrained Parametrizations for Variance-Covariance Matrices", Statistics and Computing, 6, 289-296. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.pdMat}}, \code{\link{coef.pdMat}}, \code{\link{pdClasses}}, \code{\link{matrix<-.pdMat}}} \examples{ pd1 <- pdSymm(diag(1:3), nam = c("A","B","C")) pd1 } \keyword{models} nlme/man/simulate.lme.Rd0000644000176000001440000000714514632316272014713 0ustar ripleyusers% File nlme/man/simulate.lme.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{simulate.lme} \title{Simulate Results from \code{lme} Models} \alias{simulate.lme} \alias{plot.simulate.lme} % currently undocumented (needs own help page) \alias{print.simulate.lme} \usage{ \method{simulate}{lme}(object, nsim = 1, seed = , m2, method = c("REML", "ML"), niterEM = c(40, 200), useGen, \dots) } \arguments{ \item{object}{ an object inheriting from class \code{"\link{lme}"}, representing a fitted linear mixed-effects model, or a list containing an \code{lme} model specification. If given as a list, it should contain components \code{fixed}, \code{data}, and \code{random} with values suitable for a call to \code{\link{lme}}. This argument defines the null model. } \item{m2}{an \code{"\link{lme}"} object or a list, like \code{object} containing a second lme model specification. This argument defines the alternative model. If given as a list, only those parts of the specification that change between model \code{object} and \code{m2} need to be specified.} \item{seed}{ an optional integer that is passed to \code{set.seed}. Defaults to a random integer. } \item{method}{an optional character array. If it includes \code{"REML"} the models are fit by maximizing the restricted log-likelihood. If it includes \code{"ML"} the log-likelihood is maximized. Defaults to \code{c("REML", "ML")}, in which case both methods are used.} \item{nsim}{an optional positive integer specifying the number of simulations to perform. Defaults to \code{1}. \bold{This has changed. Previously the default was 1000.} } \item{niterEM}{an optional integer vector of length 2 giving the number of iterations of the EM algorithm to apply when fitting the \code{object} and \code{m2} to each simulated set of data. Defaults to \code{c(40,200)}. } \item{useGen}{ an optional logical value. If \code{TRUE}, the \code{\link{nlminb}} optimizer is used with numerical derivatives of the log-likelihood. If \code{FALSE}, the \code{\link{nlm}} algorithm is used with an analytic gradient. The default depends on the \code{"\link{pdMat}"} classes used in \code{object} and \code{m2}: if both are standard classes (see \code{\link{pdClasses}}) then defaults to \code{FALSE}, otherwise defaults to \code{TRUE}. } \item{\dots}{optional additional arguments. None are used.} } \description{ The model \code{object} is fit to the data. Using the fitted values of the parameters, \code{nsim} new data vectors from this model are simulated. Both \code{object} and \code{m2} are fit by maximum likelihood (ML) and/or by restricted maximum likelihood (REML) to each of the simulated data vectors. } \value{ an object of class \code{simulate.lme} with components \code{null} and \code{alt}. Each of these has components \code{ML} and/or \code{REML} which are matrices. An attribute called \code{seed} contains the seed that was used for the random number generator. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) \emph{Mixed-Effects Models in S and S-PLUS}, Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{set.seed}}} \examples{ orthSim <- simulate.lme(list(fixed = distance ~ age, data = Orthodont, random = ~ 1 | Subject), nsim = 3, # limited here for speed m2 = list(random = ~ age | Subject)) % checked in ../tests/predict.lme.R } \keyword{models} nlme/man/IGF.Rd0000644000176000001440000000236214251721455012715 0ustar ripleyusers% File nlme/man/IGF.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{IGF} \alias{IGF} \title{Radioimmunoassay of IGF-I Protein} \description{ The \code{IGF} data frame has 237 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{Lot}{ an ordered factor giving the radioactive tracer lot. } \item{age}{ a numeric vector giving the age (in days) of the radioactive tracer. } \item{conc}{ a numeric vector giving the estimated concentration of IGF-I protein (ng/ml) } } } \details{ Davidian and Giltinan (1995) describe data obtained during quality control radioimmunoassays for ten different lots of radioactive tracer used to calibrate the Insulin-like Growth Factor (IGF-I) protein concentration measurements. } \source{ Davidian, M. and Giltinan, D. M. (1995), \emph{Nonlinear Models for Repeated Measurement Data}, Chapman and Hall, London. Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.11) } %\examples{} \keyword{datasets} nlme/man/predict.lmList.Rd0000644000176000001440000000531614251721455015207 0ustar ripleyusers% File nlme/man/predict.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{predict.lmList} \title{Predictions from an lmList Object} \usage{ \method{predict}{lmList}(object, newdata, subset, pool, asList, se.fit, \dots) } \alias{predict.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{newdata}{an optional data frame to be used for obtaining the predictions. All variables used in the \code{object} model formula must be present in the data frame. If missing, the same data frame used to produce \code{object} is used. } \item{subset}{an optional character or integer vector naming the \code{lm} components of \code{object} from which the predictions are to be extracted. Default is \code{NULL}, in which case all components are used. } \item{asList}{an optional logical value. If \code{TRUE}, the returned object is a list with the predictions split by groups; else the returned value is a vector. Defaults to \code{FALSE}. } \item{pool}{an optional logical value indicating whether a pooled estimate of the residual standard error should be used. Default is \code{attr(object, "pool")}. } \item{se.fit}{an optional logical value indicating whether pointwise standard errors should be computed along with the predictions. Default is \code{FALSE}. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ If the grouping factor corresponding to \code{object} is included in \code{newdata}, the data frame is partitioned according to the grouping factor levels; else, \code{newdata} is repeated for all \code{lm} components. The predictions and, optionally, the standard errors for the predictions, are obtained for each \code{lm} component of \code{object}, using the corresponding element of the partitioned \code{newdata}, and arranged into a list with as many components as \code{object}, or combined into a single vector or data frame (if \code{se.fit=TRUE}). } \value{ a list with components given by the predictions (and, optionally, the standard errors for the predictions) from each \code{lm} component of \code{object}, a vector with the predictions from all \code{lm} components of \code{object}, or a data frame with columns given by the predictions and their corresponding standard errors. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{predict.lm}}} \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) predict(fm1, se.fit = TRUE) } \keyword{models} nlme/man/formula.pdBlocked.Rd0000644000176000001440000000267214251721455015647 0ustar ripleyusers% File nlme/man/formula.pdBlocked.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{formula.pdBlocked} \title{Extract pdBlocked Formula} \usage{ \method{formula}{pdBlocked}(x, asList, \dots) } \alias{formula.pdBlocked} \arguments{ \item{x}{an object inheriting from class \code{"pdBlocked"}, representing a positive definite block diagonal matrix.} \item{asList}{an optional logical value. If \code{TRUE}, a list with the formulas for the individual block diagonal elements of \code{x} is returned; else, if \code{FALSE}, a one-sided formula combining all individual formulas is returned. Defaults to \code{FALSE}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The \code{formula} attributes of the \code{pdMat} elements of \code{x} are extracted and returned as a list, in case \code{asList=TRUE}, or converted to a single one-sided formula when \code{asList=FALSE}. If the \code{pdMat} elements do not have a \code{formula} attribute, a \code{NULL} value is returned. } \value{ a list of one-sided formulas, or a single one-sided formula, or \code{NULL}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{pdBlocked}}, \code{\link{pdMat}}} \examples{ pd1 <- pdBlocked(list(~ age, ~ Sex - 1)) formula(pd1) formula(pd1, asList = TRUE) } \keyword{models} nlme/man/Glucose.Rd0000644000176000001440000000167514251721455013717 0ustar ripleyusers% File nlme/man/Glucose.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Glucose} \alias{Glucose} \title{Glucose levels over time} \description{ The \code{Glucose} data frame has 378 rows and 4 columns. } \format{ This data frame contains the following columns: \describe{ \item{Subject}{ an ordered factor with levels \code{6} < \code{2} < \code{3} < \code{5} < \code{1} < \code{4} } \item{Time}{ a numeric vector } \item{conc}{ a numeric vector of glucose levels } \item{Meal}{ an ordered factor with levels \code{2am} < \code{6am} < \code{10am} < \code{2pm} < \code{6pm} < \code{10pm} } } } \source{ Hand, D. and Crowder, M. (1996), \emph{Practical Longitudinal Data Analysis}, Chapman and Hall, London. } %\examples{} \keyword{datasets} nlme/man/corCompSymm.Rd0000644000176000001440000000455114662037430014561 0ustar ripleyusers% File nlme/man/corCompSymm.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corCompSymm} \title{Compound Symmetry Correlation Structure} \usage{ corCompSymm(value, form, fixed) } \alias{corCompSymm} \arguments{ \item{value}{the correlation between any two correlated observations. Defaults to 0.} \item{form}{a one sided formula of the form \code{~ t}, or \code{~ t | g}, specifying a time covariate \code{t} and, optionally, a grouping factor \code{g}. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corCompSymm} class, representing a compound symmetry structure corresponding to uniform correlation. Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corCompSymm}, representing a compound symmetry correlation structure. } \references{ Milliken, G. A. and Johnson, D. E. (1992) "Analysis of Messy Data, Volume I: Designed Experiments", Van Nostrand Reinhold. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer, esp. pp. 233-234. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corClasses}}, \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}} } \examples{ ## covariate is observation order and grouping factor is Subject cs1 <- corCompSymm(0.5, form = ~ 1 | Subject) cs1 # Uninitialized ... \dontshow{summary(cs1) # (ditto)} # Pinheiro and Bates, p. 225 cs1CompSymm <- corCompSymm(value = 0.3, form = ~ 1 | Subject) cs2CompSymm <- corCompSymm(value = 0.3, form = ~ age | Subject) cs1CompSymm <- Initialize(cs1CompSymm, data = Orthodont) corMatrix(cs1CompSymm) } \keyword{models} nlme/man/intervals.Rd0000644000176000001440000000234314657640762014331 0ustar ripleyusers% File nlme/man/intervals.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{intervals} \title{Confidence Intervals on Coefficients} \usage{ intervals(object, level, \dots) } \alias{intervals} \arguments{ \item{object}{a fitted model object from which parameter estimates can be extracted.} \item{level}{an optional numeric value for the interval confidence level. Defaults to 0.95.} \item{\dots}{some methods for the generic may require additional arguments.} } \description{ Confidence intervals on the parameters associated with the model represented by \code{object} are obtained. This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include: \code{gls}, \code{lme}, and \code{lmList}. } \value{ will depend on the method function used; see the appropriate documentation. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{intervals.lme}}, \code{\link{intervals.lmList}}, \code{\link{intervals.gls}} } \keyword{models} nlme/man/getResponseFormula.Rd0000644000176000001440000000132714251721455016134 0ustar ripleyusers% File nlme/man/getResponseFormula.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getResponseFormula} \title{Extract Formula Specifying Response Variable} \usage{ getResponseFormula(object) } \alias{getResponseFormula} \arguments{ \item{object}{any object from which a formula can be extracted.} } \description{ The left hand side of \code{formula{object}} is returned as a one-sided formula. } \value{ a one-sided formula with the response variable associated with \code{formula{object}}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{getResponse}}} \examples{ getResponseFormula(y ~ x | g) } \keyword{models} nlme/man/residuals.glsStruct.Rd0000644000176000001440000000263314251721455016275 0ustar ripleyusers% File nlme/man/residuals.glsStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{residuals.glsStruct} \title{Calculate glsStruct Residuals} \usage{ \method{residuals}{glsStruct}(object, glsFit, \dots) } \alias{residuals.glsStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{glsStruct}"}, representing a list of linear model components, such as \code{corStruct} and \code{"\link{varFunc}"} objects.} \item{glsFit}{an optional list with components \code{logLik} (log-likelihood), \code{beta} (coefficients), \code{sigma} (standard deviation for error term), \code{varBeta} (coefficients' covariance matrix), \code{fitted} (fitted values), and \code{residuals} (residuals). Defaults to \code{attr(object, "glsFit")}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The residuals for the linear model represented by \code{object} are extracted. } \value{ a vector with the residuals for the linear model represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is primarily used inside \code{gls} and \code{residuals.gls}. } \seealso{\code{\link{gls}}, \code{\link{glsStruct}}, \code{\link{residuals.gls}}, \code{\link{fitted.glsStruct}} } \keyword{models} nlme/man/residuals.nlmeStruct.Rd0000644000176000001440000000452714251721455016447 0ustar ripleyusers% File nlme/man/residuals.nlmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{residuals.nlmeStruct} \title{Calculate nlmeStruct Residuals} \usage{ \method{residuals}{nlmeStruct}(object, level, conLin, \dots) } \alias{residuals.nlmeStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{nlmeStruct}"}, representing a list of mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in extracting the residuals from \code{object}. Level values increase from outermost to innermost grouping, with level zero corresponding to the population fitted values. Defaults to the highest or innermost level of grouping.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying nlme model. Defaults to \code{attr(object, "conLin")}.} \item{\dots}{optional arguments to the residuals generic. Not used.} } \description{ The residuals at level \eqn{i} are obtained by subtracting the fitted values at that level from the response vector. The fitted values at level \eqn{i} are obtained by adding together the contributions from the estimated fixed effects and the estimated random effects at levels less or equal to \eqn{i} and evaluating the model function at the resulting estimated parameters. } \value{ if a single level of grouping is specified in \code{level}, the returned value is a vector with the residuals at the desired level; else, when multiple grouping levels are specified in \code{level}, the returned object is a matrix with columns given by the residuals at different levels. } \references{ Bates, D.M. and Pinheiro, J.C. (1998) "Computational methods for multilevel models" available in PostScript or PDF formats at http://nlme.stat.wisc.edu } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is primarily used within the \code{nlme} function. } \seealso{\code{\link{nlme}}, \code{\link{fitted.nlmeStruct}} } \keyword{models} nlme/man/corMatrix.reStruct.Rd0000644000176000001440000000220714251721455016070 0ustar ripleyusers% File nlme/man/corMatrix.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corMatrix.reStruct} \title{Extract Correlation Matrix from Components of an reStruct Object} \usage{ \method{corMatrix}{reStruct}(object, \dots) } \alias{corMatrix.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the correlation matrices corresponding to the \code{pdMat} elements of \code{object}. } \value{ a list with components given by the correlation matrices corresponding to the elements of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{as.matrix.reStruct}}, \code{\link{corMatrix}}, \code{\link{reStruct}}, \code{\link{pdMat}}} \examples{ rs1 <- reStruct(pdSymm(diag(3), ~age+Sex, data = Orthodont)) corMatrix(rs1) } \keyword{models} nlme/man/pairs.lmList.Rd0000644000176000001440000000734514633640310014671 0ustar ripleyusers% File nlme/man/pairs.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pairs.lmList} \title{Pairs Plot of an lmList Object} \usage{ \method{pairs}{lmList}(x, form, label, id, idLabels, grid, \dots) } \alias{pairs.lmList} \arguments{ \item{x}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{form}{an optional one-sided formula specifying the desired type of plot. Any variable present in the original data frame used to obtain \code{x} can be referenced. In addition, \code{x} itself can be referenced in the formula using the symbol \code{"."}. Conditional expressions on the right of a \code{|} operator can be used to define separate panels in a Trellis display. The expression on the right hand side of \code{form}, and to the left of the \code{|} operator, must evaluate to a data frame with at least two columns. Default is \code{~ coef(.) }, corresponding to a pairs plot of the coefficients of \code{x}. } \item{label}{an optional character vector of labels for the variables in the pairs plot.} \item{id}{an optional numeric value, or one-sided formula. If given as a value, it is used as a significance level for an outlier test based on the Mahalanobis distances of the estimated random effects. Groups with random effects distances greater than the \eqn{1-value} percentile of the appropriate chi-square distribution are identified in the plot using \code{idLabels}. If given as a one-sided formula, its right hand side must evaluate to a logical, integer, or character vector which is used to identify points in the plot. If missing, no points are identified. } \item{idLabels}{an optional vector, or one-sided formula. If given as a vector, it is converted to character and used to label the points identified according to \code{id}. If given as a one-sided formula, its right hand side must evaluate to a vector which is converted to character and used to label the identified points. Default is the innermost grouping factor. } \item{grid}{an optional logical value indicating whether a grid should be added to plot. Default is \code{FALSE}.} \item{\dots}{optional arguments passed to the Trellis plot function. } } \description{ Diagnostic plots for the linear model fits corresponding to the \code{x} components are obtained. The \code{form} argument gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a \code{|} operator) always implies that different panels are used for each level of the conditioning factor, according to a Trellis display. The expression on the right hand side of the formula, before a \code{|} operator, must evaluate to a data frame with at least two columns. If the data frame has two columns, a scatter plot of the two variables is displayed (the Trellis function \code{xyplot} is used). Otherwise, if more than two columns are present, a scatter plot matrix with pairwise scatter plots of the columns in the data frame is displayed (the Trellis function \code{splom} is used). } \value{ a diagnostic Trellis plot. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{pairs.lme}}, \code{\link{pairs.compareFits}}, \code{\link[lattice]{xyplot}}, \code{\link[lattice]{splom}}} \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) # scatter plot of coefficients by gender, identifying unusual subjects pairs(fm1, ~coef(.) | Sex, id = 0.1, adj = -0.5) # scatter plot of estimated random effects -- "bivariate Gaussian (?)" pairs(fm1, ~ranef(.)) } \keyword{models} nlme/man/corLin.Rd0000644000176000001440000001014014251721456013530 0ustar ripleyusers% File nlme/man/corLin.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corLin} \title{Linear Correlation Structure} \usage{ corLin(value, form, nugget, metric, fixed) } \alias{corLin} \arguments{ \item{value}{an optional vector with the parameter values in constrained form. If \code{nugget} is \code{FALSE}, \code{value} can have only one element, corresponding to the "range" of the linear correlation structure, which must be greater than zero. If \code{nugget} is \code{TRUE}, meaning that a nugget effect is present, \code{value} can contain one or two elements, the first being the "range" and the second the "nugget effect" (one minus the correlation between two observations taken arbitrarily close together); the first must be greater than zero and the second must be between zero and one. Defaults to \code{numeric(0)}, which results in a range of 90\% of the minimum distance and a nugget effect of 0.1 being assigned to the parameters when \code{object} is initialized.} \item{form}{a one sided formula of the form \code{~ S1+...+Sp}, or \code{~ S1+...+Sp | g}, specifying spatial covariates \code{S1} through \code{Sp} and, optionally, a grouping factor \code{g}. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{nugget}{an optional logical value indicating whether a nugget effect is present. Defaults to \code{FALSE}.} \item{metric}{an optional character string specifying the distance metric to be used. The currently available options are \code{"euclidean"} for the root sum-of-squares of distances; \code{"maximum"} for the maximum difference; and \code{"manhattan"} for the sum of the absolute differences. Partial matching of arguments is used, so only the first three characters need to be provided. Defaults to \code{"euclidean"}.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corLin} class, representing a linear spatial correlation structure. Letting \eqn{d} denote the range and \eqn{n} denote the nugget effect, the correlation between two observations a distance \eqn{r < d} apart is \eqn{1-(r/d)} when no nugget effect is present and \eqn{(1-n) (1 -(r/d))}{(1-n)*(1-(r/d))} when a nugget effect is assumed. If \eqn{r \geq d}{r >= d} the correlation is zero. Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corLin}, also inheriting from class \code{corSpatial}, representing a linear spatial correlation structure. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. Littel, Milliken, Stroup, and Wolfinger (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}}, \code{\link{dist}} } \examples{ sp1 <- corLin(form = ~ x + y) # example lme(..., corLin ...) # Pinheiro and Bates, pp. 222-249 fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight, random = ~ Time) # p. 223 fm2BW.lme <- update(fm1BW.lme, weights = varPower()) # p 246 fm3BW.lme <- update(fm2BW.lme, correlation = corExp(form = ~ Time)) # p. 249 fm7BW.lme <- update(fm3BW.lme, correlation = corLin(form = ~ Time)) } \keyword{models} nlme/man/Initialize.reStruct.Rd0000644000176000001440000000367214251721455016230 0ustar ripleyusers% File nlme/man/Initialize.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Initialize.reStruct} \title{Initialize reStruct Object} \usage{ \method{Initialize}{reStruct}(object, data, conLin, control, \dots) } \alias{Initialize.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{data}{a data frame in which to evaluate the variables defined in \code{formula(object)}.} \item{conLin}{a condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying model.} \item{control}{an optional list with a single component \code{niterEM} controlling the number of iterations for the EM algorithm used to refine initial parameter estimates. It is given as a list for compatibility with other \code{Initialize} methods. Defaults to \code{list(niterEM = 20)}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Initial estimates for the parameters in the \code{pdMat} objects forming \code{object}, which have not yet been initialized, are obtained using the methodology described in Bates and Pinheiro (1998). These estimates may be refined using a series of EM iterations, as described in Bates and Pinheiro (1998). The number of EM iterations to be used is defined in \code{control}. } \value{ an \code{reStruct} object similar to \code{object}, but with all \code{pdMat} components initialized. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{reStruct}}, \code{\link{pdMat}}, \code{\link{Initialize}} } \keyword{models} nlme/man/compareFits.Rd0000644000176000001440000000332314251721456014563 0ustar ripleyusers% File nlme/man/compareFits.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{compareFits} \title{Compare Fitted Objects} \usage{ compareFits(object1, object2, which) } \alias{compareFits} \alias{print.compareFits} \arguments{ \item{object1,object2}{data frames, or matrices, with the same row names, but possibly different column names. These will usually correspond to coefficients from fitted objects with a grouping structure (e.g. \code{lme} and \code{lmList} objects).} \item{which}{an optional integer or character vector indicating which columns in \code{object1} and \code{object2} are to be used in the returned object. Defaults to all columns.} } \description{ The columns in \code{object1} and \code{object2} are put together in matrices which allow direct comparison of the individual elements for each object. Missing columns in either object are replaced by \code{NA}s. } \value{ a three-dimensional array, with the third dimension given by the number of unique column names in either \code{object1} or \code{object2}. To each column name there corresponds a matrix with as many rows as the rows in \code{object1} and two columns, corresponding to \code{object1} and \code{object2}. The returned object inherits from class \code{compareFits}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{plot.compareFits}}, \code{\link{pairs.compareFits}}, \code{\link{comparePred}}, \code{\link{coef}}, \code{\link{random.effects}} } \examples{% don't change lightly -- now called from other examples! fm1 <- lmList(Orthodont) fm2 <- lme(fm1) (cF12 <- compareFits(coef(fm1), coef(fm2))) } \keyword{models} nlme/man/pooledSD.Rd0000644000176000001440000000164614251721455014025 0ustar ripleyusers% File nlme/man/pooledSD.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{pooledSD} \title{Extract Pooled Standard Deviation} \usage{ pooledSD(object) } \alias{pooledSD} \arguments{ \item{object}{an object inheriting from class \code{lmList}.} } \description{ The pooled estimated standard deviation is obtained by adding together the residual sum of squares for each non-null element of \code{object}, dividing by the sum of the corresponding residual degrees-of-freedom, and taking the square-root. } \value{ the pooled standard deviation for the non-null elements of \code{object}, with an attribute \code{df} with the number of degrees-of-freedom used in the estimation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{lm}}} \examples{ fm1 <- lmList(Orthodont) pooledSD(fm1) } \keyword{models} nlme/man/intervals.lmList.Rd0000644000176000001440000000362114251721455015561 0ustar ripleyusers% File nlme/man/intervals.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{intervals.lmList} \title{Confidence Intervals on lmList Coefficients} \usage{ \method{intervals}{lmList}(object, level = 0.95, pool = attr(object, "pool"), \dots) } \alias{intervals.lmList} \alias{print.intervals.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{level}{an optional numeric value with the confidence level for the intervals. Defaults to 0.95. } \item{pool}{an optional logical value indicating whether a pooled estimate of the residual standard error should be used. Default is \code{attr(object, "pool")}. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Confidence intervals on the linear model coefficients are obtained for each \code{lm} component of \code{object} and organized into a three dimensional array. The first dimension corresponding to the names of the \code{object} components. The second dimension is given by \code{lower}, \code{est.}, and \code{upper} corresponding, respectively, to the lower confidence limit, estimated coefficient, and upper confidence limit. The third dimension is given by the coefficients names. } \value{ a three dimensional array with the confidence intervals and estimates for the coefficients of each \code{lm} component of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \references{ Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \seealso{\code{\link{lmList}}, \code{\link{intervals}}, \code{\link{plot.intervals.lmList}} } \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) intervals(fm1) } \keyword{models} nlme/man/fitted.lmList.Rd0000644000176000001440000000306414251721456015033 0ustar ripleyusers% File nlme/man/fitted.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fitted.lmList} \title{Extract lmList Fitted Values} \usage{ \method{fitted}{lmList}(object, subset, asList, \dots) } \alias{fitted.lmList} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmList}"}, representing a list of \code{lm} objects with a common model. } \item{subset}{an optional character or integer vector naming the \code{lm} components of \code{object} from which the fitted values are to be extracted. Default is \code{NULL}, in which case all components are used. } \item{asList}{an optional logical value. If \code{TRUE}, the returned object is a list with the fitted values split by groups; else the returned value is a vector. Defaults to \code{FALSE}. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ The fitted values are extracted from each \code{lm} component of \code{object} and arranged into a list with as many components as \code{object}, or combined into a single vector. } \value{ a list with components given by the fitted values of each \code{lm} component of \code{object}, or a vector with the fitted values for all \code{lm} components of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lmList}}, \code{\link{residuals.lmList}}} \examples{ fm1 <- lmList(distance ~ age | Subject, Orthodont) fitted(fm1) } \keyword{models} nlme/man/lme.lmList.Rd0000644000176000001440000001311714363200201014311 0ustar ripleyusers% File nlme/man/lme.lmList.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{lme.lmList} \title{LME fit from lmList Object} \usage{ \method{lme}{lmList}(fixed, data, random, correlation, weights, subset, method, na.action, control, contrasts, keep.data) } \alias{lme.lmList} \arguments{ \item{fixed}{an object inheriting from class \code{"\link{lmList}."}, representing a list of \code{lm} fits with a common model.} \item{data}{this argument is included for consistency with the generic function. It is ignored in this method function.} \item{random}{an optional one-sided linear formula with no conditioning expression, or a \code{pdMat} object with a \code{formula} attribute. Multiple levels of grouping are not allowed with this method function. Defaults to a formula consisting of the right hand side of \code{formula(fixed)}.} \item{correlation}{an optional \code{corStruct} object describing the within-group correlation structure. See the documentation of \code{\link{corClasses}} for a description of the available \code{corStruct} classes. Defaults to \code{NULL}, corresponding to no within-group correlations.} \item{weights}{an optional \code{varFunc} object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to \code{varFixed}, corresponding to fixed variance weights. See the documentation on \code{\link{varClasses}} for a description of the available \code{varFunc} classes. Defaults to \code{NULL}, corresponding to homoscedastic within-group errors.} \item{subset}{an optional expression indicating the subset of the rows of \code{data} that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{method}{a character string. If \code{"REML"} the model is fit by maximizing the restricted log-likelihood. If \code{"ML"} the log-likelihood is maximized. Defaults to \code{"REML"}.} \item{na.action}{a function that indicates what should happen when the data contain \code{NA}s. The default action (\code{na.fail}) causes \code{lme} to print an error message and terminate if there are any incomplete observations.} \item{control}{a list of control values for the estimation algorithm to replace the default values returned by the function \code{lmeControl}. Defaults to an empty list.} \item{contrasts}{an optional list. See the \code{contrasts.arg} of \code{model.matrix.default}.} \item{keep.data}{logical: should the \code{data} argument (if supplied and a data frame) be saved as part of the model object?} } \description{ If the random effects names defined in \code{random} are a subset of the \code{lmList} object coefficient names, initial estimates for the covariance matrix of the random effects are obtained (overwriting any values given in \code{random}). \code{formula(fixed)} and the \code{data} argument in the calling sequence used to obtain \code{fixed} are passed as the \code{fixed} and \code{data} arguments to \code{lme.formula}, together with any other additional arguments in the function call. See the documentation on \code{\link{lme.formula}} for a description of that function. } \value{ an object of class \code{lme} representing the linear mixed-effects model fit. Generic functions such as \code{print}, \code{plot} and \code{summary} have methods to show the results of the fit. See \code{lmeObject} for the components of the fit. The functions \code{resid}, \code{coef}, \code{fitted}, \code{fixed.effects}, and \code{random.effects} can be used to extract some of its components. } \references{ The computational methods follow the general framework of Lindstrom and Bates (1988). The model formulation is described in Laird and Ware (1982). The variance-covariance parametrizations are described in Pinheiro and Bates (1996). The different correlation structures available for the \code{correlation} argument are described in Box, Jenkins and Reinse (1994), Littel \emph{et al} (1996), and Venables and Ripley, (2002). The use of variance functions for linear and nonlinear mixed effects models is presented in detail in Davidian and Giltinan (1995). Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden--Day. Davidian, M. and Giltinan, D.M. (1995) "Nonlinear Mixed Effects Models for Repeated Measurement Data", Chapman and Hall. Laird, N.M. and Ware, J.H. (1982) "Random-Effects Models for Longitudinal Data", Biometrics, 38, 963--974. Lindstrom, M.J. and Bates, D.M. (1988) "Newton-Raphson and EM Algorithms for Linear Mixed-Effects Models for Repeated-Measures Data", Journal of the American Statistical Association, 83, 1014--1022. Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C. and Bates., D.M. (1996) "Unconstrained Parametrizations for Variance-Covariance Matrices", Statistics and Computing, 6, 289--296. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. } \author{ José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu} } \seealso{\code{\link{lme}}, \code{\link{lmList}}, \code{\link{lmeObject}} } \examples{ fm1 <- lmList(Orthodont) fm2 <- lme(fm1) summary(fm1) summary(fm2) } \keyword{models} nlme/man/Dim.pdMat.Rd0000644000176000001440000000166714251721455014074 0ustar ripleyusers% File nlme/man/Dim.pdMat.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Dim.pdMat} \title{Dimensions of a pdMat Object} \usage{ \method{Dim}{pdMat}(object, \dots) } \alias{Dim.pdMat} \alias{Dim.pdCompSymm} \alias{Dim.pdDiag} \alias{Dim.pdIdent} \alias{Dim.pdNatural} \alias{Dim.pdSymm} \arguments{ \item{object}{an object inheriting from class \code{"\link{pdMat}"}, representing a positive-definite matrix.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function returns the dimensions of the matrix represented by \code{object}. } \value{ an integer vector with the number of rows and columns of the matrix represented by \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Dim}}} \examples{ Dim(pdSymm(diag(3))) } \keyword{models} nlme/man/splitFormula.Rd0000644000176000001440000000173014251721455014767 0ustar ripleyusers% File nlme/man/splitFormula.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{splitFormula} \title{Split a Formula} \usage{ splitFormula(form, sep) } \alias{splitFormula} \arguments{ \item{form}{a \code{formula} object.} \item{sep}{an optional character string specifying the separator to be used for splitting the formula. Defaults to \code{"/"}. } } \description{ Splits the right hand side of \code{form} into a list of subformulas according to the presence of \code{sep}. The left hand side of \code{form}, if present, will be ignored. The length of the returned list will be equal to the number of occurrences of \code{sep} in \code{form} plus one. } \value{ a list of formulas, corresponding to the split of \code{form} according to \code{sep}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{formula}}} \examples{ splitFormula(~ g1/g2/g3) } \keyword{models} nlme/man/logLik.gnls.Rd0000644000176000001440000000222114251721455014465 0ustar ripleyusers% File nlme/man/logLik.gnls.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{logLik.gnls} \title{Log-Likelihood of a gnls Object} \usage{ \method{logLik}{gnls}(object, REML, \dots) } \alias{logLik.gnls} \arguments{ \item{object}{an object inheriting from class \code{"\link{gnls}"}, representing a generalized nonlinear least squares fitted model.} \item{REML}{an logical value for consistency with \code{logLik,gls}, but only \code{FALSE} is accepted.. } \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ Returns the log-likelihood value of the nonlinear model represented by \code{object} evaluated at the estimated coefficients. } \value{ the log-likelihood of the linear model represented by \code{object} evaluated at the estimated coefficients. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{gnls}}, \code{\link{logLik.lme}} } \examples{ fm1 <- gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean, weights = varPower()) logLik(fm1) } \keyword{models} nlme/man/fitted.lmeStruct.Rd0000644000176000001440000000471314251721455015552 0ustar ripleyusers% File nlme/man/fitted.lmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{fitted.lmeStruct} \title{Calculate lmeStruct Fitted Values} \usage{ \method{fitted}{lmeStruct}(object, level, conLin, lmeFit, \dots) } \alias{fitted.lmeStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmeStruct}"}, representing a list of linear mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in extracting the fitted values from \code{object}. Level values increase from outermost to innermost grouping, with level zero corresponding to the population fitted values. Defaults to the highest or innermost level of grouping.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying lme model. Defaults to \code{attr(object, "conLin")}.} \item{lmeFit}{an optional list with components \code{beta} and \code{b} containing respectively the fixed effects estimates and the random effects estimates to be used to calculate the fitted values. Defaults to \code{attr(object, "lmeFit")}.} \item{\dots}{some methods for this generic accept other optional arguments.} } \description{ The fitted values at level \eqn{i} are obtained by adding together the population fitted values (based only on the fixed effects estimates) and the estimated contributions of the random effects to the fitted values at grouping levels less or equal to \eqn{i}. The resulting values estimate the best linear unbiased predictions (BLUPs) at level \eqn{i}. } \value{ if a single level of grouping is specified in \code{level}, the returned value is a vector with the fitted values at the desired level; else, when multiple grouping levels are specified in \code{level}, the returned object is a matrix with columns given by the fitted values at different levels. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is generally only used inside \code{lme} and \code{fitted.lme}. } \seealso{\code{\link{lme}}, \code{\link{fitted.lme}}, \code{\link{residuals.lmeStruct}} } \keyword{models} nlme/man/corMatrix.Rd0000644000176000001440000000166314657640762014276 0ustar ripleyusers% File nlme/man/corMatrix.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corMatrix} \title{Extract Correlation Matrix} \usage{ corMatrix(object, \dots) } \alias{corMatrix} \arguments{ \item{object}{an object for which a correlation matrix can be extracted.} \item{\dots}{some methods for this generic function require additional arguments.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include all \code{"corStruct"} classes, see \sQuote{\link{corClasses}}. } \value{ will depend on the method function used; see the appropriate documentation. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corMatrix.corStruct}}, \code{\link{corMatrix.pdMat}}, \code{\link{corMatrix.reStruct}} } \keyword{models} nlme/man/Names.reStruct.Rd0000644000176000001440000000306114251721455015162 0ustar ripleyusers% File nlme/man/Names.reStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Names.reStruct} \title{Names of an reStruct Object} \usage{ \method{Names}{reStruct}(object, \dots) \method{Names}{reStruct}(object, \dots) <- value } \alias{Names.reStruct} \alias{Names<-.reStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{reStruct}"}, representing a random effects structure and consisting of a list of \code{pdMat} objects.} \item{value}{a list of character vectors with the replacement values for the names of the individual \code{pdMat} objects that form \code{object}. It must have the same length as \code{object}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function extracts the column names of each of the positive-definite matrices represented the \code{pdMat} elements of \code{object}. } \value{ a list containing the column names of each of the positive-definite matrices represented by the \code{pdMat} elements of \code{object}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \section{SIDE EFFECTS}{ On the left side of an assignment, sets the \code{Names} of the \code{pdMat} elements of \code{object} to the corresponding element of \code{value}. } \seealso{\code{\link{reStruct}}, \code{\link{pdMat}}, \code{\link{Names.pdMat}} } \examples{ rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) Names(rs1) } \keyword{models} nlme/man/Ovary.Rd0000644000176000001440000000247014251721455013410 0ustar ripleyusers% File nlme/man/Ovary.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Ovary} \alias{Ovary} \title{Counts of Ovarian Follicles} \description{ The \code{Ovary} data frame has 308 rows and 3 columns. } \format{ This data frame contains the following columns: \describe{ \item{Mare}{ an ordered factor indicating the mare on which the measurement is made. } \item{Time}{ time in the estrus cycle. The data were recorded daily from 3 days before ovulation until 3 days after the next ovulation. The measurement times for each mare are scaled so that the ovulations for each mare occur at times 0 and 1. } \item{follicles}{ the number of ovarian follicles greater than 10 mm in diameter. } } } \details{ Pierson and Ginther (1987) report on a study of the number of large ovarian follicles detected in different mares at several times in their estrus cycles. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.18) Pierson, R. A. and Ginther, O. J. (1987), Follicular population dynamics during the estrus cycle of the mare, \emph{Animal Reproduction Science}, \bold{14}, 219-231. } %\examples{} \keyword{datasets} nlme/man/Variogram.corExp.Rd0000644000176000001440000000377514251721455015507 0ustar ripleyusers% File nlme/man/Variogram.corExp.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Variogram.corExp} \title{Calculate Semi-variogram for a corExp Object} \usage{ \method{Variogram}{corExp}(object, distance, sig2, length.out, \dots) } \alias{Variogram.corExp} \arguments{ \item{object}{an object inheriting from class \code{"\link{corExp}"}, representing an exponential spatial correlation structure.} \item{distance}{an optional numeric vector with the distances at which the semi-variogram is to be calculated. Defaults to \code{NULL}, in which case a sequence of length \code{length.out} between the minimum and maximum values of \code{getCovariate(object)} is used.} \item{sig2}{an optional numeric value representing the process variance. Defaults to \code{1}.} \item{length.out}{an optional integer specifying the length of the sequence of distances to be used for calculating the semi-variogram, when \code{distance = NULL}. Defaults to \code{50}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function calculates the semi-variogram values corresponding to the Exponential correlation model, using the estimated coefficients corresponding to \code{object}, at the distances defined by \code{distance}. } \value{ a data frame with columns \code{variog} and \code{dist} representing, respectively, the semi-variogram values and the corresponding distances. The returned value inherits from class \code{Variogram}. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{corExp}}, \code{\link{plot.Variogram}}, \code{\link{Variogram}} } \examples{ stopifnot(require("stats", quietly = TRUE)) cs1 <- corExp(3, form = ~ Time | Rat) cs1 <- Initialize(cs1, BodyWeight) Variogram(cs1)[1:10,] } \keyword{models} nlme/man/Earthquake.Rd0000644000176000001440000000452114251721456014402 0ustar ripleyusers% File nlme/man/Earthquake.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Earthquake} \alias{Earthquake} \title{Earthquake Intensity} \description{ The \code{Earthquake} data frame has 182 rows and 5 columns. } \format{ This data frame contains the following columns: \describe{ \item{Quake}{ an ordered factor with levels \code{20} < \code{16} < \code{14} < \code{10} < \code{3} < \code{8} < \code{23} < \code{22} < \code{6} < \code{13} < \code{7} < \code{21} < \code{18} < \code{15} < \code{4} < \code{12} < \code{19} < \code{5} < \code{9} < \code{1} < \code{2} < \code{17} < \code{11} indicating the earthquake on which the measurements were made. } \item{Richter}{ a numeric vector giving the intensity of the earthquake on the Richter scale. } \item{distance}{ the distance from the seismological measuring station to the epicenter of the earthquake (km). } \item{soil}{ a factor with levels \code{0} and \code{1} giving the soil condition at the measuring station, either soil or rock. } \item{accel}{ maximum horizontal acceleration observed (g). } } } \details{ Measurements recorded at available seismometer locations for 23 large earthquakes in western North America between 1940 and 1980. They were originally given in Joyner and Boore (1981); are mentioned in Brillinger (1987); and are analyzed in Davidian and Giltinan (1995). } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.8) Davidian, M. and Giltinan, D. M. (1995), \emph{Nonlinear Models for Repeated Measurement Data}, Chapman and Hall, London. Joyner and Boore (1981), Peak horizontal acceleration and velocity from strong-motion records including records from the 1979 Imperial Valley, California, earthquake, \emph{Bulletin of the Seismological Society of America}, \bold{71}, 2011-2038. Brillinger, D. (1987), Comment on a paper by C. R. Rao, \emph{Statistical Science}, \bold{2}, 448-450. } %\examples{} \keyword{datasets} nlme/man/Dim.corSpatial.Rd0000644000176000001440000000327214251721455015122 0ustar ripleyusers% File nlme/man/Dim.corSpatial.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{Dim.corSpatial} \title{Dimensions of a corSpatial Object} \usage{ \method{Dim}{corSpatial}(object, groups, \dots) } \alias{Dim.corSpatial} \arguments{ \item{object}{an object inheriting from class \code{"\link{corSpatial}"}, representing a spatial correlation structure.} \item{groups}{an optional factor defining the grouping of the observations; observations within a group are correlated and observations in different groups are uncorrelated.} \item{\dots}{further arguments to be passed to or from methods.} } \description{ if \code{groups} is missing, it returns the \code{Dim} attribute of \code{object}; otherwise, calculates the dimensions associated with the grouping factor. } \value{ a list with components: \item{N}{length of \code{groups}} \item{M}{number of groups} \item{spClass}{an integer representing the spatial correlation class; 0 = user defined class, 1 = \code{corSpher}, 2 = \code{corExp}, 3 = \code{corGaus}, 4 = \code{corLin}} \item{sumLenSq}{sum of the squares of the number of observations per group} \item{len}{an integer vector with the number of observations per group} \item{start}{an integer vector with the starting position for the distance vectors in each group, beginning from zero} } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{Dim}}, \code{\link{Dim.corStruct}} } \examples{ Dim(corGaus(), getGroups(Orthodont)) cs1ARMA <- corARMA(0.4, form = ~ 1 | Subject, q = 1) cs1ARMA <- Initialize(cs1ARMA, data = Orthodont) Dim(cs1ARMA) } \keyword{models} nlme/man/VarCorr.Rd0000644000176000001440000000447014251721456013671 0ustar ripleyusers% File nlme/man/VarCorr.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{VarCorr} \title{Extract variance and correlation components} \alias{VarCorr} \alias{VarCorr.lme} \alias{VarCorr.pdMat} \alias{VarCorr.pdBlocked} \alias{print.VarCorr.lme} \usage{ VarCorr(x, sigma = 1, \dots) \method{VarCorr}{lme}(x, sigma = x$sigma, rdig = 3, \dots) \method{VarCorr}{pdMat}(x, sigma = 1, rdig = 3, \dots) \method{VarCorr}{pdBlocked}(x, sigma = 1, rdig = 3, \dots) } \arguments{ \item{x}{a fitted model object, usually an object inheriting from class \code{"\link{lme}"}.} \item{sigma}{an optional numeric value used as a multiplier for the standard deviations. The default is \code{x$sigma} or \code{1} depending on \code{\link{class}(x)}.} \item{rdig}{an optional integer value specifying the number of digits used to represent correlation estimates. Default is \code{3}.} \item{\dots}{further optional arguments passed to other methods (none for the methods documented here).} } \description{ This function calculates the estimated variances, standard deviations, and correlations between the random-effects terms in a linear mixed-effects model, of class \code{"\link{lme}"}, or a nonlinear mixed-effects model, of class \code{"\link{nlme}"}. The within-group error variance and standard deviation are also calculated. } \value{ a matrix with the estimated variances, standard deviations, and correlations for the random effects. The first two columns, named \code{Variance} and \code{StdDev}, give, respectively, the variance and the standard deviations. If there are correlation components in the random effects model, the third column, named \code{Corr}, and the remaining unnamed columns give the estimated correlations among random effects within the same level of grouping. The within-group error variance and standard deviation are included as the last row in the matrix. } \references{ Pinheiro, J.C., and Bates, D.M. (2000) \emph{Mixed-Effects Models in S and S-PLUS}, Springer, esp. pp. 100, 461. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{lme}}, \code{\link{nlme}}} \examples{ fm1 <- lme(distance ~ age, data = Orthodont, random = ~age) VarCorr(fm1) } \keyword{models} nlme/man/corNatural.Rd0000644000176000001440000000431214662037430014416 0ustar ripleyusers% File nlme/man/corNatural.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corNatural} \title{General correlation in natural parameterization} \usage{ corNatural(value, form, fixed) } \alias{corNatural} \alias{print.corNatural} \arguments{ \item{value}{an optional vector with the parameter values. Default is \code{numeric(0)}, which results in a vector of zeros of appropriate dimension being assigned to the parameters when \code{object} is initialized (corresponding to an identity correlation structure).} \item{form}{a one sided formula of the form \code{~ t}, or \code{~ t | g}, specifying a time covariate \code{t} and, optionally, a grouping factor \code{g}. A covariate for this correlation structure must be integer valued. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corNatural} class, representing a general correlation structure in the ``natural'' parameterization, which is described under \code{\link{pdNatural}}. Objects created using this constructor must later be initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corNatural} representing a general correlation structure. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Initialize.corNatural}}, \code{\link{pdNatural}}, \code{\link{summary.corNatural}} } \examples{ ## covariate is observation order and grouping factor is Subject cs1 <- corNatural(form = ~ 1 | Subject) cs1 # Uninitialized ... summary(Initialize(cs1, data = Orthodont)) } \keyword{models} nlme/man/corRatio.Rd0000644000176000001440000001057714251721455014101 0ustar ripleyusers% File nlme/man/corRatio.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{corRatio} \title{Rational Quadratic Correlation Structure} \usage{ corRatio(value, form, nugget, metric, fixed) } \alias{corRatio} \arguments{ \item{value}{an optional vector with the parameter values in constrained form. If \code{nugget} is \code{FALSE}, \code{value} can have only one element, corresponding to the "range" of the rational quadratic correlation structure, which must be greater than zero. If \code{nugget} is \code{TRUE}, meaning that a nugget effect is present, \code{value} can contain one or two elements, the first being the "range" and the second the "nugget effect" (one minus the correlation between two observations taken arbitrarily close together); the first must be greater than zero and the second must be between zero and one. Defaults to \code{numeric(0)}, which results in a range of 90\% of the minimum distance and a nugget effect of 0.1 being assigned to the parameters when \code{object} is initialized.} \item{form}{a one sided formula of the form \code{~ S1+...+Sp}, or \code{~ S1+...+Sp | g}, specifying spatial covariates \code{S1} through \code{Sp} and, optionally, a grouping factor \code{g}. When a grouping factor is present in \code{form}, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to \code{~ 1}, which corresponds to using the order of the observations in the data as a covariate, and no groups.} \item{nugget}{an optional logical value indicating whether a nugget effect is present. Defaults to \code{FALSE}.} \item{metric}{an optional character string specifying the distance metric to be used. The currently available options are \code{"euclidean"} for the root sum-of-squares of distances; \code{"maximum"} for the maximum difference; and \code{"manhattan"} for the sum of the absolute differences. Partial matching of arguments is used, so only the first three characters need to be provided. Defaults to \code{"euclidean"}.} \item{fixed}{an optional logical value indicating whether the coefficients should be allowed to vary in the optimization, or kept fixed at their initial value. Defaults to \code{FALSE}, in which case the coefficients are allowed to vary.} } \description{ This function is a constructor for the \code{corRatio} class, representing a rational quadratic spatial correlation structure. Letting \eqn{d} denote the range and \eqn{n} denote the nugget effect, the correlation between two observations a distance \eqn{r} apart is \eqn{1/(1+(r/d)^2)} when no nugget effect is present and \eqn{(1-n)/(1+(r/d)^2)} when a nugget effect is assumed. Objects created using this constructor need to be later initialized using the appropriate \code{Initialize} method. } \value{ an object of class \code{corRatio}, also inheriting from class \code{corSpatial}, representing a rational quadratic spatial correlation structure. } \references{ Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with S", 4th Edition, Springer-Verlag. Littel, Milliken, Stroup, and Wolfinger (1996) "SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{ \code{\link{Initialize.corStruct}}, \code{\link{summary.corStruct}}, \code{\link{dist}} } \examples{ sp1 <- corRatio(form = ~ x + y + z) # example lme(..., corRatio ...) # Pinheiro and Bates, pp. 222-249 fm1BW.lme <- lme(weight ~ Time * Diet, BodyWeight, random = ~ Time) # p. 223 fm2BW.lme <- update(fm1BW.lme, weights = varPower()) # p 246 fm3BW.lme <- update(fm2BW.lme, correlation = corExp(form = ~ Time)) # p. 249 fm5BW.lme <- update(fm3BW.lme, correlation = corRatio(form = ~ Time)) # example gls(..., corRatio ...) # Pinheiro and Bates, pp. 261, 263 fm1Wheat2 <- gls(yield ~ variety - 1, Wheat2) # p. 263 fm3Wheat2 <- update(fm1Wheat2, corr = corRatio(c(12.5, 0.2), form = ~ latitude + longitude, nugget = TRUE)) } \keyword{models} nlme/man/getResponse.Rd0000644000176000001440000000204114657640762014613 0ustar ripleyusers% File nlme/man/getResponse.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{getResponse} \title{Extract Response Variable from an Object} \usage{ getResponse(object, form) } \alias{getResponse} \alias{getResponse.data.frame} \arguments{ \item{object}{any object.} \item{form}{an optional two-sided formula. Defaults to \code{formula(object)}.} } \description{ This function is generic; method functions can be written to handle specific classes of objects. Classes which already have methods for this function include \code{data.frame}, \code{gls}, \code{lme}, and \code{lmList}. } \value{ For the \code{data.frame} method, the result of evaluating the left-hand side of \code{form} in \code{object}. For \code{gls}, \code{lme}, and \code{lmList}, the sum of the \code{fitted} values and the \code{residuals}. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \seealso{\code{\link{getResponseFormula}}} \examples{ getResponse(Orthodont) } \keyword{models} nlme/man/PBG.Rd0000644000176000001440000000341614251721455012721 0ustar ripleyusers% File nlme/man/PBG.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{PBG} \alias{PBG} \title{Effect of Phenylbiguanide on Blood Pressure} \description{ The \code{PBG} data frame has 60 rows and 5 columns. } \format{ This data frame contains the following columns: \describe{ \item{deltaBP}{ a numeric vector } \item{dose}{ a numeric vector } \item{Run}{ an ordered factor with levels \code{T5} < \code{T4} < \code{T3} < \code{T2} < \code{T1} < \code{P5} < \code{P3} < \code{P2} < \code{P4} < \code{P1} } \item{Treatment}{ a factor with levels \code{MDL 72222} \code{Placebo} } \item{Rabbit}{ an ordered factor with levels \code{5} < \code{3} < \code{2} < \code{4} < \code{1} } } } \details{ Data on an experiment to examine the effect of a antagonist MDL 72222 on the change in blood pressure experienced with increasing dosage of phenylbiguanide are described in Ludbrook (1994) and analyzed in Venables and Ripley (2002, section 10.3). Each of five rabbits was exposed to increasing doses of phenylbiguanide after having either a placebo or the HD5-antagonist MDL 72222 administered. } \source{ Pinheiro, J. C. and Bates, D. M. (2000), \emph{Mixed-Effects Models in S and S-PLUS}, Springer, New York. (Appendix A.21) Venables, W. N. and Ripley, B. D. (2002) \emph{Modern Applied Statistics with S (4th ed)}, Springer, New York. Ludbrook, J. (1994), Repeated measurements and multiple comparisons in cardiovascular research, \emph{Cardiovascular Research}, \bold{28}, 303-311. } %\examples{} \keyword{datasets} nlme/man/gls-internal.Rd0000644000176000001440000000210414251721455014701 0ustar ripleyusers% File nlme/man/gls-internal.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{gls-internal} \title{Auxiliary functions used by gls} \alias{glsApVar} \alias{glsEstimate} \description{ These are functions used by \code{gls} to call its compiled C code. They are exported to allow experimentation with modified versions. } \usage{ glsApVar(glsSt, sigma, conLin = attr(glsSt, "conLin"), .relStep = .Machine$double.eps^(1/3), minAbsPar = 0, natural = TRUE) glsEstimate(object, conLin = attr(object, "conLin"), control = list(singular.ok = FALSE)) } \arguments{ \item{glsSt, object}{An object inheriting from class \code{"\link{glsStruct}"}.} \item{sigma}{the estimated residual standard error: see \code{\link{glsObject}}.} \item{conLin}{A \sQuote{condensed linear model}: see \code{\link{logLik.glsStruct}}.} \item{.relStep, minAbsPar, natural}{Control values: see \code{\link{glsControl}}.} \item{control}{The relevant part of a \code{\link{glsControl}} return value.} } \keyword{internal} nlme/man/recalc.modelStruct.Rd0000644000176000001440000000312214251721455016040 0ustar ripleyusers% File nlme/man/recalc.modelStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{recalc.modelStruct} %\title{Recalculate Condensed Linear Model for a \code{modelStruct} Object} \title{Recalculate for a modelStruct Object} \usage{ \method{recalc}{modelStruct}(object, conLin, \dots) } \alias{recalc.modelStruct} \arguments{ \item{object}{an object inheriting from class \code{"modelStruct"}, representing a list of model components, such as \code{corStruct} and \code{varFunc} objects.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying model. Defaults to \code{attr(object, "conLin")}.} \item{\dots}{some methods for this generic require additional arguments. None are used in this method.} } \description{ This method function recalculates the condensed linear model object using each element of \code{object} sequentially from last to first. } \value{ the recalculated condensed linear model object. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{This method function is generally only used inside model fitting functions, such as \code{lme} and \code{gls}, that allow model components, such as correlated error terms and variance functions. } \seealso{\code{\link{recalc.corStruct}}, \code{\link{recalc.reStruct}}, \code{\link{recalc.varFunc}}} \keyword{models} nlme/man/residuals.lmeStruct.Rd0000644000176000001440000000471414251721456016270 0ustar ripleyusers% File nlme/man/residuals.lmeStruct.Rd % Part of the nlme package for R % Distributed under GPL 2 or later: see nlme/LICENCE.note \name{residuals.lmeStruct} \title{Calculate lmeStruct Residuals} \usage{ \method{residuals}{lmeStruct}(object, level, conLin, lmeFit, \dots) } \alias{residuals.lmeStruct} \arguments{ \item{object}{an object inheriting from class \code{"\link{lmeStruct}"}, representing a list of linear mixed-effects model components, such as \code{reStruct}, \code{corStruct}, and \code{varFunc} objects.} \item{level}{an optional integer vector giving the level(s) of grouping to be used in extracting the residuals from \code{object}. Level values increase from outermost to innermost grouping, with level zero corresponding to the population fitted values. Defaults to the highest or innermost level of grouping.} \item{conLin}{an optional condensed linear model object, consisting of a list with components \code{"Xy"}, corresponding to a regression matrix (\code{X}) combined with a response vector (\code{y}), and \code{"logLik"}, corresponding to the log-likelihood of the underlying lme model. Defaults to \code{attr(object, "conLin")}.} \item{lmeFit}{an optional list with components \code{beta} and \code{b} containing respectively the fixed effects estimates and the random effects estimates to be used to calculate the residuals. Defaults to \code{attr(object, "lmeFit")}.} \item{\dots}{some methods for this generic accept optional arguments.} } \description{ The residuals at level \eqn{i} are obtained by subtracting the fitted values at that level from the response vector. The fitted values at level \eqn{i} are obtained by adding together the population fitted values (based only on the fixed effects estimates) and the estimated contributions of the random effects to the fitted values at grouping levels less or equal to \eqn{i}. } \value{ if a single level of grouping is specified in \code{level}, the returned value is a vector with the residuals at the desired level; else, when multiple grouping levels are specified in \code{level}, the returned object is a matrix with columns given by the residuals at different levels. } \author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}} \note{ This method function is primarily used within the \code{\link{lme}} function. } \seealso{\code{\link{lme}}, \code{\link{residuals.lme}}, \code{\link{fitted.lmeStruct}} } \keyword{models} nlme/DESCRIPTION0000644000176000001440000000343314772475235012766 0ustar ripleyusersPackage: nlme Version: 3.1-168 Date: 2025-03-31 Priority: recommended Title: Linear and Nonlinear Mixed Effects Models Authors@R: c(person("José", "Pinheiro", role = "aut", comment = "S version"), person("Douglas", "Bates", role = "aut", comment = "up to 2007"), person("Saikat", "DebRoy", role = "ctb", comment = "up to 2002"), person("Deepayan", "Sarkar", role = "ctb", comment = "up to 2005"), person("EISPACK authors", role = "ctb", comment = "src/rs.f"), person("Siem", "Heisterkamp", role = "ctb", comment = "Author fixed sigma"), person("Bert", "Van Willigen",role = "ctb", comment = "Programmer fixed sigma"), person("Johannes", "Ranke", role = "ctb", comment = "varConstProp()"), person("R Core Team", email = "R-core@R-project.org", role = c("aut", "cre"), comment = c(ROR = "02zz1nj61"))) Contact: see 'MailingList' Description: Fit and compare Gaussian linear and nonlinear mixed-effects models. Depends: R (>= 3.6.0) Imports: graphics, stats, utils, lattice Suggests: MASS, SASmixed LazyData: yes Encoding: UTF-8 License: GPL (>= 2) BugReports: https://bugs.r-project.org MailingList: R-help@r-project.org URL: https://svn.r-project.org/R-packages/trunk/nlme/ NeedsCompilation: yes Packaged: 2025-03-31 11:19:09 UTC; ripley Author: 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] (02zz1nj61) Maintainer: R Core Team Repository: CRAN Date/Publication: 2025-03-31 11:21:01 UTC