plotNet: Network plot

Description Usage Arguments Author(s) Examples

View source: R/R_utils_wC.R

Description

Plot for a set of individuals in a testing set, a network of individuals in training set in a SSI

Usage

1
2
3
4
5
6
plotNet(fm, B, Z = NULL, K, indexK = NULL, subsetG = NULL,
           tst = NULL, U = NULL, d = NULL, group = NULL, group.shape = NULL,
           set.color = NULL, set.size = NULL, df = NULL, title, axis.labels = TRUE,
           curve = FALSE, bg.color = "gray20", unified = TRUE, ntst = 36,
           line.color = "gray90", line.tick = 0.3, legend.pos="right",
           point.color = "gray20", sets = c("Testing","Supporting","Non-active"))

Arguments

fm

An object of the 'SSI' class

B

Matrix of regression coefficients with number of rows and number of columns equal to the length of the vectors provided in fm$tst and fm$trn, respectively

Z

Design matrix for the random effects. When Z=NULL an identity matrix is considered (default) thus G = K; otherwise G = Z K Z' is used

K

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

indexK

Vector of integers indicating which columns and rows will be read when K is the name of a binary file. Default indexK=NULL will read the whole matrix

subsetG

Vector of integers indicating which columns (and rows) from G the vectors fm$trn and fm$tst refer to. Default subsetG=NULL considers that elements fm$trn and fm$tst refer to columns (and rows) from G; otherwise elements in training and testing in G have indices subsetG[fm$trn] and subsetG[fm$tst]

tst

Vector of integers indicating which individuals are in testing set and must be contained in fm$tst. Default tst=NULL will consider the whole vector fm$tst to plot

U

Matrix with eigenvectors from spectral value decomposition of G = U D U'

d

Vector with eigenvalues from spectral value decomposition of G = U D U'

group

Object of the 'dataframe' class with one column grouping for the individuals. The rows must match with the rows in G matrix

df

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

title

A 'character' type string for the plot title

bg.color

A 'character' type string indicating the plot background color

line.color

A 'character' type string indicating the color of lines connecting 'active' training individuals with each individual in testing set

line.tick

A numeric value indicating the tick of lines connecting 'active' training individuals with each individual in testing set

set.color

Vector of 'character' strings indicating the color point of each level of 'testing', 'active', and 'non-active' elements, respectively

set.size

Vector of 'numeric' values indicating the size of 'testing', 'active', and 'non-active' elements, respectively

group.shape

Vector of 'integer' numbers indicating the shape of each level of the grouping column provided group

curve

TRUE or FALSE to whether draw curve of rect lines connecting 'active' training individuals with each individual in testing set

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

A 'character' type string indicating the color of the points in the plot

ntst

Maximum number of individuals in 'testing' that are plotted separated as indicated by single=FALSE

legend.pos

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

sets

Vector of 'character' strings indicating the names of the sets: testing group, predictors with non-zero coefficient, and predictors with zero coefficient in the SSI, respectively

Author(s)

Marco Lopez-Cruz (lopezcru@msu.edu) and Gustavo de los Campos

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  require(SFSI)
  data(wheatHTP)
  X = scale(X[1:300,])        # Subset and scale markers
  G = tcrossprod(X)/ncol(X)   # Genomic relationship matrix
  y = scale(Y[1:300,"YLD"])   # Subset response variable
  
  fm = SSI(y,K=G,tst=1:15,trn=16:length(y))
  
  # Basic setting
  plotNet(fm,K=G,bg.color="white",line.color="gray25")
  plotNet(fm,K=G,unified=FALSE)
  
  # Passing a matrix of coefficients
  B=as.matrix(coef(fm,df=15))
  plotNet(fm,B=B,K=G,curve=TRUE,set.size=c(3.5,1.5,1))
  
  # Using Spectral Value Decomposition and grouping
  EVD <- eigen(G)
  gp <- data.frame(group=kmeans(EVD$vectors[,1:3],centers=5)$cluster)
  plotNet(fm,curve=TRUE,group=gp,U=EVD$vectors,d=EVD$values)

MarcooLopez/SFSI_data documentation built on April 15, 2021, 10:53 a.m.