Cap*_*chi 3 c# math statistics
我需要对一个数字集执行一些统计计算,我需要计算的其中一项是中值绝对偏差。我得到了一个 ISO 标准,它告诉我的是
我不知道如何处理这些信息,因为我没有接受过任何统计数学培训。因此,我无法将上述内容转换为 C# 函数。
中位数是middl的电子元件排序阵列(或平均的两个中间项,如果数组有偶数项):
double[] source = new double[] { 1, 2, 3, 4, 5 };
Array.Sort(source);
double med = source.Length % 2 == 0
? (source[source.Length / 2 - 1] + source[source.Length / 2]) / 2.0
: source[source.Length / 2];
double[] d = source
.Select(x => Math.Abs(x - med))
.OrderBy(x => x)
.ToArray();
double MADe = 1.483 * (d.Length % 2 == 0
? (d[d.Length / 2 - 1] + d[d.Length / 2]) / 2.0
: d[d.Length / 2]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2028 次 |
| 最近记录: |