![]() ![]() ![]() I thought to add a constraint to the minimize call, # make the determinant always positive So I need a way to make sure the minimization algorithm throws away values that are outside the domain of the problem. Now, the problem, by my estimation, seems to be is guessing values that create a covariance matrix that is not positive definite. ValueError: the input matrix must be positive semidefinite No matter what I set as my guess, this script reliably throws a ValueError, Result = minimize(fun = likelihood, x0 = guess, options =, method="SLSQP") Likelihood = lambda x: (-1)*log_likelihood_function(x, some_data) # maximize log-likelihood by minimizing the negative Log_likelihood += multivariate_normal.logpdf(x=point, mean=mu, cov=sigma) I am assuming the values of the sample means and variances, leaving only the sample correlation between the variables as the unknown, from scipy.stats import multivariate_normal I have a python script where I compute the value of a normal log-likelihood function for a sample of bivariate data using scipy's multivariate_normal.log_pdf. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |