We introduce an improved multi-factor credit risk model describing simultaneously the default rate and the loss given default. Our methodology is based on the KMV model, which we generalize in three ways. First, we add a model for loss given default (LGD), second, we bring dynamics to the model, and third, we allow non-normal distributions of risk factors. Both the defaults and the LGD are driven by a common factor and an individual factor; the individual factors are mutually independent, but we allow any form of dependence of the common factors. We test our model on a nationwide portfolio of US mortgage delinquencies, modeling the dependence of the common factor by a VECM model, and compare our results with the current regulatory framework, which is described in the Basel II Accord. * Support from the Czech Science Foundation under grants 402/09/H045 and 402/09/0965 and from Charles University under grant GAUK 46108 is gratefully acknowledged. The authors are also grateful to Jan Voříšek for valuable comments and the idea of using the VECM model for the description of the factors. 1 PD and LGD are usually referred to as risk factors; however, in this paper we call them "indicators" in order to verbally distinguish between these main quantities and the factors that drive them.