stat545a hw6: putting it all together