Wolfram 언어

확장된 확률 및 통계 기능

푸아송 점 과정에서의 샘플링

푸아송 점 과정은 다차원 푸아송 과정에 대한 일차원 푸아송 과정의 일반화라 할 수있습니다. 기하 영역에서 동차 푸아송 점 과정은 RandomPoint를 사용하여 샘플링 할 수있습니다.

국가의 다각형을 작성합니다.

In[1]:=
Click for copyable input
region = DiscretizeGraphics[CountryData["Mexico", "Polygon"], ImageSize -> Medium]
Out[1]=

영역, 강도, 실현의 세개 인수로 푸아송 점 과정의 샘플을 취하는 함수를 정의합니다.

In[2]:=
Click for copyable input
ppp[region_, intensity_, n_] := Module[{nlist, pts}, nlist = RandomVariate[PoissonDistribution[intensity RegionMeasure[region]], n]; pts = RandomPoint[region, Total[nlist]]; nlist = Accumulate[nlist]; nlist = Transpose[{Prepend[Most[nlist] + 1, 1], nlist}]; Table[Take[pts, ind], {ind, nlist}] ]

강도 0.5로 국가의 다각형 푸아송 점 과정의 실현을 생성하고 이를 Graphics를 사용하여 시각화합니다.

In[3]:=
Click for copyable input
intensity = 0.5; sample = ppp[region, intensity, 1];
In[4]:=
Click for copyable input
Show[region, Graphics[{Black, Point @@ sample}]]
Out[4]=

같은 과정을 통해 104개의 샘플을 생성합니다. 각 샘플의 점의 총수는 PoissonDistribution을 만족시키며, 평균은 강도 영역의 면적을 곱한 것과 같습니다.

In[5]:=
Click for copyable input
samples = ppp[region, intensity, 10^4]; counts = Length /@ samples;
In[6]:=
Click for copyable input
htd = PearsonChiSquareTest[counts, PoissonDistribution[intensity RegionMeasure[region]], "HypothesisTestData"];
In[7]:=
Click for copyable input
htd["TestDataTable"]
Out[7]=
In[8]:=
Click for copyable input
htd["TestConclusion"]
Out[8]=

어떤 부분 영역의 점의 개수도 푸아송 분포를 따릅니다. 여기서는 다각형 내에있는 원판에 대해 원판 안의 점의 수를 세어 이를 확인합니다.

In[9]:=
Click for copyable input
disk1 = Disk[{-107, 28}, 1.5]; Show[region, Graphics[{Red, disk1}]]
Out[9]=
In[10]:=
Click for copyable input
memberfun1 = RegionMember[disk1]; counts1 = Table[Total[Boole[memberfun1[pts]]], {pts, samples}];

PearsonChiSquareTest를 푸아송 분포의 점에 수행합니다.

In[11]:=
Click for copyable input
htd = PearsonChiSquareTest[counts1, PoissonDistribution[intensity RegionMeasure[disk1]], "HypothesisTestData"];
In[12]:=
Click for copyable input
htd["TestDataTable"]
Out[12]=
In[13]:=
Click for copyable input
htd["TestConclusion"]
Out[13]=

떨어진 곳에 있는 어떤 부분 영역의 점의 수는 독립되어 있습니다. 여기에서는 2개의 겹치지 않는 원판의 점의 수를 세고 SpearmanRankTest를 수행합니다.

In[14]:=
Click for copyable input
disk2 = Disk[{-100, 20}, 1.3]; Show[region, Graphics[{Red, disk1, Blue, disk2}]]
Out[14]=
In[15]:=
Click for copyable input
memberfun2 = RegionMember[disk2]; counts2 = Table[Total[Boole[memberfun2[pts]]], {pts, samples}];
In[16]:=
Click for copyable input
htd = SpearmanRankTest[counts1, counts2, "HypothesisTestData"];
In[17]:=
Click for copyable input
htd["TestDataTable"]
Out[17]=
In[18]:=
Click for copyable input
htd["TestConclusion"]
Out[18]=

관련 예제

de en es fr ja pt-br ru zh