createfMRIsimulation: createfMRIsimulation

View source: R/simulation2.R

createfMRIsimulationR Documentation

createfMRIsimulation

Description

function for generating NPDR-formatted rs-fMRI data set

Usage

createfMRIsimulation(
  num.samples = 100,
  num.variables = 100,
  num.times = 100,
  pct.imbalance = 0.5,
  pct.signals = 0.1,
  main.bias = 0.4,
  interaction.bias = 0.4,
  hi.cor = 0.8,
  lo.cor = 0.2,
  label = "class",
  sim.type = "interactionErdos",
  mix.type = NULL,
  pct.mixed = 0.5,
  plot.graph = FALSE,
  use.Rcpp = FALSE,
  prob.connected = NULL,
  out.degree = NULL,
  sim.graph.structure = TRUE,
  data.type = "continuous",
  graph.structure = NULL
)

Arguments

num.samples

number of samples

num.variables

number of variables (features)

num.times

- (numeric) number of time points for each ROI (same for cases and controls)

pct.imbalance

fraction of num.samples that are cases

pct.signals

fraction of num.variables that are functional

main.bias

approximate effect size for main effect simulations

interaction.bias

approximate effect size for interaction effects

hi.cor

parameter to use for network-connected pairwise correlations

lo.cor

parameter to use for network-non-connected pairwise correlations

label

should just be "class" for binary response

sim.type

a character that determines the type of simulation: mainEffect/mainEffect_Erdos-Renyi/mainEffect_Scalefree/interactionErdos/interactionScalefree/mixed

mix.type

character that determines the type of mixed effects simulation: main-interactionErdos/main-interactionScalefree

pct.mixed

percent of functional variables that are main effects (1 - pct_interaction). Use with sim.type="mixed" and specify mix.type.

plot.graph

logical indicating whether to plot networks

use.Rcpp

if true use Rcpp to correct negative eigenvalues

prob.connected

probability of drawing an edge between two arbitrary vertices in Erdos-Renyi graph

out.degree

out-degree of vertices in Scale-free graph

sim.graph.structure

- (logical) set to TRUE for random graph from igraph package. If FALSE, must provide graph structure as input.

data.type

character indicating if data is from a "continuous" or "discrete" distribution

graph.structure

(igraph) graph structure generated from igraph, NULL default

Details

Parameters: Very similar to createSimulation2() in NPDR

New Parameters:

num.times - (numeric) number of time points for each ROI (same for cases and controls) graph.structure - (igraph like object) user-supplied graphical structure for all subjects. Currently only igraph object is acceptable. We really just need the ability to compute degree vec and adjacency matrix in generate_structured_corrmat(). sim.graph.structure - (logical) set to TRUE for random graph from igraph package. If FALSE, must provide graph structure as input.

Value:

(list) with the following elements:

corr.attr.names - (character) ordered vec of ROI names from simulation. Each subject's correlation matrix will have this exact order in its rows and columns. dataset - (matrix) of dimension num.samples x num.variables*(num.variables - 1), where each row represents a subject's pairwise correlations. The first (num.variables - 1) columns are all pairwise correlations (excluding self-correlation) with the first ROI in corr.attr.names vec, the next subsequent group of (num.variables - 1) columns are pairwise correlations with the second ROI in corr.attr.names vec, ... etc. This order is preserved in all individual subject correlation matrices.

Details: Generates (num.times x num.variables) matrix of (num.variables) ROI time series for each of the num.samples subjects. Each ROI has (num.times) time points in the simulated fMRI scan. Functional ROIs can be created using (sim.type), which should be one of c("interactionErdos","interactionScalefree"). Effect size is controlled exactly the same as in createSimulation2(), using a combination of (interaction.bias), (hi.cor), and (prob.connected) (or out.degree). For example, setting interaction.bias = 1, hi.cor ~ 1, and prob.connected ~ 1 will yield maximal effect sizes for functional ROIs (or out.degree = num.variables - 1 for interactionScalefree). The order of ROIs in (dataset) columns is given by (corr.attr.names), which is a primary input to npdr() that allows us to assign importance to each ROI.

Notes: Must be careful when using real data to make sure all subject correlation matrices have the same row/column order. The (corr.attr.names) parameter contains ROI names in the same order as row/column in subject correlation matrices. If subjects have differing row/column order, then ROI importance is meaningless.

Value

A list with:

dataset

(matrix) of dimension num.samples x num.variables*(num.variables - 1), where each row

corr.attr.names

(character) ordered vec of ROI names from simulation. Each subject's correlation matrix will have this exact order in its rows and columns.


insilico/npdr documentation built on July 6, 2023, 1:14 p.m.