R/exampledata.R

#' Example dataset
#'
#' A simulated example dataset of ECCO.
#' The variables are as follows:
#'
#' @docType data
#' @keywords datasets
#' @name exampledata
#' @usage data(exampledata)
#' @format Contains the following objects:
#' \describe{
#'   \item{gene_name}{a vector containg the names of all genes.}
#'   \item{M_matrix}{a matrix containing the whole gene expression data.}
#'   \item{peer}{a data list containing the whole gene expression data after removing the PEER factors.}
#'   \item{snp_raw}{a data list containing the whole genotype data.}
#'   \item{Y}{the phenotype data.}
#'   \item{peerlist}{the number of peer factors to be examined.}
#' }
#' @examples
#' data(exampledata)
#' attach(exampledata)
#' N=length(gene_name)
#' iv_snp=c()
#' summary0=c()
#' for(ind in 1:N)
#' {
#' tryCatch({
#'  gene=M_matrix[,ind]
#'  geno=snp_raw[[ind]]
#'  genename=gene_name[ind]
#'  result=ecco0(gene,genename,gene_name,geno,ind,Y)
#'  iv_snp=rbind(iv_snp,result$iv_snp)
#'  summary0=rbind(summary0,result$summary)
#'  },
#'  error=function(e){})
#'  }
#'  res=c()
#'  summary_total=summary0
#'  for(num_peer in 1:length(peerlist))
#'  {
#'   tryCatch({
#'   pheno=Y
#'   gene=M_matrix
#'   gene_name=gene_name
#'   peerlist=c(1,2,5)
#'   summary<-ecco(pheno,peer[[num_peer]],gene_name,iv_snp,peerlist[num_peer],summary0)
#'   },
#'   error=function(e){})
#'   summary_total=rbind(summary_total,summary)
#'   res=rbind(res,c(cor(as.numeric(summary[,4]),as.numeric(summary[,5])),peerlist[num_peer]))
#'   }
#'   res=data.frame(res)
#'   optimal_num_peer=res[which(res[,1]==max(res[,1])),2]
#' closeAllConnections()
#' detach(exampledata)
"exampledata"
fanyue322/ECCO documentation built on July 11, 2020, 1:10 p.m.