Using scanWith for marginalize