Friday, November 28, 2014

Almond Biscotti



Every Christmas, one of the must-haves around our house is biscotti! These a delicious twice-baked cookie that come in many different colors and flavors.  Over the years we have tried many different types, but one of my favorites is the classic almond biscotti. Every Christmas morning we all wake up, head down stairs, each make a big, hot cup of coffee (or tea) and sit down to open our stockings.  By the time the coffee has cooled just enough, we find that Santa has left a personal bag of biscotti in each of our stockings! It's like he can read our minds. :)

This year I set out to learn how to make almond biscotti.  If you are like our family, you will love this recipe!

Ingredients
- 1 cup whole almonds (with skin, toasted, chopped)
- 1 cup sugar
- 1/2 cup unsalted butter (room temperature) 
- 1 tsp vanilla extract
- 2 tsp almond extract
- 3 tbsp brandy
- 3 eggs
- 2 3/4 cups all-purpose flour
- 1 1/2 tsp baking powder
- 1/4 tsp salt

Recipe

1) Start by toasting almonds in a pan for 5-10 mins until light brown and fragrant. Let cool completely and coarsely chop. 


2) Mix together sugar and butter for 2 mins until light and fluffy.  Add brandy, vanilla extract, almond extract and eggs.  In a separate bowl mix together flour, baking powder and salt.  Add 1 tsp of the flour mixture to the coarsely chopped almonds.  This helps the almonds hold into their place. Slowly add the flour mixture to the wet mixture.  Finally, add the almonds to the dough.  Cover and refrigerate dough for 30 minutes.

3) Preheat oven to 350F.  One an un-greased baking sheet, shape dough into two loaves where each loaf is almost the entire length of a cookie sheet (2inches by 16inches). If the dough is sticky, use a little bit of water to help the dough from sticking to your hands.


4) Bake the loaves for 30 minutes. Transfer baked loaves to a cooling rack and let cool for 15 minutes.


5) Using a serrated knife, cut the loaves into 1/2 inch to 3/4 inch slices (I like mine on the thinner side, but this is a personal preference thing).


6) Place the slices baking on the baking sheet and bake for another 20 minutes at 350F.  Transfer the delicious, warm biscotti cookies to a cooling rack.



These will last for up to a week in a sealed container.  I think the flavor intensifies over the next day or so.  Personally, my favorite way to enjoy them is with a nice cup of tea.  Either way just try to restrain yourself from eating them all at once. :)



Monday, November 3, 2014

Halloween Trick-or-Treaters as a Poisson Process

Usually this time of the year I'm blogging about some Halloween-themed cookie recipe or jack-o-lanterns (and roasted pumpkin seeds yum!). This year I thought it would be fun to discuss the idea of a Poisson process and use Halloween as an example.  In this blogpost, I will simulate the number of trick-or-treaters as a Poisson process!



Generally speaking, a Poisson process is a continuous-time process ${N(t), t \geq 0}$ where $N(t)$ counts the number of events that occur in a time interval [0, $t$] and the inter-arrival time of these events in a given time interval. In our case, we can think the Poisson process counting the number of trick-or-treaters in a given time interval. Specifically a Poisson process is characterized by the following properties:
  1. The number of events at time $t$ = 0 is 0 (or $N(0) = 0$)
  2. Stationary increments: the probability distribution of $N(t+h) - N(t)$ depends only on $h$ (not $t$). This means the probability of observing a certain number of trick-or-treaters in a given time interval depends only on the length of the time interval (e.g. 1hr).  
  3. Independent increments: the number of events occurring in disjoint time intervals are independent of each other. You can think of this as the number of trick-or-treaters we see from e.g. 5:30-6:30pm doesn't influence the number of trick-or-treaters we see e.g. 7:30-8:30pm. 
  4. $N(t)$ is distributed as a Poisson distribution.  
Assuming these four properties, we immediately get a free piece of information:
  • Inter-arrival times between the events (or "waiting times") are independent and identically distributed as an exponential random variable with a given rate parameter. Therefore to simulate a Poisson process all we have to do is simulate the inter-arrival times between events using an exponential distribution.  
Now, there are several types of Poisson processes, but for our purposes I will discuss on two: (1) a homogeneous and (2) inhomogeneous Poisson process. The main difference between the two is the rate at which the events occur.  In the homogeneous Poisson process events occur at a constant rate $\lambda$.  In the inhomogenous Poisson process, events occur at a variable rate $\lambda(t)$.  
  • homogenous Poisson process: 
    • The probability of one event in a small interval $h$ is approximately $\lambda h$ where $\lambda$ is a rate parameter. The probability of two events in a small interval is approximately 0.
$$N(t) \sim Poisson(\lambda t)$$
$$P[N(t + s) - N(t) = k] = \frac{e^{-\lambda s} (\lambda s)^{k}}{k!}$$

If we define $S_k$ as the arrival time of the $k^{th}$ events and $X_k = S_k - S_{k-1}$ as the time between the $k^{th}$ and $k-1$ arrival time, then 

$$P(X_k > t | S_{k-1} = s) = e^{-\lambda t}$$
  • inhomogenous Poisson process: 
    • The difference is here the rate parameter varies over time: $\lambda(t)$.  This means we no longer have stationary increments as above because the number of events observed in a given time interval depends on the length of the interval AND the time $t$ itself.  
Let's try an example. Let's simulate the number trick-or-treaters using a homogeneous Poisson process with rate parameter $\lambda$. Using this blogpost as an estimate for the number of trick-or-treaters per minute, I estimated there are 1-2 trick-or-treaters per minute.  As stated above, to simulate the Poisson process, I will simulate the inter-arrival times of the trick-or-treaters using an exponential distribution. The cumulative distribution function of an exponential random variable $T$ is given by

$$u = F(x) = 1 -e^{-\lambda t}$$

As a little background reading, here are two sets of notes on simulating a Poisson process which are particularly useful: here and here.  If the hours for trick-or-treating are around 5:30-8:30pm, the inter-arrival times $X_k$ can be simulated $u \sim U[0,1]$, then we can solve solve for $t$:

$$t = - \frac{\log(u)}{\lambda}$$



One nice extension of this example would be to an inhomogeneous Poisson process where the rate at which the trick-or-treaters arrive varies across time.  I'll leave it to you to try.  Hope everyone had a safe and happy Halloween!