#' Get Information Criterion
#'
#' Function to compute AIC, BIC and GCV.
#'
#' @param nll final negative loglikelihood value (on the sum scale).
#' @param df Degrees of freedom (typically, number of estimated parameters, though may differ under fusion)
#' @param n number of observations (denominator of nll)
#' @param ic string specifying the criterion selected.
#'
#' @return a number representing the requested information criterion.
#' @export
get_ic <- function(nll, df, n=NA, ic){
switch(tolower(ic),
aic=2*nll + 2 * df,
bic=2*nll + log(n) * df,
gcv=nll/(n^2*(1-df/n)^2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.