How do you pull out the p-value (for the significance of the coefficient of the single explanatory variable being non-zero) and R-squared value from a simple linear regression model? For example…

x = cumsum(c(0, runif(100, -1, +1)))
y = cumsum(c(0, runif(100, -1, +1)))
fit = lm(y ~ x)
summary(fit)

I know that summary(fit) displays the p-value and R-squared value, but I want to be able to stick these into other variables.

12 Answers
12

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *