Skip to content

Commit

Permalink
export family 'logistic_normal'
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Feb 4, 2022
1 parent f9e6a98 commit cddbf13
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ export(launch_shinystan)
export(lf)
export(log_lik)
export(log_posterior)
export(logistic_normal)
export(logit_scaled)
export(logm1)
export(lognormal)
Expand Down
26 changes: 19 additions & 7 deletions R/families.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@
#' consecutive thresholds to the same value, and
#' \code{"sum_to_zero"} ensures the thresholds sum to zero.
#' @param refcat Optional name of the reference response category used in
#' categorical, multinomial, and dirichlet models. If \code{NULL} (the
#' default), the first category is used as the reference. If \code{NA}, all
#' categories will be predicted, which requires strong priors or carefully
#' specified predictor terms in order to lead to an identified model.
#' \code{categorical}, \code{multinomial}, \code{dirichlet} and
#' \code{logistic_normal} models. If \code{NULL} (the default), the first
#' category is used as the reference. If \code{NA}, all categories will be
#' predicted, which requires strong priors or carefully specified predictor
#' terms in order to lead to an identified model.
#' @param bhaz Currently for experimental purposes only.
#'
#' @details
Expand Down Expand Up @@ -90,8 +91,8 @@
#' \item{Families \code{weibull}, \code{frechet}, and \code{gen_extreme_value}
#' ('generalized extreme value') allow for modeling extremes.}
#'
#' \item{Families \code{beta} and \code{dirichlet} can be used to model
#' responses representing rates or probabilities.}
#' \item{Families \code{beta}, \code{dirichlet}, and \code{logistic_normal}
#' can be used to model responses representing rates or probabilities.}
#'
#' \item{Family \code{asym_laplace} allows for quantile regression when fixing
#' the auxiliary \code{quantile} parameter to the quantile of interest.}
Expand Down Expand Up @@ -147,6 +148,8 @@
#' \item{Families \code{lognormal} and \code{hurdle_lognormal}
#' support \code{identity} and \code{inverse}.}
#'
#' \item{Family \code{logistic_normal} supports \code{identity}.}
#'
#' \item{Family \code{inverse.gaussian} supports \code{1/mu^2},
#' \code{inverse}, \code{identity}, \code{log}, and \code{softplus}.}
#'
Expand Down Expand Up @@ -291,7 +294,8 @@ brmsfamily <- function(family, link = NULL, link_sigma = "log",
if (!has_joint_link(out$family)) {
out$refcat <- NA
} else if (!is.null(refcat)) {
out$refcat <- as_one_character(refcat, allow_na = TRUE)
allow_na_ref <- !is_logistic_normal(out$family)
out$refcat <- as_one_character(refcat, allow_na = allow_na_ref)
}
}
if (is_cox(out$family)) {
Expand Down Expand Up @@ -633,6 +637,14 @@ dirichlet2 <- function(link = "log") {
.brmsfamily("dirichlet2", link = link, slink = slink, refcat = NA)
}

#' @rdname brmsfamily
#' @export
logistic_normal <- function(link = "identity", refcat = NULL) {
# TODO: allow to pass and store 'link_sigma' as well
slink <- substitute(link)
.brmsfamily("logistic_normal", link = link, slink = slink, refcat = refcat)
}

#' @rdname brmsfamily
#' @export
von_mises <- function(link = "tan_half", link_kappa = "log") {
Expand Down
18 changes: 12 additions & 6 deletions man/brmsfamily.Rd

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

0 comments on commit cddbf13

Please sign in to comment.