R

Asked • 06/17/19

pull out p-values and r-squared from a linear regression?

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.

1 Expert Answer

By:

Benjamin B. answered • 06/21/19

Tutor
4.9 (35)

Ecologist with 4 years of R and research experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.