Timeline for How can I fit a distribution to a dataset while forcing it through an exact point in r?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 12, 2023 at 16:42 | comment | added | Tom | When I run it on Aon Benfield CRAFT, I get b = 92.74, q = 1.68. Based on this, I would have thought using a lower and upper argument of 0.01 and 100 should work but it does not? Perhaps the function needs editing as well | |
May 12, 2023 at 12:34 | comment | added | Jarle Tufto |
@Tom For the "SSQ" method in the other answer, this is really just a system of two equations in two unknowns (the shape and the scale) but since you can solve the first equation for the scale given the shape, you can reduce this to a single equation that can be solved numerically using e.g. uniroot as suggested by @whuber.
|
|
May 12, 2023 at 12:30 | comment | added | Jarle Tufto |
For the Pareto you probably have to restrict the upper and lower arguments in the call to optimise to more sensible values. The constraint that the scale $x_m$ needs to be no larger than the smallest observation, this translates to a restriction also on the shape parameter.
|
|
May 12, 2023 at 9:52 | comment | added | Tom | Also, is there an alternative function that I could use for the SSQ method? | |
May 12, 2023 at 9:19 | comment | added | Tom | I have managed to replicate it for Weibull but I am still struggling with pareto? | |
May 9, 2023 at 16:06 | comment | added | Tom | When trying the function for Weibull, I receive this error: Warning messages: 1: In optimise(lnL, lower = 0, upper = 1000, maximum = TRUE, ... : NA/Inf replaced by maximum positive value. When trying it with pareto, i receive this error: Error in qpareto(p, shape) : argument "shape" is missing, with no default. Sorry for the basic questions, I am a beginner in r! | |
May 9, 2023 at 15:51 | comment | added | Jarle Tufto | @Tom Yes, sure. But note that for the Pareto, the constained likelihood may be zero for some values of the shape parameter since the support is of the pdf is $[x_m,\infty)$, that is, it depends on the scale parameter $x_m$. | |
May 9, 2023 at 15:11 | comment | added | Tom | Hi Jarle, this is brilliant thank you. So I assume the same function could apply to Weibull, and what about Pareto2? | |
May 5, 2023 at 20:23 | history | answered | Jarle Tufto | CC BY-SA 4.0 |