calc.ic: Calculate an information criterion. In BOSSreg: Best Orthogonalized Subset Selection (BOSS)

Description

Calculate a specified information criterion (IC) for an estimate or a group of estimates. The choices of IC include AIC, BIC, AICc, BICc, GCV and Mallows' Cp.

Usage

 1 2 3 4 5 6 7 calc.ic( y_hat, y, ic = c("aicc", "bicc", "aic", "bic", "gcv", "cp"), df, sigma = NULL )

Arguments

 y_hat A vector of fitted values with length(y_hat)=length(y)=n, or a matrix, with nrow(coef)=length(y)=n and ncol(y_hat)=m, containing m different fits. y A vector of response variable, with length(y)=n. ic A specified IC to calculate. Default is AICc ('aicc'). Other choices include AIC ('aic'), BIC ('bic'), BICc ('bicc'), GCV ('gcv') and Mallows' Cp ('cp'). df A number if y_hat is a vector, or a vector with length(df)=ncol(y_hat)=m if y_hat is a matrix. df represents the degrees of freedom for each fit. sigma Standard deviation of the error term. It only needs to be specified if the argument ic='cp'.

Details

This function enables the computation of various common IC for model fits, which can further be used to choose the optimal fit. This allows user comparing the effect of different IC. In order to calculate an IC, degrees of freedoms (df) needs to be specified. To be more specific, here are the formulas used to calculate each IC:

Value

The value(s) of the specified IC for each fit.

Sen Tian

Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ## Generate a trivial dataset, X has mean 0 and norm 1, y has mean 0 set.seed(11) n = 20 p = 5 x = matrix(rnorm(n*p), nrow=n, ncol=p) x = scale(x, center = colMeans(x)) x = scale(x, scale = sqrt(colSums(x^2))) beta = c(1, 1, 0, 0, 0) y = x%*%beta + scale(rnorm(20, sd=0.01), center = TRUE, scale = FALSE) ## Fit the model boss_result = boss(x, y) ## Print the values of AICc-hdf for all subsets given by BOSS print(boss_result\$IC_boss\$aicc) ## calculate them manually using the calc.ic function y_hat = cbind(rep(1,n),x)%*%boss_result\$beta_boss print(calc.ic(y_hat, y, df=boss_result\$hdf_boss))

BOSSreg documentation built on March 7, 2021, 1:06 a.m.