Scatter and points
An ideal way to start assessing the data for a regression is creating a scatter plot.
A company has gathered the amount of time users of their website spend checking out items, Time
and are interested in how this impacts the amount of time their users search on the site each day, TimeSearching
, with a particular interest in knowing how much time a user spends on the site when they spent 17 minutes checking out items.
The webdata
dataset has been loaded for you.
This exercise is part of the course
A/B Testing in R
Exercise instructions
- Load the
ggplot2
package to create plots. - Use the regression line formula to determine and store the amount of time spent on the site daily when a user spends 17 minutes on the Internet daily as
yhat
given a y-intercept of14.97
and slope of0.42
. - Create a scatter plot fitting for assessing the impact of
Time
onTimeSearching
, including intersecting lines at 17 time and the predicted amount of time spent on the site daily.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Call the ggplot package
___
# Derive predicted value
yhat <- ___
# Create the scatter plot
ggplot(___) +
___ +
___ +
___