More affluent areas of Massachusetts—not surprisingly—tend to have higher quality nursing homes, according to an Associated Press review of federal data. The AP review of Centers for Medicare and Medicaid Services data found the quality of nursing homes varies widely by region, but better care is often found in areas with higher income levels. The agency studied factors such as staffing levels and annual health inspections before ranking nearly 16,000 nursing homes in the country with one to five stars.