k = exp(-1); Scale = exp(1)
gdata = data.frame(y = rgamma(1000, shape = k, scale = Scale))
fit = vglm(y ~ 1, gengamma, gdata, trace = TRUE)
coef(fit, matrix = TRUE)
# Another example
gdata = data.frame(x = runif(nn <- 5000))
gdata = transform(gdata, Scale = exp(1), d = exp(0 + 1.2*x),
k = exp(-1 + 2*x))
gdata = transform(gdata, y = rgengamma(nn, scale = Scale, d = d, k = k))
fit = vglm(y ~ x, gengamma(zero = 1, iscal = 6), gdata, trace = TRUE)
fit = vglm(y ~ x, gengamma(zero = 1), gdata, trace = TRUE, maxit = 50)
coef(fit, matrix = TRUE)
Run the code above in your browser using DataLab