pdata <- data.frame(Mean = 1.0, SD = exp(1.0))
pdata <- transform(pdata, y = rposnorm(n <- 1000, m = Mean, sd = SD))
if (FALSE) with(pdata, hist(y, prob = TRUE, border = "blue",
main = paste("posnorm(m =", Mean[1], ", sd =", round(SD[1], 2),")")))
fit <- vglm(y ~ 1, posnormal, data = pdata, trace = TRUE)
coef(fit, matrix = TRUE)
(Cfit <- Coef(fit))
mygrid <- with(pdata, seq(min(y), max(y), len = 200))
if (FALSE) lines(mygrid, dposnorm(mygrid, Cfit[1], Cfit[2]), col = "red")
Run the code above in your browser using DataLab