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 = 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)
m |
numeric; 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 usually estimated as integer values. Hence, this distribution is discrete and its probability mass function is
{\displaystyle P[X = x] \sim f(x) \, \mathrm r^{-x}} \,\mathrm{,}
where x \ge -0.5
denotes the difference between the limiting magnitude lm
and the meteor magnitude m
, and f(x)
is 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 reference 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 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
.
If log = TRUE
is specified, the logarithm of the perception probabilities
must be returned.
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.
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.