The effects of cognitive impairment on nursing home residents' emergency department visits and hospitalizations