nested_analysis function

Perform an analysis on a nested data matrix