We examine the dynamics of the bid and ask queues of a limit order book and their relationship with the intensity of trade arrivals. In particular, we study the probability of price movements and trade arrivals as a function of the quote imbalance at the top of the limit order book. We propose a stochastic model in an attempt to capture the joint dynamics of the top of the book queues and the trading process, and describe a semi-analytic approach to calculate the relative probability of market events. We calibrate the model using historical market data and discuss the quality of fit and practical applications of the results.