d = data.frame(x = sort(runif(n <- 40)))
d = transform(d, y1 = 1 + 2*x + rnorm(n, sd=0.1),
y2 = 3 + 4*x + rnorm(n, sd=0.1),
y3 = 7 + 4*x + rnorm(n, sd=0.1))
fit = vglm(cbind(y1,y2) ~ x, gaussianff, data=d)
coef(fit, matrix=TRUE)
# For comparison:
coef( lmfit <- lm(y1 ~ x, data=d))
coef(glmfit <- glm(y2 ~ x, data=d, gaussian))
vcov(fit)
vcov(lmfit)
t(weights(fit, type="prior")) # Unweighted observations
weights(fit, type="working")[1:4,] # Identity matrices
# Reduced-rank VLM (rank-1)
fit2 = rrvglm(cbind(y1,y2,y3) ~ x, gaussianff, data=d)
Coef(fit2)
Run the code above in your browser using DataLab