hmnhmn
hmnhmn

Reputation: 173

Is it possible to extract only the log-likelihood value from logLik object in R?

Basically I'm trying to find a way to extract the number value of log-likelihood value from logLik object.

E.g., the output: 'log Lik.' -72.0789 (df=2) Is it possible to 'extract' only the -72.0789 number so it could be assigned elsewhere?

Upvotes: 5

Views: 1767

Answers (1)

Simon O'Hanlon
Simon O'Hanlon

Reputation: 60000

Just use [ to extract the value. e.g.:

logLik(mod)[1]
# [1] -10.44608

Or head:

head( logLik(mod) )
# [1] -10.44608

Upvotes: 4

Related Questions