This function calculates D11 and D22 for the CrossNN test.
getD(distM,treated.index)
The distance matrix for the pooled observations (pooled over the treated subjects and the matched controls). If there are n treated subjects and n matched controls, then this distance matrix is a 2n by 2n matrix with the [i,j] element the distance between observation i and observation j. What distance to use is decided by users. Some simple choices are the Euclidean distance, L1 distance, and mahalanobis distance.
The subject indices of the treated subjects. The subjects are ordered in the same way as for calculating the distance matrix, distM.