Learn R Programming

epiparameter (version 0.4.1)

epiparameter_distribution_functions: PDF, CDF, PMF, quantiles and random number generation for <epiparameter> objects

Description

The <epiparameter> object holds a probability distribution which can either be a continuous or discrete distribution. These are the density, cumulative distribution, quantile and random number generation functions. These operate on any distribution that can be included in an <epiparameter> object.

Usage

# S3 method for epiparameter
density(x, at, ...)

# S3 method for epiparameter cdf(x, q, ..., log = FALSE)

# S3 method for epiparameter quantile(x, p, ...)

# S3 method for epiparameter generate(x, times, ...)

Value

numeric vector.

Arguments

x

An <epiparameter> object.

at

The quantiles to evaluate at.

...

dots Extra arguments to be passed to the method.

q

The quantiles to evaluate at.

log

If TRUE, probabilities will be given as log probabilities.

p

The probabilities to evaluate at.

times

The number of random samples.

Examples

Run this code
ep <- epiparameter(
  disease = "ebola",
  epi_name = "incubation_period",
  prob_distribution = create_prob_distribution(
    prob_distribution = "gamma",
    prob_distribution_params = c(shape = 1, scale = 1)
  )
)

# example of each distribution method for an `epiparameter` object
stats::density(ep, at = 1)
distributional::cdf(ep, q = 1)
stats::quantile(ep, p = 0.2)
distributional::generate(ep, times = 10)

Run the code above in your browser using DataLab