Skip to content

Commit

Permalink
more extensive doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Clark committed Dec 12, 2023
1 parent fff8502 commit bccb098
Show file tree
Hide file tree
Showing 29 changed files with 301 additions and 203 deletions.
2 changes: 1 addition & 1 deletion R/mvgam-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#' \item `fit_engine` `Character` describing the fit engine, either as `stan` or `jags`
#' \item `backend` `Character` describing the backend used for modelling, either as `rstan`, `cmdstanr` or `rjags`
#' \item `algorithm` `Character` describing the algorithm used for finding the posterior,
#' either as `sampling`, `meanfield` or `fullrank`
#' either as `sampling`, `laplace`, `pathfinder`, `meanfield` or `fullrank`
#' \item `max_treedepth` If the model was fitted using `Stan`, the value supplied for the maximum
#' treedepth tuning parameter is returned (see \code{\link[rstan]{stan}} for details).
#' Otherwise `NULL`
Expand Down
116 changes: 88 additions & 28 deletions R/mvgam.R

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions R/print.mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,52 +23,56 @@ if(!is.null(object$trend_call)){
print(object$call)
}

cat("Family:\n")
cat("\nFamily:\n")
cat(paste0(object$family, '\n'))


cat("Link function:\n")
cat("\nLink function:\n")
cat(paste0(family_links(object$family), '\n'))


cat("Trend model:\n")
print(object$trend_model)

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

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

}

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


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

}

cat('N observations:\n')
if(class(object$obs_data)[1] == 'list'){
cat(length(object$obs_data$y), '\n')
} else {
cat(NROW(object$obs_data), '\n')
}
cat('\nN timepoints:\n')
cat(max(object$obs_data$time), '\n')


if(object$fit_engine == 'jags'){
cat('Status:\n')
cat('\nStatus:\n')
cat('Fitted using JAGS', '\n')

}

if(object$fit_engine == 'stan'){
cat('Status:\n')
cat('\nStatus:\n')
cat('Fitted using Stan', '\n')

n_kept <- object$model_output@sim$n_save - object$model_output@sim$warmup2
cat(object$model_output@sim$chains, " chains, each with iter = ",
object$model_output@sim$iter,
"; warmup = ", object$model_output@sim$warmup, "; thin = ",
object$model_output@sim$thin, " \n",
"Total post-warmup draws = ", sum(n_kept), "\n\n", sep = '')

}

}
Expand All @@ -90,11 +94,10 @@ print.mvgam_prefit = function(x, ...){
print(object$call)
}

cat("Family:\n")
cat("\nFamily:\n")
cat(paste0(object$family, '\n'))


cat("Link function:\n")
cat("\nLink function:\n")
cat(paste0(family_links(object$family), '\n'))


Expand All @@ -106,25 +109,22 @@ print.mvgam_prefit = function(x, ...){
}



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

}

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


cat('N observations:\n')
if(class(object$obs_data)[1] == 'list'){
cat(length(object$obs_data$y), '\n')
} else {
cat(NROW(object$obs_data), '\n')
}
cat('\nN timepoints:\n')
cat(max(object$obs_data$time), '\n')


cat('Status:\n')
cat('\nStatus:\n')
cat('Not fitted', '\n')

}
Loading

0 comments on commit bccb098

Please sign in to comment.