注册 登录
编程论坛 VB6论坛

请问如何用vb计算偏度系数和峰度系数?

ictest 发布于 2018-09-11 17:06, 1264 次点击
在listbox里有N个数据,请问如何用vb计算偏度系数和峰度系数?
在excel里,有这两个系数的函数:      峰度:KURT()         偏度:SKEW()

求平均值、最大值、最小值、标准差 的语句我已经写出来了,如下:
程序代码:
Dim a As Single
For i = 0 To List1.ListCount - 1
a = a + List1.List(i)
Next i

Text1.Text = Format(a / List1.ListCount, "0.0000000")

Dim min As Single
Dim max As Single

min = List1.List(0)
For i = 0 To List1.ListCount - 1
If min > List1.List(i) Then min = List1.List(i)
Next
Text2.Text = Format(min, "0.0000000")

max = List1.List(0)
For i = 0 To List1.ListCount - 1
If max < List1.List(i) Then max = List1.List(i)
Next
Text3.Text = Format(max, "0.0000000")

For i = 0 To List1.ListCount - 1
List2.AddItem Format((List1.List(i) - Val(Text1.Text)) ^ 2, "0.0000000")
Next i

Dim b As Single
For i = 0 To List2.ListCount - 1
b = b + List2.List(i)
Next i
Text4.Text = Format(Sqr(Format(b / List2.ListCount, "0.0000000")), "0.0000000")

1 回复
#2
风吹过b2018-09-14 10:45
有数据,那就差 公式了,你找这二个函数的实现 公式,然后把数据填进去运算就是了。

你要知道,计算机里基本上所有的功能,都是使用编程实现。
1