Welcome in this final section of the review of data. We're going to finish up our  analysis, part two of the analysis, specifically around our bike sharing data set.  So, if you remember from part one of the analysis, we were just looking at  overall summaries, trying to figure out the difference between registered and  casual users. We were also looking at extreme observations for both registered  and casual users, and then we finished with looking at the trend of registered  users over time and seeing improvements from 2011 to 2012 Now we have a  couple more specific analyzes to run, we've been asked to identify key  probabilities around customers, specifically the probability a customer is  registered given that the season is fall, as well as the probability of customers  are registered user given the season is summer, and then we're going to provide confidence intervals for both of those probabilities, so let's jump in and start  looking at those. What you see here is a table of registered versus casual users  per season. You'll notice the very, very top row has individual seasons that  signify the columns spring, summer, fall, and winter, as well as the total. The  individual rows you see here are for registered, as well as casual users. You can see that registered users is higher than casual users for every one of the  months. That's not surprising, based on the previous analysis that we've already done. However, what we need to do is answer a couple of conditional  probabilities. Remember the idea of a conditional probability given a certain  condition. What is the probability of something happening? The first question we were asked to look at was, given the fact that the season is fall. What's the  probability that a user is a registered user? Okay, perfect. So we're going to  isolate down just the fall season. So I've highlighted for you the fall column. So  here we are, only now dealing with 841,613 of our actual users. When looking at this, what we are looking at here in the fall, if we were to randomly select any  user from any single day, what is the probability that they were a registered user. Well, when looking at this, we can see that of the 841,613 users on any given  day in the fall, 711,831 of them were registered users. So, if we look at that that  leads us to about 84.6% chance or a probability of 0.846 again the idea here  being if you were to just randomly select any user on any single day in the fall  season what's the probability you got a registered user, and that's what we're  looking at. At least in the fall season, it's a rather high chance you're going to get a registered user. However, remember what we talked about when it came to  interval estimates, we want to be able to provide some kind of wiggle room,  some margin of error to show how much belief we have in our numbers, so let's  do that. Let's remind ourselves what the confidence interval is for proportions,  because that's what a probability is, right? It's a proportion, so we're going to be  looking at our sample proportion, so we have our sample proportion estimate of  0.846 and if you remember, when building a confidence interval, we have that  test statistic on the left hand side, our point estimate plus or minus, we have the  margin of error, that margin of error consists of the number that we pull from the 

normal distribution times the standard error of our statistic, p hat, the standard  error of p hat was the square root of p hat times one minus p hat over the  sample size, so now we have all of the numbers we would need, so we have  again our point estimate 0.846 plus or minus. Now we're just going to build a  95% confidence interval. It didn't specify in the direction, so 95% is a reasonable number to go with on a normal distribution, 95% would take the value of 1.96  Okay, so remember it's about two standard deviations on either side of the mean will give us 95% of our data, so that's why you have your 1.96 So, okay, 0.846  plus or minus 1.96 times the square root of 0.846 times 1 minus 0.846 again our sample proportions divided by our sample size. Now our sample size here,  remember we are completely contained in the fall, given that the season is fall,  so we've subsetted our data down. So, given our season is fall, we've isolated  ourselves to just fall users. That's 841,613 individual instances of a user on a  single day. We were to calculate all of that out, we would see we have 0.846  plus or minus 1.96 times 0.0004 or in other words, if you wanted to report your  number, you would have 0.846 plus or minus 0.0008. Now I know what you're  thinking, that doesn't seem like a lot of wiggle room. Well, you're exactly right.  Look, we've looked at 841,000 people. We have a lot of confidence in this  number, so there's not a lot of wiggle room around this number, whereas if I had  0.846 plus or minus 0.1, that would show that I had a lot more wiggle room in  this number. So, notice how it looks like you have a lot more confidence in that  0.846 because that margin of error is so much tighter and smaller, which again  is intuitive based on the fact that we have such a large sample size that we're  dealing with wonderful now. Let's do the exact same thing for summer. So, the  question was asked not only about fall customers, but also about summer  customers. So, let's isolate ourselves to the 1,061,129 individual users on a  single day inside of the summer, with that being the case, if we were to  randomly select an individual user on any given day in the summer, 835,000 and zero, I'm sorry, 835,038 of them were registered users out of the little over 1  million. If we were again to work out this proportion, we would get a smaller  proportion than we had in the fall. Here we only see 78.7% of our users on any  given day would be a registered user, or a probability of 0.787 again smaller  than what we had in the fall, but let's build ourselves another interval estimate  around this number. Luckily, it's the exact same equation as we had previously,  with slightly different numbers. Our statistic, our point estimate has changed. It  was 0.846 for fall customers, but here it's 0.787 for our summer customers. We  still have plus or minus to add a little bit of wiggle room above and below, and  we're still going to build a 95% confidence interval, so we still have that 1.96  here on our calculation. Then we're also going to again multiply this by the  standard error, which would be the square root of again our point estimate 0.787 times 1 minus that point estimate of 0.787 divided by our new sample size.  We're not isolating ourselves to the fall anymore. We're isolating ourselves to 

