sdata <- data.frame(y = rsnorm(nn <- 1000, shape = 5))
fit <- vglm(y ~ 1, skewnormal1, sdata, trace = TRUE)
coef(fit, matrix = TRUE)
head(fitted(fit), 1)
with(sdata, mean(y))
with(sdata, hist(y, prob = TRUE))
x <- with(sdata, seq(min(y), max(y), len = 200))
with(sdata, lines(x, dsnorm(x, shape = Coef(fit)), col = "blue"))
sdata <- data.frame(x2 = runif(nn))
sdata <- transform(sdata, y = rsnorm(nn, shape = 1 + 2*x2))
fit <- vglm(y ~ x2, skewnormal1, sdata, trace = TRUE, crit = "coef")
summary(fit)
Run the code above in your browser using DataLab