Here is my attempt with ContinuousRV:
from sympy.stats import ContinuousRV
from sympy import Lambda, log, Pow, exp, symbols, Interval, oo
# Parameters
_BETA = 10.56
_ETA = -90
_ALPHA = 3.11
x, beta, alpha, eta = symbols("x, beta, alpha, eta")
log_weibull_pdf = ((beta / (alpha * (1 - x - eta))) *
(Pow(log(1 - x - eta) / alpha, beta - 1)) *
(exp(-Pow(log(1 - x - eta) / alpha, beta))))
X = ContinuousRV(x, log_weibull_pdf.subs({beta: _BETA,
alpha: _ALPHA,
eta: _ETA}),
set=Interval(-oo, -_ETA))
which fails with:
ValueError: x**w where w is irrational is not defined for negative x
--
Seb
On Sunday, October 11, 2020 at 1:51:16 AM UTC-5 czgdp1807 wrote:
> Hi,
>
> I think for creating RVs with custom distributions, one can use,
> ContinuousRV, DiscreteRV Or FiniteRV depending on the type of
> distribution. You can take a look at
> https://docs.sympy.org/latest/modules/stats.html#examples
> Note that the PDF/PMF should be a SymPy object.
>
> With Regards,
> Gagandeep Singh
> Github - https://github.com/czgdp1807
> LinkedIn - https://www.linkedin.com/in/czgdp1807
>
> On Sun, 11 Oct, 2020, 3:45 AM [email protected], <[email protected]> wrote:
>
>> Hello,
>>
>> I'm trying to set up a custom distribution with the following function
>> describing its PDF:
>>
>> def pdf(x, beta, alpha, eta):
>> t0 = beta / (alpha * (1 - x - eta))
>> t1 = pow(np.log(1 - x - eta) / alpha, beta - 1)
>> t2 = np.exp(-pow(np.log(1 - x - eta) / alpha, beta))
>> return t0 * t1 * t2
>>
>> It's a particular parameterization of the Log-Weibull distribution, with
>> beta and alpha being the shape and scale parameters, respectively, and eta
>> acts as a shift parameter representing the upper bound of the sample space,
>> which is then defined as -inf < x < eta. I'm interested in drawing random
>> variates, computing the above PDF, and CDF.
>>
>> I have limited experience with sympy, and none with sympy.stats, but it
>> seems as if what I need is sympy.stats.ContinuousDistributionHandmade.
>> However, I'd appreciate any pointers.
>>
>> Thanks,
>> --
>> Seb
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/8f73147b-7032-464d-b95c-a1b68537c1a7n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/sympy/8f73147b-7032-464d-b95c-a1b68537c1a7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/16120812-5243-4f41-869e-7d03288dfb97n%40googlegroups.com.