0
$\begingroup$

The following code does not run for larger number of iterations . It runs for n=5 ,10 etc. but does not run for n=50 or greater. I tried to limit the accuracy goal and precision goal in 'FindDistributionParameters'. Any suggestions? Wondering at what place should I try ?NumericQ !

ClearAll[a0, d0]
ZP[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[ZP[sigma, alpha, theta]];
mydata = 
Sort[RandomVariate[ZP[15, 2, 4], 50]]; myLCData = Take[mydata, -40];
Table[myinitalParameters = 
Values[FindDistributionParameters[mydata, ZP[a0, 2, d0]]] // 
FullSimplify; 
myTData := Sort[RandomVariate[TruncatedDistribution[{0,Min[myLCData]}, 
ZP[myinitalParameters[[1]], 2, myinitalParameters[[2]]]], 10]]; 
myPCData := Join[myLCData, myTData]; mydata = myPCData;
myinitalParameters, {i, 5}]
$\endgroup$
  • $\begingroup$ Your code runs fine on my computer with {i, 50} at the end. Try wrapping your Table in a Monitor[..., i] command to see how it's progressing. $\endgroup$ – Roman May 14 at 11:19
  • $\begingroup$ It is not working on my computer. Adding monitor is not much help. Can you run it for i=100? Thanks. $\endgroup$ – nutan May 15 at 10:44
  • $\begingroup$ For {i, 100} this code takes 86 seconds on my laptop, running Mathematica 12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019). What is your $Version? $\endgroup$ – Roman May 15 at 11:51
  • $\begingroup$ My version is 11.3.0. on McBook Air. I am still struggling with n=50. $\endgroup$ – nutan May 15 at 13:15
  • $\begingroup$ Try with a fresh kernel? A MacBook Air isn't exactly powerful, but still it should do. $\endgroup$ – Roman May 15 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.