Joint Likelihood in Scipy

25 views Asked by At

The code below finds the joint likelihood for n (= 3 ) variables from a normal distribution with known sigma. I'm trying to extend this to finding the joint likelihood for n variables from a location-scale-t distribution with three unknown parameters (location, scale, and df), but am struggling with how exactly to proceed here. Is there a helpful function for this? At the moment I am attempting to do this manually by specifying multiple parameter domains...

n = 3; x = stats.norm(loc=0,scale=1).rvs(n, random_state = 10); # set seed
parameter_domain = np.linspace(-10,10,1001);
likelihood = stats.norm.pdf((x[:,np.newaxis])*np.ones(parameter_domain.shape),
                            loc=parameter_domain1, scale=1)#.prod(axis=0) # sigma=1 known
n = 3
df_true = 15, loc_true = 10, scale_true = 2 
x = stats.t(df = df_true, loc = loc_true, scale = scale_true).rvs(n, random_state = 10) # Data from location-scale-t distn.
df_parameter_domain = np.linspace(1, 100, 100)#np.linspace(-10,10,1001);
loc_parameter_domain = np.linspace(-10,10,1001)
scale_parameter_domain = np.linspace(0, 10, 1001)

likelihood = stats.t.pdf((x[:,np.newaxis])*np.ones(parameter_domain.shape),
                            loc=df_parameter_domain, scale=scale_parameter_domain, df = df_parameter_domain)#.prod(axis=0) # no variables known
0

There are 0 answers