Language acquisition involves learning nonadjacent dependencies that can exist between words in a sentence. Several artificial grammar learning studies have shown that the human ability to detect dependencies between A and B in sequences AXB is influenced by the amount of variation in the X element. This paper presents a model of statistical learning that displays similar behavior on this task and generalizes in a human-like way. The model was also used to predict human behavior for increased distance and more variation in dependencies. We compare this model-based approach with the standard invariance account of the variability effect.