est_norm {pedbp} | R Documentation |
With at least two quantile values find the mean and standard deviation of a normal distribution to match up with empirical values provided.
est_norm(q, p, weights = rep(1, length(p)), ...)
q |
quantile values. |
p |
probabilities corresponding to the |
weights |
relative weight of each quantile. The higher the weight the better the approximated distribution will be at fitting that quantile. |
... |
passed to |
For X ~ N(mu, sigma), Pr[X <= q] = p
Given the set of quantiles and probabilities, est_norm
uses
optim
to find the preferable mean and standard deviation
of a normal distribution to fit the provided quantiles.
Use the weight
argument to emphasize which, if any, of the provided
quantiles needs to be approximated closer than others. By default all the
quantiles are weighted equally.
a pedbp_est_norm
object. This is a list with elements:
para named numeric vector with the mean and standard deviation for a Gaussian distribution
qpa numeric matrix with two columns built from the input values of
q
and p
weightsthe weights
used
callThe call made
optimresult from calling optim
# Example 1
q <- c(-1.92, 0.1, 1.89) * 1.8 + 3.14
p <- c(0.025, 0.50, 0.975)
x <- est_norm(q, p)
str(x)
x
plot(x)
# Example 2 -- build with quantiles that are easy to see unlikely to be from
# a Normal distribuiton
q <- c(-1.92, 0.05, 0.1, 1.89) * 1.8 + 3.14
p <- c(0.025, 0.40, 0.50, 0.975)
# with equal weights
x <- est_norm(q, p)
x
plot(x)
# weight to ignore one of the middle value and make sure to hit the other
x <- est_norm(q, p, weights = c(1, 2, 0, 1))
x
plot(x)
# equal weight the middle, more than the tails
x <- est_norm(q, p, weights = c(1, 2, 2, 1))
x
plot(x)