Lost my temper with my child.

We've been trying to potty train my almost 3 year old daughter for 3 weeks now. She just stood in front of the toilet and pissed herself. I lost my cool. I yelled at her and I swatted her on her butt. I don't know what else to do. I've talked to her and she aways tells me she knows she needs to go to the potty when she needs to go. We've tried taking her every 20 mins. We've tried positive reinforcement. I don't know what to do any more.