| vmgeom | R Documentation |
Density, distribution function, quantile function, and random generation for the geometric model of visual meteor magnitudes.
dvmgeom(m, lm, r, log = FALSE, perception_fun = vmperception)
pvmgeom(
m,
lm,
r,
lower.tail = TRUE,
log = FALSE,
perception_fun = vmperception
)
qvmgeom(p, lm, r, lower.tail = TRUE, perception_fun = vmperception)
rvmgeom(n, lm, r, perception_fun = vmperception)
m |
integer; the meteor magnitude. |
lm |
numeric; limiting magnitude. |
r |
numeric; the population index. |
log |
logical; if |
perception_fun |
function; perception probability function (optional). Default is vmperception. |
lower.tail |
logical; if |
p |
numeric; probability. |
n |
numeric; count of meteor magnitudes. |
In visual meteor observations, magnitudes are estimated as integer values. Consequently, the distribution of observed magnitudes is discrete, and its probability mass function is given by
P[M = m] \sim
\begin{cases}
f(m_{\mathrm{lim}} - m)\, r^m, & \text{if } m_{\mathrm{lim}} - m > -0.5,\\[5pt]
0 & \text{otherwise,}
\end{cases}
where m_{\mathrm{lim}} denotes the limiting (non-integer) magnitude of the observation,
and m the integer meteor magnitude.
The function f(\cdot) denotes the perception probability function.
Thus, the distribution is the product of the perception probabilities and the
underlying geometric distribution of meteor magnitudes.
Therefore, the parameter p of the geometric distribution is given by p = 1 - 1/r.
The parameter lm specifies the limiting magnitude for the meteor magnitude m.
m must be an integer meteor magnitude.
The length of the vector lm must either equal the length of the vector m,
or lm must be a scalar value.
In the case of rvmgeom, the length of the vector lm must equal n,
or lm must be a scalar value.
If a different perception probability function perception_fun is provided,
it must have the signature function(x) and return the perception probability of
the difference x between the limiting magnitude and the meteor magnitude.
If x >= 15.0, the function perception_fun should return a perception probability of 1.0.
The argument perception_fun is resolved using match.fun.
dvmgeom: density
pvmgeom: distribution function
qvmgeom: quantile function
rvmgeom: random generation
The length of the result is determined by n for rvmgeom, and by the maximum
of the lengths of the numeric vector arguments for the other functions.
All arguments are vectorized; standard R recycling rules apply.
Since the distribution is discrete, qvmgeom and rvmgeom always return integer values.
qvmgeom may return NaN with a warning.
vmperception stats::Geometric
N <- 100
r <- 2.0
limmag <- 6.5
(m <- seq(6, -7))
# discrete density of `N` meteor magnitudes
(freq <- round(N * dvmgeom(m, limmag, r)))
# log likelihood function
lld <- function(r) {
-sum(freq * dvmgeom(m, limmag, r, log = TRUE))
}
# maximum likelihood estimation (MLE) of r
est <- optim(2, lld, method = "Brent", lower = 1.1, upper = 4)
# estimations
est$par # mean of r
# generate random meteor magnitudes
m <- rvmgeom(N, r, lm = limmag)
# log likelihood function
llr <- function(r) {
-sum(dvmgeom(m, limmag, r, log = TRUE))
}
# maximum likelihood estimation (MLE) of r
est <- optim(2, llr, method = "Brent", lower = 1.1, upper = 4, hessian = TRUE)
# estimations
est$par # mean of r
sqrt(1 / est$hessian[1][1]) # standard deviation of r
m <- seq(6, -4, -1)
p <- vismeteor::dvmgeom(m, limmag, r)
barplot(
p,
names.arg = m,
main = paste0("Density (r = ", r, ", limmag = ", limmag, ")"),
col = "blue",
xlab = "m",
ylab = "p",
border = "blue",
space = 0.5
)
axis(side = 2, at = pretty(p))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.