Random generation for the PLN model with latent mean equal to mu, latent covariance matrix equal to Sigma and average depths (sum of counts in a sample) equal to depths
a n * p count matrix, with row-sums close to depths, with an attribute "offsets" corresponding to the true generated offsets (in log-scale).
The default value for mu and Sigma assume equal abundances and no correlation between the different species.
## 10 samples of 5 species with equal abundances, no covariance and target depths of 10,000
rPLN()
#> Y1 Y2 Y3 Y4 Y5
#> S1 1598 1622 4101 374 35
#> S2 1086 1270 1751 2560 1127
#> S3 1031 497 1076 3731 1592
#> S4 449 8035 1300 4238 1044
#> S5 1228 1642 370 761 1782
#> S6 860 747 2003 638 1283
#> S7 581 1690 3943 3269 4859
#> S8 2561 3304 1771 1036 3108
#> S9 223 13983 2157 792 4513
#> S10 1645 2405 471 1459 1760
#> attr(,"offsets")
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [2,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [3,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [4,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [5,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [6,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [7,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [8,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [9,] 7.100902 7.100902 7.100902 7.100902 7.100902
#> [10,] 7.100902 7.100902 7.100902 7.100902 7.100902
## 2 samples of 10 highly correlated species with target depths 1,000 and 100,000
## very different abundances
mu <- rep(c(1, -1), each = 5)
Sigma <- matrix(0.8, 10, 10); diag(Sigma) <- 1
rPLN(n=2, mu = mu, Sigma = Sigma, depths = c(1e3, 1e5))
#> Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10
#> S1 42 71 57 81 30 4 0 5 10 5
#> S2 11183 6657 5511 15542 9003 1146 1066 903 1465 1732
#> attr(,"offsets")
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
#> [1,] 3.671389 3.671389 3.671389 3.671389 3.671389 3.671389 3.671389 3.671389
#> [2,] 8.276560 8.276560 8.276560 8.276560 8.276560 8.276560 8.276560 8.276560
#> [,9] [,10]
#> [1,] 3.671389 3.671389
#> [2,] 8.276560 8.276560