Generally, yes. You can leave even if your healthcare provider thinks you should stay. But it will be documented in your record as discharged against medical advice (AMA).