Hello, for testing coefficients of lm(), I wrote the following function (with the kind support of this mailing list):
# See Verzani, simpleR (pdf), p. 80 coeff.test <- function(lm.result, idx, value) { # idx = 1 is the intercept, idx>1 the other coefficients # null hypothesis: coeff = value # alternative hypothesis: coeff != value coeff <- coefficients(lm.result)[idx] SE <- coefficients(summary(lm.result))[idx,"Std. Error"] n <- df.residual(lm.result) t <- (coeff - value )/SE 2 * pt(-abs(t),n) # times two because problem is two-sided } This works fine for lm() objects, but fails for rlm() because df.residual() is NA. Can I get the degrees of freedom by calculating n = length(lm.result) - length(coefficients(lm.result)) Thanks for any help! Jan ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.