Move calculation of DOF to initialize.R