Description Usage Arguments Value Author(s) Examples
Logit-Normal distribution is characterized by the following probability density function,
f(x;μ, σ) = \frac{1}{σ √{2π}} \frac{1}{x(1-x)} \exp ≤ft\lbrace - \frac{(\textrm{logit}(x)-μ)^2}{2σ^2} \right\rbrace
where the domain is x \in \mathbf{R} with parameters for location μ \in \mathbf{R} and dispersion σ^2 \in (0,∞). \textrm{logit}(x) is a logit function, i.e., \textrm{logit}(x) = \log(x/(1-x)).
1 | LogitNormal(x, weight = NULL)
|
x |
a length-n vector of values in (0,1). |
weight |
a length-n weight vector. If set as |
a named list containing (weighted) MLE of
location μ.
standard deviation σ.
Kisung You
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 35 36 37 38 39 40 | # generate data from Unif(0,1)
x = stats::runif(100)
# fit unweighted
LogitNormal(x)
## Not run:
# put random weights to see effect of weights
niter = 1000
ndata = 200
# generate data as above and fit unweighted MLE
x = stats::runif(ndata)
xmle = LogitNormal(x)
# iterate
vec.mu = rep(0,niter)
vec.sig = rep(0,niter)
for (i in 1:niter){
# random weight
ww = abs(stats::rnorm(ndata))
MLE = LogitNormal(x, weight=ww)
vec.mu[i] = MLE$mu
vec.sig[i] = MLE$sigma
if ((i%%10) == 0){
print(paste0(" iteration ",i,"/",niter," complete.."))
}
}
# distribution of weighted estimates + standard MLE
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
hist(vec.mu, main="location 'mu'")
abline(v=xmle$mu, lwd=3, col="red")
hist(vec.sig, main="dispersion 'sigma'")
abline(v=xmle$sigma, lwd=3, col="blue")
par(opar)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.