if (FALSE) {
x <- seq(0,4, by=.1)
para <- vec2par(c(.5, 1.4), type="kmu")
F <- cdfkmu(x, para)
X <- quakmu(F, para, quahi=pi)
plot(F, X, type="l", lwd=8)
lines(F, x, col=2)
}
if (FALSE) {
# Note that in this example very delicate steps are taken to show
# how one interacts with the Dirac Delta function (x=0) when the m
# is known but mu == 0. For x=0, the fraction of total probability
# is recorded, but when one is doing numerical summation to evaluate
# whether the total probability under the PDF is unity some algebraic
# manipulations are needed as shown for the conditional when kappa
# is infinity.
delx <- 0.001
x <- seq(0,3, by=delx)
plot(c(0,3), c(0,1), xlab="RHO", ylab="pdfkmu(RHO)", type="n")
m <- 1.25
mus <- c(0.25, 0.50, 0.75, 1, 1.25, 0)
for(mu in mus) {
kappa <- m/mu - 1 + sqrt((m/mu)*((m/mu)-1))
para <- vec2par(c(kappa, mu), type="kmu")
if(! is.finite(kappa)) {
para <- vec2par(c(Inf,m), type="kmu")
density <- pdfkmu(x, para)
lines(x, density, col=2, lwd=3)
dirac <- 1/delx - sum(density[x != 0])
cumulant <- (sum(density) + density[1]*(1/delx - 1))*delx
density[x == 0] <- rep(dirac, length(density[x == 0]))
message("Total integrated probability is ", cumulant, "\n")
}
lines(x, pdfkmu(x, para))
}
mtext("Yacoub (2007, figure 3)")
}
Run the code above in your browser using DataLab