Model for correlations in stock markets