biLGP {RMKdiscrete}R Documentation

The bivariate Lagrangian Poisson (LGP) distribution

Description

Density, random-number generation, and moments of the log-transformed distribution.

Usage

dbiLGP(y, theta, lambda, nc=NULL, log=FALSE, add.carefully=FALSE)
biLGP.logMV(theta,lambda,nc=NULL,const.add=1,tol=1e-14,add.carefully=FALSE)
rbiLGP(n, theta, lambda)

Arguments

y

Numeric vector or two-column matrix of bivariate data. If matrix, each row corresponds to an observation.

theta

Numeric vector or three-column matrix of non-negative values for index parameters θ0\theta _0, θ1\theta _1, and θ2\theta _2, in that order. If matrix, is read by row.

lambda

Numeric vector or three-column matrix of values for multiplicative parameters λ0\lambda _0, λ1\lambda _1, and λ2\lambda _2, in that order. If matrix, is read by row. Values must be on the interval [-1,1].

nc

Numeric vector or three-column matrix of (reciprocals of) the normalizing constants. These constants differ from 1 only if the corresponding lambda parameter is negative; see dLGP() for details. If matrix, is read by row. Defaults to NULL, in which case the normalizing constants are computed automatically.

log

Logical; should the natural log of the probability be returned? Defaults to FALSE.

add.carefully

Logical. If TRUE, the program takes extra steps to try to prevent round-off error during the addition of probabilities. Defaults to FALSE, which is recommended, since using TRUE is slower and rarely makes a noticeable difference in practice.

const.add

Numeric vector of positive constants to add to the non-negative integers before taking their natural logarithm. Defaults to 1, for the typical log(y+1)\log (y+1) transformation.

tol

Numeric; must be positive. When biLGP.logMV() is calculating the second moment of the log-transformed distribution, it stops when the next term in the series is smaller than tol.

n

Integer; number of observations to be randomly generated.

Details

The bivariate LGP is constructed from three independent latent random variables, X0X_0, X1X_1, and X2X_2, where

X0LGP(θ0,λ0)X_0 \sim LGP(\theta _0, \lambda _0)

X1LGP(θ1,λ1)X_1 \sim LGP(\theta _1, \lambda _1)

X2LGP(θ2,λ2)X_2 \sim LGP(\theta _2, \lambda _2)

The observable variables, Y1Y_1 and Y2Y_2, are defined as Y1=X0+X1Y_1 = X_0 + X_1 and Y2=X0+X2Y_2 = X_0 + X_2, and thus the dependence between Y1Y_1 and Y2Y_2 arises because of the common term X0X_0. The joint PMF of Y1Y_1 and Y2Y_2 is derived from the joint PMF of the three independent latent variables, with X1X_1 and X2X_2 re-expressed as Y1X0Y_1 - X_0 and Y2X0Y_2 - X_0, and after X0X_0 is marginalized out.

Function dbiLGP() is the bivariate LGP density (PMF). Function rbiLGP() generates random draws from the bivariate LGP distribution, via calls to rLGP(). Function biLGP.logMV() numerically computes the means, variances, and covariance of a bivariate LGP distribution, after it has been log transformed following addition of a positive constant.

Vectors of numeric arguments other than tol are cycled, whereas only the first element of logical and integer arguments is used.

Value

dbiLGP() returns a numeric vector of probabilities. rbiLGP() returns a matrix of random draws, which is of type 'numeric' (rather than 'integer', even though the bivariate LGP only has support on the non-negative integers). biLGP.logMV() returns a numeric matrix with the following five named columns:

  1. EY1: Post-tranformation expectation of Y1Y_1.

  2. EY2: Post-tranformation expectation of Y2Y_2.

  3. VY1: Post-tranformation variance of Y1Y_1.

  4. VY2: Post-tranformation variance of Y2Y_2.

  5. COV: Post-tranformation covariance of Y1Y_1 and Y2Y_2.

Author(s)

Robert M. Kirkpatrick rkirkpatrick2@vcu.edu

References

Famoye, F., & Consul, P. C. (1995). Bivariate generalized Poisson distribution with some applications. Metrika, 42, 127-138.

Consul, P. C., & Famoye, F. (2006). Lagrangian Probability Distributions. Boston: Birkhauser.

See Also

LGP, dpois()

Examples

## The following two lines do the same thing:
dbiLGP(y=1,theta=1,lambda=0.1)
dbiLGP(y=c(1,1),theta=c(1,1,1),lambda=c(0.1,0.1,0.1))

dbiLGP(y=c(1,1,2,2,3,5),theta=c(1,1,1,2,2,2),lambda=0.1)
## Due to argument cycling, the above line is doing the following three steps:
dbiLGP(y=c(1,1),theta=c(1,1,1),lambda=c(0.1,0.1,0.1))
dbiLGP(y=c(2,2),theta=c(2,2,2),lambda=c(0.1,0.1,0.1))
dbiLGP(y=c(3,5),theta=c(1,1,1),lambda=c(0.1,0.1,0.1))

## Inputs to dbiLGP() can be matrices, too:
dbiLGP(y=matrix(c(1,1,2,2,3,5),ncol=2,byrow=TRUE),
  theta=matrix(c(1,1,1,2,2,2,1,1,1),ncol=3,byrow=TRUE),
  lambda=0.1)

## theta0 = 0 implies independence:
a <- dbiLGP(y=c(1,3),theta=c(0,1,2),lambda=c(0.1,-0.1,0.5))
b <- dLGP(x=1,theta=1,lambda=-0.1) * dLGP(x=3,theta=2,lambda=0.5)
a-b #<--near zero.
## lambdas of zero yield the ordinary Poisson:
a <- dbiLGP(y=c(1,3), theta=c(0,1,2),lambda=0)
b <- dpois(x=1,lambda=1) * dpois(x=3,lambda=2) #<--LGP theta is pois lambda
a-b #<--near zero

( y <- rbiLGP(10,theta=c(1.1,0.87,5.5),lambda=c(0.87,0.89,0.90)) )
dbiLGP(y=y,theta=c(1.1,0.87,5.5),lambda=c(0.87,0.89,0.90))

biLGP.logMV(theta=c(0.65,0.35,0.35),lambda=0.7,tol=1e-8)

[Package RMKdiscrete version 0.2 Index]