Learn R Programming

MRPC (version 2.2.0)

data_examples: Example data under a simple and complex models

Description

Example data under the simple and complex graphs. Data may be continuous or discrete.

Usage

data(data_examples)

Arguments

Value

A list that containing the numeric data matrix and components of a graph.

  • simple: Simple model.

  • complex: Complex model.

  • cont: Continuous.

  • disc: Discrete.

  • withGV: With genetic information.

  • withoutGV: Without genetic information.

  • data: Data matrix.

  • graph: Components of a graph.

Details

For each model, the graph and a simulated data matrix are available for both continuous and discrete data.

For continuous data with genetic information: 1000 samples in row and 6 variables in column. First two columns are the genetic variants and remaning columns are gene expression.

Continuous data without genetic information: 1000 samples in row and 8 variables in column.

Discrete data with genetic information: 1000 samples in row and 6 variables in column. First column is the genetic variant and remaning columns are the gene expression.

Discrete data without genetic information: 1000 samples in row and 5 variables in column.

Continuous data with genetic information for complex model: 1000 samples in row and 22 variables in column. First 14 column is the genetic variants and remaning columns are the genes expression.

Examples

Run this code
# NOT RUN {
# Continuous data with genetic varitant (GV)
# load the data
data("data_examples")  

# Extract the sample size
n <- nrow(data_examples$simple$cont$withGV$data)  

# Extract the node/column names
V <- colnames(data_examples$simple$cont$withGV$data)  

# Calculate Pearson correlation
suffStat_C <- list(C = cor(data_examples$simple$cont$withGV$data),
                   n = n)

# Infer the graph by MRPC
data.mrpc.cont.withGV <- MRPC(data = data_examples$simple$cont$withGV$data,
                              suffStat = suffStat_C, 
                              GV = 2,
                              FDR = 0.05, 
                              alpha = 0.05,
                              indepTest = 'gaussCItest',
                              labels = V,
                              FDRcontrol = TRUE,
                              verbose = TRUE)
# Plot the results
par(mfrow = c(1, 2))
# plot the true graph
plot(data_examples$simple$cont$withGV$graph,
     main = "truth") 
# plot the inferred graph
plot(data.mrpc.cont.withGV,
     main = "inferred")    


# Continuous data without genetic information
# load the data
data("data_examples")    

# Extract the sample size
n <- nrow(data_examples$simple$cont$withoutGV$data) 

# Extract the node/column names
V <- colnames(data_examples$simple$cont$withoutGV$data)

# Calculate Pearson correlation
suffStat_C <- list(C = cor(data_examples$simple$cont$withoutGV$data),
                   n = n)

# Infer the graph by MRPC
data.mrpc.cont.withoutGV <- MRPC(data = data_examples$simple$cont$withoutGV$data,
                                 suffStat = suffStat_C, 
                                 GV = 0,
                                 FDR = 0.05,
                                 alpha = 0.05,
                                 indepTest = 'gaussCItest',
                                 labels = V, 
                                 FDRcontrol = TRUE,
                                 verbose = TRUE)
# Plot the results
par(mfrow = c(1, 2))
# plot the true graph
plot(data_examples$simple$cont$withoutGV$graph,
     main = "truth") 
# plot the inferred graph
plot(data.mrpc.cont.withoutGV,
     main = "inferred") 

# Discrete data with genetic information
# load the data
data("data_examples")     

# Extract the sample size
n <- nrow(data_examples$simple$disc$withGV$data)  

# Extract the node/column names
V <- colnames(data_examples$simple$disc$withGV$data)

# Calculate Pearson correlation
suffStat_C <- list(C = cor(data_examples$simple$disc$withGV$data),
                   n = n)

# Infer the graph by MRPC
data.mrpc.disc.withGV <- MRPC(data = data_examples$simple$disc$withGV$data,
                              suffStat = suffStat_C, 
                              GV = 1,
                              FDR = 0.05, 
                              alpha = 0.05,
                              indepTest = 'gaussCItest',
                              labels = V, 
                              FDRcontrol = TRUE,
                              verbose = TRUE)
# Plot the results
par (mfrow = c(1, 2))
# plot the true graph
plot(data_examples$simple$disc$withGV$graph,
     main = "truth") 
# Plot the inferred causal graph
plot(data.mrpc.disc.withGV,
     main = "inferred") 

# Discrete data without genetic information
# load the data
data("data_examples")    

# Extract the sample size
n <- nrow (data_examples$simple$disc$withoutGV$data)  

# Extract the node/column names
V <- colnames(data_examples$simple$disc$withoutGV$data)   

# Calculate Pearson correlation
suffStat_C <- list(C = cor(data_examples$simple$disc$withoutGV$data),
                   n = n)

# Infer the graph by MRPC
data.mrpc.disc.withoutGV <- MRPC(data = data_examples$simple$disc$withoutGV$data,
                                 suffStat = suffStat_C, 
                                 GV = 1,
                                 FDR = 0.05, 
                                 alpha = 0.05,
                                 indepTest = 'gaussCItest',
                                 labels = V, 
                                 FDRcontrol = TRUE,
                                 verbose = TRUE)
# Plot the results
par(mfrow = c(1, 2))
# plot the true graph
plot(data_examples$simple$disc$withoutGV$graph,
     main = "truth") 
# plot the inferred graph
plot(data.mrpc.disc.withoutGV,
     main = "inferred") 

# Continuous data with genetic information for complex model
# load the data
data("data_examples")   

# Graph without clustering
plot(data_examples$complex$cont$withGV$graph) 

# Adjacency matrix from directed example graph
Adj_directed <- as(data_examples$complex$cont$withGV$graph,
                   "matrix")

# Plot of dendrogram with modules colors of nodes
PlotDendrogramObj <- PlotDendrogram(Adj_directed,
                                    minModuleSize = 5)
                  
# Visualization of inferred graph with modules colors
PlotGraphWithModulesObj <- PlotGraphWithModules(Adj_directed,
                                                PlotDendrogramObj,
                                                GV=14,
                                                node.size=8,
                                                arrow.size = 5,
                                                label.size = 3,
                                                alpha = 1) 
# plot 
plot(PlotGraphWithModulesObj)  
# }

Run the code above in your browser using DataLab