added R function for conditionalModel