Anticipation is one of the key aspects involved in flexible and adaptive behavior. The ability for an autonomous agent to extract a relevant model of its coupling with the environment and of the environment itself can provide it with a strong advantage for survival. In this work we develop an event-based anticipation framework for performing latent learning and we provide two mathematical tools to identify relevant relationships between events. These tools allow us to build a predictive model which is then embedded in an action-selection architecture to generate adaptive behavior. We first analyze some of the properties of the model in simple learning tasks. Its efficiency is evaluated in a more complex task where the agent has to adapt to a changing environment. In the last section we discuss extensions of the model presented.