Foundations of statistical theory