Forum: help
Monitor Forum | Start New ThreadRE: mixed exponential created by distr not working correctly [ Reply ] By: Peter Ruckdeschel on 2017-11-19 17:51 | [forum:45468] |
I have no time to look at this in detail (will do so later ~ mid Dec),but on first glance this should be the default minimal grid width that is byting you here -- have you looked at changing this in distroptions() ? Later reply (Dec 1 2017): Indeed, you can fix this (at the cost of large object sizes, and slower computations, though) by using a finer resolution: distroptions(DefaultNrGridPoints=2^21) ## uses 2e6 gridpoints now instead of 4e3 mixobj <- UnivarMixingDistribution( Exp(0.000281587060464458), Exp(4.60503874426382e-05), Exp(8.66633661057179e-06), Exp(2.06028276672794e-06), Exp(3.35389385119948e-07), Exp(7.42313835767416e-08), mixCoeff = ws) qtst <- q(mixobj) ptst <- p(mixobj) qtst(ptst(10000)) [1] 10000.42 ## so I guess you need to seek a compromise between object size+computation time on one hand and accuracy on the other. I hope this helps -- best, Peter |
mixed exponential created by distr not working correctly [ Reply ] By: Allen Tan on 2017-11-17 02:40 | [forum:45467] |
Thank you for this great package, it is very helpful in working with mixed distributions. However, when I am working with mix exponential distributions with rate very close to 0 (very large means). The q function seems not to work correctly. example codes: ws <- c(0.467605678, 0.214252136, 0.177945838, 0.116423842, 0.022384060, 0.001388445) mixobj <- UnivarMixingDistribution( Exp(0.000281587060464458), Exp(4.60503874426382e-05), Exp(8.66633661057179e-06), Exp(2.06028276672794e-06), Exp(3.35389385119948e-07), Exp(7.42313835767416e-08), mixCoeff = ws) qtst <- q(mixobj) ptst <- p(mixobj) qtst(ptst(10000)) This should return 10000, if the q function is working correctly, but not in this case. I think it generally works, so I suspect this might be an issue related to machine number precision? It would be great if it can be fixed. Thanks! Allen |