### change in density of n2 for two different values of rho (given n1=10)
barplot(rbind(dbipoilog(n1=rep(10,21),n2=0:20,mu1=0,mu2=0,sig=1,sig2=1,rho=0.0),
dbipoilog(n1=rep(10,21),n2=0:20,mu1=0,mu2=0,sig=1,sig2=1,rho=0.8)),
beside=TRUE,space=c(0,0.2),names.arg=0:20,xlab="n2",col=1:2)
legend(35,0.0012,c("rho=0","rho=0.8"),fill=1:2)
### draw random deviates from a community of 50 species
rbipoilog(S=50,mu1=0,mu2=0,sig1=1,sig2=2,rho=0.7)
### draw random deviates including zeros
rbipoilog(S=50,mu1=0,mu2=0,sig1=1,sig2=2,rho=0.7,keep0=TRUE)
### draw random deviates with sampling intensities nu1=0.5 and nu2=0.7
rbipoilog(S=50,mu1=0,mu2=0,sig1=1,sig2=2,rho=0.7,nu1=0.5,nu2=0.7)
### draw random deviates conditioned on a certain number of species
rbipoilog(S=50,mu1=0,mu2=0,sig1=1,sig2=2,rho=0.7,nu1=0.5,nu2=0.7,condS=TRUE)
### how many species are likely to be observed in at least one of the samples
### (given S,mu1,mu2,sig1,sig2,rho)?
hist(replicate(1000,nrow(rbipoilog(S=50,mu1=0,mu2=0,sig1=1,sig2=2,rho=0.7))),
main="", xlab = "Number of species observed in at least one of the samples")
### how many individuals are likely to be observed
### (given S,mu1,mu2,sig1,sig2,rho)?
hist(replicate(1000,sum(rbipoilog(S=50,mu1=0,mu2=0,sig1=1,sig2=2,rho=0.7))),
main="", xlab="sum nr of individuals in both samples")
Run the code above in your browser using DataLab