ldat <- data.frame(y = rlnorm(nn <- 1000, meanlog = 1.5, sdlog = exp(-0.8)))
fit <- vglm(y ~ 1, lognormal, ldat, trace = TRUE)
coef(fit, matrix = TRUE)
Coef(fit)
ldat2 <- data.frame(x2 = runif(nn <- 1000))
ldat2 <- transform(ldat2, y = rlnorm(nn, mean = 0.5, sd = exp(x2)))
fit <- vglm(y ~ x2, lognormal(zero = 1), ldat2, trace = TRUE, crit = "c")
coef(fit, matrix = TRUE)
Coef(fit)
lambda <- 4
ldat3 <- data.frame(y = lambda + rlnorm(n = 1000, mean = 1.5, sd = exp(-0.8)))
fit <- vglm(y ~ 1, lognormal3, ldat3, trace = TRUE, crit = "c")
coef(fit, matrix = TRUE)
summary(fit)
Run the code above in your browser using DataLab