-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also creation of jsdmStanFamily class to support this, and associated changes to accessory functions and documentation
- Loading branch information
Showing
26 changed files
with
682 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,5 +33,4 @@ Suggests: | |
rmarkdown, | ||
ggplot2 | ||
Config/testthat/edition: 3 | ||
Config/testthat/parallel: true | ||
VignetteBuilder: knitr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#' jsdmStanFamily class | ||
#' | ||
#' This is the jsdmStanFamily class, which occupies a slot within any | ||
#' jsdmStanFit object. | ||
#' | ||
#' @name jsdmStanFamily | ||
#' | ||
#' @section Elements for \code{jsdmStanFamily} objects: | ||
#' \describe{ | ||
#' \item{\code{family}}{ | ||
#' A length one character vector describing family used to fit object. Options | ||
#' are \code{"gaussian"}, \code{"poisson"}, \code{"bernoulli"}, | ||
#' \code{"neg_binomial"}, \code{"binomial"}, \code{"zi_poisson"}, | ||
#' \code{"zi_neg_binomial"}, or \code{"multiple"}. | ||
#' } | ||
#' \item{\code{params}}{ | ||
#' A character vector that includes all the names of the family-specific parameters. | ||
#' } | ||
#' \item{\code{params_dataresp}}{ | ||
#' A character vector that includes any named family-specific parameters that are | ||
#' modelled in response to data. | ||
#' } | ||
#' \item{\code{preds}}{ | ||
#' A character vector of the measured predictors included if family parameters | ||
#' are modelled in response to data. If family parameters are not modelled in | ||
#' response to data this is left empty. | ||
#' } | ||
#' \item{\code{data_list}}{ | ||
#' A list containing the original data used to fit the model | ||
#' (empty when save_data is set to \code{FALSE} or family parameters are not | ||
#' modelled in response to data). | ||
#' } | ||
#' } | ||
#' | ||
jsdmStanFamily_empty <- function(){ | ||
res <- list(family = character(), | ||
params = character(), | ||
params_dataresp= character(), | ||
preds = character(), | ||
data_list = list()) | ||
class(res) <- "jsdmStanFamily" | ||
return(res) | ||
} | ||
|
||
# jsdmStanFamily methods | ||
|
||
#' Print jsdmStanFamily object | ||
#' | ||
#' @param x A jsdmStanFamily object | ||
#' @param ... Other arguments, not used at this stage. | ||
#' | ||
#' @export | ||
print.jsdmStanFamily <- function(x, ...){ | ||
cat(paste("Family:", x$family, "\n", | ||
ifelse(length(x$params)>0, | ||
paste("With parameters:", | ||
paste0(x$params, sep = ", "),"\n"), | ||
""))) | ||
if(length(x$params_dataresp)>0){ | ||
cat(paste("Family-specific parameter", | ||
paste0(x$params_dataresp,sep=", "), | ||
"is modelled in response to", length(x$preds), | ||
"predictors. These are named:", | ||
paste0(x$preds, sep = ", "))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.