|
最初由 y.j0929 发布
[B]能请教一下哪位师傅,需求的标准方差怎么算么? [/B]
请看我在“Research into Demand Planning”上的发言:
// 计算预测误差
public float CalculateForecastError(
TDemandArray Demand, // 各周期的真实需求
TForecastArray Forecast, // 各周期的预测需求
int Periods) // 误差计算时将要涵盖的周期数
{
int Index;
float MeanOfForecastError;
......
MeanOfForecastError = 0.0;
// 计算
for (Index= 0; Index<Periods; Index++)
{
MeanOfForecastError = MeanOfForecastError + Power(Demand[Index] - Forecast[Index], 2);
}
MeanOfForecastError = MeanOfForecastError / Periods; //均方差
MeanOfForecastError = Sqr(MeanOfForecastError); //标准差
return MeanOfForecastError;
} |
|