Description Usage Arguments Details Value References See Also Examples
Compute the unnormalized posterior density function of the parameter λ in the hierarchical model to estimate population counts given by
f(λ\big | N^{\textrm{MNO}}; N^{\textrm{Nreg}})\propto f(λ)\cdot \textrm{dpois}(N^{\textrm{MNO}}; λ)\cdot S(λ; N^{\textrm{MNO}}, N^{\textrm{Nreg}}),
where dpois
is the probability density function of a Poisson distribution and
S is defined in the bibliographic reference.
1 2 3 |
lambda |
numeric vector |
nMNO, |
nReg non-negative integer vectors with the number of individuals detected in each cell according to the network operator and the register |
fu, |
fv named lists with the prior marginal distributions of the two-dimensional points for the Monte Carlo integration |
flambda |
named list with the prior distribution of the lambda parameter |
relTol |
relative tolerance in the computation of the |
nSim |
number of two-dimensional points to generate to compute the integral. Default value
is |
nStrata |
integer vector of length 2 with the number of strata in each dimension. Default
value is |
verbose |
logical (default |
nThreads |
number (default the number of all cores, including logical cores) to use for computation |
The lengths of the input vectors nMNO
and nReg
must be both equal to 1 and
independent of the length of the input vector lambda
. The integral is computed using with
Monte Carlo techniques using nSim
points for each of the values lambda
specified so
that the final data.table has length(lambda)
rows.
The prior distributions are specified as named lists where the first component of each list must be the name of distribution ('unif', 'triang', 'degen', 'gamma') and the rest components must be named according to the name of the parameters of the random generator of the corresponding distribution according to:
unif: xMin
, xMax
for the minimum, maximum of the sampled interval.
degen: x0
for the degenerate value of the random variable.
triang: xMin
, xMax
, xMode
for minimum, maximum and mode (see
qtriang
).
gamma: scale
and shape
with the same meaning as in rgamma
.
It is important to know that currently this function accepts only parameters for a single cell at a time. In case of interest for the density function values for a set of cells, the user should program his/her own routine to apply this function to every cell.
dlambda
returns a data.table with the values of the density function
(column probLambda
) for each value of lambda together with additional variables:
The common length of nMNO
and nReg
identifies the number of territorial
cells in which the number of individuals detected by the telecommunication network and
official data. The column cellID
identifies these territorial cells.
The length of lambda
identifies the number of parameters upon which the integral
will be computed in each cell. The column parID
identifies each of these input
parameters.
The inputs nMNO
and nReg
are also included in the output
data.table in columns under the same name.
The value on the integral times the Poisson density function ifalso included under the
column integral
https://github.com/MobilePhoneESSnetBigData
genUV
, Phi
for related functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # This data.table must have 5x3= 15 rows
dlambda(seq(0, 1, length.out = 5),
nMNO = c(20, 17, 25), nReg = c(115, 123, 119),
fu = list('unif', xMin = 0.3, xMax = 0.5), fv = list('gamma', shape = 11, scale = 12),
flambda = list('gamma', shape = 11, scale = 12))
# Easily, a function to draw conditioned on the parameters:
f <- function(x){
dlambda(x, nMNO = 20, nReg = 115,
fu = list('unif', xMin = 0.3, xMax = 0.5), fv = list('unif', xMin = 100, xMax = 120),
flambda = list('gamma', shape = 11, scale = 12))$probLambda
}
curve(f, xlim = c(0, 150))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.