In most cases, the younger the person is when they get anxiety or depression, the more likely it is to be hereditary. Anxiety and depression can still be genetic if they show up in your older family members. But often, new conditions in people that are over the age of 20 are linked to painful or stressful life events.