Hi, If you look in the print.ols function you can see that the adjusted R^2 is not stored in the ols object but calculated on the fly, the relevant code snippet from that function looks to be:
x <- ols1 stats <- x$stats resid <- x$residuals n <- length(resid) ndf <- stats["d.f."] df <- c(ndf, n - ndf - 1, ndf) r2 <- stats["R2"] rdf <- df[2] rsqa <- 1 - (1 - r2) * (n - 1)/rdf Martyn -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Seeto Sent: 09 March 2011 09:10 To: r-help@r-project.org Subject: [R] rms: getting adjusted R^2 from ols object How can I extract the adjusted R^2 value from an ols object (using rms package)? library(rms) x <- rnorm(10) y <- x + rnorm(10) ols1 <- ols(y ~ x) Typing "ols1" displays adjusted R^2 among other things, but how can I assign it to a variable? I tried str(ols1) but couldn't see where to go from there. Thanks, Mark Seeto ______________________________________________ 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. ________________________________________________________________________ This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}} ______________________________________________ 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.