intercorr_pois_nb: Calculate Intermediate MVN Correlation for Poisson - Negative...

Description Usage Arguments Value References See Also

View source: R/intercorr_pois_nb.R

Description

This function calculates a k_pois x k_nb intermediate matrix of correlations for the Poisson and Negative Binomial variables by extending the method of Yahav & Shmueli (2012, doi: 10.1002/asmb.901). The intermediate correlation between Z1 and Z2 (the standard normal variables used to generate the Poisson and Negative Binomial 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 ρ_{Y1, Y2} are simulated. Then the intermediate correlation is found as follows:

ρ_{Z1, Z2} = \frac{1}{b} * log(\frac{ρ_{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 and Negative Binomial variables.

The function is used in intercorr and corrvar and would not ordinarily be called by the user.

Usage

1
2
intercorr_pois_nb(rho_pois_nb = NULL, lam = NULL, p_zip = 0,
  size = NULL, mu = NULL, p_zinb = 0, nrand = 100000, seed = 1234)

Arguments

rho_pois_nb

a k_pois x k_nb matrix of target correlations; order of each type should be 1st regular, 2nd zero-inflated

lam

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

p_zip

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)

size

a vector of size parameters for the Negative Binomial variables (see stats::dnbinom); the order should be 1st regular NB variables, 2nd zero-inflated NB variables

mu

a vector of mean parameters for the NB variables (*Note: either prob or mu should be supplied for all Negative Binomial variables, not a mixture; default = NULL); order the same as in size; for zero-inflated NB this refers to the mean of the NB distribution (see VGAM::dzinegbin)

p_zinb

a vector of probabilities of structural zeros (not including zeros from the NB distribution) for the zero-inflated NB variables (see VGAM::dzinegbin); if p_zinb = 0, Y_{nb} has a regular NB distribution; if p_zinb is in (-prob^size/(1 - prob^size), 0), Y_{nb} has a zero-deflated NB distribution and p_zinb is not a probability; if p_zinb = -prob^size/(1 - prob^size), Y_{nb} has a positive-NB distribution (see VGAM::dposnegbin); if length(p_zinb) < length(size), the missing values are set to 0 (and ordered 1st)

nrand

the number of random numbers to generate in calculating the bound (default = 10000)

seed

the seed used in random number generation (default = 1234)

Value

the k_pois x k_nb intermediate correlation matrix whose rows represent the k_pois Poisson variables and columns represent the k_nb Negative Binomial variables

References

Please see references for intercorr_pois.

See Also

intercorr_pois, intercorr_nb, intercorr, corrvar


SimCorrMix documentation built on May 2, 2019, 1:24 p.m.