ldata <- data.frame(y1 = rlnorm(nn <- 1000, meanlog = 1.5, sdlog = exp(-0.8)))
fit1 <- vglm(y1 ~ 1, lognormal, ldata, trace = TRUE)
coef(fit1, matrix = TRUE)
Coef(fit1)
ldata2 <- data.frame(x2 = runif(nn <- 1000))
ldata2 <- transform(ldata2, y2 = rlnorm(nn, mean = 0.5, sd = exp(x2)))
fit2 <- vglm(y2 ~ x2, lognormal(zero = 1), ldata2, trace = TRUE, crit = "c")
coef(fit2, matrix = TRUE)
Coef(fit2)
lambda <- 4
ldata3 <- data.frame(y3 = lambda + rlnorm(n = 1000, mean = 1.5, sd = exp(-0.8)))
fit3 <- vglm(y3 ~ 1, lognormal3, ldata3, trace = TRUE, crit = "c")
coef(fit3, matrix = TRUE)
summary(fit3)
Run the code above in your browser using DataLab