Williams was mis diagnosed with dementia. He was getting medication for one type when he had Lewey Body Dementia. The meds cause depression and suicide when given incorrectly.
Considering that Williams was self-medicating with illegal drugs during the Mork and Mindy years, I think there is a high likelihood that depression predated the medication in his case.