Learn R Programming

SFSI (version 1.2.0)

net.plot: Network plot

Description

Network plot of testing and training individuals from an object of the class 'SSI'

Usage

net.plot(object, Z = NULL, K = NULL, i = NULL,
        show.names = FALSE, group = NULL, group.shape = NULL,
        set.color = NULL, set.size = NULL, df = NULL, main,
        axis.labels = TRUE, curve = FALSE, bg.color = "white",
        unified = TRUE, ntst = 36, line.color = "gray80", 
        line.tick = 0.3, legend.pos="right", point.color = "gray20",
        sets = c("Testing","Supporting","Non-active"), 
        eps = .Machine$double.eps)

Value

Returns the top-2 PC's plot connecting testing (predicted) individuals with training (predictors) individuals

Arguments

object

An object of the 'SSI' class or a matrix of coefficients

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

K

(numeric matrix) Kinship relationships. This can be a (character) name of a binary file where the matrix is stored

i

(integer vector) Index testing elements (stored in object$tst). Default i=NULL will consider all elements in object$tst

group

(data.frame) Column grouping for the individuals. The rows must match with the rows in G matrix

df

(numeric) Average number of training individuals contributing to the prediction (active) of testing individuals. Default df=NULL will use the df that yielded the optimal accuracy

main

(character/expression) Title of the plot

bg.color

(character) Plot background color

line.color

(character) Color of lines connecting nodes in rows with those in columns

line.tick

(numeric) Tick of lines connecting nodes in rows with those in columns

curve

TRUE or FALSE to whether draw curve lines connecting nodes in rows with those in columns

show.names

TRUE or FALSE to whether show node names given by the row/column names of either K or object (when this is a matrix)

set.color

(character vector) Color point of each type of node: row, 'active' column, and 'non-active' column, respectively

set.size

(numeric vector) Size of each type of node: row, 'active' column, and 'non-active' column, respectively

group.shape

(integer vector) Shape of each level of the grouping column provided as group

axis.labels

TRUE or FALSE to whether show labels in both axes

unified

TRUE or FALSE to whether show an unified plot or separated for each individual in 'testing'

point.color

(character) Color of the points in the plot

ntst

(integer) Maximum number of row nodes ('testing') that are plotted separated as indicated by unified=FALSE

legend.pos

(character) Either "right", topright","bottomleft","bottomright","topleft", or "none" indicating where the legend is positioned in the plot

sets

(character vector) Names of the types of node: row, 'active' column, and 'non-active' column, respectively

eps

(numeric) Minumum value to declare nodes to be connected. Default is the machine precision (numerical zero)

Author

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

Details

Plot edges in the plane xy given by a numerical matrix. When the object is a 'SSI' object the edges are taken from the regression coefficients from the 'SSI'. Edges are plotted according to the Fruchterman-Reingold algorithm. When a matrix K is provided, edges are plotted according to the spectral value decomposition of Z K Z' = U D U'

Examples

Run this code
  require(SFSI)
  data(wheatHTP)
  
  index = which(Y$trial %in% 1:6)     # Use only a subset of data
  Y = Y[index,]
  M = scale(M[index,])/sqrt(ncol(M))  # Subset and scale markers
  G = tcrossprod(M)                   # Genomic relationship matrix
  y = as.vector(scale(Y[,"E1"]))      # Scale response variable
  
  # Training and testing sets
  tst = which(Y$trial == 2)
  trn = which(Y$trial != 2)

  fm = SSI(y,K=G,tst=tst,trn=trn)
  
  # Basic setting
  net.plot(fm)
  net.plot(fm, i=c(1,2))  # Show the first 2 tst elements
  net.plot(fm, show.names=c(TRUE,TRUE,FALSE), set.size=c(4,2,1), df=10)
  # \donttest{
  # Passing a matrix of coefficients
  B = as.matrix(coef(fm, df=15))
  net.plot(B, curve=TRUE, set.size=c(3.5,1.5,1))
  # }

Run the code above in your browser using DataLab