Package 'mcmapper'

Title: Mapping First Moment and C-Statistic to the Parameters of Distributions for Risk
Description: Provides a series of numerical methods for extracting parameters of distributions for risks based on knowing the expected value and c-statistics (e.g., from a published report on the performance of a risk prediction model). This package implements the methodology described in Sadatsafavi et al (2024) <doi:10.48550/arXiv.2409.09178>. The core of the package is mcmap(), which takes a pair of (mean, c-statistic) and the distribution type requested. This function provides a generic interface to more customized functions (mcmap_beta(), mcmap_logitnorm(), mcmap_probitnorm()) for specific distributions.
Authors: Mohsen Sadatsafavi [aut, cre]
Maintainer: Mohsen Sadatsafavi <[email protected]>
License: MIT + file LICENSE
Version: 0.0.11
Built: 2024-11-05 06:50:55 UTC
Source: CRAN

Help Index


Functions related to logit-normal distribution.

Description

Functions related to logit-normal distribution.

Usage

rlogitnorm(n, mu, sigma)

dlogitnorm(x, mu, sigma)

plogitnorm(x, mu, sigma)

qlogitnorm(x, mu, sigma)

Arguments

n

Number of draws requested (for rlogitnorm)

mu

Mean of the logit-transformed variable

sigma

SD of the logit-transformed variable

x

For density, CDF, and quantile functions

Value

Depends on the function


The main mapper function

Description

Maps a pair of mean and c-statistic value to the parameters of a specified distribution for risk

Usage

mcmap(target, type = c("beta", "logitnorm", "probitnorm"))

Arguments

target

A vector of size 2. The first element is mean and the second element is c-statistic.

type

One of "beta", "logitnorm", "probitnorm". Loosy matching is enabled (so "b" will be mapped to "beta").

Value

An object of class mcmapper. The "value" component returns the parameter. Any warning or error from the integration or gradient ascent will also be returned in the "info" component.

Examples

mcmap(c(0.1, 0.75), "beta")

Mapper function for beta distribution

Description

Maps a pair of mean and c-statistic value to the parameters of a beta distribution

Usage

mcmap_beta(
  target,
  method = "",
  integrate_controls = list(),
  optim_controls = list()
)

Arguments

target

A vector of size 2. The first element is mean and the second element is c-statistic.

method

Not implemented for this funciton yet; leave as empty string.

integrate_controls

(optional): parameters to be passed to integrate()

optim_controls

(optional): parameters to be passed to optim()

Value

A vector of size two that contains the distribution parameters

Examples

mcmap_beta(c(0.1, 0.75))

A generic mapper function

Description

Maps a pair of mean and c-statistic value to the parameters of an unspecified distribution that is indexed by two parameters

Usage

mcmap_generic(
  target,
  CDF,
  integrate_controls = list(),
  optim_controls = list()
)

Arguments

target

A vector of size 2. The first element is mean and the second element is c-statistic.

CDF

Cumulative distribution function of an unnspecified distribution. The CDF must be indexed by two parameters.

integrate_controls

(optional): parameters to be passed to integrate()

optim_controls

(optional): parameters to be passed to optim()

Value

A vector of size two that contains the distribution parameters

Examples

mcmap_generic(c(0.1, 0.75), pbeta)

Mapper function for logit-normal distribution

Description

Maps a pair of mean and c-statistic value to the parameters of a logit-normal distribution

Usage

mcmap_logitnorm(
  target = c(m = 0.25, c = 0.75),
  method = "",
  integrate_controls = list(),
  optim_controls = list()
)

Arguments

target

A vector of size 2. The first element is mean and the second element is c-statistic.

method

Either empty string, which invoked the default method; or "meansolve" which uses two 1-dimensional optimization approach.

integrate_controls

(optional): parameters to be passed to integrate()

optim_controls

(optional): parameters to be passed to optim()

Value

A vector of size two that contains the distribution parameters

Examples

mcmap_logitnorm(c(0.1, 0.75))

Mapper function for probit-normal distribution

Description

Maps a pair of mean and c-statistic value to the parameters of a pobit-normal distribution

Usage

mcmap_probitnorm(
  target = c(m = 0.25, c = 0.75),
  method = "",
  integrate_controls = list(),
  optim_controls = list()
)

Arguments

target

A vector of size 2. The first element is mean and the second element is c-statistic.

method

Fir compatibilty with other functions. Use "" for now (alternative optimization methods might be implemented in the future)

integrate_controls

(optional): parameters to be passed to integrate()

optim_controls

(optional): parameters to be passed to optim()

Value

A vector of size two that contains the distribution parameters

Examples

mcmap_probitnorm(c(0.1, 0.75))

Functions related to probit-normal distribution.

Description

Functions related to probit-normal distribution.

Usage

dprobitnorm(x, mu, sigma)

pprobitnorm(x, mu, sigma)

rprobitnorm(n, mu, sigma)

qprobitnorm(x, mu, sigma)

Arguments

x

For density, CDF, and quantile functions

mu

Mean of the probit-transformed variable

sigma

SD of the probit-transformed variable

n

Number of draws requested (for rprobitnorm)

Value

Depends on the function