//---------- ANALYZE ----------// //----- Functions -----// //--- Predict ---// private Dictionary <DateTime, int> PredictNext7Days(int DataType) { Dictionary <DateTime, int> kvp = new Dictionary <DateTime, int>(); switch (DataType) { case 0: double[] xVals = new double[listVM1.Count + days]; double[] yVals = new double[listVM1.Count + days]; int j = 0; foreach (Statistic1 statistic1 in listVM1) { xVals[j] = statistic1.TotalInvoiceByDate; yVals[j] = statistic1.TotalPriceByDate; j++; } for (int k = j; k < (days + j); k++) { xVals[k] = 0; yVals[k] = 0; } LinearRegression linearRegression = new LinearRegression(xVals, yVals); linearRegression.PredictData(); for (int i = 1; i <= 7; i++) { kvp.Add(DateTime.Now.Date.AddDays(i), Convert.ToInt32(linearRegression.yIntercept + linearRegression.slope * i)); } break; case 1: break; default: break; } return(kvp); }