## E1. Modelling the mean of the exponential distribution ##
set.seed(17010502)
dof <- 2.5
isq.data <- data.frame(x2 = runif(100, 0, 1))
isq.data <- transform(isq.data, y = rinv.chisq(n = 100, df = dof + x2))
# \donttest{
hist(isq.data$y)
# }
fit.inv <- vglm(y ~ x2, family = inv.chisqff(link = "inv.chisqMlink"),
data = isq.data, trace = TRUE )
coef(fit.inv, matrix = TRUE)
summary(fit.inv)
## E3. Special values in a matrix ##
(theta <- matrix(c(Inf, -Inf, NA, NaN, 1 , 2, 3, 4), ncol = 4, nrow = 2))
inv.chisqMlink(theta = theta) ## NaNs for df = theta <= 2
## E2. inv.chisqMlink() and its inverse ##
theta <- 0.1 + 1:5 # dof = df
my.diff <- theta - inv.chisqMlink(inv.chisqMlink(theta = theta), inverse =TRUE)
summary(my.diff) # Zero
Run the code above in your browser using DataLab