Size-driven phase transition in stress-induced ferroelectric thin films