![]() Set.seed( 1) p1 0.4575 trawl :: ModLSD_Mean(base :: log( 1 -p2) /base :: log( 1 -p1 -p2),p1 /( 1 -p2)) #> 0.45619 #Compute the empirical and theoretical mean of the second component base :: mean(y) #> 0.8995 trawl :: ModLSD_Mean(base :: log( 1 -p1) /base :: log( 1 -p1 -p2),p2 /( 1 -p1)) #> 0.91238 #Compute the empirical and theoretical variance of the first component stats :: var(y) #> 0.3686306 trawl :: ModLSD_Var(base :: log( 1 -p2) /base :: log( 1 -p1 -p2),p1 /( 1 -p2)) #> 0.3724961 #Compute the empirical and theoretical variance of the second component stats :: var(y) #> 0.5690567 trawl :: ModLSD_Var(base :: log( 1 -p1) /base :: log( 1 -p1 -p2),p2 /( 1 -p1)) #> 0.5776045 #Compute the empirical and theoretical correlation between the two components stats :: cor(y,y) #> -0.3961486 trawl :: BivLSD_Cor(p1,p2) #> -0.3608673 #Compute the empirical and theoretical covariance between the two components stats :: cov(y,y) #> -0.1814394 trawl :: BivLSD_Cov(p1,p2) #> -0.1673877 The trawl package implements the functions Bivariate_LSDsim and Trivariate_LSDsim to simulate from both the bivariate and the trivariate logarithmic series distribution. \] Simulations from the univariate LSD can be carried out using the function Runuran::urlogarithmic. The multivariate logarithmic series distribution Second, we simulate \(X_2|X_1=x_1\) from the univariate negative binomial distribution NB( \(\kappa+x_1,p_2\)), see for instance (Dunn 1967). The simulation algorithm proceeds in two steps: First, we simulate \(X_1\) from the univariate negative binomial distribution NB( \(\kappa\), \(p_1/(1-p_2)\)). The trawl package introduces the function Bivariate_NBsim which generates samples from the bivariate negative binomial distribution. We note that the function stats::rnbinom can be used to simulate from the univariate negative binomial distribution. Recall that a random variable \(X\) has (univariate) negative binomial law with parameters \(\kappa>0, 00\). ![]() The multivariate negative binomial distribution. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |