family.epiparameter: Family method for the <epiparameter> class

View source: R/epiparameter.R

family.epiparameterR Documentation

Family method for the ⁠<epiparameter>⁠ class

Description

The family() function is used to extract the distribution names from objects from {distributional} and {distcrete}. This method provides the same interface for ⁠<epiparameter>⁠ objects to give consistent output irrespective of the internal distribution class.

Usage

## S3 method for class 'epiparameter'
family(object, ..., base_dist = FALSE)

Arguments

object

An ⁠<epiparameter>⁠ object.

...

further arguments passed to methods.

base_dist

A boolean logical for whether to return the name of a transformed distribution (e.g. "mixture" or "truncated") or the underlying distribution type (e.g. "gamma" or "lnorm"). Default is FALSE.

Value

A character string with the name of the distribution, or NA when the ⁠<epiparameter>⁠ object is unparameterised.

Examples

# example with continuous distribution
ep <- epiparameter(
  disease = "ebola",
  epi_name = "incubation_period",
  prob_distribution = create_prob_distribution(
    prob_distribution = "gamma",
    prob_distribution_params = c(shape = 1, scale = 1)
  )
)
family(ep)

# example with discretised distribution
ep <- epiparameter(
  disease = "ebola",
  epi_name = "incubation_period",
  prob_distribution = create_prob_distribution(
    prob_distribution = "lnorm",
    prob_distribution_params = c(meanlog = 1, sdlog = 1),
    discretise = TRUE
  )
)
family(ep)

epiparameter documentation built on April 3, 2025, 5:50 p.m.