Implement theta marginalization