ndata <- data.frame(x2 = rnorm(nn <- 200))
ndata <- transform(ndata, y = rnorm(nn, mean = 1-3*x2, sd = exp(1+0.2*x2)))
fit <- vglm(y ~ x2, normal1(zero = NULL), ndata, trace = TRUE)
coef(fit, matrix = TRUE)
# Generate data from N(mu = theta = 10, sigma = theta) and estimate theta.
theta <- 10
ndata <- data.frame(y = rnorm(100, m = theta, sd = theta))
fit <- vglm(y ~ 1, normal1(lsd = "identity"), ndata,
constraints = list("(Intercept)" = rbind(1, 1)))
coef(fit, matrix = TRUE)
Run the code above in your browser using DataLab