# Empirical PDF from Empirical CDF

(cross post)

Suppose I do an experiment $N$ times and get a vector $X$ of results. Let $C_X(y)$ be the empirical cumulative distribution function of $X$. Suppose $X$ is sorted so that $x_1 \leq x_2 \cdots \leq x_N$. Approximately,
$C_X(y)=0\textrm{ if }y \leq x \textrm{ for all }x \in X$
$C_X(y)=1\textrm{ if }y > x \textrm{ for all }x \in X$
$C_X(y)=\frac{i+\frac{y-x_i}{x_{i+1}-x_i}}{N} \textrm{ if } x_i \leq y \leq x_{i+1}$

Question: What is the most efficient way to compute the corresponding empirical PDF of $X$? Just interpolate through the histogram?

# Two-step empirical CDF from one-step empirical CDF

(cross-post)

Suppose I have a random variable $X_i$ which changes by $X_{i+1}=X_i+\delta_i$ from one timestep to the next. Suppose I do an experiment where I observe $N$ values $d_1,d_2,\ldots,d_N$ of $\delta_0$ and make an experimental CDF of $\delta_0$, by sorting $d$ so that $d_1 \leq d_2 \cdots \leq d_N$, and then approximating the CDF of $y$ as $\frac{i}{N}$ where $d_i \leq y \leq d_{i+1}$.

Question: What is the most efficient way to compute the empirical CDF of two steps of $X$, assuming that the process for going from $X_i$ to $X_{i+1}$ follows the same empirical distribution? The brute force way that occurs to me is to create the set $E={d_i+d_j: 1\leq i\leq N, 1\leq j\leq N}$, sorting $E=e_1,\ldots,e_{N^2}$ and then approximating the two-step CDF of $y$ as $\frac{i}{N^2}$ where $e_i \leq y \leq e_{i+1}$.

# A night with Bernie and a few nights at the Borgata

I saw Bernie Sanders speech at the Riverside Church in Manhattan on August 28th. Bernie was OK, 1000 people in attendance, but I’m still not feeling the way forward for him.  It was all old hippies, 60+ average age, a few young people, but mostly lefties and a few Republicans sneaking into to silently sneer.  Harper’s Magazine sponsored, now casting itself as the anti-Washington Post honest liberal media.  WaPo under Jeff Bezos is now just The Man.  The Democratic Party is also just The Man and not in the corner of the working class.  I hope Bernie’s stuff takes off and doesn’t get lost in the noise, but I haven’t seen coherent action from them since he bent the knee for Hillary.

Then it was off to Atlantic City where I scored a few hundred up playing poker and then as I settled in and got the measure of who I was playing with and got chicken, a few hundred back down.  Net net I think I contributed about \$120 to the economy of a little old lady named Evelyn and several other Atlantic City senior citizens who spend their mornings in the Borgata Poker Room.

Borgata is a confusing maze of slot machines.  The Water Club is a nice hotel within the casino, they have a spa with a great salt water lap pool on the 34th floor.  I sort of enjoyed that, but not as much as if I was 35 and it was first time at the rodeo.

Borgata is  run by MGM Grand with some help from Steve Wynn.  For a look at Revel, which tried to be the subsequent rival and was designed instead by Morgan Stanley, check this out.

I stayed for 2 nights at the Borgata with a friend who was comped the room based on his mini Baccarat play. I play 1/2 No Limit Texas Hold Em which is basically a trailer trash game that is a loss leader for the casino, so they don’t comp as well for that.

Borgata is the most Vegas-like casino in Atlantic City and the freshest overall. That said, it was new in 2003 and I don’t think it has been seriously updated since then. The door to our room wouldn’t shut without a good tug. The knob was missing on the light between the beds. The metal toilet paper holder was pulled out a bit from the wall. These are minor details that did not impact my stay, but speak of a limited maintenance budget and a certain slide in the willingness to maintain (room 976 or 978 if management is listening; trying opening the door to both rooms and then let it close on it’s own and see what happens).

