Skip to content

Instantly share code, notes, and snippets.

@theotheo
Created December 5, 2014 14:48
Show Gist options
  • Save theotheo/ce719671285c623c0eb6 to your computer and use it in GitHub Desktop.
Save theotheo/ce719671285c623c0eb6 to your computer and use it in GitHub Desktop.
Example linear regression for "iris" dataset
> iris.fit <- lm(Petal.Width ~ Petal.Length, data=iris)
> summary(iris.fit)
Call:
lm(formula = Petal.Width ~ Petal.Length, data = iris)
Residuals:
Min 1Q Median 3Q Max
-0.56515 -0.12358 -0.01898 0.13288 0.64272
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.363076 0.039762 -9.131 4.7e-16 ***
Petal.Length 0.415755 0.009582 43.387 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.2065 on 148 degrees of freedom
Multiple R-squared: 0.9271, Adjusted R-squared: 0.9266
F-statistic: 1882 on 1 and 148 DF, p-value: < 2.2e-16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment