compute expectations