In [5]:
# Carregando os pacotes
library(datasets)
library(broom)
library(ggplot2)
library(lattice)
library(QuantPsyc)
In [7]:
# Visualizando o dataset
data(iris)
str(iris)
head(iris)
Out[7]:
In [9]:
# Regressão Linear Simples
# Sepal Length vs Petal Lenth
ggplot(data = iris,aes(x = Sepal.Length, y = Petal.Length)) +
geom_point(size = 2, colour = "black") +
geom_point(size = 1, colour = "white") +
geom_smooth(aes(colour = "black"), method = 'lm') +
ggtitle("Sepal Length vs Petal Length") +
xlab("Sepal Length") + ylab("Petal Length") +
theme(legend.position = "none")