twCoefLogitnorm

Share:

Description

Estimating coefficients of logitnormal distribution from median and upper quantile

Usage

1
2
3
4
5
6
7
twCoefLogitnorm(median, quant, perc = 0.975, method = "BFGS", 


    theta0 = c(mu = 0, sigma = 1), returnDetails = FALSE, 


    ...)

Arguments

median

numeric vector: the median of the density function

quant

numeric vector: the upper quantile value

perc

numeric vector: the probability for which the quantile was specified

method

method of optimization (see optim)

theta0

starting parameters

returnDetails

if TRUE, the full output of optim is attached as attributes resOptim

...

Value

numeric matrix with columns c("mu","sigma")

rows correspond to rows in median, quant, and perc

Author(s)

Thomas Wutzler

See Also

logitnorm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# estimate the parameters, with median at 0.7 and upper quantile at 0.9


(theta <- twCoefLogitnorm(0.7,0.9))





x <- seq(0,1,length.out=41)[-c(1,41)]	# plotting grid


px <- plogitnorm(x,mu=theta[1],sigma=theta[2])	#percentiles function


plot(px~x); abline(v=c(0.7,0.9),col="gray"); abline(h=c(0.5,0.975),col="gray")





dx <- dlogitnorm(x,mu=theta[1],sigma=theta[2])	#density function


plot(dx~x); abline(v=c(0.7,0.9),col="gray")





# vectorized


(theta <- twCoefLogitnorm(seq(0.4,0.8,by=0.1),0.9))