twCoefLogitnormE: twCoefLogitnormE

Description Usage Arguments Value Author(s) See Also Examples

View source: R/logitnorm.R

Description

Estimating coefficients of logitnormal distribution from expected value, i.e. mean, and upper quantile.

Usage

1
2
3
twCoefLogitnormE(mean, quant, perc = c(0.975), 
    method = "BFGS", theta0 = c(mu = 0, sigma = 1), 
    returnDetails = FALSE, ...)

Arguments

mean

the expected value of the density function

quant

the quantile values

perc

the probabilities for which the quantiles were specified

method

method of optimization (see optim)

theta0

starting parameters

returnDetails

if TRUE, the full output of optim is returned with attribute resOptim

...

Value

named numeric matrix with estimated parameters of the logitnormal distribution. colnames: c("mu","sigma")

Author(s)

Thomas Wutzler

See Also

logitnorm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# estimate the parameters
(thetaE <- twCoefLogitnormE(0.7,0.9))

x <- seq(0,1,length.out = 41)[-c(1,41)]	# plotting grid
px <- plogitnorm(x,mu = thetaE[1],sigma = thetaE[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 = thetaE[1],sigma = thetaE[2])	#density function
plot(dx~x); abline(v = c(0.7,0.9),col = "gray")

z <- rlogitnorm(1e5, mu = thetaE[1],sigma = thetaE[2])
mean(z)	# about 0.7

# vectorized
(theta <- twCoefLogitnormE(mean = seq(0.4,0.8,by = 0.1),quant = 0.9))

logitnorm documentation built on Jan. 7, 2021, 9:09 a.m.