lmr <- vec2lmom(c(125,0.20), lscale=FALSE)
quarice(0.75,parrice(lmr))
# The quantile function of the Rice as implemented in lmomco
# is slow because of rooting the CDF, which is created by
# integration of the PDF. Rician random variates are easily created.
# Thus, in speed applications the rlmomco() with a Rice parameter
# object could be bypassed by the following function, rrice().
if (FALSE) {
"rrice" = function(n, nu, alpha) { # from the VGAM package
theta = 1 # any number
X = rnorm(n, mean=nu * cos(theta), sd=alpha)
Y = rnorm(n, mean=nu * sin(theta), sd=alpha)
return(sqrt(X^2 + Y^2))
}
n <- 5000; # suggest making it about 10,000
nu <- 100; alpha <- 10
set.seed(501); lmoms(rrice(n, nu, alpha))
set.seed(501); lmoms(rlmomco(n, vec2par(c(nu,alpha), type='rice')))
# There are slight numerical differences between the two?
}
Run the code above in your browser using DataLab