dlambda: Posterior density function of the lambda parameter.

Description Usage Arguments Details Value References See Also Examples

Description

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.

Usage

1
2
3
dlambda(lambda, nMNO, nReg, fu, fv, flambda, relTol = 1e-06, nSim = 1000,
  nStrata = c(1, 100), verbose = FALSE,
  nThreads = RcppParallel::defaultNumThreads())

Arguments

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 kummer function. Default value is 1e-6

nSim

number of two-dimensional points to generate to compute the integral. Default value is 1e3

nStrata

integer vector of length 2 with the number of strata in each dimension. Default value is c(1, 1e2)

verbose

logical (default FALSE) to report progress of the computation

nThreads

number (default the number of all cores, including logical cores) to use for computation

Details

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:

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.

Value

dlambda returns a data.table with the values of the density function (column probLambda) for each value of lambda together with additional variables:

References

https://github.com/MobilePhoneESSnetBigData

See Also

genUV, Phi for related functions.

Examples

 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))

MobilePhoneESSnetBigData/pestim documentation built on May 31, 2019, 2:44 p.m.