Ultrametric matrices and factor models