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

How to evaluate the significance of the three-way interaction with quadratic term?

I have the following two mixed models Full model (with the three-way interaction) m_Kunkle_pacc3_n <- lmer(pacc3_old ~ PRS_Kunkle*AgeAtVisit + PRS_Kunkle*I(AgeAtVisit^2) + APOE_score*AgeAtVisit +…
zjppdozen
  • 63
  • 5
1
vote
2 answers

Is there a simple way to calculate the maximum likelihood estimate of a parameter in R?

I am trying to calculate the MLE of a poisson distribution in R. Is there a function in R that allows us to do this (eg. I know Stata has a mlexp function that allows us to make this calculation quite easily). I see that there is a mlexp function in…
1
vote
0 answers

Calculation of log-likelihood in bnlearn

I have created a Bayesian network model using the library bnlearn. I would like to calculate the log-likelihood of the model. Could you please let me know how can I do this? Sample code for creation of model: bn = bn.fit(net, train) nationprob =…
user15984416
1
vote
0 answers

How you do efficiently parameterize a batch of covariance matrices in PyTorch

I want to output a batch of multivaraible Gaussians (For likelihood based learning). But I don't know how I can do that. I have something like this . . . covar=self.covar(o_t) #returns batch_size*(obs_dim*obs_dim) mean=self.mean(o_t) …
user68099
  • 141
  • 7
1
vote
0 answers

How to estimate exponential MLL function + add confidence intervals in R gpplot2?

I'm trying to plot the raw data along with the exponential curve fit and add confidence intervals for maximum likelihood model function in R. My data is stored in df(x.number, y.size). I'm trying to run MLL using the skewfun in R I want to use…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
1
vote
0 answers

Using "optim" function in R for making profile likelihood for a parameter

I am using the maximum likelihood method to estimate a set of parameters. Particularly, I use "optim" function in R to do the optimization task. Now, I am going to make the profile likelihood for each of the parameters. I wanted to know how I can do…
Maryam
  • 97
  • 1
  • 8
1
vote
1 answer

How to use optim() to produce coefficient estimates for a generalized linear model?

I've written the following model in R: model1_b <- glm(bupacts ~ sex + couples + women_alone, data = risky, family = poisson(link="log")) I would like to find the coefficient estimates for this model using optim. That is, I would like to get to the…
w5698
  • 159
  • 7
1
vote
0 answers

Gaussian Mixture model log-likelihood to likelihood-Sklearn

I want to calculate the likelihoods instead of log-likelihoods. I know that score gives per sample average log-likelihood and for that I need to multiply score with sample size but the log likelihoods are very large negative numbers such as…
Sahar Atif
  • 11
  • 1
1
vote
0 answers

Likelihood function in bayes by backprop

I generate my regression data synthetically using finite element method. So inherently my synthetic data is noiseless. In this case can someone help me understanding how can I write my likelihood function? (Likelihood term of my ELBO) I have seen…
1
vote
1 answer

Multiprocessing in a Python function: where to put freeze_support()?

I am trying to use one of the GGS functions in Python 2.7 (https://github.com/cvxgrp/GGS, the function that I am trying to use is located inside ggs.py and it is called GGSCrossVal, row 72) but Python shown me this error: Attempt to start a new…
1
vote
1 answer

Different results when optimizing hyperparameter for a Gaussian process regression

i'm studying gaussian process regression, and i'm trying to use the built-in functions from scikit-learn, and also trying to impement a custom function for doing so. This is the code when using scikit-learn: import numpy as np from…
1
vote
2 answers

Evaluate Derivative of Negative Log Likelihood Python

I am trying to evaluate the derivative of the negative log likelihood functionin python. I am using sympy to compute the derivative however, I receive an error when I try to evaluate it. The example code below attempts to compute this for the…
njalex22
  • 367
  • 1
  • 4
  • 13
1
vote
1 answer

Difference between log likelihood by hand and logLike function

I'm trying to compare the value of the log likelihood function given by the logLik function and the value calculate by hand for a Gamma distribution. The value given by the logLik function is: require(fitdistrplus) x = rgamma(50,shape = 2, scale =…
1
vote
0 answers

Evaluating Parzen window log-likelihood for GAN

I am trying to reimplement the original GAN paper by Ian Goodfellow et al. And I need to show that my implementation achieves same or similar results as the authors achieved. But I am not sure how to evaluate this metric. I took a look at their…
1
vote
1 answer

Plotting log likelihood as a function of theta1 and theta2

I am asked to plot the log-likelihood for a logistic regression model as a function of theta1 and theta2 to assess if its a convex function (the model only has two parameters and thetas are the weights of each parameter). My understanding is that I…