Transcutaneous electrical and magnetic nerve stimulation devices are disclosed, along with methods of averting imminent medical attacks using energy that is delivered noninvasively by the devices. The attacks comprise asthma attack, epileptic seizure, attacks of migraine headache, transient ischemic attack or stroke, onset of atrial fibrillation, myocardial infarction, onset of ventricular fibrillation or tachycardia, panic attack, and attacks of acute depression. The imminence of an attack is forecasted using grey-box or black-box models as used in control theory. In preferred embodiments of the disclosed methods, a vagus nerve in the neck of a patient is stimulated noninvasively to avert the attack.