How can i sample from a distribution already fitted with allfitdist?

조회 수: 1 (최근 30일)
EM geo
EM geo 2019년 1월 24일
댓글: EM geo 2019년 1월 25일
I want to find the best fitting of a variable distribution (the second column of the matrix D) using the function "allfitdist". I find the best one that is the generalized pareto. Now i want to save this result in a structure and then i want to randomly sample 10000 times from this result. I'm using this code:
[Ddg2 PDdg2] = allfitdist(D(:,2),'cdf')
My(2).result = PDdg2{1,1} %generalized pareto
output = random(My(2).result,10000)
Something is weard because in the output i get a really big matrix. Maybe i'm wrong in the second raw of the code, when i select the generalized pareto from PDdg2.
Someone can help me? I've attached the data and the function.

채택된 답변

Jeff Miller
Jeff Miller 2019년 1월 25일
Try
output = random(My(2).result,10000,1)
Your command gives a 10000 x 10000 output matrix.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by