Skip to content

Instantly share code, notes, and snippets.

@alfcrisci
Forked from mollietaylor/fit.R
Last active August 29, 2015 14:23
Show Gist options
  • Save alfcrisci/816aba723325bd40d26d to your computer and use it in GitHub Desktop.
Save alfcrisci/816aba723325bd40d26d to your computer and use it in GitHub Desktop.
ols <- lm(Temp ~ Solar.R,
data = airquality)
summary(ols)
str(ols)
plot(Temp ~ Solar.R,
data = airquality)
abline(ols)
library(ggplot2)
# ggplot(data = airquality,
# aes(Solar.R, Temp)) +
# geom_point(pch = 19) +
# geom_abline(intercept = ols$coefficients[1],
# slope = ols$coefficients[2])
ggplot(data = airquality,
aes(Solar.R, Temp)) +
geom_point(pch = 19) +
geom_smooth(method = lm,
se = FALSE)
library(lattice)
xyplot(Temp ~ Solar.R,
data = airquality,
type = c("p", "r"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment