# NOT RUN {
## define ZM and fZM LNRE models
ZM <- lnre("zm", alpha=.8, B=1e-3)
FZM <- lnre("fzm", alpha=.8, A=1e-5, B=.05)
## random samples from the two models
vec2tfl(rlnre(ZM, 10000))
vec2tfl(rlnre(FZM, 10000))
rlnre(FZM, 10000, what="tfl") # more efficient
## plot logarithmic type density functions
x <- 10^seq(-6, 1, by=.01) # pi = 10^(-6) .. 10^(-1)
y.zm <- ltdlnre(ZM, x)
y.fzm <- ltdlnre(FZM, x)
# }
# NOT RUN {
plot(x, y.zm, type="l", lwd=2, col="red", log="x", ylim=c(0,14000))
lines(x, y.fzm, lwd=2, col="blue")
legend("topright", legend=c("ZM", "fZM"), lwd=3, col=c("red", "blue"))
# }
# NOT RUN {
## probability pi_k of k-th type according to FZM model
k <- 10
plnre(FZM, tqlnre(FZM, k-1)) - plnre(FZM, tqlnre(FZM, k))
## number of types with pi >= 1e-6
tplnre(ZM, 1e-6)
## lower tail fails for infinite population size
# }
# NOT RUN {
tplnre(ZM, 1e-3, lower=TRUE)
# }
# NOT RUN {
## total probability mass assigned to types with pi <= 1e-6
plnre(ZM, 1e-6)
# }
Run the code above in your browser using DataLab