Learn R Programming

BNSP (version 2.0.2)

dnorm.pois: Bivariate Normal-Poisson distribution

Description

Normal-Poisson probability density function.

Usage

dnorm.pois(x,y,mu,Sigma,rate,E)

Arguments

x

Real valued sample from a univariate Normal distribution.

y

Integer valued sample from a univariate Poisson distribution.

mu

Two-dimentional vector with means, denoted as \(\mu\) below.

Sigma

Two-by-two covariance matrix, denoted as \(\Sigma\) below.

rate

Mean of the Poisson variable, denoted as \(\lambda\) below.

E

Offset term, denoted as \(E\) below.

Value

Function dnorm.pois returns the joint probability density function of correlated Normal and Poisson random variables $$ f(x,y|\theta) = \int_{c_{y-1}}^{c_{y}} N(x,y^{*}|\mu,\Sigma) dy^{*},$$ where \(y^*\) denotes a continuous random variable that determines the count according to the rule $$Y = y \iff c_{y-1} < y^* < c_{y}.$$ Cut-points \(c_y\) are defined by $$c_{y} = \Phi^{-1}(F(y;E\lambda)),$$ where \(\Phi()\) is the Normal cdf, \(F()\) the Poisson cdf, \(E\) denotes an offset term and \(\lambda\) is the mean of the Poisson. Further, \(\mu\) and \(\Sigma\) denote the mean vector and covariance matrix of \((x,y^{*})\).

The integral is evaluated using the univariate Normal cdf $$ f(y,x|\theta) = N(x|\mu_{1},\sqrt\Sigma_{11})\{\Phi(\frac{c_y-E(y^*|x)}{sd(y^*|x)})-\Phi(\frac{c_{y-1}-E(y^*|x)}{sd(y^*|x)})\},$$ where \(E(y^*|x) = \mu_{2}+\Sigma_{12}(x-\mu_1)/\Sigma_{11}\) and \(sd(y^*|x) = \sqrt{\Sigma_{22}-\Sigma_{12}^2 / \Sigma_{11}}\).

Examples

Run this code
# NOT RUN {
#When the covariance matrix is diagonal dnorm.pois is equal to the product of dnorm and dpois
mu<-c(0,0)
cov.mat<-matrix(c(1,0.0,0.0,1),ncol=2,nrow=2)
dnorm.pois(0,5,mu=mu,Sigma=cov.mat,rate=3,E=2)
dnorm(0,0,1)*dpois(5,6)
#Otherwise not equal
mu<-c(0,0)
cov.mat<-matrix(c(1,-0.8,-0.8,1),ncol=2,nrow=2)
dnorm.pois(0,5,mu=mu,Sigma=cov.mat,rate=3,E=2)
# }

Run the code above in your browser using DataLab