the summer, where we had again 1,061,129 users on a given day. You were to  work out the math yet again, we would see all the way over on the right hand  side our point estimate of 0.787 plus or minus 0.0008 Again, we have a lot of  confidence in this number due to the large sample size that we're dealing with  here. So we can reasonably say that the summer and the fall have a certain  proportion of customers that are registered as compared to casual. Now, not  surprisingly, there are more registered users than casual, but it looks like in the  fall there are even more registered users than casual compared to the summer.  Wonderful, so we identified some key probabilities, as well as some confidence  intervals around them. Now let's work on the second half of part two. The  customer's marketing division has also got preconceived notions on the average number of total users for the 2012 season as follows to help develop their  marketing budgets. So we're only going to be looking at 2012 numbers, not 2011 and 2012 This would make sense, considering the fact that it looks like our  numbers are growing over time. So, we're going to use the last year of our data  to be able to get the most updated piece of information. So, the preconceived  notions are that the average number of daily users in the summer is no more  than 6500 and the average number of daily users in the fall is no less than 6000  Well, what we need to do is validate those above claims using some statistical  hypothesis tests that we talked about in the previous section. So, remember,  first step to any good hypothesis test, right, is to define your null and your  alternative hypotheses, so it looks like the preconceived notion we've got going  in is the average number of daily users in the summer is less than or equal to  6500 They're saying, you know, what, we don't think that it's any more than 6500 that's what they're assuming going in. That's how they've made their marketing  budgets in the past. We need to test if this is still true, so we can update our  marketing. So, our alternative is going to be that there's more than 6500  average users in a day in the summer, so that we can make sure that we're not  spending too little on marketing, all right. So, if we were to look at 2012 alone,  and we were to look at our sample data, we would see that on average the daily  number of users in the summer of 2012 was 6824 with a standard deviation of  913 Now this is only 94 days. Again, there are 94 days in the summer of 2012  So, perfect. So, the question is, do we have enough evidence to say that that  average of 6824 is really bigger than our initial guess of 6500 Now, yes, you can initially think, well, of course, it's bigger, it's a bigger number, but is it big enough  to where we believe that it's actually not 6500 Remember that 6500 is just an  average, so we could just get numbers that are higher than that, just out of  sheer luck. What we want to do is see if those numbers are truly higher than  that, and that's what the hypothesis test is going to do for us. So, when looking  at our test statistic, if you remember from hypothesis testing, we have our test  statistic, t, which is equal to x bar minus mu divided by s over the square root of  n, and we can plug in our numbers: 6824 minus 6500 divided by 913 over the 

