Skip to content

Commit f1d3972

Browse files
committed
Refer to full name df.residual in fastLm summary (closes #115)
1 parent 019796c commit f1d3972

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2022-11-04 Dirk Eddelbuettel <[email protected]>
2+
3+
* R/fastLm.R (summary.fastLm,print.fastLm): Refer to correct and full
4+
variable name df.residual in the returned object
5+
16
2022-09-15 Jonah Gabry <[email protected]>
27

38
* inst/skeleton/rcppeigen_hello_world.cpp: Correct typo

R/fastLm.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ summary.fastLm <- function(object, ...) {
5454
object$coefficients <- cbind(Estimate = coef,
5555
"Std. Error" = se,
5656
"t value" = tval,
57-
"Pr(>|t|)" = 2*pt(-abs(tval), df=object$df))
57+
"Pr(>|t|)" = 2*pt(-abs(tval), df=object$df.residual))
5858

5959
## cf src/stats/R/lm.R and case with no weights and an intercept
6060
f <- object$fitted.values
@@ -66,7 +66,7 @@ summary.fastLm <- function(object, ...) {
6666
object$r.squared <- mss/(mss + rss)
6767
df.int <- if (object$intercept) 1L else 0L
6868
n <- length(f)
69-
rdf <- object$df
69+
rdf <- object$df.residual
7070
object$adj.r.squared <- 1 - (1 - object$r.squared) * ((n - df.int)/rdf)
7171
class(object) <- "summary.fastLm"
7272
object
@@ -82,7 +82,7 @@ print.summary.fastLm <- function(x, ...) {
8282

8383
printCoefmat(x$coefficients, P.values=TRUE, has.Pvalue=TRUE, ...)
8484
cat("\nResidual standard error: ", formatC(x$s, digits=digits), " on ",
85-
formatC(x$df), " degrees of freedom\n", sep="")
85+
formatC(x$df.residual), " degrees of freedom\n", sep="")
8686
cat("Multiple R-squared: ", formatC(x$r.squared, digits=digits),
8787
",\tAdjusted R-squared: ",formatC(x$adj.r.squared, digits=digits),
8888
"\n", sep="")

0 commit comments

Comments
 (0)