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

Methods_SSI

SSI methods


Description

Useful methods for retrieving, summarizing and visualizing important results from an object of the class 'SSI'

Usage

## S3 method for class 'SSI'
coef(object, ..., df=NULL, tst=NULL)

## S3 method for class 'SSI'
fitted(object, ...)

## S3 method for class 'SSI'
summary(object, ...)
  
## S3 method for class 'SSI'
plot(..., title=NULL, py=c("accuracy","MSE"))

Arguments

object

An object of the class 'SSI'. One or more objects must be passed as ... in the method plot

df

(numeric) Average (across testing individuals) number of non-zero regression coefficients

tst

(integer vector) Which individuals are in testing set. Default tst=NULL will consider all individuals in object$tst

py

(character) Either 'accuracy' or 'MSE' to plot the correlation between observed and predicted values or the mean squared error, respectively, in the y-axis

title

(character or expression) Title of the plot

...

Arguments to be passed:

  • object: One or more objects of the class 'SSI' (for method plot)

  • Not needed for methods summary and fitted

Value

Method fitted returns a matrix with the predicted values for each individual in the testing set (in rows) for each value of lambda (in columns).

Method coef (list of matrices) returns the regression coefficients for each testing set individual (elements of the list). Each matrix contains the coefficients for each value of lambda (in rows) associated to each training set individual (in columns). If tst is specified, the elements of the list will correspond only to the testing individuals given in tst. If df is specified, only the coefficients for the lambda associated to df are returned as a 'matrix' with testing individuals in rows.

Method summary returns a list object containing:

  • lambda: (vector) sequence of (across testing individuals) values of lambda used in the coefficients' estimation.

  • df: (vector) degrees of freedom (across testing individuals) at each solution associated to each value of lambda.

  • accuracy: (vector) correlation between observed and predicted values associated to each value of lambda.

  • MSE: (vector) mean squared error associated to each value of lambda.

  • optCOR: (vector) summary of the SSI with maximum accuracy.

  • optMSE: (vector) summary of the SSI with minimum MSE.

Method plot creates a plot of either accuracy or MSE versus the (average across testing individuals) number of predictors (with non-zero regression coefficient) and versus lambda.

Author(s)

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

Examples

require(SFSI)
  data(wheatHTP)
  
  X = scale(X[1:200,])/sqrt(ncol(X))    # Subset and scale markers
  G = tcrossprod(X)                     # Genomic relationship matrix
  y = as.vector(scale(Y[1:200,"YLD"]))  # Subset ans scale response variable
  
  fm1 = SSI(y,K=G,tst=1:50,trn=51:length(y))
  
  yHat = fitted(fm1)              # Predicted values for each SSI
  out = summary(fm1)              # Useful function to get results
  corTST = out$accuracy           # Testing set accuracy (correlation cor(y,yHat))
  out$optCOR                      # SSI with maximum accuracy
  out$optMSE                      # SSI with minimum MSE
  B = coef(fm1)                   # Regression coefficients
  B = coef(fm1,df=out$optCOR$df)  # Regression coefficients associated with one 'df'
  plot(fm1,title=expression('corr('*y[obs]*','*y[pred]*') vs sparsity'))   
  plot(fm1,py="MSE",title='Mean Square Error vs sparsity')

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.