implementing EM for doctimerel
first version of EM for doctimerel