Rosie goes to the door when she needs to pee, but sometimes she pees in the house when she's mad at us. Today, she was at my neighbor's. When he wasn't paying attention to her, she got mad because he wasn't paying attention to her and peed on him

Any suggestions on how to correct this behavior?