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
1
vote
1 answer

Normalizing the Posterior and Likelihood in Bayesian Calculations

I am trying to work through https://rpruim.github.io/Kruschke-Notes/bayes-rule-and-the-grid-method.html and was confused about the normalized posterior and likelihood…
1
vote
0 answers

Discrepancies in curve fitting of exponential functions using maximum likelihood in R

I have a data-set and I'm exploring potential exponential fits to the data using eye-balled estimations and estimations via maximum likelihood methods. I'm finding a huge discrepancy in one of the parameter fits and I'm not sure how to reconcile…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
1
vote
1 answer

Maximum Likelihood parameter estimation for complex polynomial (right skew function) in R

I have a dataset with y.size and x.number. I am trying to compare the AIC value for a linear regression estimation of the model and a custom model. I was able to successfully run the estimates for the linear regression. The custom model estimation…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
1
vote
2 answers

How to estimate [and plot] maximum likelihood with Poisson distribution?

I have a function set up to calculate the likelihood of a distribution. I am getting negative values and I am wondering if my function is right? and if so how can I plot my function as a curve? y <- function(mu, x) { n <- length(x) -n*mu +…
irene
  • 17
  • 5
1
vote
0 answers

How to calculate AIC in python?

I have a very long time-CO2 concentration data and I fitted exponential and rectangular hyperbolic function to it with the following codes. def ExponentialModel(x,a,b,c): cmod = a+b*np.exp(c*x) return cmod def RectHypSatModel(cobs, cmax,…
surya
  • 11
  • 1
1
vote
0 answers

Is there an easy way to calculate likelihood value for a hold out dataset?

I would like to calculate the held-out likelihood value or log-likelihood value of a fitted model against a hold out dataset. Below is a simplified example: tr = data.frame(y=rnorm(100, 10, 1), x=1) tst = data.frame(y=rnorm(50, 9, 1),…
Xiaojie Zhou
  • 164
  • 2
  • 6
1
vote
0 answers

Loglikelihood and gradient function implementation in Python

With reference to the scientific paper https://arxiv.org/abs/1704.04289 I am trying to implement the section 7.3 referring to Optimising hyperparameters. Specifically the equation 35 on the page # 25 in the paper. The negative log likelihood…
1
vote
1 answer

Constrain on parameters for Negative Log Likelihood Minimization

I am trying to fit a 5 parameter (a, b, c, d, e) model, where one of the parameters is constrained by another, let's say, 0< d < 1 e < |d| I am currently using zfit which as far as I know, uses iMinuit I have only created the zfit.Parameters and put…
Horace
  • 62
  • 4
1
vote
0 answers

PyTorch - Superior Model Performance by Misusing Loss Function (Negative Log Likelihood)?

I misread PyTorch's NLLLoss() and accidentally passed my model's probabilities to the loss function instead of my model's log probabilities, which is what the function expects. However, when I train a model under this misused loss function, the…
Rylan Schaeffer
  • 1,945
  • 2
  • 28
  • 50
1
vote
0 answers

Maximum likelihood estimation of a multivariate normal distribution of arbitrary dimesion in R - THE ULTIMATE GUIDE?

I notice searching through stackoverflow for similar questions that this has been asked several times hasn't really been properly answered. Perhaps with help from other users this post can be a helpful guide to programming a numerical estimate of…
jlouis
  • 11
  • 3
1
vote
0 answers

Practical Uncertainties in "Reverse" NLLLoss for Generative Adversarial Network

I've been attempting to implement my own GAN with some limited successes. I tweaked a bit of how they trained it in the tutorial and was wondering if this more drastic change is viable. The first change I made was to make the discriminator classify…
1
vote
1 answer

plotting log-likelihood function in R

Hi I have received an error of x and y length differ in my code. datasim is a simulated sample of size 1000. Please help me with this. x <- datasim loglik <- function(theta){ k<- theta[1] lambda<- theta[2] out <- sum(dweibull(x,shape = k,…
siegfried
  • 461
  • 1
  • 5
  • 20
1
vote
0 answers

Maximum Likelihood Estimator Python

Suppose I have data points distributed over time like a decreasing exponential function but it includes zero mean Gaussian noise with variance of say 20. How would I determine the likelihood function and find MLE's for the parameters? So all I have…
Kyle
  • 21
  • 1
  • 3
1
vote
1 answer

Calculating the log-likelihood of a set of observations sampled from a mixture of two normal distributions using R

I wrote a function to calculate the log-likelihood of a set of observations sampled from a mixture of two normal distributions. This function is not giving me the correct answer. I will not know which of the two distributions any given sample is…
icedcoffee
  • 935
  • 1
  • 6
  • 18
1
vote
1 answer

Calculating AIC for Fixed Effect logit from bife package

I would like to ask how to calculace inf. criteria such as AIC, etc... for Fixed effect logit model from bife package. Basic summmary output does NOT include AIC, how ever when looking at: Goodness-of-fit for fixed effect logit model using 'bife'…
Petr
  • 1,606
  • 2
  • 14
  • 39