Skip to content

Commit

Permalink
improve print and summary; add corpcor to dependencies in actions checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjclark committed Nov 4, 2024
1 parent 2e49488 commit 322dde6
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check-rstan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
lubridate
wrswoR
tweedie
corpcor
splines2
scoringRules
matrixStats
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
lubridate
wrswoR
tweedie
corpcor
splines2
scoringRules
matrixStats
Expand Down
37 changes: 23 additions & 14 deletions R/print.mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,43 @@ cat(paste0(object$family, '\n'))
cat("\nLink function:\n")
cat(paste0(family_links(object$family), '\n'))


cat("\nTrend model:\n")
if(inherits(object$trend_model, 'mvgam_trend')){
print(object$trend_model$label)
cat('\n')
} else {
cat(paste0(object$trend_model, '\n'))
if(!inherits(object, 'jsdgam')){
cat("\nTrend model:\n")
if(inherits(object$trend_model, 'mvgam_trend')){
print(object$trend_model$label)
cat('\n')
} else {
cat(paste0(object$trend_model, '\n'))
}
}

if(object$use_lv){
cat("N latent factors:\n")
cat("\nN latent factors:\n")
cat(object$n_lv, '\n')

}

cat('\nN series:\n')
cat(NCOL(object$ytimes), '\n')

if(inherits(object, 'jsdgam')){
cat('\nN species:\n')
cat(NCOL(object$ytimes), '\n')
} else {
cat('\nN series:\n')
cat(NCOL(object$ytimes), '\n')
}

if(!is.null(object$upper_bounds)){
cat('\nUpper bounds:\n')
cat(object$upper_bounds, '\n')

}

cat('\nN timepoints:\n')
cat(NROW(object$ytimes), '\n')

if(inherits(object, 'jsdgam')){
cat('\nN sites:\n')
cat(NROW(object$ytimes), '\n')
} else {
cat('\nN timepoints:\n')
cat(NROW(object$ytimes), '\n')
}

if(object$fit_engine == 'jags'){
cat('\nStatus:\n')
Expand Down
2 changes: 1 addition & 1 deletion R/residual_cor.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#' directly associated, but they are still correlated *through* other species. In other words, they
#' are conditionally independent given the other species. It is important that the precision matrix
#' does not exhibit the exact same properties of the correlation e.g., the diagonal elements are
#' not equal to 1. Nevertheless, relatively larger values of precision imply a stronger
#' not equal to 1. Nevertheless, relatively larger values of precision may imply stronger
#' direct relationships between two species.
#'
#' In addition to the residual correlation and precision matrices, the median or mean point estimator
Expand Down
64 changes: 44 additions & 20 deletions R/summary.mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ cat(paste0(object$family, '\n'))
cat("\nLink function:\n")
cat(paste0(family_links(object$family), '\n'))

cat("\nTrend model:\n")
if(inherits(object$trend_model, 'mvgam_trend')){
print(object$trend_model$label)
} else {
cat(paste0(object$trend_model, '\n'))
if(!inherits(object, 'jsdgam')){
cat("\nTrend model:\n")
if(inherits(object$trend_model, 'mvgam_trend')){
print(object$trend_model$label)
cat('\n')
} else {
cat(paste0(object$trend_model, '\n'))
}
}


if(object$use_lv){
if(!is.null(object$trend_call)){
cat("\nN process models:\n")
Expand All @@ -99,16 +101,26 @@ if(object$use_lv){
}
}

cat('\nN series:\n')
cat(NCOL(object$ytimes), '\n')
if(inherits(object, 'jsdgam')){
cat('\nN species:\n')
cat(NCOL(object$ytimes), '\n')
} else {
cat('\nN series:\n')
cat(NCOL(object$ytimes), '\n')
}

if(!is.null(object$upper_bounds)){
cat('\nUpper bounds:\n')
cat(object$upper_bounds, '\n')
}

cat('\nN timepoints:\n')
cat(NROW(object$ytimes), '\n')
if(inherits(object, 'jsdgam')){
cat('\nN sites:\n')
cat(NROW(object$ytimes), '\n')
} else {
cat('\nN timepoints:\n')
cat(NROW(object$ytimes), '\n')
}

if(object$fit_engine == 'jags'){
cat('\nStatus:\n')
Expand Down Expand Up @@ -825,14 +837,16 @@ summary.mvgam_prefit = function(object, ...){
cat(paste0(family_links(object$family), '\n'))


cat("\nTrend model:\n")
if(inherits(object$trend_model, 'mvgam_trend')){
cat(paste0(print(object$trend_model$label), '\n'))
} else {
cat(paste0(object$trend_model, '\n'))
if(!inherits(object, 'jsdgam')){
cat("\nTrend model:\n")
if(inherits(object$trend_model, 'mvgam_trend')){
print(object$trend_model$label)
cat('\n')
} else {
cat(paste0(object$trend_model, '\n'))
}
}


if(object$use_lv){
if(!is.null(object$trend_call)){
cat("\nN process models:\n")
Expand All @@ -846,12 +860,22 @@ summary.mvgam_prefit = function(object, ...){

}

cat('\n\nN series:')
cat(NCOL(object$ytimes), '\n')
if(inherits(object, 'jsdgam')){
cat('\nN species:\n')
cat(NCOL(object$ytimes), '\n')
} else {
cat('\nN series:\n')
cat(NCOL(object$ytimes), '\n')
}


cat('\n\nN timepoints:')
cat(NROW(object$ytimes), '\n')
if(inherits(object, 'jsdgam')){
cat('\nN sites:\n')
cat(NROW(object$ytimes), '\n')
} else {
cat('\nN timepoints:\n')
cat(NROW(object$ytimes), '\n')
}


cat('\nStatus:')
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/residual_cor.jsdgam.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/residual_cor.jsdgam.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 322dde6

Please sign in to comment.