A computer program (RFAC) has been developed, which allows the automated estimation of residual indices (R-factors) for protein NMR structures and gives a reliable measure for the quality of the structures. The R-factor calculation is based on the comparison of experimental and simulated 1H NOESY NMR spectra. The approach comprises an automatic peak picking and a Bayesian analysis of the data, followed by an automated structure based assignment of the NOESY spectra and the calculation of the R-factor. The major difference to previously published R-factor definitions is that we take the non-assigned experimental peaks into account as well. The number and the intensities of the non-assigned signals are an important measure for the quality of an NMR structure. It turns out that for different problems optimally adapted R-factors should be used which are defined in the paper. The program allows to compute a global R-factor, different R-factors for the intra residual NOEs, the inter residual NOEs, sequential NOEs, medium range NOEs and long range NOEs. Furthermore, R-factors can be calculated for various user defined parts of the molecule or it is possible to obtain a residue-by-residue R-factor. Another possibility is to sort the R-factors according to their corresponding distances. The summary of all these different R-factors should allow the user to judge the structure in detail. The new program has been successfully tested on two medium sized proteins, the cold shock protein (TmCsp) from Termotoga maritima and the histidine containing protein (HPr) from Staphylococcus carnosus. A comparison with a previously published R-factor definition shows that our approach is more sensitive to errors in the calculated structure