Is it ethical to do phd thesis about topic someone else did it before?
It doesn't sound like there's an ethical problem here -- as long as you appropriately credit the earlier work. (That is, prominently cite the prior work and clearly explain the relationship.)

However, you should note that re-doing someone else's work with minor changes will generally be viewed as less significant and novel than the original work. In particular, doing almost the same analysis as someone else's PhD thesis is likely not sufficient for another PhD. 

That said, it is valuable (and often publishable) to re-do prior work. This is helpful to you and the community, and could form part of your PhD.