aicVC: AIC Model Selection

View source: R/aic.R

aicVCR Documentation

AIC Model Selection

Description

Select genetic variance components via Akaike's information criterion (AIC).

Usage

aicVC(y, x, v = list(E=diag(length(y))), initpar, k = 2, init = 1, keep = 1,
   direction = c("forward", "backward"), nit = 25, msg = FALSE,
   control = list(), hessian = FALSE)

Arguments

y

A numeric vector or a numeric matrix of one column (representing a phenotype for instance).

x

A data frame or matrix, representing covariates if not missing.

v

A list of variance components of interest. Note: E is reserved for residual (or environmental) variance and can be missed in v; it is considered to be an identify matrix if it is specified.

v can be provided as a single matrix.

initpar

Optional initial parameter values.

k

Penalty on a parameter. The selection criterion is the known "AIC" if k = 2 and is "BIC" if k = log(n) where "n" is the sample size.

init

Indicates which variance components for the initial model. By default, E is included if it is missing in v.

keep

Indicator of which variance components should be forced into the final model. By default, E is kept in the final model if it is not specified in v.

direction

The mode of search. Either "forward" or "backward" with default "forward".

nit

Maximum number of iterations for optimization. Ignored if there are not more than two variance components.

msg

A logical variable. True if one wants to track the process for monitoring purpose.

control

A list of control parameters to be passed to optim.

hessian

Logical. Should a numerically differentiated Hessian matrix be returned?

Details

In genome-wide association studies (GWAS), random effects are usually added to a model to account for polygenic variation. Abney et al (2000) showed that five variance components including the most interesting additive and dominance variance components are potentially induced by polygenes. The above function is intended for selecting variance components that contribute "most" to a quantitative trait.

Function estVC is called by the above function to estimate the parameters and maximum likelihood in each model. Refer to estVC for more information.

Value

aic

AIC of the final model.

model

Gives parameter estimates, log-likihood, and other information.

lik

Log-likelihood of the model selected at each intermediate step.

trace

Indicates which variance components were selected at each intermediate step.

See Also

estVC for more information.

Examples

data(miscEx)

## Not run: 
# forward selection
# any variance component will be selected
# if AIC improve by 1e-5 or larger
pheno<- pdatF8[!is.na(pdatF8$bwt) & !is.na(pdatF8$sex),]
ii<- match(rownames(pheno), rownames(gmF8$AA))
v<- list(A=gmF8$AA[ii,ii], D=gmF8$DD[ii,ii])

o<- aicVC(y=pheno$bwt, x=pheno$sex, k=0, v=v, msg=TRUE)
o

# forward selection
of<- aicVC(y=pheno$bwt, x=pheno$sex, v=v, k=1/2,
	direction="for", msg=TRUE)
of

# backward elimination
ob<- aicVC(y=pheno$bwt, x=pheno$sex, v=v, k=1/2, init=1:2,
	direction="back", msg=TRUE)
ob

## End(Not run)

QTLRel documentation built on Aug. 9, 2023, 1:07 a.m.

Related to aicVC in QTLRel...