weighted.pc: Weighted Pearson Correlation (WPC) based on bivariate...

View source: R/bzinb.R

weighted.pcR Documentation

Weighted Pearson Correlation (WPC) based on bivariate zero-inflated negative binomial (BZINB) model

Description

weighted.pc calculates Pearson's correlation with less weights for pairs containing zero(s). The weights are determined by BZINB model.

Usage

weighted.pc(xvec, yvec, param = NULL, ...)

Arguments

xvec, yvec

a pair of bzinb random vectors. nonnegative integer vectors. If not integers, they will be rounded to the nearest integers.

param

a vector of parameters ((a0, a1, a2, b1, b2, p1, p2, p3, p4)). See bzinb for details. If param is null, it will be estimated by bzinb().

...

optional arguments used passed to bzinb, when param is null.

Value

weighted Pearson correlation (WPC) estimate

Author(s)

Hunyong Cho, Chuwen Liu, Jinyoung Park, and Di Wu

References

Cho, H., Preisser, J., Liu, C., and Wu, D. (In preparation), "A bivariate zero-inflated negative binomial model for identifying underlying dependence"

Examples

# generating a pair of random vectors
set.seed(2)
data1 <- rbzinb(n = 20, a0 = 1, a1 = 1, a2 = 1, 
                b1 = 1, b2 = 1, p1 = 0.5, p2 = 0.2, 
                p3 = 0.2, p4 = 0.1)

weighted.pc(xvec = data1[,1], yvec = data1[,2], 
            param = c(0.769, 0.041, 0.075, 3.225, 1.902, 0.5, 0.084, 1e-20, 0.416))
weighted.pc(xvec = data1[,1], yvec = data1[,2])


bzinb documentation built on May 29, 2024, 9:41 a.m.