vmgeom {vismeteor} | R Documentation |
Visual magnitude distribution of geometric distributed meteor magnitudes
Description
Density, distribution function, quantile function and random generation for the visual magnitude distribution of geometric distributed meteor magnitudes.
Usage
dvmgeom(m, lm, r, log = FALSE, perception.fun = NULL)
pvmgeom(m, lm, r, lower.tail = TRUE, log = FALSE, perception.fun = NULL)
qvmgeom(p, lm, r, lower.tail = TRUE, perception.fun = NULL)
rvmgeom(n, lm, r, perception.fun = NULL)
Arguments
m |
numeric; the meteor magnitude. |
lm |
numeric; limiting magnitude. |
r |
numeric; the population index. It is the only parameter of the distribution. |
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. |
Details
In visual meteor observation, it is common to estimate meteor magnitudes in integer values. Hence, this distribution is discrete and has the density
{\displaystyle P[X = x] \sim f(x) \, \mathrm r^{-x}} \,\mathrm{,}
where x \ge -0.5
is the difference between the limiting magnitude lm
and the meteor magnitude m
and f(x)
is the perception probability function.
This distribution is thus a product of the
perception probabilities and the
actual geometric distribution of the meteor magnitudes.
Therefore, the parameter p
of the geometric distribution is p = 1 - 1/r
.
The parameter lm
indicate what the parameter m
refers to.
m
must be an integer meteor magnitude.
The length of the vector lm
must then be equal to the length of the vector m
or lm
is a scalar value.
In case of rvmgeom
, the length of the vector lm
must be n
or lm
is a scalar value.
If the perception probabilities function perception.fun
is given,
it must have the signature function(x)
and must return the perception probabilities of
the difference x
between the limiting magnitude and the meteor magnitude.
If x >= 15.0
, the perception.fun
function should return the perception probability of 1.0
.
If log = TRUE
is given, the logarithm value of the perception probabilities
must be returned. perception.fun
is resolved using match.fun.
Value
dvmgeom
gives the density, pvmgeom
gives the distribution function,
qvmgeom
gives the quantile function, and rvmgeom
generates random deviates.
The length of the result is determined by n
for rvmgeom
, and is the maximum
of the lengths of the numerical vector arguments for the other functions.
Since the distribution is discrete, qvmgeom
and rvmgeom
always return integer values.
qvmgeom
can return NaN
value with a warning.
See Also
Examples
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))