[Python] Python scipy.stats create new distribution function by adjusting a single argument

Discussão em 'Python' iniciado por Stack, Novembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    I'm using the distfit package (https://erdogant.github.io/distfit/...#module-distfit.distfit.distfit.fit_transform) to find the best-fitting statistical distribution for some empirical data. The results include the fit distribution as an model=<scipy.stats._distn_infrastructure.rv_continuous_frozen at 0x7fa4a42c8a90> object, a tuple of parameters for it params=(1013.8436378790848, -556.0268261452745, 81.19476091801334), and also separate loc and scale parameters. The model object has an args attribute which is the same as params

    results = {'name': 'loggamma',
    'score': 0.004380365964219514,
    'loc': -556.0268261452745,
    'scale': 81.19476091801334,
    'arg': (1013.8436378790848,),
    'params': (1013.8436378790848, -556.0268261452745, 81.19476091801334),
    'model': <scipy.stats._distn_infrastructure.rv_continuous_frozen at 0x7fa4a42c8a90>,
    'bootstrap_score': 0,
    'bootstrap_pass': None,
    'color': '#e41a1c',
    'CII_min_alpha': 1.7049279936189805,
    'CII_max_alpha': 10.095497944750718}
    model.args = (1013.8436378790848, -556.0268261452745, 81.19476091801334)


    Now that I have these, I want to adjust the scale parameter from some other data and obtain a new distribution function with only the scale changed, so I can use the new distribution function's inverse CDF method.

    With the new scale parameter, I now have params=(1013.8436378790848, -556.0268261452745, 52). I then set dist.args equal to the same. When I use this modified distribution's inverse CDF (.ppf) method, I get unexpected results. That may be ok, but I'm unsure if I'm creating this new distribution correctly. Thanks.

    Continue reading...

Compartilhe esta Página