logLik.gips {gips} | R Documentation |
Extract the Log-Likelihood for gips
class
Description
Calculates Log-Likelihood of the sample based on the gips
object.
Usage
## S3 method for class 'gips'
logLik(object, ...)
Arguments
object |
An object of class |
... |
Further arguments will be ignored. |
Details
This will always be the biggest for perm = "()"
(provided that p <= n
).
If the found permutation still requires more parameters than n
,
the likelihood does not exist; thus the function returns NULL
.
If the projected_cov
(output of project_matrix()
)
is close to singular, the NA
is returned.
Value
Log-Likelihood of the sample.
When the multivariate normal model does not exist
(number_of_observations < n0
), it returns NULL
.
When the multivariate normal model cannot be reasonably approximated
(output of project_matrix()
is singular), it returns -Inf
.
In both failure situations, it shows a warning. More information can be found in the Existence of likelihood section below.
Existence of likelihood
We only consider the non-degenerate multivariate normal model.
In the gips
context, such a model exists only when
the number of observations is bigger or equal to n0
. To get n0
for the gips
object g
, call summary(g)$n0
.
For more information, refer to C_\sigma
and n0
section in
vignette("Theory", package = "gips")
or its
pkgdown page.
Calculation details
For more details and used formulas, see
the Information Criterion - AIC and BIC section in
vignette("Theory", package = "gips")
or its
pkgdown page.
See Also
-
logLik()
- Generic function thislogLik.gips()
extends. -
find_MAP()
- Usually, thelogLik.gips()
is called on the output offind_MAP()
. -
AIC.gips()
,BIC.gips()
- Often, one is more interested in an Information Criterion AIC or BIC. -
summary.gips()
- One can getn0
by callingsummary(g)$n0
. To see why one may be interested inn0
, see the Existence of likelihood section above. -
project_matrix()
- Project the known matrix onto the found permutations space. It is mentioned in the Calculation details section above.
Examples
S <- matrix(c(
5.15, 2.05, 3.60, 1.99,
2.05, 5.09, 2.03, 3.57,
3.60, 2.03, 5.21, 1.97,
1.99, 3.57, 1.97, 5.13
), nrow = 4)
g <- gips(S, 5)
logLik(g) # -32.67048
# For perm = "()", which is default, there is p + choose(p, 2) degrees of freedom
g_map <- find_MAP(g, optimizer = "brute_force")
logLik(g_map) # -32.6722 # this will always be smaller than `logLik(gips(S, n, perm = ""))`
g_n_too_small <- gips(S, 4)
logLik(g_n_too_small) # NULL # the likelihood does not exists