revised method to estimate level model

to corret potential error that log a negative number