How to extract the p-value for the slope from an ols object in R
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 7 years ago . If I do data(mtcars) m1 <- lm(mpg ~ cyl, data= mtcars, x= TRUE, y= TRUE) then I can extract the p-value for the slope using summary(m1)$coefficients[2, 4] . But if I do library(rms) data(mtcars) m2 <- ols(mpg ~ cyl, data= mtcars, x= TRUE, y= TRUE) what do I need to do to extract the p-value for the slope? 回答1: You can use the corresponding extractor function, but you need to