Median estimation through a regression transformation