"Restrain" takes a direct object, and suggests forcibly containing that object, which otherwise would proceed freely, and perhaps forcefully. The metaphorical use you present is common, but be aware that it is metaphorical. To literally "restrain" something is to bind it with physical restraints -- to tie down an animal with ropes or to put shackles on a person, for example. If you say, metaphorically, that you are restraining your anger, it evokes a picture of chaining up a violent beast to prevent it from doing harm.
To "refrain from" is much milder and rather narrower in scope. It describes a rational choice against the specified course of personal action. As such, your first and third examples of this verb don't ring quite true to me:
refraining from something is always deliberate, and emphasizing that by redundantly saying so suggests that what you mean is actually different from refraining
If it is a struggle to avoid some course of action, then avoiding it is not well described as refraining from it. "Restraining" oneself describes that situation better.
Thus, although your example sentences could be rewritten to exchange usage of "restrain" and "refrain", the results would have rather different connotations, and some of them would sound odd. For example, compare "John managed to restrain his anger" with "John refrained from an angry response". They could hardly be more different. The first describes a passionate man near the limit of his self control, whereas the second describes a calm, dispassionate man. Neither makes an angry outburst, but the two pictures are entirely different.