square root of our sample size, 94 This gives us a test statistic value of 3.44  Okay, well, that's helpful to a point, but the question is, what's the probability?  What's the p value of me getting a test statistic of 3.44 Well, let's take a look. If  we were to go to our t table, and again, there's a variety of ways of doing this,  you can use computers, you can use your calculator, all of them have the ability  to do this. I'm just going to look at the t table directly. If you go to our t table, you  can see that we don't have a row for the 90s. Now, if we have a sample size of  94 our degrees of freedom would be our sample size minus one, so that would  be 93 but we don't have a 93 row, so let's just round it down to 90. So the goal is looking on this 90 row. Do you see the number 3.44 Not really. In fact, the  largest number I've got is 3.402 So, in other words, my evidence is so big it  doesn't even appear on my table. So, let's see what probability, what p value  corresponds to the largest value I have on my table. Well, remember, we have a  one-sided test. We're only looking to see if it's above 6500 I don't care if it's  below, and that leaves a one-tailed p value of 0.0005 In other words. Is the  chances of me seeing a sample the way I did with an average of 6824 a  standard deviation of 913 and me actually having a mean in my population still  be 6500 users per day or less, on average, the probability of that actually  happening is less than 0.0005 You know, what I don't know about you, but that  just seems too rare for me. I no longer believe my initial hypothesis. I'm going to  reject the null hypothesis, and so I believe we actually have more users on  average than 6500 users in the summer. We should adjust our marketing  budgets accordingly. All right, so that's the first test. Let's take a look at the  second test again. The preconceived notion here was the average number of  daily users in the fall is greater than or equal to 6000 so they're assuming that  they have on average more than 6000 users a day in the fall. So again, that's  going to be our null hypothesis. That's what our working hypothesis is. Going  into the situation, we need to test if it's less than that again to adjust our  marketing budgets accordingly, so we can collect a sample of data. Remember,  we are only looking in the fall in 2012 and we can see the average number of  users in the fall of 2012 was 5792 However, the standard deviation was quite  wide, 1599 and there were only 89 days in the fall of 2012 Again, we can plug  these same numbers into the test statistic calculation that we saw in the  previous example. So we take our average from our sample, 5792 minus off our  original thought 6000 divided by our standard deviation 1599 over the square  root of our sample size 89 and we will get a negative 1.23 definitely not as big of a number as we saw previously with 3.44 but what p value does that give us?  First things first, when looking at the t table, you do not need to worry about  negatives or positives in terms of your test statistic value. All you're looking for is just the absolute value of that test statistic, we're looking for the number 1.23  We don't care if it's negative or positive here. Why? Because we're only looking  at one side of the distribution when looking in this table. Luckily, if you 

remember, the t distribution is perfectly symmetric, just like the normal  distribution, so it doesn't matter what side of the distribution you look on, the  area in the tail is going to be the same, so we're looking for 1.23 on our 90 row.  Okay, well, I don't see the exact number of 1.23 but I do see the numbers 1.04  and 1.29 so I know that my number is in between those two numbers, so again I don't know the exact p value, but I know that it's in this range, so if I look up at  the very top I can see what p values correspond to each of those numbers, so  the 1.04 would be a p value of 0.15, the 1.29 would be a p value of point one.  So, in other words, I don't know what it is, but I know that the p value is between 0.1 and 0.15 for my value of 1.23 In other words, there is between a 10 and 15% chance of us seeing the sample that we did underneath that null hypothesis, and if we were to use a significance level of 0.05 we would not reject this null  hypothesis. I do not believe I do not have enough evidence to say that the  average number of daily users isn't greater than or equal to 6000 Now you may  be thinking, well, hold on, I mean the average that we looked at was 5792 yes,  but it looks like that number is close enough to 6000 where I don't believe that  it's really below 6000 I just happen to have a bad fall, and so that's what we're  really looking at. Okay, so it looks like we don't need to worry about changing  marketing budgets for. Fall, however, we do need to change the marketing  budgets when it comes to the actual summer, so that's some great  recommendations we can make to the marketing department. Again, hopefully  this has helped you see some of the value of what we can do with statistics. We  can really show the impact to people about prior beliefs and really help them  evaluate and make better decisions. So, we've looked at the data, explored the  data in the last lecture. Now, we answered some more technical answers  around the data in this lecture. So, we've really hit this problem from all angles,  and really we can help this company, as well as the marketing division in this  company, make a lot better decisions using the data that we've collected, so that is the end of this lecture. That is the end of this section, and I look forward to  seeing you in the next one.



Last modified: Monday, June 29, 2026, 8:38 AM