This function calculates a k_pois x k_pois
intermediate matrix of correlations for the
Poisson variables using the method of Yahav & Shmueli (2012, 10.1002/asmb.901). The intermediate correlation between Z1 and Z2
(the standard normal variables used to generate the Poisson variables Y1 and Y2 via the inverse CDF method) is
calculated using a logarithmic transformation of the target correlation. First, the upper and lower Frechet-Hoeffding bounds
(mincor, maxcor) on \(\rho_{Y1, Y2}\) are simulated. Then the intermediate correlation is found as follows:
$$\rho_{Z1, Z2} = \frac{1}{b} * log(\frac{\rho_{Y1, Y2} - c}{a}),$$
where \(a = -(maxcor * mincor)/(maxcor + mincor)\), \(b = log((maxcor + a)/a)\), and \(c = -a\).
The function adapts code from Amatya & Demirtas' (2016) package PoisNor-package
by:
1) allowing specifications for the number of random variates and the seed for reproducibility
2) providing the following checks: if Sigma_(Z1, Z2)
> 1, Sigma_(Z1, Z2)
is set to 1; if Sigma_(Z1, Z2)
< -1,
Sigma_(Z1, Z2)
is set to -1
3) simulating regular and zero-inflated Poisson variables.
The function is used in intercorr
and corrvar
and would not ordinarily be called by the user.
intercorr_pois(rho_pois = NULL, lam = NULL, p_zip = 0, nrand = 100000,
seed = 1234)
a k_pois x k_pois
matrix of target correlations ordered 1st regular and 2nd zero-inflated
a vector of lambda (mean > 0) constants for the regular and zero-inflated Poisson variables (see stats::dpois
);
the order should be 1st regular Poisson variables, 2nd zero-inflated Poisson variables
a vector of probabilities of structural zeros (not including zeros from the Poisson distribution) for the
zero-inflated Poisson variables (see VGAM::dzipois
); if p_zip
= 0, \(Y_{pois}\) has a regular Poisson
distribution; if p_zip
is in (0, 1), \(Y_{pois}\) has a zero-inflated Poisson distribution;
if p_zip
is in (-(exp(lam) - 1)^(-1), 0)
, \(Y_{pois}\) has a zero-deflated Poisson distribution and p_zip
is not a probability; if p_zip = -(exp(lam) - 1)^(-1)
, \(Y_{pois}\) has a positive-Poisson distribution
(see VGAM::dpospois
); if length(p_zip) < length(lam)
, the missing values are set to 0 (and ordered 1st)
the number of random numbers to generate in calculating the bound (default = 10000)
the seed used in random number generation (default = 1234)
the k_pois x k_pois
intermediate correlation matrix for the Poisson variables
Amatya A & Demirtas H (2015). Simultaneous generation of multivariate mixed data with Poisson and normal marginals. Journal of Statistical Computation and Simulation, 85(15):3129-39. 10.1080/00949655.2014.953534.
Demirtas H & Hedeker D (2011). A practical way for computing approximate lower and upper correlation bounds. American Statistician, 65(2):104-109.
Frechet M (1951). Sur les tableaux de correlation dont les marges sont donnees. Ann. l'Univ. Lyon SectA, 14:53-77.
Hoeffding W. Scale-invariant correlation theory. In: Fisher NI, Sen PK, editors. The collected works of Wassily Hoeffding. New York: Springer-Verlag; 1994. p. 57-107.
Yahav I & Shmueli G (2012). On Generating Multivariate Poisson Data in Management Science Applications. Applied Stochastic Models in Business and Industry, 28(1):91-102. 10.1002/asmb.901.
Yee TW (2018). VGAM: Vector Generalized Linear and Additive Models. R package version 1.0-5. https://CRAN.R-project.org/package=VGAM.