## Example 1 ##
Shapes <- 1:10
yulesimonMlink(theta = Shapes, deriv = 1) ## d eta/d theta, as function of theta
yulesl.inv <-
# The inverse minus actual values
yulesimonMlink(theta = yulesimonMlink(theta = Shapes), inverse = TRUE) - Shapes
summary(yulesl.inv) ## zero
## Example 2. Special values of theta (rho) ##
rhos <- c(-Inf, -2, -1, 0.0, 0.5, 1, 5, 10, 100, Inf, NaN, NA)
rbind(rho = rhos,
yuleslink = yulesimonMlink(theta = rhos),
inv.yulesl =yulesimonMlink(theta = rhos, inverse = TRUE))
## Example 3 The yulesimonMlink transformation and the first two derivatives ##
# \donttest{
rhos <- seq(1, 20, by = 0.01)[-1]
y.rhos <- yulesimonMlink(theta = rhos, deriv = 0)
der.1 <- yulesimonMlink(theta = rhos, deriv = 1)
der.2 <- yulesimonMlink(theta = rhos, deriv = 2)
plot(y.rhos ~ rhos, col = "black",
main = "log(mu), mu = E[Y], Y ~ Yule-Simon(rho).",
ylim = c(-5, 10), xlim = c(-1, 5), lty = 1, type = "l", lwd = 3)
abline(v = 1.0, col = "orange", lty = 2, lwd = 3)
abline(v = 0, h = 0, col = "gray50", lty = "dashed")
lines(rhos, der.1, col = "blue", lty = 5)
lines(rhos, der.2, col = "chocolate", lty = 4)
legend(2, 7, legend = c("yulesimonMlink", "deriv = 1", "deriv = 2"),
col = c("black", "blue", "chocolate"), lty = c(1, 5, 4))
# }
Run the code above in your browser using DataLab