# Set up data
x <- exdex::newlyn
u <- quantile(x, probs = 0.9)
exc <- x > u
# Fit a Bernoulli distribution
fit <- fit_bernoulli(exc)
# Calculate the loglikelihood at the MLE
res <- logLikVec(fit)
# The logLik method sums the individual loglikelihood contributions.
logLik(res)
# nobs, coef, vcov, logLik methods for objects returned from fit_bernoulli()
nobs(fit)
coef(fit)
vcov(fit)
logLik(fit)
# Adjusted loglikelihood
# Create 5 clusters each corresponding approximately to 1 year of data
cluster <- rep(1:5, each = 579)[-1]
afit <- alogLik(fit, cluster = cluster, cadjust = FALSE)
summary(afit)
Run the code above in your browser using DataLab