0

VBA でワイブル分布と一般化パレート分布で乱数を生成したいと考えています。それを手伝ってくれませんか。Analysis Toolpack-VBA を使用することに興味はありません。

前もってありがとう、Skeihani

4

1 に答える 1

0

これらのユーザー定義関数は、あなたが望むことをするかもしれません:

Function RandWeib(fScale As Single, _
                  fShape As Single, _
                  Optional bVolatile As Boolean = False) As Single

  ' shg 2008
  ' http://en.wikipedia.org/wiki/Weibull_distribution

  ' Returns a random variate with Weibull distribution
  ' fScale > 0
  ' fShape > 0
  ' By formula: =Scale * -LN(RAND()) ^ (1 / Shape)

  If bVolatile Then Application.Volatile

  RandWeib = fScale * (-Log(1! - Rnd())) ^ (1! / fShape)
End Function

Function RandPareto(fScale As Single, _
                    fShape As Single, _
                    Optional bVolatile As Boolean = False) As Single
  ' shg 2015
  ' https://en.wikipedia.org/wiki/Pareto_distribution

  ' Returns a random variate with Pareto distribution
  ' fScale > 0
  ' fShape > 0
  ' By formula: =Scale / RAND() ^ (1 / Shape)

  If bVolatile Then Application.Volatile

  RandPareto = fScale / (1! - Rnd()) ^ (1! / fShape)
End Function
于 2015-11-09T17:25:31.420 に答える