Referring to here , I would like to find the MLE of alpha
and lam
, given the following PDF
import scipy.stats as st
import numpy as np
class Weib(st.rv_continuous):
def _pdf(self, data, alpha, lam):
t = data[0]
delta = data[1]
fx = (alpha * lam * (t**(alpha-1)))**(delta) * np.exp(-lam * (t**alpha))
return fx
def _argcheck(self, alpha, lam):
a = alpha > 0
l = lam > 0
return (a & l)
And I tried
Weib_inst = Weib(name='Weib')
Samples = Weib_inst.rvs(alpha=1, lam=3, size = 1000)
And it says
'float' object is not subscriptable
Weib_inst._fitstart([[1,2],[2,4]])
also returns the same error message.
It seems this occurs because the data is not 1-dimensional, but I cannot find the way to bypass this.
Any help might be appreciated.
You may try to define _fitstart
in your subclass. The framework assumes univariate distributions, however.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.