m = 2; SD = exp(1)
y = rfnorm(n <- 1000, m=m, sd=SD)
hist(y, prob=TRUE, main=paste("fnormal1(m=",m,", sd=",round(SD,2),")"))
fit = vglm(y ~ 1, fam=fnormal1, trace=TRUE)
coef(fit, mat=TRUE)
(Cfit = Coef(fit))
mygrid = seq(min(y), max(y), len=200) # Add the fit to the histogram
lines(mygrid, dfnorm(mygrid, Cfit[1], Cfit[2]), col="red")
Run the code above in your browser using DataLab