I was trying to generate in R, bivariate sample from a mixture of two component distributions viz., normal and gamma distributions. I used the 'copula' package for that.
The code I wrote is as follows-
library("copula")
mycop=normalCopula(param=c(0),dim=2,dispstr="ex")
mymvd=mvdc(copula=mycop,margins=c("norm","norm"),
paramMargins=list(list(mean=-1,sd=0.5),list(mean=1,sd=0.5)))
This gave a bivariate sample from Normal(-1,1,0.5^2,0.5^2,0). The same code with exponential will lead give a bivariate sample from that distribution.But I don't know how to generate from w*BivariateNormal + (1-w)*BivariateGamma. Please help. I searched everywhere in yt but couldn't find anything. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire