Thursday, December 11, 2014

Heath Bar Saltine Toffee Bark



We had a bake sale in the office a few weeks ago that inspired this post!  I tried this dessert which is essentially saltines covered in toffee, chocolate. That just sounds amazing, right? The good news it tastes just as amazing! The salty crackers pair so well with the crunchy toffee and sweet chocolate.  You can also top it with whatever topping you like! For this recipe, I topped the saltine toffee bark with heath bars and colored sugar.

As we are now in midst of the holiday season, I hope this inspires you to bring it to a holiday party or gathering.  It is even a perfect treat for gifts to the people you have no idea what to buy.

Ingredients
- 2 packs of salted saltine crackers 
- 1 cup unsalted butter (2 sticks)
- 1 cup brown sugar
- 2 cups semi-sweet chocolate chips
- optional toppings: heath bar, peanuts, pecans

Note: You can use unsalted saltines and salted butter or salted saltines and unsalted butter (not both!)

Recipe
1) Preheat the oven to 400F. Double line a cookie sheet with aluminum foil (you definitely want the double lined part, trust me).  Add saltine crackers to the cookie sheet in a flat layer. 


2) Melt the butter and sugar together in a sauce pan over medium heat.  Bring it to a boil and let it boil for 3 minutes.  You do not need to stir once the mixture comes to a boil.  At this point, the toffee is ready to go!


3) Pour the toffee over the saltines and spread it out evenly.  Bake for 6 minutes in a preheated oven at 400F.  This is what the toffee and saltines should look like when it comes out of the oven. Bubbly magic.


4)  At this point, the toffee is incredibly hot, so be careful to not burn yourself.  Add the chocolate chips evenly across the toffee while it is still hot.  After a few minutes, the chips will have started to melt.  


5) Spread the melted chocolate across with a knife. Let the chocolate cool for 5 minutes.


6) After five minutes, add a layer of toppings.  Here I used a chopped up heath bar and red & white sugar.  Let the pan cool at room temperature for 20-30 minutes. Afterward you can put the pan in the refrigerator to set up and firm up even more.




After the chocolate toffee has cooled, break it up into giant pieces of bark and enjoy! 


Friday, December 5, 2014

quantro

The last year Rafa (@rafalab) and I have been hard at work on an R-package called quantro that can help you decide on how best to normalize your noisy high-throughput data such as DNA methylationRNASeq and ChIPSeq. One of the most successful and widely applied multi-sample normalization methods, quantile normalization, is a global normalization method and based on a set of assumptions that are not always appropriate depending on the type and source of variation. Until now, it has been left to the researcher to decide if these assumptions are appropriate.  quantro is a data-driven method to test for the assumptions of global normalization methods and helps researchers decide on "when to use quantile normalization?".

I am happy to announce quantro was accepted as an R-package in the Bioconductor 3.0 release this fall and a pre-print of the manuscript has been posted on bioRxiv today!    There is vignette is available to give an example of how the package works using the FlowSorted.DLPFC.450k data package in Bioconductor.

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!


Friday, October 17, 2014

Fall in Love with Apple Crisp

Fall is in full swing around here. We have had a few rainy days, the leaves are starting to change colors and the cool weather is descending upon us.  In fall, one of my favorite things to make is my mom's apple crisp!

I have great memories of watching her make a warm soup or spaghetti to go along with the apple crisp.  This is probably one of my favorite desserts next to a dark chocolate mousse! The best part is the apples do not need to be sweetened up with any sugar.  Between the naturally sweet apple pieces and sweet crunchy topping, you won't miss the extra sugar!



To make the apple crisp, you can go to the store to buy the ingredients, but if you live near an orchard, I highly suggest going to pick your own.  This is the second year wear have been able to pick our own apples at a local orchard and we always come back with at least 1/2 bushel of apples.  The picture below 1/4 of a bushel because the other 1/4 went home with a friend of mine who came to visit Boston.  I want to say it was around 35 apples.



To make the apple crisp you need the following ingredients

Ingredients
- 4-5 large apples
- 1/2 cup butter (1 stick)
- 1 cup brown sugar
- 1/2 cup all-purpose flour
- 1 cup old-fashioned oats
- pinch of salt and cinnamon
- 1/2 teaspoon vanilla

Recipe

1) Start by combining the flour and oats. 


2) Next, mix in the cinnamon and salt with the flour mixture.


3) In a separate bowl mix the brown sugar, butter and vanilla until well blended. Add the flour mixture to the brown sugar mixture.  The topping should be crumbly.


4) Peel and quarter the apples. Cut the quarters into even thinner pieces if you want slices instead of quarters of apples.  Place the apples in an 8x8 baking pan.  


5) Finally, add the topping to the sliced apples and bake at 350 degrees for 20 minutes.  The apples should just be starting to get soft, but not mushy.  The crumble topping should also be getting crispy.  Hopefully you will enjoy it as much as I do this time of the year!  

Monday, October 13, 2014

Where did summer go??

I can hardly believe summer has come and gone already.  This was arguably one of the busiest summers I've ever had.  Unfortunately, that left very little time to blog about everything going on.  I want to remedy that and get back into blogging regularly.  I apologize already for all the pictures coming in this post, but I decided to do one long post recapping summer rather than several short ones.

Summer kicked off with my sister's beautiful wedding in early May.  The wedding was held outdoors at Cedar Bend Events around 20 miles south of Austin, TX. Their ceremony started with both her and her husband dancing down the aisle to Happy by Pharell Williams.  If you know my sister, it was very fitting!


All of the bridesmaids and flower girls were asked to wear floral dresses and cowboy boots which turned out to be a lot of fun! The only problem was trying to find cowboy boots in the middle of March in Boston. It was worth the search though! 


One of my favorite pictures was this one [left to right] of me, my mom and my sister Vanessa.


We had so many friends and family there to celebrate with Vanessa & Cory on their wedding day.  The day turned out absolutely perfect and I couldn't be happier for both of them.  


Two weeks later I was off to the inaugural Women in Statistics Conference held in Cary, NC. That was one of the two events I did blog about this summer, so rather than elaborating on it again, I encourage you to read the blogs linked above.  I will say this: the entire conference has had a lasting effect on me.  I love the old friends and new friends I was able to meet.  New opportunities have come out of it, and I am very grateful that I was able to be a part of the conference. I look forward to the next one!

On a more heavy-hearted note, we lost my grandmother to cancer at the beginning of June. She had been battling cancer for several years now, but it was still very hard on our family.  This is an older picture of my sister and I with her from Easter many years ago.


We were fortunate enough to have all of the family come together for the funeral in Concord, CA. The picture below was taken at The Warehouse Cafe in Port Costa


We took this picture of my dad with his two brothers and dad (my grandfather) by the railroad tracks and the water next to the restaurant.


Somewhere in the middle of the summer, Chris and I found time to explore Boston a little bit too.  We canoed down the Charles River (twice!): 


We attended our first Red Sox game:



We made our first lobster rolls:


and took a duck boat tour around Boston with an out of town guest who came to visit us!


At the end of June, we had our annual BCB Department Retreat which was very informative and fun including catching the end of one of the world cup matches at lunch time!


At the end of July, there were two major conferences happening back to back: Bioconductor Conference (BioC 2014) and the Joint Statistical Meetings (JSM 2014), both held in Boston this year. I had never attended a Bioconductor conference, but I really enjoyed meeting the major contributors and developers behind it. Here is a picture from BioC developer day:


Here are two pictures fom JSM advertising the This is Statistics campaign:


In addition to the conferences, I also found time to fit in progress on my research.  I submitted an R package to Bioconductor called quantro and it was successfully accepted a few weeks later!  Also, one of my projects required some of my calculus to be dusted off the shelf, so I drew this to explain my feelings on the subject at the time. :)


