Linear regression on nyc-east-river-bicycle-counts data set
Is the bikers on Manhattan Bridge dependent on high temperature on each day?
bikes <- read_csv("/Users/bchand005c/CUNY/DATA-605/assignment/week-11/nyc-east-river-bicycle-counts.csv")
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
## X1 = col_integer(),
## Date = col_datetime(format = ""),
## Day = col_datetime(format = ""),
## `High Temp (°F)` = col_double(),
## `Low Temp (°F)` = col_double(),
## Precipitation = col_character(),
## `Brooklyn Bridge` = col_double(),
## `Manhattan Bridge` = col_integer(),
## `Williamsburg Bridge` = col_double(),
## `Queensboro Bridge` = col_double(),
## Total = col_integer()
## )
head(bikes)
## # A tibble: 6 x 11
## X1 Date Day `High Temp (°F)`
## <int> <dttm> <dttm> <dbl>
## 1 0 2016-04-01 00:00:00 2016-04-01 00:00:00 78.1
## 2 1 2016-04-02 00:00:00 2016-04-02 00:00:00 55
## 3 2 2016-04-03 00:00:00 2016-04-03 00:00:00 39.9
## 4 3 2016-04-04 00:00:00 2016-04-04 00:00:00 44.1
## 5 4 2016-04-05 00:00:00 2016-04-05 00:00:00 42.1
## 6 5 2016-04-06 00:00:00 2016-04-06 00:00:00 45
## # ... with 7 more variables: `Low Temp (°F)` <dbl>, Precipitation <chr>,
## # `Brooklyn Bridge` <dbl>, `Manhattan Bridge` <int>, `Williamsburg
## # Bridge` <dbl>, `Queensboro Bridge` <dbl>, Total <int>
ggplot(data = bikes, aes(x = `High Temp (°F)`, y = `Manhattan Bridge`)) +
geom_point(color='blue') +
geom_smooth(method = "lm", se = FALSE)

fit <- lm(`Manhattan Bridge` ~ `High Temp (°F)`, data = bikes)
autoplot(fit)
