Introduction

The data set we are using represents the daily total of cyclist on Queensboro Bridge based on weekday, temperature, and precipitation. The data was collected from the Traffic Information Management Systems(TIMS). Each of the records shows the total number of cyclists per 24 hours at the Queenboro Bridge.

Data Description

Date = The observation ID

Day = Day of the week the data was collected

HighTemp = High temperature projected for the day

LowTemp = low temperature projected for the day

Precipitation = Precipitation amount for the day

Queensboro Bridge = Bridge the data was conducted on

Total = Total amount of cyclists per day

Before we use the data set we had to change the original form it is in. Both Queenboro Bridge and Total contained commas which made them character values. To use these variables in our model we removed the commas which resulted in them becoming numeric and therefore usable for the model.

Research Question

The research question we are looking at is if the amount of cyclist crossing the Queensboro Bridge is independent based on Hightemp, Lowtemp, Precipitation, and day,

We will look closely at a Poisson model, poisson regression on rates model, and a Quasi model to answer our research question.

Poisson Regression

The poisson regression model analyzes counts of data. The model looks at how much the independent variables influence the rate.

The regression model is:

\(log(Response) = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + ... + \beta_p x_p\)

The poisson regression model has 4 basic assumptions:

Poisson Response: the response variable is a count per unit of time or space described by poisson distribution

Independence: The observations are independent from one another

Mean and Variance are equal: The mean of a poisson random variable must be equal to the variance; if this assumption fails it will result into an issue of dispersion.

Linearity: The log of the mean rate is a linear function of lambda

To begin we start by looking at a poisson regression model using the glm() function. We ignore the total amount of cyclists who cross the bridge each day from the data set. We ignore this observation because it is not important to the model as we are trying to see the amount of cyclists who cross the bridge based on weather and week day.

The Poisson regression model for the counts of cyclists on Bridge versus the weekday and weather.
  Estimate Std. Error z value Pr(>|z|)
(Intercept) 7.446 0.02623 283.8 0
HighTemp 0.01353 0.0006957 19.44 3.279e-84
LowTemp 0.00002154 0.0009302 0.02315 0.9815
Precipitation -0.9719 0.0193 -50.37 0
DayMonday 0.009886 0.01174 0.8417 0.3999
DaySaturday -0.331 0.01204 -27.5 1.619e-166
DaySunday -0.2842 0.01159 -24.52 8.421e-133
DayThursday -0.007112 0.0121 -0.588 0.5566
DayTuesday 0.1524 0.01229 12.4 2.665e-35
DayWednesday 0.02506 0.01182 2.121 0.03392

The poisson regression table coefficients show that everything but Low Temp, Monday, and Thursday are statistically significant. Showing that if we look at cyclist count across weather and weekday there will is evidence to support possible discrepancy between weather and weekday. The significance of the model however does not imply the model is important. There are many things that could impact the statistical significance of some variables such as: sample size, effect size, variability, correlation, random chance, and multiple comparisons.

When looking at Low temp, Monday, and Thursday there is no significant evidence to show potential discrepancy across weather and weekday.

The total population of cyclists for each day also depends on the number of days the data was taken. We ignore the total cyclists for each day of the days a sample was taken which implies the sample was not used effectively.

Poisson Regression on rates

Through a poisson regression on rates we can determine that the mean count is proportional to t.

Since we are using the poisson regression on rates model as a relative count we must account for other changes in the data. Therefore we use log(t) as an offset.

The regression model for rates is:

\(log(Response/t) = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + ... + \beta_p x_p\)

The model used for Poisson regression on rates is the same as used for a poisson regression model. We will use that model and include the offset observation as its own part of the model.

Poisson regression on the rate of the cyclists rate based on week day and weather.
  Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.273 0.02657 -47.94 0
HighTemp -0.004733 0.000695 -6.811 9.71e-12
LowTemp 0.002714 0.0009323 2.911 0.003602
Precipitation 0.107 0.01875 5.708 1.14e-08
DayMonday -0.04347 0.01174 -3.704 0.0002121
DaySaturday -0.01414 0.01196 -1.183 0.237
DaySunday -0.04512 0.01161 -3.888 0.0001013
DayThursday -0.01512 0.01209 -1.251 0.211
DayTuesday -0.03401 0.01235 -2.754 0.005885
DayWednesday -0.001922 0.0118 -0.1628 0.8706

The poisson regression on rates table shows that the log of cyclists is not the same among weather and days of the week.

The log rates on Friday(baseline) were higher than the other days of the week and Low Temp had the lowest log rate. The coefficients show the change of log rate between Friday(baseline) and every other weekday. The coefficients for weather show the change of log rate between associate weather and reference group. We also see LowTemp,Thursday,and Saturday are not statistically significant to the model.

Reduced model

Since in the poisson regression on rates we see that low temp is not statistically significant we will remove it from the final model. We do this to verify the model will not be affected in any way by removing the variable.

Reduced poisson regression model for rates
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.2517 0.0255 -49.0570 0.0000
HighTemp -0.0030 0.0004 -8.4427 0.0000
Precipitation 0.1232 0.0179 6.8869 0.0000
DayMonday -0.0343 0.0113 -3.0361 0.0024
DaySaturday -0.0102 0.0119 -0.8550 0.3925
DaySunday -0.0505 0.0115 -4.4120 0.0000
DayThursday -0.0099 0.0120 -0.8257 0.4090
DayTuesday -0.0315 0.0123 -2.5571 0.0106
DayWednesday 0.0034 0.0117 0.2897 0.7720

Looking at the reduced model we see that Thursday and Saturday are still not statistically significant. This is not suprising as removing a variable that is insignificant should not have any effect on the results.