Finally, the biggest news of the summer was I got married Labor Day weekend!  I figured I had already maxed out my photo quota for one blog post, so stay tuned for that in the next post.  For now I leave you with this picture of our penguin cake topper which was designed, 3D printed [design available on thingiverse] and painted by my husband Chris! :)


I promise to get back to my usual posts very soon!  I hope everyone had a restful and productive summer.

Friday, June 13, 2014

World Cup and Word Clouds in R

Yesterday two cool things happened. Wait, three cool things happened. It was the start of the 2014 World Cup, brazil was the first time to score in the world cup (in their own goal oops!) and I learned how to create word clouds in R! Here is a tutorial on how to create word clouds in R with a world cup theme.


Whether you have a set of words already or you are interested in scraping data from social media sites such as Twitter, beautiful word clouds in R are only a few steps away with the help of some fantastic R-packages.


Set up Twitter authentication with R
If you are interested in obtaining a set of tweets with a hashtag (e.g. #worldcup), there are a few steps you must complete first.  As with all new relationships, it begins with a "handshake". This handshake is essentially a communication between you and and the Twitter server telling the two systems the type of information to be communicated. This entails the following five steps:

1. Go to https://dev.twitter.com and sign in using your twitter account.  Your picture will appear in the top right corner. Hover over the picture and click on My Applications.  If this is your first application, click on the Create a New App. Fill out the required application details which includes a Name, Description and Website.  None of this really matters, so just fill it in with whatever you wish.

2. Once you have created your app, you will see some details related to the OAuth Settings.  This will include a Consumer Key, Consumer secret, Request token URL, Authorize URL, Access token URL, Callback URL.  Keep all this information handy as you will need it in just a minute.

3. Load the Rcurl package and set the SSL certifications globally

library(RCurl)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))

4. Open up R or Rstudio and load the twitteR R-package

install.packages("twitterR")
library(twitteR)

5.  Once the twitteR package is loaded, type the following in R

reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"
apiKey <- "yourAPIKey"
apiSecret <- "yourAPISecret"
twitCred <- OAuthFactory$new(consumerKey=apiKey,consumerSecret=apiSecret,requestURL=reqURL,accessURL=accessURL,authURL=authURL)
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
registerTwitterOAuth(twitCred)

The yourAPIkey and yourAPISecret should be changed with your key found on your twitter application page.  The second to last step will ask you to go to a specific URL and enter the code found on the webpage in R.  If all went well, you have successful had a handshake with Twitter!


Get tweets using searchTwitter()
First, we can obtain a set of tweets containing a searchString. This searchString can be a hashtag or just a string of characters in quotations.  Here I will get a set of tweets containing the hashtag #worldcup.

mytweets <- searchTwitter("#worldcup", n = 100, cainfo = "cacert.pem")
length(mytweets)


Clean tweets using clean.tweets()
Load the following R-packages and extract the text portion from the tweet using getText():

library(tm)
library(wordcloud)
library(RColorBrewer)
library(plyr)
mytweets.text <- laply(mytweets, function(x) x$getText() )

Using a function clean.tweets() from this gist (originally obtained from here), we can remove invalid characters that cannot be analyzed.

clean_text = clean.tweets(tweets.text)


Create a word cloud using tweets
tweet_corpus = Corpus(VectorSource(clean_text))
tdm = TermDocumentMatrix(tweet_corpus, control = list(removePunctuation = TRUE, 
  stopwords = c("machine", "learning", stopwords("english")), 
removeNumbers = TRUE, tolower = TRUE))
m = as.matrix(tdm)
word_freqs = sort(rowSums(m), decreasing=TRUE)
dm = data.frame(word=names(word_freqs), freq=word_freqs)
wordcloud(dm[,1], dm[,2], random.order=FALSE, colors=brewer.pal(8, "Dark2")) 


Additional Resources