I am generating a matrix of probabilities from a bivariate gaussian copula with poisson marginals. I can't figure out why probabilities doesn't add to 1 but to slightly more. Here is the code:
library(copula) cop<-normalCopula(param = 0.92, dim = 2) mv <- mvdc(cop, c("pois", "pois"),list(list(lambda = 6), list(lambda = 4))) m <- matrix(NA,50,50) for (i in 0:49) { for (j in 0:49) { m[i+1,j+1]=dMvdc(c(i,j),mv) } } sum(m) [1] 1.048643
EDIT: It seems that this problem is present only when the param
parameter (the correlation) is different from 0.
1 Answers
Answers 1
This is what dMvdc
does:
Here is the density of your copula, are the probability densities of your choice (in this case dpois
), and are the corresponding cdf's (in this case ppois
).
For this to represent a valid probability distribution, i.e. to integrate to 1, you need to be able to do the final substitution below, which requires continuous probability distributions:
If you use discrete pdf's (via Dirac deltas):
the above will generally fail:
which is what you observed.
The 0 correlation case works accidentally, because in that case is simply the identity function:
dCopula(c(runif(1), runif(1)), normalCopula(0)) #[1] 1
I'm not sure if the copula can be normalized appropriately to salvage the non-zero correlation case.
0 comments:
Post a Comment