Dear R-help,

In the rms package, when using the ols function with a penalty, the
df.residual appears to always be n-1 (with n being the sample size).
That seems strange to me, but I don't have much knowledge in this
area.

Here's an example:

library(rms)

set.seed(1)

n <- 50

d <- data.frame(x1 = rnorm(n),
                x2 = rnorm(n, 0, 5),
                x3 = rnorm(n))
d$y <- with(d, 1 + 0.8*x1 + 0.5*x2 - 0.5*x3) + rnorm(n)

ols1 <- ols(y ~ x1 + x2 + x3, data=d)
ols2 <- ols(y ~ x1 + x2 + x3, data=d, penalty=10)

ols1$stats["d.f."]  # 3
ols2$stats["d.f."]  # 5.2

ols1$df.residual    # 46 = n - 3 - 1
ols2$df.residual    # 49


I would be grateful if someone could give a brief explanation of why
df.residual is n-1. The reason I'm interested in this is that
confidence intervals for predicted values use the df.residual value.

Thanks,
Mark

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to