output matches output of stan's code