219 points · by skadamat · 2y ago · 190 comments
The further behind the previous bus a bus is, the more people will arrive at the bus stop. The more people there are at the stop, the longer the bus has to spend picking them all up and selling them tickets etc. Therefore the delayed bus will tend to experience more delay. The bus behind them will have less people to pick up, so it will spend a shorter time at stops and tend to catch up with the first bus, so the two busses are dragged towards each other.
[1]: [A self-coördinating bus route to resist bus bunching](https://doi.org/10.1016%2Fj.trb.2011.11.001)
[2]: [NAU’s new bus system makes for shorter wait times for riders](https://news.nau.edu/nau-bus-schedules/)
Looking at the second link, it seems they implement it by having the buses pause at certain points. Does it do that with riders onboard? That seems like it could be a deterioration in experience for those riders that are on the bus pausing.
It's not worth it to make every stop optional because then the routes become too unpredictable and scheduling is hard. Usually there's like 5-10% of optional bus stops on each route - only in the places where very few people get in/out.
If nobody is waiting and nobody asks to get off they don’t stop. If nobody asks to get off and there’s a second bus right behind, drivers skip the stop.
> the Keoride app matches customers who are travelling in the same direction and calculates an optimised flexible route to pick up and drop off customers close to their destination, you can even track the vehicle and get updated on your ETA in real time.
In my country, apart from an app/ online, you can buy a ticket pretty much anywhere. I guess someone worked out that bus drivers with money are a potential theft risk, and also that selling tickets on the bus takes time and makes busses late(r than they would be).
If you buy a transit pass or use their app you can get significant discounts.
Most people that drive often just have monthly tickets so they don't have to do anything - just get in/out of the bus.
Drivers are banned from selling tickets - they only do the driving. And nobody checks if you bought a ticket on every ride - there's a random check every now and then and if you're caught you pay a high fine. But you have maybe 1% chance of being checked at any given ride.
I can link my payment method, and purchase tickets in seconds whenever I’m ready.
I think most people complaining about buses in this thread just live in a city where public transport isn't a priority so it barely works :/
The city buses I've seen in USA have 1 or 2 doors. It's already wrong - it makes the boarding time unnecessarily long. Then there's the tickets - drivers shouldn't be selling or checking the tickets. You should buy tickets in a ticket machine or on your smartphone. And they shouldn't be checked every time - it takes too long. Have a group of people who board random buses and check the tickets there while the bus is driving so as not to waste anybody's time.
Bus schedules and routes should be designed with randomness in mind. There should be a small buffer (1 minute is enough if boarding is quick) to zero the randomness on each bus stop. Most bus stops should be mandatory so that 3 consecutive bus stops without passangers don't wreck the whole schedule (and then it spreads to other buses because you have to wait for 5 minutes at a bus stop for your departure time and you block entrance for other buses' passangers which makes boarding longer).
If you just put an intercity bus (that can work with 1 door and driver selling the tickets) and use it as a city bus that stops every 1-5 minutes - it won't work.
City buses should be optimized for latency not throughput.
Compare:
https://www.lubus.info/images/stories/taborbus/5122-57.jpg vs https://www.chicagobus.org/system/photos/250/large/DSC00925....
That's double the boarding time at every stop right there.
The schedule is also designed in such a way that the bus is usually ~1 minute ahead of time and can wait for the proper time to depart from each bus stop - zeroing the randomness on each stop. If it gets too delayed on one part of the route it can catch up on next few bus stops.
On intercity routes there's fewer bus stops so usually there's just 1 door and the driver sells the tickets.
In practice I see buses slowing down or stopping to keep their ordering, and I don't understand why.
(Of course that doesn't work for trains which can't overtake)
It's a good plan but you have to make sure fairness is ensured. It's the same feeling as, if I go get a burger & fries, the guy behind me orders identically, burger and fries, and somehow gets served first. The instinct is to say, "what the heck, why does HE get fast service than me in a straightforwardly unfair manner?!?"
So you'd need the empty bus and full bus to hit the same spot at the same time, fill the empty bus as the full one unloads. But which bus leaves first? If the former empty bus leaves first, you're being unfair QoS to the people who are seated on the full bus (which, to their perspective, at their prior stop, was the first-in-order-on bus so therefore should be the first-in-order-off bus. On the other hand, if the full bus leaves first, why did you make incoming passengers board the empty one? They should have boarded the full one to get to their destination faster.
The solution, which we see in practice, is to have the empty bus wait 5 or 10 minutes and let the full one get ahead. If we are seeing rounded fairness to all parties as the priority.
In a network metaphor, you do not halt all other TCP connection on a system because one TCP connection was stalled by a lost packet, in the name of fairness. No one would ever want that.
The people on the full bus can easily see that they are not moving because they are still unloading. Who would see another empty bus passing by and thinking "those people should be made to wait"?
In my experience on the subway, a train will start SKIPPING STATIONS when they are bunched together, forcing me to get off and wait for another train entirely. So I don't think fairness is the reasons buses keep their order.
My solution has been to stop looking at the station when I leave 7-Eleven.
⸻
1. I still do.
``Then stop raising your arm.''
A patient comes into a doctors office complaining of pain all over. The patient grabs their elbow and says: "It hurts when I touch my elbow like this." They then grabs onto their shin and says "When I grab my shin like this, it starts hurting too!" Finally, they massage their forehead and say "It even hurts when I rub my head! Doctor what's wrong with me!?"
The doctor runs a few tests and replies: "Your finger is broken."
> you arrive at a random time
So, um, if you intend to take public transit, it's best to not arrive at a random time. Looking at the time tables and planning around them is public transit user 101.
Average Jackpot prize is JackpotPool/Average winners.
Average Jackpot prize given you win is JackpotPool/(1+Average winners).
The number of expected other winners on the date you win is the same as the average number of winners. Your winning ticket doesn't affect the average number of winners.
This is similar to the classroom paradox where there are more winners when the prize is poorly split, so the average observed jackpot prize is less than the average jackpot prize averaged over events.
But if you are not, and pick a random time where you win, on average, you will win as much as the average lottery winner.
For the classroom paradox to work, you have to take the average prize per draw after splitting, not the average prize per winner.
For example, if there are 9 winners in the first draw and 1 in the second, then there are 5 winners on average, so the average prize is 1/5. If you are one of the winners, there is 9/10 chance you are among the 9 and only win 1/9, which is less than average, but there is also 1/10 change of winning full prize, which is much better than average. If you take a weighed average of these (9/10*1/9+1/10*1) you get 1/5, back to the average prize. The average individual prize per draw is (1/9+1)/2=5/9, but it is kind of a meaningless number.
Another way to see it is that most of the times, you will win less than average, but the few times you win more, then you will win big. But isn't it what lotteries are all about?
> Average Jackpot prize given you win is JackpotPool/(1+Average winners).
That doesn't make a lot of sense.
Maybe you mean that most winners get less than the average prize.
Let's say that there is $1m jackpot and there could be one, two, three or four winners (with equal probability).
To simplify the calculation, let's say that each outcome happens once.
The average prize is $400k (4 x $1m / (1+2+3+4)).
A winner has 40% probability of getting just $250k and 30% probability of getting $333k.
----
Edit: Or maybe you tried to say something like the following but didn't get it right because "average winners" means different things when you win and when you don't.
> Average Jackpot prize is JackpotPool/Average winners when there are one or more winners
> Average Jackpot prize given you win is JackpotPool/(1+Average winners when there are zero or more winners).
What you care about, is the expected amount you win, given that you have a winning ticket.
Let's say there are N players, and let's say anyone has a 1 in X independent chance to win.
If you don't buy a ticket, there are N/X expected winners.
If you do buy a ticket, it doesn't affect whether other people win or not.
There are still N/X expected other winners.
Your participation doesn't reduce the expected number of people, who are not yourself, that will win.
This isn't a Monty hall problem, because Monty Hall introduced new information.
Buying a ticket doesn't introduce new information.
With Prob of (X-1)/X, you lose, and go home unhappy.
With Prob of 1/X, you win. And now there are 1 + N winners.
Your buying a ticket therefore increased the overall expected number of winners by 1/X. That is correct.
Conditioned on you winning, there are 1+N expected winners.
Conditioned on you losing, there are N expected winners.
Conditioned on you losing, there are N expected winners. The number of winners can be zero and the average prize cannot be calculated dividing the jackpot by the N expected winners [edit: not that you could before...]. [edit: the following is not correct "You have to divide the jackpot by a higher number: the expected winners conditional on having at least one."] No winner, no prize.
---
Let's say there are 2 people playing and the probability of winning is 50%. The number of expected winners is 1. If the jackpot is $1000 the "average lottery winner" doesn't get $1000.
Three outcomes are possible, with the following probabilities:
1/4 zero winners
1/2 one winner gets $1000
1/4 two winners get $500 each
The "average lottery winner" gets less than $1000. The "average lottery winner" gets $750. (Imagine that a lot of draws have happened: for each split jackpot there were two jackpots going to a single winnner. All in all, half the winners got $1000 and the other half got $500.)Consider now that you are one of the two players and you win. The other person will either win (you get $500) or not (you get $1000) with the same probability. Your expected prize? $750
What a coincidence!
On the other hand, your analytically computed expected winning is indeed less than an analytically computed expected average prize, when conditioned on the fact that you won, because you are more likely than not to be in a lottery that has more winners than the average lottery. This is mathematically the same phenomenon as the thing where the perceived average class size if you sample random students is greater than the actual average class size, because more students will be in the larger classes. This doesn't mean every class is larger than the average class, which is not possible. It just means that if you randomly select a student, you have a better than 50/50 chance of selecting someone in a larger than average class.
I think this is a good hint that the conclusion isn't true. Just think about what it would mean if this were true for a sample of lotto winners. For a winner, if they win, their average number of winners is higher than the global average. Repeat this logic for each individual winner... And every winner wins with a higher number of winners than the average. Which is clearly impossible.
It would be true if you were guaranteed to win, since that's the assumption you have conditioned the probability on, but that's not a lottery then. If you want to get the actual expected value across all samples you need to take a weighted sum including the expected value when you don't win.
It's just like the average pupil being in a larger than average class size, it's not impossible!
Take a situation where you have 499 lotteries with zero winners, and 1 lottery with 1000 winners.
There are on average 2 winners per lottery.
From the perspective of all the winners, there was an average of 1000 winners.
That's the very basis of the paradox in the article.
Now, in that case, the lottery would be investigated for fraud. But the paradox plays out in a much gentler sense.
1/10 odds, 10 entrants, one winner expected on average.
Given a particular winner: Expect: 0.9 + 1 winners
Given the same particular loser: Expect: 0.9 winners
Over all cases we see: 0.1(1.9) + 0.9(0.9) = 1 winners
Checks out, but if the numbers are correct then any winner should be able to calculate the higher average and be right knowing only that there is at least one winner. So in cases where there is at least one winner: P(winners>=1)=1-(9/10)^10=~65% The expectation should work out to 1.9. The rest of the time we expect zero winners. However if I use those numbers I get an overall expected number of winners as 1.237, which has increased the overall number of winners across all cases. In order for that number to work out to one, the expected winners when there is at least one winner would have to be ~1.535. Which suggests that the expected outcome is different depending on if you check your own ticket, or someone else's, even if you see the same thing?
Am I just not on for math today? I thought the solution to the paradox would be that the higher expectation discounts outcomes with zero winners.
Sorry, but no! The total number of expected winners (including you) is the same as the average number of winners.
If the odds of winning are 1 in 14 million, and 28 million tickets are sold, then you expect there to be 2 winners.
If look at your ticket and see you've won the lottery, then the odds of winners are still 1 in 14 million, and out of the 27,999,999 other tickets sold, you expect 2 other winners, and now expect 3 winners total, given you have won.
Instead of 1 in 14 million, we'll just do 1 in 2, and 8 players.
So we'll check how many bits are set in the average random byte:
void Main()
{
byte[] buffer = new byte[256*1024];
Random.Shared.NextBytes(buffer);
var avg = buffer.Average(b => System.Runtime.Intrinsics.X86.Popcnt.PopCount(b));
Console.WriteLine(avg);
}
Okay, bounces around 3.998 to 4.001, seems normal.Now let's check how many bits are set in the average random byte given that the low bit is 1 (i.e. player 1 has won!)
void Main()
{
byte[] buffer = new byte[256*1024];
Random.Shared.NextBytes(buffer);
var avg = buffer
.Where(b => (b & ((byte)0x01)) == 0x01)
.Average(b => System.Runtime.Intrinsics.X86.Popcnt.PopCount(b));
Console.WriteLine(avg);
}
Now ~=4.500Which is 1+3.5
In this case, we're 1+ average from the 7 other players, so being an average of 7 others not 8 others is significant.
If we simulate with millions of players, you'll see that removing 1 person from the pool makes essentially no difference.
If you have a ticket and haven’t checked that it is winning, you should expect two winners, regardless of whether you end up being one of them.
If you play the lottery trillions of times (always with the same odds, for simplicity) and build up a frequentist sample of winning events, you will on average be part of a pool of two winners in those instances where you win.
You snuck in the assumption that the first ticket checked (yours) is a winner, which screws up the statistics.
The reason is similar to the Monty Hall Problem (https://en.wikipedia.org/wiki/Monty_Hall_problem)
To understand, lets think about the simplest representation of this problem... 2 people playing the lottery, and a 50/50 chance to win.
So, we can map out all the possible combinations:
A wins (50%) and B wins (50%) - 25% of the time
A wins (50%) and B loses (50%) - 25% of the time
A loses (50%) and B wins (50%) - 25% of the time
A loses (50%) and B loses (50%) - 25% of the time
So we have 4 even outcomes, so to figure out the average number of winners, we just add up the total number of winners in all the situations and divide by 4... so two winners in the first scenario, plus one winner in scenario 2, plus one winner in scenario 3, and zero winners in scenario 4, for 4 total winners in all situations... divide that by 4, and we see we have an average of 1 winner per scenario.
This makes sense... with 50/50 chance of winning with 2 people leads to an average of 1 winner per draw.
Now lets see what happens if we check for situations where player A wins; in our example, that is the first two scenarios. We throw out scenario 3 and 4, since player A loses in those two scenarios.
So scenario one has 2 winners (A + B) while scenario two has 1 winner (just A)... so in two (even probability) outcomes where A is a winner, we have a total of 3 winners... divide that 3 by the two scenarios, and we get an average of 1.5 winners per scenario where A is a winner.
Why does this happen? In this simple example it is easy to see why... we removed the 1/4 chance where we have ZERO winners, which was bringing down the average.
This same thing happens no matter how many players and what the odds are... by selecting only the scenarios where a specific player wins, we are removing all the possible outcomes where zero people win.
"The total number of expected winners (including you) is the same as the average number of winners"
means
"The total number of expected winners (including you) is the same as the average number of winners when there is at least one winner"
All the possible outcomes where zero people win are irrelevant when it comes to the calculation of how much "the average lottery winner" wins.
However, if A wins, A wins either $3 (case 1) or $6 (case 2), so A's expected winnings are $4.5, which is indeed < $5, as GGP asserted.
The number of winners you expect depends on what information you have, namely, whether or not you know that you are holding a winning lottery ticket or not!
Maximizing the minutes doesn't track but people are irrational. When I got an e-cig my use went way, way higher.
Thanks for the tip!
Who is arriving in the first part of the sentence? At first I thought he meant the bus arrival, thus N = 10, and 2N would be 20. But then he says
>The average wait time is also close to 10 minutes, just as the waiting time paradox predicted.
10 isn't 20 so ???
> when the average span between arrivals is [10] minutes, the average span experienced by riders is [20] minutes.
>The average wait time is also close to 10 minutes, just as the waiting time paradox predicted.
The average wait time is half the 'average span experienced by riders', since the rider arrives, on average, halfway through the average span.
A bit like usnig the metro. You don't know the schedule, you just know the realative time to the next train
That is, they sound like similar questions, but they are not. How long can one random person expect to wait at a stop is different from how long a population will wait at a given spot. In large because a person can only arrive at a single time in the waiting interval, but more passengers become less likely the closer to departure time.
(I realize I didn't word all of this as a question, but I am not asserting I'm correct here. Genuinely curious if I understand correctly.)
Here's a trivial example.
Buses are supposed to arrive at a 10 minute interval: 12:00, 12:10 and 12:20. But today the second bus arrives a bit early, at 12:07. So they arrive at 12:00, 12:07 and 12:20. We arrive at the bus stop at a random moment >12:00 and <= 12:20.
If we arrive in the interval 12:00-12:07, our average waiting time will be 3.5 minutes. What's the chance that we do arrive in this interval? 7 mins/20 mins.
If we arrive in the interval 12:07-12:20, our average waiting time will be 6.5 minutes. What's the chance that we do arrive in this interval? 13 mins/20 mins.
So our expected waiting time is not 5 minutes but 3.5 * 7/20 + 6.5 * 13/20 = 5.45.
Basically "the shit intervals are longer so we're more likely to arrive in them. the lucky intervals are shorter so we're less likely to arrive in them.". If we arrive at a random time, which is the core assumption here.
Now you might say "but 5.45 doesn't feel close to 2N". And that's where the other assumption that probably does not reflect reality comes in - the bus arrival times are simulated as uniform random numbers. I mean, it depends on where you live, haha. But it's pretty much a worst case scenario, so in reality it's not as bad. Which the writer shows using the real-world data.
Nevertheless, unless it's the Japanese subway which always arrives exactly on time, it's always going to be bigger than 2N.
And what if we don't arrive at a random time, but arrive according to some pattern guided by the bus schedule? That change everything.
Still, it's actually pretty common to arrive at a random time, and buses (and some subways, or other things in life) do tend to arrive not exactly on time, in which case it holds. To some extent.
If both are completely uniformly random, the mean waiting time will be the mean interval between buses. (In fact the distribution of the passenger arrival doesn't matter anymore.)
The real world is somewhere between those two.
> If buses arrive exactly every ten minutes, it's true that your average wait time will be half that interval: 5 minutes.
Which means that "not arriving exactly on schedule" is indeed a requirement.
As the article notes, it's the same reason the average coin in a sequence of tosses will be in a longer run than the average run length.
someone comes to a subway station at (uniform) random times between 6p and 8p; he notices that the first train he observes arriving at the same station is 3 times more often inbound than outbound. He also knows that time intervals between the trains going in the opposite directions are fixed and equal — say, always 6 minutes, so the only random event here is when this person arrives at the platform. Explain how this is possible.
But the bigger question: What's the difference between "an inbound train" and "an outbound train"? Aren't almost all trains usually both inbound and outbound? First they arrive at a station, then they go on to the next. Or even at a "terminus"-type station; first they arrive at the terminus, then they go back in the other direction. How does he decide whether a train is an inbound or an outbound one, while it is standing still?
Past discussion: https://news.ycombinator.com/item?id=18321062
edit: interesting post with a different ending than I imagined.
Been thinking about using some statistical methods to give me some better estimates of the busses I take to work. Like "given that it's $today, which is a Tuesday, it's 17:30, and the display says the bus is 7 minutes delayed, how long til it will actually come?
Anything would be better than what we have. When I studied NextBus predictions for the SF Muni 1-California line I found that the predicted arrival time was not even correlated with the actual arrival time. If they had taken all the radios and computers out of the system and just showed a random number as the minutes to arrival that would have been every bit as good as NextBus.
Bold of you to assume they hadn't already done that.
Remember, lowest bidder wins the contract.
The N Judah is usually on time or a little early, except going outbound between 6:30pm and 7:30pm. If you’re waiting for the F, you should mentally add 2 minutes to whatever time you see. The J Church going downtown becomes increasingly late the closer to downtown it actually gets (partly because it often loses the signal lottery with the N Judah since it gets stalled out at the Market Street intersection even if it was scheduled to go in ahead of time). When the L trains were running, it would always seem to depart from the Zoo-side terminus on time if you were waiting there, but if you were waiting up the street on Taraval, you could reliably add 5 to 10 minutes to your wait time.
Also at the Embarcadero, there can never be two working upwards escalators going from the MUNI platform to the eastern exits at the same time. It simply cannot happen. If one gets fixed, the other will break, even if it was just fixed a few days ago.
Some discussion then: https://news.ycombinator.com/item?id=18321062
OK sometimes the app / bus location system fucks up but most of the time or their are unexpected road road work or traffic accident that suddently forces it to be slower but most of the time it is pretty much accurate.
I really enjoy having 10-20 lines that produces the expectation value directly by simulation; that's a fast way for me to understand the underlying values.
One way to simulate "random" arrival time is to draw uniform points in the interval [0, N * tau].
It turns out the inter-arrival time generated this way is approximately exponential:
1. the difference of consecutive ordered uniformly distribution random variables follows a Beta(1, N) distribution [1].
2. As N goes to infinity, N * Beta(1, N) converges to Exponential(1) [2].
3. Since we scale the rand() by N * tau, the inter arrival time will follow an Exponential(1 / tau) distribution (as N goes to infinity), which has an expected value of tau [3].
Edit: I just realized that the author did mention this simulation is only an approximation in the side note.
[1] https://en.wikipedia.org/wiki/Order_statistic#The_joint_dist...
[2] https://en.wikipedia.org/wiki/Beta_distribution#Special_and_...
[3] https://en.wikipedia.org/wiki/Exponential_distribution#Relat...