From 352c5e31d8432d5e2d029d1964b3e2bc8f6dc83d Mon Sep 17 00:00:00 2001 From: cvanderaa Date: Wed, 24 Apr 2024 18:01:04 +0200 Subject: [PATCH] fix: fixed small error in degrees of freedom --- NEWS.md | 5 +++-- R/ScpModel-Workflow.R | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index fe95e6d..3f7a3f3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,9 @@ # scp 1.13 -## scp 1.13.5 +## scp 1.13.5 -(nothing yet) +- fix: fixed small error in degrees of freedom +- fix: break workflow upon infinite values ## scp 1.13.4 diff --git a/R/ScpModel-Workflow.R b/R/ScpModel-Workflow.R index b5c9a97..b2d0e68 100644 --- a/R/ScpModel-Workflow.R +++ b/R/ScpModel-Workflow.R @@ -332,7 +332,8 @@ scpModelWorkflow <- function(object, formula, hat <- x %*% tcrossprod(xtxInvLam, x) df <- length(y) - sum(diag(2 * hat - tcrossprod(hat))) } else { - df <- max(length(y) - ncol(x) - 1, 1) + ## note: not - 1 because intercept is in x + df <- max(length(y) - ncol(x), 1) } residuals <- y - x %*% beta list(coefficients = beta[, 1],