Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotPath

Coefficients path plot


Description

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

Usage

plotPath(fm, Z = NULL, K = NULL, indexK = NULL, 
   tst = NULL, title = NULL, maxCor = 0.85)

Arguments

fm

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'

indexK

(integer vector) Which columns and rows will be read when K is the name of a binary file. Default indexK=NULL will read the whole matrix

tst

(integer vector) Which individuals are in testing set and to plot. It must be contained in fm$tst. Default tst=NULL will consider the whole vector fm$tst to plot

title

(character/expression) Title of the plot

maxCor

(numeric) Maximum correlation allowed for two different coefficients. A group of coeffcients with a correlation greater than maxCor are likely to overlap in the plot thus only one is kept

Value

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

Author(s)

Marco Lopez-Cruz (maraloc@gmail.com) and Gustavo de los Campos

Examples

require(SFSI)
  data(wheatHTP)
  
  X = scale(X[1:300,])/sqrt(ncol(X))   # Subset and scale markers
  G = tcrossprod(X)                    # Genomic relationship matrix
  y = as.vector(scale(Y[1:300,"YLD"])) # Subset response variable
  WL = scale(WL[1:300,])               # Reflectance data
  
  # Sparse phenotypic regression
  fm1 = lars2(var(WL),cov(y,WL))
  
  # Sparse family index
  fm2 = SSI(y,K=G,tst=1:15,trn=16:length(y))
  
  
  plotPath(fm1)
  plotPath(fm2,maxCor=0.6)
  plotPath(fm2,K=G,maxCor=0.6)
  
  
  # Path plot for the first individual in testing set for the SSI
  plotPath(fm2,K=G,tst=fm2$tst[1])

SFSI

Sparse Family and Selection Index

v0.3.0
GPL-3
Authors
Marco Lopez-Cruz [aut, cre], Gustavo de los Campos [aut], Paulino Perez-Rodriguez [ctb]
Initial release
2021-04-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.