Ditto the poker room. I’ve been to the poker rooms in the Tropicana (the best overall in terms of attentiveness to the players and an overall poker atmosphere, and has touches like serving food at the table, which the Borgata doesn’t do), the Taj Mahal (most like a bus station waiting room in terms of vibe) and the Golden Nugget. I first visited the Borgata poker room in 2003 when it first opened. At that time, it seemed quite modern, expensive and imposing, with it’s tables that shuffled the cards automatically for the dealers (at the Trop at that time, dealers were still shuffling their own cards; the game moves faster with the machines, a mixed blessing; some smaller newer casinos on Indian reservations take it to the limit and cut out the dealer altogether, which is not an experience I would travel for). Cut to 2017: Exact same room, same tables, same chairs. We walked in, at 12PM on a Monday night. It was hard to find the floor manager for cash games. I went to look for the floor manager for tournaments. It took a while to find him. When I asked him details on tournaments the next day, he had to fumble around in a computer for a URL and look it up off the website, which I could do myself. He seemed tired and didn’t seem to know his own floor. The night floor manager for cash games also seemed tired and listless. The Borgata’s poker room, it seems, has morphed into the Taj poker room. Beaten down, tired, a haven for grinders, with 8 grinders to 1 or 2 fish per table, and grinders moving around the room, leaving their chips on one table while playing at the next. It wasn’t really much fun to play there.

On the plus side, the Water Club has a nice spa, with an exceptional lap pool and hot tub area. The steam room was OK, but could have used a lot more eucalyptus scent. The attendant sprayed some for me, but it really didn’t have much punch.

The restaurants were OK, a bit formulaic. These were crowded at meal times with long lines. So they are doing something right.

One more minus is that the casino allows smoking on the floor at designated spots. The ventilation is not strong enough to eliminate the smoke odor, and as a result, the smell of tobacco ash is inescapable during endless walks from point A to point B, the result of an intentionally confusing layout intended to maximize gaming revenue. Smokers are said to have less self-control and consequently to wager more, and so are prioritized by casinos.

They had a free comedy night. 3 geriatric comedians entertained an equally greying audience, with mild humor. The comedians sold their CDs in the lobby afterwards. Another desperate lifestyle, along with the poker players.

As we attempted to make merry in this place, people were drowning and seeing their homes swept away in the Houston hurricane deluge, and North Korea was lobbing missiles over Japan. This made it also a little hard to really let go, as it seemed rather self-indulgent. In my defense, I did preface the casino stay with attendance at a Bernie Sanders speech in a church, so I hope that compensated for the rest.

# Rigorous derivation of dΠ for stock with continuous dividend

Posted on StackExchange, but they have a nasty habit of deleting unanswered questions after a while, in an irrecoverable way, so I’m going to re-post all my random questions here as I go along in life.  (You can see dead questions if you know the URL, they keep it around, but if you lose the URL, forget about it.)  So….

Suppose we are holding a replicating portfolio $\Pi_t$ of long an option $f(S,t)$ and short some stock, so $\Pi_t=f(S_t,t)-\Delta_t S_t$ Suppose the stock follows geometric Brownian motion and pays continuous dividends at rate $q$, so $d S_t = S_t((\mu-q)dt + \sigma dW_t$ Naively, $d\Pi_t = d f(S_t,t)-\Delta_t dS_t$ However, because the stock pays a dividend, common sense and the literature tell us that $d\Pi_t=df(S_t,t)-\Delta_t dS_t-\Delta_t S_t dt$

Question: How do we rigorously arrive at the total derivative for $d\Pi_t$ which includes extra term $-\Delta_t S_t dt$, given that we know $\Pi_t=f(S_t,t)-\Delta_t S_t$, without appeal to common sense i.e., from the equations, without recalling the mechanics of how the stock works? Because, naively, I would not include the extra term, if I just knew the equation defining $\Pi_t$ and nothing about the mechanics of the stock.

# Date range search fields in Django: Take your rant to your blog, mister!

This is something I figured out but it was horribly difficult and took me a week and 10 cups of coffee to figure out.  I posted a soluion on StackExchange. Because I noted the #cups of coffee I got two immediate downvotes and angry messages from some gurus who spend all their time on StackExchange:

This is not the right place to post your rants. Please consider posting this in your blog or somewhere.

and

This really isn’t the place for a rant disguised as a question. If you want to request this specific feature, you can open a ticket. If you just want to put this out there for future reference, you can ask a question on how to do it, and add your own answer. Either way, please use a more constructive tone.

I edited out the snark and now their comments look overheated, because the post is now entirely dry and technical.  I hope they leave their castigations up so I can have some exciting controversy at the bottom of the post, which is as stimulating without the color as a description of how to install a replacement toilet handle.