R Under development (unstable) (2025-08-24 r88696 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 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. > date() [1] "Mon Aug 25 14:40:56 2025" > ## See R20.15a > npg <- 20 # No of subjects per group > subject <- 1:(2*npg) # Subjects' ids > treat.f <- gl(2, npg, labels = c("Placebo", "Active")) > dts <- data.frame(subject, treat.f) # Subject-level data > > dtL <- + list(time = c(4, 12, 24, 52), + subject = subject) > dtLong <- expand.grid(dtL) # "Long" format > mrgDt <- merge(dtLong, dts, sort = FALSE) # Merged > exmpDt <- + within(mrgDt, + { + m0 <- 75 - 0.1 * time # Under H0 # Changed from 65 to 75 (Feb. 2013) + mA <- 85 - 0.1 * time # Under HA + mA <- ifelse(treat.f %in% "Active", mA, m0) + }) > > ## See R20.16a > data(armd, package = "nlmeU") > library(nlme) > D0 <- diag(c(100, 0.09)) > sgma <- 5 > (D <- D0/(sgma*sgma)) # D [,1] [,2] [1,] 4 0.0000 [2,] 0 0.0036 > (pd1 <- pdDiag(D, form = ~time, data = armd)) Positive definite matrix structure of class pdDiag representing (Intercept) time (Intercept) 4 0.0000 time 0 0.0036 > (vF <- varPower(form = ~time, fixed = 0.15)) Variance function structure of class varPower representing power 0.15 > > ## See R20.16b > cntrl <- + lmeControl(maxIter = 0, msMaxIter = 0, niterEM = 0, + returnObject = TRUE, opt = "optim") > fmA <- + lme(mA ~ time + treat.f, + random = list(subject = pd1), + weights = vF, + data = exmpDt, + control = cntrl) > fixef(fmA) (Intercept) time treat.fActive 75.0 -0.1 10.0 > > detach(package:nlme) > > library(nlmeU) Attaching package: 'nlmeU' The following object is masked _by_ '.GlobalEnv': armd > sigma(fmA) [1] 5.885341e-15 > Pwr(fmA, sigma = sgma, L = c("treat.fActive" = 1)) numDF denDF F-value nc Power 1 1 38 5.80549e+30 5.80549e+30 1 Warning message: In pf(Fcrit, ndf, ddf2, ncx) : convergence failed in 'pnbeta' > > dif <- 10 > dim(dif) <- c(length(dif), 1) > colnames(dif) <- "treat.fActive" > dtF <- Pwr(fmA, sigma = sgma, + L = c("treat.fActive" = 1), altB = dif) Warning message: In pf(Fcrit, numDF, denDF, nc) : convergence failed in 'pnbeta' > dtF (Intercept) time treat.fActive Power nc Fcrit Fvalue denDF 1 75 -0.1 10 1 5.80549e+30 4.098172 5.80549e+30 38 numDF 1 1 > > > packageVersion("nlme") [1] '3.1.168' > sessionInfo() R Under development (unstable) (2025-08-24 r88696 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows Server 2022 x64 (build 20348) Matrix products: default LAPACK version 3.12.1 locale: [1] LC_COLLATE=C LC_CTYPE=German_Germany.utf8 [3] LC_MONETARY=C LC_NUMERIC=C [5] LC_TIME=C time zone: Europe/Berlin tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] nlmeU_0.71.6 loaded via a namespace (and not attached): [1] compiler_4.6.0 tools_4.6.0 nlme_3.1-168 grid_4.6.0 lattice_0.22-7 > detach(package:nlmeU) > > > > > proc.time() user system elapsed 0.23 0.04 0.26