푸아송 점 과정에서의 샘플링
푸아송 점 과정은 다차원 푸아송 과정에 대한 일차원 푸아송 과정의 일반화라 할 수있습니다. 기하 영역에서 동차 푸아송 점 과정은 RandomPoint를 사용하여 샘플링 할 수있습니다.
국가의 다각형을 작성합니다.
In[1]:=
region = DiscretizeGraphics[CountryData["Mexico", "Polygon"],
ImageSize -> Medium]
Out[1]=
영역, 강도, 실현의 세개 인수로 푸아송 점 과정의 샘플을 취하는 함수를 정의합니다.
In[2]:=
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]:=
intensity = 0.5;
sample = ppp[region, intensity, 1];
In[4]:=
Show[region, Graphics[{Black, Point @@ sample}]]
Out[4]=
같은 과정을 통해 104개의 샘플을 생성합니다. 각 샘플의 점의 총수는 PoissonDistribution을 만족시키며, 평균은 강도 영역의 면적을 곱한 것과 같습니다.
In[5]:=
samples = ppp[region, intensity, 10^4];
counts = Length /@ samples;
In[6]:=
htd = PearsonChiSquareTest[counts,
PoissonDistribution[intensity RegionMeasure[region]],
"HypothesisTestData"];
In[7]:=
htd["TestDataTable"]
Out[7]=
In[8]:=
htd["TestConclusion"]
Out[8]=
어떤 부분 영역의 점의 개수도 푸아송 분포를 따릅니다. 여기서는 다각형 내에있는 원판에 대해 원판 안의 점의 수를 세어 이를 확인합니다.
In[9]:=
disk1 = Disk[{-107, 28}, 1.5];
Show[region, Graphics[{Red, disk1}]]
Out[9]=
In[10]:=
memberfun1 = RegionMember[disk1];
counts1 = Table[Total[Boole[memberfun1[pts]]], {pts, samples}];
PearsonChiSquareTest를 푸아송 분포의 점에 수행합니다.
In[11]:=
htd = PearsonChiSquareTest[counts1,
PoissonDistribution[intensity RegionMeasure[disk1]],
"HypothesisTestData"];
In[12]:=
htd["TestDataTable"]
Out[12]=
In[13]:=
htd["TestConclusion"]
Out[13]=
떨어진 곳에 있는 어떤 부분 영역의 점의 수는 독립되어 있습니다. 여기에서는 2개의 겹치지 않는 원판의 점의 수를 세고 SpearmanRankTest를 수행합니다.
In[14]:=
disk2 = Disk[{-100, 20}, 1.3];
Show[region, Graphics[{Red, disk1, Blue, disk2}]]
Out[14]=
In[15]:=
memberfun2 = RegionMember[disk2];
counts2 = Table[Total[Boole[memberfun2[pts]]], {pts, samples}];
In[16]:=
htd = SpearmanRankTest[counts1, counts2, "HypothesisTestData"];
In[17]:=
htd["TestDataTable"]
Out[17]=
In[18]:=
htd["TestConclusion"]
Out[18]=