# pathdiagram: Path Diagram In GMRP: GWAS-based Mendelian Randomization and Path Analyses

## Description

Create a directed acyclic diagram to represent causal effects of risk factors on the disease of study.

## Usage

 `1` ```pathdiagram(pathdata, disease, R2, range) ```

## Arguments

 `pathdata` R object that is dataset consisting of correlation matrix of risk factors and a numeric vector of direct path coefficients. `disease` a string that specifies outcome name or disease name. If disease name is long or has multiple words, then we suggest an abbreviated name, for example, coronary artery disease may be shortened as `CAD`. `R2` a numeric parameter, is R-square obtained from path analysis. `range` range of specified columns for correlation matrix. For example, `range = c(2:4)` means the correlation coefficient begins with column 2 and end at column 4.

## Details

The pathdata contains correlation matrix of risk factors and a numeric vector of direct path coefficients obtained from path analysis of beta data of `SNP`s on risk factors and disease. Columns must have risk factor names and path.

## Value

NULL. pathdiagram will create one-level path diagram labeled with colors.

## Author(s)

Yuan-De Tan tanyuande@gmail.com

`pathdiagram2`, `plotmat`, `plotweb`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```mypath<-matrix(NA,3,4) mypath[1,]<-c(1.000000,-0.066678, 0.420036,0.764638) mypath[2,]<-c(-0.066678,1.000000,-0.559718,0.496831) mypath[3,]<-c(0.420036,-0.559718,1.000000,0.414346) colnames(mypath)<-c("ldl","hdl","tg","path") #mypath # ldl hdl tg path #1 1.000000 -0.066678 0.420036 0.764638 #2 -0.066678 1.000000 -0.559718 0.496831 #3 0.420036 -0.559718 1.000000 0.414346 mypath<-as.data.frame(mypath) pathdiagram(pathdata=mypath,disease="cad",R2=0.988243,range=c(1:3)) ```