added function to calculate marginals from simulation, added test, added test for joints distribution of states in binary network