This function evaluates the log-likelihood of a VLMC fitted on a discrete time series.
Arguments
- object
the vlmc representation.
- initial
specifies the likelihood function, more precisely the way the first few observations for which contexts cannot be calculated are integrated in the likelihood. Defaults to
"truncated"
. Seeloglikelihood()
for details.- ...
additional parameters for logLik.
Value
an object of class logLik
. This is a number, the log-likelihood of
the (CO)VLMC with the following attributes:
df
: the number of parameters used by the VLMC for this likelihood calculationnobs
: the number of observations included in this likelihood calculationinitial
: the value of theinitial
parameter used to compute this likelihood
Examples
pc <- powerconsumption[powerconsumption$week == 5, ]
breaks <- c(
0,
median(powerconsumption$active_power, na.rm = TRUE),
max(powerconsumption$active_power, na.rm = TRUE)
)
labels <- c(0, 1)
dts <- cut(pc$active_power, breaks = breaks, labels = labels)
m_nocovariate <- vlmc(dts)
ll <- logLik(m_nocovariate)
ll
#> 'log Lik.' -207.9581 (df=69)
attributes(ll)
#> $nobs
#> [1] 945
#>
#> $df
#> [1] 69
#>
#> $initial
#> [1] "truncated"
#>
#> $class
#> [1] "logLik"
#>