Quasi-Poisson Rate Model

The Quasi-Poisson allows for an adjustment to be made by adding a dispersion parameter to the poisson variance. The quasi-poisson then estimates the over-dispersion parameter.

In the case study we will find the dispersion coefficients of the poisson variance using glm().

This function will be used on our data to see if the mean and variance of bikers on the bridge each day is equal. We will also see that the estimated regression coefficients will be the same since the scale parameter does not impact linear system solutions. However we will see a difference in variance.

Quasi-Poisson regression on the rate of number of bikers on Queensboro Bridge.
  Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.273 0.02657 -47.94 0
HighTemp -0.004733 0.000695 -6.811 9.71e-12
LowTemp 0.002714 0.0009323 2.911 0.003602
Precipitation 0.107 0.01875 5.708 1.14e-08
DayMonday -0.04347 0.01174 -3.704 0.0002121
DaySaturday -0.01414 0.01196 -1.183 0.237
DaySunday -0.04512 0.01161 -3.888 0.0001013
DayThursday -0.01512 0.01209 -1.251 0.211
DayTuesday -0.03401 0.01235 -2.754 0.005885
DayWednesday -0.001922 0.0118 -0.1628 0.8706

The Quasi model creates a new parameter which allows the variance to be smaller or larger than the mean by a multiplicative factor, phi

Due to phi influencing the QLME of regression coefficients there are many changes that can be made to the results. We can expect the standard errors and p-values to be different from those in the regular poisson regression model.

An example of this is in the Quasi model for Saturday the p-value = 0.237 and the standard error = 0.01196. In the regular poisson model we see that p-value = 1.619e-166 and the standard error = 0.01204.

The Quasi model also exhibits some of the same results as in the other poisson models conducted so far.In both the poisson on rates and the reduced poisson on rates we see that Thursday and Saturday are not statistically significant. However in the Quasi model we see that Wednesday also becomes statistically insignificant.

Disppersion

When we use a poisson regression to analyse our data there is a potential issue of over dispersion. The model finds the dispersion parameter with p as the regression coefficients.

We will find the dispersion value due to the insignificant variable in the Quasi model. The dispersion value also helps us to better understand if the mean and variance are equal.

Dispersion
7.447

The dispersion number for the model is high as the model needs to be around 1 to prove the poisson assumption, variance and mean are equal,is correct.

Due to our model proving the assumption incorrect we know the output of glm() with a regular log link in the poisson family are also not reliable. We should now not use the regular poisson model and use the Quasi instead due to the variances changing in the model. Since our dispersion value is 7.447 the variance of the original poisson could be changed by a multiple of 7.447.

Graphical comparisons

In the two previous sections the poisson regression models gave us numerical information about the potential discrepancy across Days of the week among the weather. We will create two graphics that will make any hidden patterns visible.

The calculations we are using for the graphics are based on the regression equation coefficients given to us in table 3, Poisson Regression on Rates.

We will be looking at the High temp,Low Temp, and Precipitation on each day of the week to create the graph. We will be using exp(-1.2734) as the baseline for days of the week, Friday.The baseline for the temperature will be given as exp(-0.0047), High Temp.

The graph will focus on temperature and precipitation being on the x-axis and the week days as the lines. The range of the each of the 3 weather types per day will be found. The range number will be the three points on the graph.

The Poisson regression model for the counts of cyclists versus, weather, weekday, and population size.
Estimate Std. Error z value Pr(>|z|)
(Intercept) 7.2835 0.0271 268.969 0.0000
HighTemp -0.0052 0.0010 -5.443 0.0000
LowTemp 0.0049 0.0009 5.168 0.0000
Precipitation -0.1619 0.0336 -4.813 0.0000
DayMonday -0.0488 0.0120 -4.078 0.0000
DaySaturday -0.0597 0.0151 -3.939 0.0001
DaySunday -0.0171 0.0148 -1.154 0.2485
DayThursday -0.0348 0.0122 -2.854 0.0043
DayTuesday -0.0976 0.0152 -6.438 0.0000
DayWednesday 0.0201 0.0118 1.697 0.0898
Total 0.0001 0.0000 28.627 0.0000

We see that on Friday there is significantly more cyclist who cross the bridge than on any other day of the week.There is very little significant difference between any other days of the week. We must further investigate why Friday has so many more people crossing the bridge.

The graph shows a linear relationship between weather and total cyclist. The cyclist rate stays about the same for High temp and precipitation. The rate begins to decrease as the temperature decreases. The pattern is consistent with the data since there are more cyclists when there is no precipitation and a high temp. It is uncommon to see a large amount of cyclist on a day with high precipitation and low temps due to the

We also see through the graph that weather and days of the week have no interaction, thus the rate is parallel.

We see that Sunday and Wednesday are not statistically significant which is suprising because neither day has been insignificant in any other models preformed. We will want to further investigate this to see what changed between the models.

Conclusion

The case study allowed for many findings to be made about the data. By using the Quasi model we see that day, temperature, and precipitation do affect the amount of bikers on the bridge. This allows us to further verify this as we come to the same conclusion with the other poisson models. Through the poisson regression model we see that precipitation highly decreases the amount of bikers. The regression on rates model and the quasi-model show the opposite and show that as precipitation increases so does bikers. However in the full model it is shown that precipitation decreases the amount of bikers. Due to having the mixed results more data would need to be gathered and rerun the study. By having more data points it would allow for a more accurate result.

The study ultimately allowed for there to be a better understanding of how temperature, precipitation, and day of the week affect the amount of bikers on the Queensboro Bridge. We come to the conclusion the amount of bikers do depend on all of these factors.