basic heirachrical model code for 476 final project