Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions R/f_s3generics_clvfitted.R
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,14 @@ summary.clv.fitted <- function(object, ...){
rownames(res$coefficients) <- names(all.est.params)
colnames(res$coefficients) <- c("Estimate","Std. Error", "z-val", "Pr(>|z|)")

# Set z-val and Pvalue of the model parameters to NA as they are by definition always > 0 ("significant")
# Printing "-" would be preferred but
# - setting to "-" would convert the whole matrix to character
# - using `printCoefmat(na.print='-')` would also show "-" for NA parameter estimates
# - therefore would likely require to re-implement `printCoefmat()` to only na.print
# for some params & columns but this is cumbersome as na.print is from the internal `print.default`
Comment thread
pschil marked this conversation as resolved.
res$coefficients[object@clv.model@names.original.params.model, c("z-val", "Pr(>|z|)")] <- NA_real_

# Optimization -------------------------------------------------------------------
res$estimated.LL <- as.vector(logLik(object))
res$AIC <- AIC(object)
Expand Down
7 changes: 5 additions & 2 deletions tests/testthat/helper_testthat_correctness_clvfitted.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ fct.testthat.correctness.clvfitted.flawless.results.out.of.the.box <- function(m
skip_on_cran()
expect_silent(fitted <- do.call(what = method, args = list(clv.data, verbose = FALSE)))
expect_silent(res.sum <- summary(fitted))
# No NAs anywhere
expect_false(any(!is.finite(coef(res.sum)))) # vcov and coef together

# No NAs in the parameter estimates and SE (checks vcov and coef together)
# There are however NAs in zval and pval as they are on purpose set to NA for the main model params
expect_false(any(!is.finite(coef(res.sum)[, c("Estimate", "Std. Error")])))

fct.DT.any.non.finite <- function(DT){
return(DT[, any(sapply(.SD, function(x){any(!is.finite(x))})), .SDcols = DT[, sapply(.SD, is.numeric)]])
}
Expand Down
Loading