Skip to content

Commit 13bc90f

Browse files
committedFeb 10, 2025·
cran version 1.09
1 parent df7aac3 commit 13bc90f

File tree

4 files changed

+46
-20
lines changed

4 files changed

+46
-20
lines changed
 

‎DESCRIPTION

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
Package: faraway
22
Version: 1.0.9
3-
Date: 2025-02-05
4-
Author: Julian Faraway <jjf23@bath.ac.uk>
5-
Maintainer: Julian Faraway <jjf23@bath.ac.uk>
6-
Title: Functions and Datasets for Books by Julian Faraway
3+
Date: 2025-02-07
4+
Authors@R: person(given = "Julian",
5+
family = "Faraway",
6+
role = c("aut", "cre"),
7+
email = "jjf23@bath.ac.uk")
8+
Title: Datasets and Functions for Books by Julian Faraway
79
Description: Books are "Linear Models with R" published 1st Ed. August 2004, 2nd Ed. July 2014, 3rd Ed. February 2025 by CRC press, ISBN 9781439887332, and "Extending the Linear Model with R" published by CRC press in 1st Ed. December 2005 and 2nd Ed. March 2016, ISBN 9781584884248 and "Practical Regression and ANOVA in R" contributed documentation on CRAN (now very dated).
810
Depends: R (>= 3.5.0)
911
License: GPL

‎NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
S3method(vif,default)
44
S3method(vif,lm)
55
export(Cpplot)
6+
export(VarCorrmat)
67
export(fround)
78
export(halfnorm)
89
export(ilogit)

‎R/faraway.R

+14-16
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ setMethod("sumary", signature(object = "merMod"),
417417
out$coef <- coefs[,"coef.est"]
418418
out$se <- coefs[,"coef.se"]
419419
cat("\nRandom Effects:\n")
420-
vc <- as.matrix.VarCorr (VarCorr (object), useScale=useScale, digits)
420+
vc <- VarCorrmat (VarCorr (object), useScale=useScale, digits)
421421
print (vc[,c(1:2,4:ncol(vc))], quote=FALSE)
422422
out$ngrps <- lapply(object@flist, function(x) length(levels(x)))
423423
is_REML <- isREML(object)
@@ -483,29 +483,29 @@ pfround <- function (x, digits) {
483483
}
484484

485485

486-
# Taken from arm package
487-
488-
#' @noRd
489-
as.matrix.VarCorr <- function (varc, useScale, digits){
490-
# VarCorr function for lmer objects, altered as follows:
491-
# 1. specify rounding
492-
# 2. print statement at end is removed
493-
# 3. reMat is returned
494-
# 4. last line kept in reMat even when there's no error term
486+
#' Helper function to convert VarCorr objects
487+
#'
488+
#' Used internally when showing summary for lmer objects
489+
#'
490+
#'
491+
#' @param varc a numeric vector
492+
#' @param useScale a numeric vector
493+
#' @param digits a numeric vector
494+
#' @return a matrix
495+
#' @author copied from the arm package
496+
#' @keywords internal
497+
#' @export VarCorrmat
498+
VarCorrmat <- function (varc, useScale, digits){
495499
sc <- attr(varc, "sc")[[1]]
496500
if(is.na(sc)) sc <- 1
497-
# recorr <- lapply(varc, function(el) el@factors$correlation)
498501
recorr <- lapply(varc, function(el) attr(el, "correlation"))
499-
#reStdDev <- c(lapply(recorr, slot, "sd"), list(Residual = sc))
500502
reStdDev <- c(lapply(varc, function(el) attr(el, "stddev")), list(Residual = sc))
501503
reLens <- unlist(c(lapply(reStdDev, length)))
502504
reMat <- array('', c(sum(reLens), 4),
503505
list(rep('', sum(reLens)),
504506
c("Groups", "Name", "Variance", "Std.Dev.")))
505507
reMat[1+cumsum(reLens)-reLens, 1] <- names(reLens)
506508
reMat[,2] <- c(unlist(lapply(reStdDev, names)), "")
507-
# reMat[,3] <- format(unlist(reStdDev)^2, digits = digits)
508-
# reMat[,4] <- format(unlist(reStdDev), digits = digits)
509509
reMat[,3] <- fround(unlist(reStdDev)^2, digits)
510510
reMat[,4] <- fround(unlist(reStdDev), digits)
511511
if (any(reLens > 1)) {
@@ -515,7 +515,6 @@ as.matrix.VarCorr <- function (varc, useScale, digits){
515515
lapply(recorr,
516516
function(x, maxlen) {
517517
x <- as(x, "matrix")
518-
# cc <- format(round(x, 3), nsmall = 3)
519518
cc <- fround (x, digits)
520519
cc[!lower.tri(cc)] <- ""
521520
nr <- dim(cc)[1]
@@ -525,7 +524,6 @@ as.matrix.VarCorr <- function (varc, useScale, digits){
525524
colnames(corr) <- c("Corr", rep("", maxlen - 1))
526525
reMat <- cbind(reMat, rbind(corr, rep("", ncol(corr))))
527526
}
528-
# if (!useScale) reMat <- reMat[-nrow(reMat),]
529527
if (useScale<0) reMat[nrow(reMat),] <- c ("No residual sd", rep("",ncol(reMat)-1))
530528
return (reMat)
531529
}

‎man/VarCorrmat.Rd

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.