Generate Poisson random variable

  • Thread starter Thread starter Ardeshir
  • Start date Start date
I need help to generate Poisson random variable via Inverse Transform .

More for curiosity than anything:

Why do you need to do this?

Thanks,

Seth Rowe [MVP]
 
Ardeshir,

Did you already try Google with: generate Poisson random variable Inverse
Transform

Kerry Moorman
 
Ardeshir,

Did you already try Google with:  generate Poisson random variable Inverse
Transform

Kerry Moorman





- نمايش متن نقل قول شده -
I dont Know This code is right or not :

Public Class Form1
Dim i As Long = 0
Dim Lambda As Double
Dim F As Double = 0
Dim p As Double = 0
Dim g As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim uRandom As Double
Randomize()
uRandom = Rnd()
Try
Lambda = Double.Parse(TextBox1.Text)
g = CType(Lambda, Int32)
Catch ex As Exception
MsgBox("Please Enter Mean(Lambda)", MsgBoxStyle.OkCancel,
"Warning")
End Try
p = (1 / Math.Exp(Lambda))
F = p
Level3:
If uRandom < F Then
Label2.Text = i
Exit Sub
Else
i = i + 1
p = (Lambda * p) / (g + 1)
F = F + p
GoTo Level3
End If

End Sub

End Class
 
Back
Top