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
2 answers

Forward and forward-backward algorithms in CRF

In the papers about CRF (like this or this), authors all mention the forward-backward algorithm, yet implementations in GitHub (or the basic implementation in PyTorch tutorial) seem to only use the forward algorithm for calculating the negative…
1
vote
1 answer

PYMC2 ZeroProbability error

I have a model with 6 parameters with uniform priors: parameter1 = pm.Uniform('parameter1',0.01,1) parameter2 = pm.Uniform('parameter2',0,2) parameter3 = pm.DiscreteUniform('parameter3',1,50) parameter4 = pm.Uniform('parameter4',0,1.75) parameter5 =…
Ale
  • 133
  • 7
1
vote
1 answer

Numerical issues in marginal likelihood estimation

I try to use an iterative procedure to estimate the marginal likelihood in a Bayesian setting for model selection. In case you are interested in the specifics, see this or this paper for instance. I'm fighting with numerical issues for quite some…
yrx1702
  • 1,619
  • 15
  • 27
1
vote
0 answers

Optimizing Log-Likelihood Function in R with optim

I have a log-likelihood function I would like to optimize and understood I could do so with optim() in R. The parameters my function requires is a vector of probabilities (of length N) as well as a symmetric matrix of size N*N (where only…
sa_zy
  • 331
  • 1
  • 10
1
vote
1 answer

Log-likelihood calculation given estimated parameters

In general: I want to calculate the (log) likelihood of data N given the estimated model parameters from data O. More specifically, I want to know if my ll_given_modPars function below exists in one of the may R packages dealing with data modeling…
pFiaux
  • 93
  • 3
1
vote
1 answer

Matlab: Error using gammaln... while plotting psychometric functions

I'm using the toolbox psignifit to plot psychometric functions from a dataset. My code looks essentially like the following: load data.mat options = struct; options.sigmoidname = 'logistic'; result = psignifit(data,options); % this is where the…
Ava
  • 157
  • 1
  • 7
1
vote
1 answer

Writing a proper normal log-likelihood in R

I have a problem regarding the following model, where I want to make inference on μ and tau, u is a known vector and x is the data vector. The log-likelihood is I have a problem writing a log-likelihood in R. x <-…
1
vote
1 answer

Make likelihood return a vector insted of number, R

I want to make my likelihood function return more than one value. I have the following likelihood loglike <- function(x,mu,tau,u){ logl <- sum(-0.5*log(2*pi) -.5*log(tau^2+u^2) * (1/(2*(tau^2+u^2)))*((x-mu)**2) ) return(-logl) } x <-…
1
vote
0 answers

Additional constrain of sum of parameters in nlminb function

I have a function f_2 and need to minimize it's parameters by nlminb in order to estimate log likelihood (that is the objective in nlminb output). There is one constrain I want to add (u1+u2+u3+u4+u5+u6+u7+u8+u9)==1 or sum of the parameters to be…
1
vote
1 answer

MLE in R bivariate normal

I'm experiencing a problem, possibly due to my coding mistake. I want to perform an MLE for a bivariate normal sample by an algorithm: require(MASS) require(tmvtnorm) require(BB) require(matrixcalc) mu = c(0,0) covmat =…
null
  • 1,944
  • 1
  • 14
  • 24
1
vote
1 answer

Maximum likelihood estimation of beta-normal in R

i want to estimate the parameters of beta-normal distribution.I've used the maxLik package library(VGAM) library(maxLik) alfa=2;beta=3;mu=0;sigma=1 n=100 x=rbetanorm(n,alfa,beta,mu,sigma) logLikFun=function(w){ alfa=w[1] beta=w[2] mu=w[3] …
saly
  • 11
  • 3
1
vote
0 answers

multivariate_normal() : Why does the manual implementation and using scipy function for multivariate vary in results

From The Scipy Documentation scipy.stats.multivariate_normal scipy.stats.multivariate_normal = A multivariate normal random variable. The mean keyword specifies the mean.…
Saleem Ahmed
  • 2,719
  • 2
  • 18
  • 31
1
vote
1 answer

Likelihood ratio test error in R - ANOVA and lrtest

I am trying to run a likelihood ratio test in R using lrtest() but it has been giving me errors that I haven't been able to fix: dat<-read.csv("file.csv", header=TRUE) dat1<-glm(Contact~Density + Species, data=dat,…
user6480584
  • 55
  • 1
  • 7
1
vote
1 answer

Extracting collocates for a given word from a text corpus - Python

I am trying to find out how to extract the collocates of a specific word out of a text. As in: what are the words that make a statistically significant collocation with e.g. the word "hobbit" in the entire text corpus? I am expecting a result…
A-B
  • 31
  • 1
  • 6
0
votes
0 answers

Why am I getting a log-likelihood of -infinity when using positive poisson regression on a large dataset in R?

I need to run a regression on a count dependent variable containing only non-zero positive integers with a mean of 2.31 and a variance of 3.86. Thus, I am using a positive poisson regression using the "vglm" family in R because the mean and variance…