[R] standard error beta glm

2009-06-11 Thread Ricardo Arias Brito
Dear All, The std. error of the estimated coefficients obtained by the summary.lm function can be calculated as: y=rnorm(20) x=y+rnorm(20) fit <- lm(y ~ x) summary(fit) sqrt( sum(fit$resid**2)/fit$df.resid * solve(t(model.matrix(fit))%*%model.matrix(fit)) ) Is posible calculate Std. Error

[R] contrasts

2009-06-03 Thread Ricardo Arias Brito
Hi all, I want t use a contrasts in adjusted regression (lm()) for a factor with four levels, compared the coefficients first with second, first with third, ..., third with fourth. Someone can help with a contrast matrix to be used. I tried and not yet I obtained. Say: y <- rnorm(50) x <- cu