We're going to embed a plotly plot or two in our presentation.
We'll use some familiar data.
January 20, 2017
We're going to embed a plotly plot or two in our presentation.
We'll use some familiar data.
data(swiss)
fit <- lm(Fertility ~ Catholic, data=swiss)
plot_ly(data=swiss,
x=~Catholic,
y=~Fertility,
size=~Education,
type="scatter",
mode="markers",
text=rownames(swiss)) %>%
add_trace(data=swiss,
x=~Catholic,
y=fitted(fit),
mode="lines",
line=list(width=2))
loessA <- loess.smooth(fitted(fit), resid(fit))
plot_ly(x=fitted(fit),
y=resid(fit),
type="scatter",
mode="markers",
hoverinfo="x+y",
name="Data",
marker=list(size=10, opacity=0.5),
showlegend=FALSE) %>%
add_trace(x = loessA$x,
y = loessA$y,
type = "scatter",
mode = "lines+markers",
name = "Smooth",
line = list(width = 2)) %>%
layout(title = "Residuals vs Fitted Values",
plot_bgcolor = "#b6e4e6",
width = 1000)
Looks like we have some residual fit we need to account for. This is the end of the presentation.