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 |
lambda |
Numeric vector or three-column matrix of values for multiplicative parameters |
nc |
Numeric vector or three-column matrix of (reciprocals of) the normalizing constants. These constants differ from 1 only if the corresponding |
log |
Logical; should the natural log of the probability be returned? Defaults to |
add.carefully |
Logical. If |
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 |
tol |
Numeric; must be positive. When |
n |
Integer; number of observations to be randomly generated. |
Details
The bivariate LGP is constructed from three independent latent random variables, X_0
, X_1
, and X_2
, where
X_0 \sim LGP(\theta _0, \lambda _0)
X_1 \sim LGP(\theta _1, \lambda _1)
X_2 \sim LGP(\theta _2, \lambda _2)
The observable variables, Y_1
and Y_2
, are defined as Y_1 = X_0 + X_1
and Y_2 = X_0 + X_2
, and thus the dependence between Y_1
and Y_2
arises because of the common term X_0
. The joint PMF of Y_1
and Y_2
is derived from the joint PMF of the three independent latent variables, with X_1
and X_2
re-expressed as Y_1 - X_0
and Y_2 - X_0
, and after X_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:
-
EY1
: Post-tranformation expectation ofY_1
. -
EY2
: Post-tranformation expectation ofY_2
. -
VY1
: Post-tranformation variance ofY_1
. -
VY2
: Post-tranformation variance ofY_2
. -
COV
: Post-tranformation covariance ofY_1
andY_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
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)