R Under development (unstable) (2025-05-03 r88188 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. > ## testing getME function > require(robustlmm) Loading required package: robustlmm Loading required package: lme4 Loading required package: Matrix > formatNum <- function(x, ...) + format(round(x, 8), trim = TRUE, drop0trailing = TRUE, ...) > options(str = strOptions(formatNum = formatNum)) > > sleepstudy2 <- within(sleepstudy, Group <- letters[1:4]) > rfm <- rlmer(Reaction ~ Days + (Days|Subject) + (1|Group), sleepstudy2, + rho.e = smoothPsi, rho.b=smoothPsi, + rho.sigma.e = psi2propII(smoothPsi, k=2.28), + rho.sigma.b = psi2propII(smoothPsi, k=2.28), + init = lmer(Reaction ~ Days + (Days|Subject) + (1|Group), sleepstudy2, + control=lmerControl(optimizer="bobyqa")), + doFit=FALSE) boundary (singular) fit: see help('isSingular') > > (nmME <- eval(formals(robustlmm:::getME.rlmerMod)$name)) [1] "X" "Z" "Zt" "Ztlist" [5] "mmList" "y" "mu" "u" [9] "b.s" "b" "Gp" "Tp" [13] "Lambda" "Lambdat" "Tlist" "A" [17] "U_b" "Lind" "sigma" "flist" [21] "fixef" "beta" "theta" "ST" [25] "is_REML" "n_rtrms" "n_rfacs" "N" [29] "n" "p" "q" "p_i" [33] "l_i" "q_i" "k" "m_i" [37] "m" "cnms" "devcomp" "offset" [41] "lower" "rho_e" "rho_b" "rho_sigma_e" [45] "rho_sigma_b" "M" "w_e" "w_b" [49] "w_b_vector" "w_sigma_e" "w_sigma_b" "w_sigma_b_vector" > for (nm in nmME) { + cat("\nName:", nm, "\n") + value <- getME(rfm, name=nm) + if (nm == "theta") { + value <- value + 1 + } else if (nm == "A") { + value@x <- value@x + 1 + } + if (substr(nm, 1, 3) == "rho") { + print(value) + } else { + str(value) + } + } Name: X num [1:180, 1:2] 1 1 1 1 1 1 1 1 1 1 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:180] "1" "2" "3" "4" ... ..$ : chr [1:2] "(Intercept)" "Days" - attr(*, "assign")= int [1:2] 0 1 - attr(*, "msgScaleX")= chr(0) Name: Z Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:522] 0 1 2 3 4 5 6 7 8 9 ... ..@ p : int [1:41] 0 10 19 29 38 48 57 67 76 86 ... ..@ Dim : int [1:2] 180 40 ..@ Dimnames:List of 2 .. ..$ : chr [1:180] "1" "2" "3" "4" ... .. ..$ : chr [1:40] "308" "308" "309" "309" ... ..@ x : num [1:522] 1 1 1 1 1 1 1 1 1 1 ... ..@ factors : list() Name: Zt Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:522] 0 36 0 1 37 0 1 38 0 1 ... ..@ p : int [1:181] 0 2 5 8 11 14 17 20 23 26 ... ..@ Dim : int [1:2] 40 180 ..@ Dimnames:List of 2 .. ..$ : chr [1:40] "308" "308" "309" "309" ... .. ..$ : chr [1:180] "1" "2" "3" "4" ... ..@ x : num [1:522] 1 1 1 1 1 1 2 1 1 3 ... ..@ factors : list() Name: Ztlist List of 3 $ Subject.(Intercept):Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. ..@ i : int [1:180] 0 0 0 0 0 0 0 0 0 0 ... .. ..@ p : int [1:181] 0 1 2 3 4 5 6 7 8 9 ... .. ..@ Dim : int [1:2] 18 180 .. ..@ Dimnames:List of 2 .. .. ..$ : chr [1:18] "308" "309" "310" "330" ... .. .. ..$ : chr [1:180] "1" "2" "3" "4" ... .. ..@ x : num [1:180] 1 1 1 1 1 1 1 1 1 1 ... .. ..@ factors : list() $ Subject.Days :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. ..@ i : int [1:162] 0 0 0 0 0 0 0 0 0 1 ... .. ..@ p : int [1:181] 0 0 1 2 3 4 5 6 7 8 ... .. ..@ Dim : int [1:2] 18 180 .. ..@ Dimnames:List of 2 .. .. ..$ : chr [1:18] "308" "309" "310" "330" ... .. .. ..$ : chr [1:180] "1" "2" "3" "4" ... .. ..@ x : num [1:162] 1 2 3 4 5 6 7 8 9 1 ... .. ..@ factors : list() $ Group.(Intercept) :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. ..@ i : int [1:180] 0 1 2 3 0 1 2 3 0 1 ... .. ..@ p : int [1:181] 0 1 2 3 4 5 6 7 8 9 ... .. ..@ Dim : int [1:2] 4 180 .. ..@ Dimnames:List of 2 .. .. ..$ : chr [1:4] "a" "b" "c" "d" .. .. ..$ : chr [1:180] "1" "2" "3" "4" ... .. ..@ x : num [1:180] 1 1 1 1 1 1 1 1 1 1 ... .. ..@ factors : list() Name: mmList List of 2 $ Days | Subject: num [1:180, 1:2] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:180] "1" "2" "3" "4" ... .. ..$ : chr [1:2] "(Intercept)" "Days" ..- attr(*, "assign")= int [1:2] 0 1 $ 1 | Group : num [1:180, 1] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:180] "1" "2" "3" "4" ... .. ..$ : chr "(Intercept)" ..- attr(*, "assign")= int 0 Name: y num [1:180] 250 259 251 321 357 ... Name: mu num [1:180] 254 273 293 313 332 ... Name: u num [1:40] 2.34 39.68 -41.79 -34.58 -40.3 ... Name: b.s num [1:40] 2.34 39.68 -41.79 -34.58 -40.3 ... Name: b Named num [1:40] 2.26 9.2 -40.4 -8.62 -38.96 ... - attr(*, "names")= chr [1:40] "308" "308" "309" "309" ... Name: Gp int [1:3] 0 36 40 Name: Tp Named num [1:3] 0 3 4 - attr(*, "names")= chr [1:3] "beg__" "Subject" "Group" Name: Lambda Formal class 'dtCMatrix' [package "Matrix"] with 7 slots ..@ i : int [1:58] 0 1 1 2 3 3 4 5 5 6 ... ..@ p : int [1:41] 0 2 3 5 6 8 9 11 12 14 ... ..@ Dim : int [1:2] 40 40 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : num [1:58] 0.9667 0.0152 0.2309 0.9667 0.0152 ... ..@ uplo : chr "L" ..@ diag : chr "N" Name: Lambdat Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:58] 0 0 1 2 2 3 4 4 5 6 ... ..@ p : int [1:41] 0 1 3 4 6 7 9 10 12 13 ... ..@ Dim : int [1:2] 40 40 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : num [1:58] 0.9667 0.0152 0.2309 0.9667 0.0152 ... ..@ factors : list() Name: Tlist List of 2 $ Subject: num [1:2, 1:2] 0.9667 0.0152 0 0.2309 $ Group : num [1, 1] 0 Name: A Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:522] 0 36 0 1 37 0 1 38 0 1 ... ..@ p : int [1:181] 0 2 5 8 11 14 17 20 23 26 ... ..@ Dim : int [1:2] 40 180 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : chr [1:180] "1" "2" "3" "4" ... ..@ x : num [1:522] 1.97 1 1.98 1.23 1 ... ..@ factors : list() Name: U_b Formal class 'dtCMatrix' [package "Matrix"] with 7 slots ..@ i : int [1:58] 0 1 1 2 3 3 4 5 5 6 ... ..@ p : int [1:41] 0 2 3 5 6 8 9 11 12 14 ... ..@ Dim : int [1:2] 40 40 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : num [1:58] 0.9667 0.0152 0.2309 0.9667 0.0152 ... ..@ uplo : chr "L" ..@ diag : chr "N" Name: Lind int [1:58] 1 2 3 1 2 3 1 2 3 1 ... Name: sigma num 25.6 Name: flist List of 2 $ Subject: Factor w/ 18 levels "308","309","310",..: 1 1 1 1 1 1 1 1 1 1 ... $ Group : Factor w/ 4 levels "a","b","c","d": 1 2 3 4 1 2 3 4 1 2 ... - attr(*, "assign")= int [1:2] 1 2 Name: fixef Named num [1:2] 251.4 10.5 - attr(*, "names")= chr [1:2] "(Intercept)" "Days" Name: beta num [1:2] 251.4 10.5 Name: theta Named num [1:4] 1.97 1.02 1.23 1 - attr(*, "names")= chr [1:4] "Subject.(Intercept)" "Subject.Days.(Intercept)" "Subject.Days" "Group.(Intercept)" Name: ST List of 2 $ Subject: num [1:2, 1:2] 0.9667 0.0157 0 0.2309 $ Group : num [1, 1] 0 Name: is_REML logi 1 Name: n_rtrms int 2 Name: n_rfacs int 2 Name: N int 180 Name: n int 180 Name: p int 2 Name: q int 40 Name: p_i Named int [1:2] 2 1 - attr(*, "names")= chr [1:2] "Days | Subject" "1 | Group" Name: l_i Named int [1:2] 18 4 - attr(*, "names")= chr [1:2] "Subject" "Group" Name: q_i Named int [1:2] 36 4 - attr(*, "names")= chr [1:2] "Days | Subject" "1 | Group" Name: k int 2 Name: m_i Named num [1:2] 3 1 - attr(*, "names")= chr [1:2] "Days | Subject" "1 | Group" Name: m int 4 Name: cnms List of 2 $ Subject: chr [1:2] "(Intercept)" "Days" $ Group : chr "(Intercept)" Name: devcomp List of 2 $ cmp : Named num [1:10] NA NA NA NA NA ... ..- attr(*, "names")= chr [1:10] "ldL2" "ldRX2" "wrss" "ussq" ... $ dims: Named int [1:12] 180 180 2 178 40 4 1 2 0 2 ... ..- attr(*, "names")= chr [1:12] "N" "n" "p" "nmp" ... Name: offset num [1:180] 0 0 0 0 0 0 0 0 0 0 ... Name: lower Named num [1:4] 0 -Inf 0 0 - attr(*, "names")= chr [1:4] "Subject.(Intercept)" "Subject.Days.(Intercept)" "Subject.Days" "Group.(Intercept)" Name: rho_e smoothed Huber psi function (k = 1.345, s = 10) Name: rho_b $Subject smoothed Huber psi function (k = 1.345, s = 10) $Group smoothed Huber psi function (k = 1.345, s = 10) Name: rho_sigma_e smoothed Huber, Proposal 2 psi function (k = 2.28, s = 10) Name: rho_sigma_b $Subject smoothed Huber, Proposal 2 psi function (k = 2.28, s = 10) $Group smoothed Huber, Proposal 2 psi function (k = 2.28, s = 10) Name: M List of 5 $ M_bb.:Formal class 'dgeMatrix' [package "Matrix"] with 4 slots .. ..@ Dim : int [1:2] 40 40 .. ..@ Dimnames:List of 2 .. .. ..$ : NULL .. .. ..$ : NULL .. ..@ x : num [1:1600] 9.105 8.529 -0.487 -0.502 -0.487 ... .. ..@ factors :List of 1 .. .. ..$ denseLU:Formal class 'denseLU' [package "Matrix"] with 4 slots .. .. .. .. ..@ x : num [1:1600] 9.105 0.9367 -0.0535 -0.0551 -0.0535 ... .. .. .. .. ..@ perm : int [1:40] 1 2 3 4 5 6 7 8 9 10 ... .. .. .. .. ..@ Dim : int [1:2] 40 40 .. .. .. .. ..@ Dimnames:List of 2 .. .. .. .. .. ..$ : NULL .. .. .. .. .. ..$ : NULL $ M_XZ :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots .. ..@ Dim : int [1:2] 2 40 .. ..@ Dimnames:List of 2 .. .. ..$ : chr [1:2] "(Intercept)" "Days" .. .. ..$ : NULL .. ..@ x : num [1:80] 8.46 39.11 8.5 53.81 8.46 ... .. ..@ factors : list() $ M_bB :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots .. ..@ Dim : int [1:2] 40 2 .. ..@ Dimnames:List of 2 .. .. ..$ : NULL .. .. ..$ : chr [1:2] "(Intercept)" "Days" .. ..@ x : num [1:80] -0.0657 0 -0.0657 0 -0.0657 ... .. ..@ factors : list() $ M_BB :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots .. ..@ Dim : int [1:2] 2 2 .. ..@ Dimnames:List of 2 .. .. ..$ : chr [1:2] "(Intercept)" "Days" .. .. ..$ : NULL .. ..@ x : num [1:4] 0.08697 -0.00271 -0.00271 0.00446 .. ..@ factors : list() $ M_bb :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots .. ..@ Dim : int [1:2] 40 40 .. ..@ Dimnames:List of 2 .. .. ..$ : NULL .. .. ..$ : NULL .. ..@ x : num [1:1600] 0.3429 -0.1875 0.0518 0.011 0.0518 ... .. ..@ factors : list() Name: w_e num [1:180] 1 1 0.812 1 1 ... Name: w_b List of 2 $ Subject:'data.frame': 18 obs. of 2 variables: ..$ (Intercept): num [1:18] 0.557 0.299 0.427 0.794 1 ... ..$ Days : num [1:18] 0.557 0.299 0.427 0.794 1 ... $ Group :'data.frame': 4 obs. of 1 variable: ..$ (Intercept): num [1:4] 1 1 1 1 Name: w_b_vector num [1:40] 0.557 0.557 0.299 0.299 0.427 ... Name: w_sigma_e num [1:180] 1 1 1 1 1 ... Name: w_sigma_b List of 2 $ Subject:'data.frame': 18 obs. of 2 variables: ..$ (Intercept): num [1:18] 0.878 0.258 0.524 1 1 ... ..$ Days : num [1:18] 0.878 0.258 0.524 1 1 ... $ Group :'data.frame': 4 obs. of 1 variable: ..$ (Intercept): num [1:4] 1 1 1 1 Name: w_sigma_b_vector num [1:40] 0.878 0.878 0.258 0.258 0.524 ... > g.all <- getME(rfm, "ALL") > g.all[grepl("^rho", names(g.all))] <- NULL > g.all[["theta"]] <- g.all[["theta"]] + 1 > str(g.all, max.level = 2) List of 48 $ X : num [1:180, 1:2] 1 1 1 1 1 1 1 1 1 1 ... ..- attr(*, "dimnames")=List of 2 ..- attr(*, "assign")= int [1:2] 0 1 ..- attr(*, "msgScaleX")= chr(0) $ Z :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots $ Zt :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots $ Ztlist :List of 3 ..$ Subject.(Intercept):Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..$ Subject.Days :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..$ Group.(Intercept) :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots $ mmList :List of 2 ..$ Days | Subject: num [1:180, 1:2] 1 1 1 1 1 1 1 1 1 1 ... .. ..- attr(*, "dimnames")=List of 2 .. ..- attr(*, "assign")= int [1:2] 0 1 ..$ 1 | Group : num [1:180, 1] 1 1 1 1 1 1 1 1 1 1 ... .. ..- attr(*, "dimnames")=List of 2 .. ..- attr(*, "assign")= int 0 $ y : num [1:180] 250 259 251 321 357 ... $ mu : num [1:180] 254 273 293 313 332 ... $ u : num [1:40] 2.34 39.68 -41.79 -34.58 -40.3 ... $ b.s : num [1:40] 2.34 39.68 -41.79 -34.58 -40.3 ... $ b : Named num [1:40] 2.26 9.2 -40.4 -8.62 -38.96 ... ..- attr(*, "names")= chr [1:40] "308" "308" "309" "309" ... $ Gp : int [1:3] 0 36 40 $ Tp : Named num [1:3] 0 3 4 ..- attr(*, "names")= chr [1:3] "beg__" "Subject" "Group" $ Lambda :Formal class 'dtCMatrix' [package "Matrix"] with 7 slots $ Lambdat :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots $ Tlist :List of 2 ..$ Subject: num [1:2, 1:2] 0.9667 0.0152 0 0.2309 ..$ Group : num [1, 1] 0 $ A :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots $ U_b :Formal class 'dtCMatrix' [package "Matrix"] with 7 slots $ Lind : int [1:58] 1 2 3 1 2 3 1 2 3 1 ... $ sigma : num 25.6 $ flist :List of 2 ..$ Subject: Factor w/ 18 levels "308","309","310",..: 1 1 1 1 1 1 1 1 1 1 ... ..$ Group : Factor w/ 4 levels "a","b","c","d": 1 2 3 4 1 2 3 4 1 2 ... ..- attr(*, "assign")= int [1:2] 1 2 $ fixef : Named num [1:2] 251.4 10.5 ..- attr(*, "names")= chr [1:2] "(Intercept)" "Days" $ beta : num [1:2] 251.4 10.5 $ theta : Named num [1:4] 1.97 1.02 1.23 1 ..- attr(*, "names")= chr [1:4] "Subject.(Intercept)" "Subject.Days.(Intercept)" "Subject.Days" "Group.(Intercept)" $ ST :List of 2 ..$ Subject: num [1:2, 1:2] 0.9667 0.0157 0 0.2309 ..$ Group : num [1, 1] 0 $ is_REML : logi 1 $ n_rtrms : int 2 $ n_rfacs : int 2 $ N : int 180 $ n : int 180 $ p : int 2 $ q : int 40 $ p_i : Named int [1:2] 2 1 ..- attr(*, "names")= chr [1:2] "Days | Subject" "1 | Group" $ l_i : Named int [1:2] 18 4 ..- attr(*, "names")= chr [1:2] "Subject" "Group" $ q_i : Named int [1:2] 36 4 ..- attr(*, "names")= chr [1:2] "Days | Subject" "1 | Group" $ k : int 2 $ m_i : Named num [1:2] 3 1 ..- attr(*, "names")= chr [1:2] "Days | Subject" "1 | Group" $ m : int 4 $ cnms :List of 2 ..$ Subject: chr [1:2] "(Intercept)" "Days" ..$ Group : chr "(Intercept)" $ devcomp :List of 2 ..$ cmp : Named num [1:10] NA NA NA NA NA ... .. ..- attr(*, "names")= chr [1:10] "ldL2" "ldRX2" "wrss" "ussq" ... ..$ dims: Named int [1:12] 180 180 2 178 40 4 1 2 0 2 ... .. ..- attr(*, "names")= chr [1:12] "N" "n" "p" "nmp" ... $ offset : num [1:180] 0 0 0 0 0 0 0 0 0 0 ... $ lower : Named num [1:4] 0 -Inf 0 0 ..- attr(*, "names")= chr [1:4] "Subject.(Intercept)" "Subject.Days.(Intercept)" "Subject.Days" "Group.(Intercept)" $ M :List of 5 ..$ M_bb.:Formal class 'dgeMatrix' [package "Matrix"] with 4 slots ..$ M_XZ :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots ..$ M_bB :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots ..$ M_BB :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots ..$ M_bb :Formal class 'dgeMatrix' [package "Matrix"] with 4 slots $ w_e : num [1:180] 1 1 0.812 1 1 ... $ w_b :List of 2 ..$ Subject:'data.frame': 18 obs. of 2 variables: ..$ Group :'data.frame': 4 obs. of 1 variable: $ w_b_vector : num [1:40] 0.557 0.557 0.299 0.299 0.427 ... $ w_sigma_e : num [1:180] 1 1 1 1 1 ... $ w_sigma_b :List of 2 ..$ Subject:'data.frame': 18 obs. of 2 variables: ..$ Group :'data.frame': 4 obs. of 1 variable: $ w_sigma_b_vector: num [1:40] 0.878 0.878 0.258 0.258 0.524 ... > > proc.time() user system elapsed 2.76 0.21 2.98