Questions tagged [log-likelihood]

Only questions related to the implementation and usage of the mathematical function - log-Likelihood should use this tag.

Given a sample and a parametric family of distributions (i.e., a set of distributions indexed by a parameter) that could have generated the sample, the Likelihood is a function that associates to each parameter the probability (or probability density) of observing the given sample.

The log-Likelihood a function which is the natural logarithm of the Likelihood function

For many applications, the log-Likelihood, is more convenient to work with as compared to the Likelihood. This is because we are generally interested in where the Likelihood reaches its maximum value. Since the logarithm is a strictly increasing function, the logarithm of a function achieves its maximum value at the same points as the function itself, hence the log-likelihood can be used in place of the likelihood for maximum likelihood estimation and related techniques.

Finding the maximum of a function often involves taking the derivative of a function and solving for the parameter being maximized, and this is often easier when the function being maximized is a log-likelihood rather than the original likelihood function, because the probability of the conjunction of several independent variables is the product of probabilities of the variables and solving an additive equation is usually easier than a multiplicative one.

232 questions
0
votes
1 answer

Deductible modeling -- Difficulty achieving convergence with scipy.optimize.minimize

I am new to Python. I apologize in advance if my code feels cringy. For the past few weeks I have been working on a difficult statistical challenge called deductible modeling. I will try avoiding unnecessary statistical jargon and keeping the…
0
votes
1 answer

Likelihood Ratio Test and pseudo Rsquared differ significantly (Logistic Regression)

I apply a logistic regression and I would like to test for statistical sigificance of my overall model. Now, the pseudo-Rsquared (McFaddon) Rsquared = 1 - L(c)/L(null) returns the variance explained by the model - where L(c) denotes the maximized…
Felix
  • 313
  • 1
  • 3
  • 22
0
votes
0 answers

Likelihood for First order censored autoregressive process with covariate(see Jung Wook Park1 , Marc G. Genton2 and Sujit K. Ghosh3)

library(mvtnorm) set.seed(14) n=10000 sigmatrue<-1 rhotrue<-0.3 b1=0.05 b0=0 y<-arima.sim(model=list(ar=c(0.3)),n=10000 ,sd=sigmatrue)#kataskevi #xronoseiras x=rep(0,n) for(i in 1:n){ x[i]=i } for(t in 1:n) { …
0
votes
1 answer

Passing additional arguments to numdifftools Hessian

I want to obtain the Hessian of the following function: def llik_scalars(param_vector, *args): Fsc = param_vector[0] Qsc = param_vector[1] Rsc = param_vector[2] y = args[0] burnin = args[1] F = np.matrix(Fsc) Q =…
Rens
  • 177
  • 9
0
votes
1 answer

Converting likelihood equation into R code

I'm working on coding GP model in R and calculating its likelihood function. I'm having problem to convert the equation below into R code: I used the code below but I keep getting error message : Error in (t(zlt - olt)) * (zlt - olt) :…
Reta
  • 363
  • 3
  • 4
  • 15
0
votes
0 answers

Comparing AIC of ARIMA and GARCH models

I stumbled upon a problem regarding model selection based on AIC. For forecasting purposes I want to select the model with the lowest AIC. I first fitted an ARIMA model and obtained AIC_arima = -952.37. After that, I wanted to see how a ARIMA-GARCH…
T Goose
  • 31
  • 6
0
votes
0 answers

Loglikelihood integrated unobserved heterogeneity returns wrong coefficients

I have a simple poisson model with unobserved heterogeneity eta that is normally distributed. This can be solved by integrating eta out of the log-likelihood. However when i try to do this it produces wrong coefficients and i can't see why. The…
0
votes
0 answers

Estimating parameters with GLM in R

Let's assume that I have a dataset as follows: set.seed(1) TDT <- data.table(Country = c(rep("A",30),rep("B",50), rep("C",20)), Id = c(rep(1,20),rep(2,20),rep(3,20),rep(4,20),rep(5,20)), Time =…
Tom
  • 2,173
  • 1
  • 17
  • 44
0
votes
1 answer

How to calculate marginal likelihood in Python with PyMC 2.3.7?

I would like to calculate the marginal likelihood of a model given a dataset in order to compare it with another, thanks to the Bayes factor. I used PyMC 2 to get the post distributions of each parameter for each model. Here is the principle (I…
0
votes
1 answer

Speedy alternatives to fmincon for log-Likelihood

I am currently using fmincon for minimizing a log-Likelihood function in respect to a 18*18 matrix. While on smaller problems the algorithm is very fast, it takes about 2h to converge in the current setup - as I am iterating over this minimisation…
Luks
  • 133
  • 11
0
votes
0 answers

D function returning zero

I am attempting to differentiate the log likelihood function of a multivariate normal distribution, NLLmvnorm <- function(data, mu, sigma) { a <- qr(sigma) logdet <- sum(log(abs(diag(a$qr)))) sigma.inv <- fast.ginv(sigma) -0.5 * (logdet +…
hkj447
  • 677
  • 7
  • 21
0
votes
0 answers

How can I convert R likelihoods to usual likelihood?

The likelihood that I get using R glm or Countr, (renewalCount) is different from when I calculate the likelihood by hand, using R estimated parameters. I am trying to fit a dataset with some functions in R, but the likelihood values are not…
sam
  • 77
  • 6
0
votes
1 answer

Scipy optimizer explodes/diverges at changing way of specifying parameters

I have a negative log-likelihood function to minimize. I want to set the array of observations as a parameter of the function to optimize and not directly into the function, but strangely, the optimizer explodes. I am interested to discover why this…
Joachim
  • 490
  • 5
  • 24
0
votes
1 answer

Estimated Gaussian distribution parameters are wrong

I'm experimenting with Gaussian distribution and its likelihood. To figure out max likelihood I differentiate likelihood with respect to mu (expectation) and sigma (mean), which equal to data.mean() and data.std() correspondingly import…
amplifier
  • 1,793
  • 1
  • 21
  • 55
0
votes
0 answers

How to calculate Likelihood of a value given a distribution?

I'm trying to get a score that tells me the probability of a value belongs to distribution or not. Score that maybe i wrongly called likelihood. For example: A = [4,5,5,6,4,16,15,14,15,16] b = 5 In this case my score should be low and i want a low…