Bikeshare in Language R

nbaballerz
bikeshare.pdf

GEORGE MASON UNIVERSITY Systems Engineering and Operations Research

SYST 468: Applied Predictive Analytics, Spring Semester 2018: Final Project. Due Wednesday, May 9 at midnight. This is an individual project.

Bike sharing systems are new generation of traditional bike rentals where whole process from membership, rental and return back has become automatic. Through these systems, are hard to design and manage due to uncertainty in the demand. The biggest expanse for bike share system is upfront cost for the bikes and real-time re-balancing, i.e moving bikes between stations. For example, in commuters would use bike to go downhill to from home to work by would take taxi or uber to go back home.

Your project is to analyze the data from Capital Bikeshare system in Washington D.C. (https://www. capitalbikeshare.com/system-data). The data was already cleaned and aggregated [1]. The data and start script are on the course Dropbox folder final-project.

The data set bikeshare.csv constans 17379 obserations of 13 variable, each row is an hourly count from 2011 to 2012 for bike rides (rentals)

bikeshare.csv contains:

• season: 1:spring, 2:summer, 3:fall, 4:winter

• yr: year (0:2011, 1:2012)

• mnth: month (1 to 12)

• hr: hour (0 to 23)

• holiday: whether day is holiday or not

• weekday: day of the week, counting from 0:sunday.

• notbizday: if day is either weekend or holiday is 1, otherwise is 0.

• weathersit:

1. Clear, Few clouds, Partly cloudy, Partly cloudy

2. Mist + Cloudy, Mist + Broken clouds, Mist + Few clouds, Mist

3. Light Snow, Thunderstorm + Scattered clouds, Light Rain + Scattered clouds

4. Heavy Rain + Ice Pallets + Thunderstorm + Mist, Snow + Fog

• temp Temperature, measured in standard deviations from average.

• hum: Humidity, measured in standard deviations from average.

• windspeed: Wind speed, measured in standard deviations from average.

• dteday: date

• cnt: count of total rental bikes

We will consider cnt (and transformations thereof) as the response of interest.

1. EDA We are interested in general characteristics of the system. Using exploratory data analysis (EDA) explore the average usage of the system by day of the week and month of the year. Is demand is the same on average across the days and months? We are also interested in high peak days. Those are the days when more re-balancing trips need to be made and more drivers need to be called in. Count number of time when the demand (cnt variable) exceeded 800. On what days of the week and months of the year it happens the most frequent?

1

Further, we are interested in special days. For example demand on 2012-10-30 and 2012-3-24 is different from the typical one. What happened on those days? Is there are other special days?

What other interesting observations you could extract from the data without building a model. Use boxplot to compare different types of days, e.g. holiday vs non-holiday.

We are interested in running marketing campaign and to target it properly, we need to know who is a more frequent user of the system, a regular commuter or a casual tourist? Can you answer this question using EDA?

2. Predictive Model: Regression Build linear model to predict the cnt variable. Discuss the economic and statistical significance of the input variables. Identify outliers using the model. Add dteday as a predictor and print the top three dteday effects by absolute value under your preferred selection rule, and describe the implied effect on cnt. Can you explain any of these?

Use LASSO to fit linear model with different values of λ. How the vest value of λ is chosen. Describe the principles involved in building a LASSO model, e.g. cross-validation and regularization.

Compare out-of-sample performance of “full” linear model and LASSO model.

3. Predictive Model: Classification The managers of Capital Bikeshare have found that the system works smoothly until more than 500 bikes are rented in any one hour. At that point, it becomes necessary to insert extra bikes into the system and move them across stations to balance loads.

Define the binary outcome variable overload that is one if cnt > 500, zero otherwise. Fit and plot the lasso path for regression of overload, no need for cross validation.

Summarize how hour-of-day effects the probability of an overload during business days. Consider a single hour with a strong effect and compare this to its effect in the liner regression.

Suppose that it costs you $200/hr in overtime pay if you have an overload (cnt > 500) with your usual number of staff. Staffing an extra driver to move the bikes costs only $100/hr and means you don’t have to pay any overtime. At what probability for overload > 0 will you want to staff an extra driver?

Plot and describe the ROC curve for your best LASSO model . What is the sensitivity and specificity of your rule from if applied with this regression?

4. Predictive Model: Trees Build a random forest model for both classification and regression. Com- pare the out-of-sample performance with LASSO models. Discuss advantages and disadvantages of tree-based models vs generalized linear models.

Instructions: This is an individual project. No late submissions will be accepted. Each submission must have two files. First is the paper (in PDF format), it should be between 10 − 15 pages including exhibits. You will be graded on presentation, writing and analysis. Second is the source code, you will not be graded on your code, it is just a supplementary for your report. Report and code files are to be submitted to BlackBoard.

References

[1] Hadi Fanaee-T and Joao Gama. Event labeling combining ensemble detectors and background knowledge. Progress in Artificial Intelligence, 2(2):113–127, Jun 2014.

2