a2p: Convert probability parameters to probabilities

Description Usage Arguments Value Examples

View source: R/duration.R

Description

mphcrm parametrizes the probabilities that it optimizes. For n+1 probabilities there are n parameters a_j, such that probability P_i = \frac{a_i}{∑_j \exp(a_j)}, where we assume that a_0 = 0.

Usage

1
2
3
a2p(a)

p2a(p)

Arguments

a

a vector of parameters

p

a vector of probabilities with sum(p) = 1

Value

a2p returns a vector probabilities with sum 1.

p2a returns a vector of parameters.

Examples

1
2
3
4
5
6
7
8
# Draw 5 parameters
a <- rnorm(5)
a
# make 6 probabilities
p <- a2p(a)
p
# convert back
p2a(p)

durmod documentation built on March 31, 2020, 5:23 p.m.