## Not run: m <- 2; SD <- exp(1)
# fdata <- data.frame(y = rfoldnorm(n <- 1000, m = m, sd = SD))
# hist(with(fdata, y), prob = TRUE, main = paste("foldnormal(m = ", m,
# ", sd = ", round(SD, 2), ")"))
# fit <- vglm(y ~ 1, foldnormal, data = fdata, trace = TRUE)
# coef(fit, matrix = TRUE)
# (Cfit <- Coef(fit))
# # Add the fit to the histogram:
# mygrid <- with(fdata, seq(min(y), max(y), len = 200))
# lines(mygrid, dfoldnorm(mygrid, Cfit[1], Cfit[2]), col = "orange")
# ## End(Not run)
Run the code above in your browser using DataLab