rate <- exp(2); myshape = 3
edata <- data.frame(y = rep(0, nn <- 1000))
for(ii in 1:myshape)
edata <- transform(edata, y = y + rexp(nn, rate = rate))
fit <- vglm(y ~ 1, erlang(shape = myshape), edata, trace = TRUE)
coef(fit, matrix = TRUE)
Coef(fit) # Answer = 1/rate
1/rate
summary(fit)
Run the code above in your browser using DataLab