Message Boards Message Boards

0
|
4652 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Run following simulation with large number of iterations?

When I tried to run the following simulation for say 5 times, it runs successfully but when I tried to run it for 50 or 200 times it never terminates or produces results. I tried to limit the accuracy goal and precision goal in the 'FindDistributionParameters', it did not work. I thought that IntegerQ? needs to be inserted some place in the definition of the distribution very first line. I tried but that did not work either. Thanks.

ClearAll[a0, d0]

    ExpoWeibull[sigma_, alpha_, theta_] := 
      ProbabilityDistribution[
       alpha theta/
         sigma (1 - Exp[-(x/sigma)^alpha])^(theta - 1) Exp[-(x/sigma)^
           alpha ]*(x/sigma)^(alpha - 1), {x, 0, Infinity}, 
       Assumptions -> sigma > 0 && alpha > 0 && theta > 0];
    DistributionParameterAssumptions[ExpoWeibull[sigma, alpha, theta]];
    TruncatedEW[sigma_, alpha_, theta_, c_] := 
      TruncatedDistribution[{c, \[Infinity]}, 
       ExpoWeibull[sigma, alpha, theta]];

    mydata = Sort[RandomVariate[ExpoWeibull[15, 2, 4], 50]];

    myp = Values[
       FindDistributionParameters[mydata, ExpoWeibull[a0, 2, d0]]];

    myLeftCensoredData = Take[mydata, -40];

    Table[myinitalParameters = 
      Values[FindDistributionParameters[mydata, ExpoWeibull[a0, 2, d0]] //
         FullSimplify]; 
     myTruncatedData := 
      Sort[RandomVariate[
        TruncatedDistribution[{0, Min[myLeftCensoredData]}, 
         ExpoWeibull[myinitalParameters[[1]], 2, 
          myinitalParameters[[2]]]], 10]]; 
     myPseudoCompleteData := Join[myLeftCensoredData, myTruncatedData]; 
     mydata = myPseudoCompleteData;
     myinitalParameters, {i, 1, 20}]
POSTED BY: Nutan Mishra
3 Replies
Posted 5 years ago

The code down to, but not including the Table, seems to work for any number of iterations.

Perhaps you could manually do the same calculations that the Table would do, but one step at a time, and look carefully at the value of myData each time. I'm guessing the contents that is causing the problem.

POSTED BY: Bill Nelson

Yes I have an idea that the probability distribution itself is complicated with three parameters hence the 'FindDistributionParameters" that maximizes the likelihood function and gives values of the parameter must be causing problem . Question is how to resolve it? do you mean to try to maximize the function manually?

POSTED BY: Nutan Mishra
Posted 5 years ago

What if you inserted a Print inside your Table that would show the calculated values that are about to be used in each iteration. If it makes progress until it gets to a particular set of values then you could see the data that is causing it to hang. That might help you track down the cause of the problem.

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract