getmarginals function

Internal function called by fitAbn.bayes.