I have some results that are stored in a multidimensional array:
double[,] results;
Each column is a time series of prices for a specific variable (e.g. "house", "car", "electricity"). I would like to calculate some statistics for each variable so that to summarize the results in a more compact form. For example, I was looking at the percentile function in Math.Net.
I would like to calculate the 90th percentile of the prices for each column (so for each variable).
I am trying the following, since the function doesn't work on multidimensional array (so I cannot pass results[,] as argument for the percentile function):
for (int i = 0, i <= results.GetLength(2), i++)
{
myList.Add(MathNet.Numerics.Statistics.Statistics.Percentile(results[,i], 90));
}
So I want to loop through the columns of my results[,] and calculate the 90th percentile, adding the result to a list. But this doesn't work because of wrong syntax in results[, i]. There is no other (more clear) error message unfortunately.
Can you help me understand where the problem is and if there's a better way to calculate a percentile by column?