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, ,
, and
, where
The observable variables, and
, are defined as
and
, and thus the dependence between
and
arises because of the common term
. The joint PMF of
and
is derived from the joint PMF of the three independent latent variables, with
and
re-expressed as
and
, and after
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 of.
-
EY2
: Post-tranformation expectation of.
-
VY1
: Post-tranformation variance of.
-
VY2
: Post-tranformation variance of.
-
COV
: Post-tranformation covariance ofand
.
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)