likelihood statistic returned from npsol

Posted on
Picture of user. skenny Joined: 07/31/2009
Forums
i am following up here on the discussion previously started on the email list. i'm still unsure, after perusing the code and the npsol manual as to weather the raw likelihood or the -2 log likelihood is being returned from the optimizer. i'm wondering if anyone might know where i could find this info? or how i might reasonably search for it in the code (?)
Replied on Mon, 08/17/2009 - 12:45
Picture of user. tbrick Joined: 07/31/2009

NPSOL doesn't care about the fit function used.

The computation of the likelihood function is performed by each objective function individually, usually as the function to be minimized. Often, this will mean that the modelFit@output$minimum element will contain -2 Log Likelihood, and for the first beta release, that is, in general, the case.

Because the objective functions are not guaranteed to be minimizing the likelihood directly (often there are computationally simpler forms that are minimized), you will not be able to count on this in the general case. Instead, you will want to use the summary() function, and pull out the -2 Log Likelihood from there. I think the syntax would be summary(modelFit)$Minus2LogLikelihood. Alternately, it should also be in modelFit@output$Minus2LogLikelihood, but the recommended access is through summary().

These changes should be available in the most recent developer build (r715).

Replied on Fri, 09/30/2011 - 08:16
Picture of user. suzannejak Joined: 01/06/2010

In reply to by tbrick

Is the $IndependenceLikelihood also the -2 * likelihood from the independence model?

In my case it is very different from the $minus2Likelihood of fitting the independence model itself.

-2loglik of independence model : 3096.288

IndependenceLik of target model: 126040060

For the independence model I used a diagonal model.

Thanks in advance! Suzanne

Replied on Tue, 10/04/2011 - 08:18
Picture of user. Ryne Joined: 07/31/2009

In reply to by suzannejak

The $IndependenceLikelihood value from @output should be the -2 log likelihood of a diagonal model with freely estimated variances and means. I understand that the name could be a little confusing, as it lacks both -2 and log. Can you post code/data so we can find the discrepancy? In your initial post, was the first value (3096.00) the Minus2LogLikelihood from your manual fitting of the diagonal model, or is that the second value?
Replied on Tue, 10/04/2011 - 09:39
Picture of user. suzannejak Joined: 01/06/2010

In reply to by Ryne

Thank you for your reply. Indeed the 3096.288 is the -2 loglikelihood of manually fitting the diagonal model. I attached my script where I fit a target model (savamodel) and ask for the independencelikelihood and then fit the independence model (savaindep) and ask for the likelihood.
Hope you can figure it out, many thanks in advance,
Suzanne