Here's how your social life could affect your dementia risk.