path.plot: Coefficients path plot

View source: R/path.plot.R

Regression coefficients pathR Documentation

Coefficients path plot

Description

Coefficients evolution path plot from an object of the class 'LASSO' or 'SSI'

Usage

path.plot(object, Z = NULL, K = NULL, 
          i = NULL, prune = FALSE, cor.max = 0.97, 
          lambda.min = .Machine$double.eps^0.5,
          nbreaks.x=6, ...)

Arguments

object

An object of the 'LASSO' or 'SSI' class

Z

(numeric matrix) Design matrix for random effects. When Z=NULL an identity matrix is considered (default) thus G = K; otherwise G = Z K Z' is used. Only needed for a fm object of the class 'SSI'

K

(numeric matrix) Kinship relationships. This can be a name of a binary file where the matrix is stored. Only needed for a fm object of the class 'SSI'

i

(integer vector) Index a response variable (columns of matrix Gamma) for an object of the class 'LASSO'. Index testing elements (stored in object$tst) for an object of the class 'SSI'. Default i=NULL will consider either all columns in matrix Gamma or all elements in object$tst, respectively

prune

TRUE or FALSE to whether prune within groups of correlated coefficients, keeping only one per group. A group of coefficients that are highly correlated are likely to overlap in the plot

cor.max

(numeric) Correlation threshold to prune within groups of correlated coefficients

lambda.min

(numeric) Minimum value of lambda to show in the plot as -log(lambda). This prevents -log(lambda) going to infinite for near-zero lambda values

nbreaks.x

(integer) Number of breaks in the x-axis

...

Other arguments for method plot: 'xlab', 'ylab', 'main', 'lwd'

Value

Returns the plot of the coefficients' evolution path along the regularization parameter

Examples

  require(SFSI)
  data(wheatHTP)
  
  index = which(Y$trial %in% 1:6)       # Use only a subset of data
  Y = Y[index,]
  X = scale(X_E1[index,])               # Reflectance data
  M = scale(M[index,])/sqrt(ncol(M))    # Subset and scale markers
  G = tcrossprod(M)                     # Genomic relationship matrix
  y = as.vector(scale(Y[,'E1']))        # Subset response variable
  
  # Sparse phenotypic regression
  fm = LARS(var(X),cov(X,y))
  
  path.plot(fm)
  
  
  # Sparse family index
  trn_tst = ifelse(seq_along(y)<11,0,1)
  fm = SSI(y,K=G,trn_tst=trn_tst)
  
  path.plot(fm, prune=TRUE)
  path.plot(fm, K=G, prune=TRUE, cor.max=0.9)
  
  # Path plot for the first individual in testing set for the SSI
  path.plot(fm, K=G, i=1)

SFSI documentation built on Nov. 18, 2023, 9:06 a.m.