uint[] stock1Price = [8, 6, 7, 5, 3, 0, 9]; uint[] stock2Price = [3, 1, 4, 1, 5, 9, 2]; uint[] economicHealth = [2, 7, 1, 8, 2, 8, 1]; uint[] consumerFear = [1, 2, 3, 4, 5, 6, 7]; // See whether the prices of stock 1 and stock 2 are correlated even // after adjusting for the overall condition of the economy and consumer // fear. double partialCor = partial!pearsonCor(stock1Price, stock2Price, economicHealth, consumerFear);
Computes the partial correlation between vec1, vec2 given conditions. conditions can be either a tuple of ranges, a range of ranges, or (for a single condition) a single range.
cor is the correlation metric to use. It can be either pearsonCor, spearmanCor, kendallCor, or any custom correlation metric you can come up with.