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 (?)
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 inmodelFit@output$Minus2LogLikelihood
, but the recommended access is throughsummary()
.These changes should be available in the most recent developer build (r715).
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
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?
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
No news yet, but I wanted to let you know that we're working on it. Thanks for the code! This really helps us figure out what the problem is.
Ok good to know, thank you!
Ok, we figured it out. This will be fixed in the next release. If you like, you can compile OpenMx from source and use the updated (fixed) version now.
This should be fixed in OpenMx 1.1.2: http://openmx.psyc.virginia.edu/2011/10/openmx-112-released
I opened a ticket for this issue http://openmx.psyc.virginia.edu/issue/2011/10/likelihood-statistic-independence-model