Skip to content
cedricx edited this page Sep 16, 2019 · 5 revisions

General Structure

Data

  • /cbica/projects/GURLAB/projects/xia_MSNR/data/original_data.RData
  • Organization:
  1. As.all: adjacency matrices for n=1051 subjects
  2. Xs.all: covariates for n=1051 subjects
  3. Ks: community assignment (p=236 Power264 without unassigned nodes)
  4. list.not.valid: combined training and testing sample (n = 813)
  5. list.valid: combined training and testing sample (n = 202)
  6. lists.train: a list of five vectors, each contains a training vector for 5-fold cross-validation
  7. lists.test:a list of five vectors, each contains a testing vector for 5-fold cross-validation

Code

  • /cbica/projects/GURLAB/projects/xia_MSNR/script/script
  • Organization:
MSNR code
  1. functions.R: script that contains the actual code for MSNR
run MSNR on original data
  1. org_par_fold.R: script performs one five-fold cross-validation of MSNR on the data. Here you need to change serverDir,workingdir,outdir, and save the result section as appropriate to your project. lam1.vals and lam2.vals control the search parameter space. Additionally, to select n=150, set this up in the code blocks assemble data and generate sets. See an example below.
  2. 'org_par_fold_job_submit.sh': _Here you need to change logFile,codeDir as appropriate to your project.
run MSNR on permuted data
  1. perm_par_fold.R: script performs one five-fold cross-validation of MSNR on the data. Here you need to change serverDir,workingdir,outdir, and save the result section as appropriate to your project. lam1.vals and lam2.vals control the search parameter space. Additionally, to select n=150, set this up in the code block assemble data and generate sets.
  2. 'perm_par_fold_job_submit.sh': _Here you need to change logFile,codeDir as appropriate to your projlsect.
example to select 150 for prototyping

As.train = As.not.valid[lists.train[[f]][1:100],,]

As.test = As.not.valid[lists.test[[f]][1:50],,]

To Run

Once you have everything set up as above (appropriate paths and variables have been named and changed), you can just execute org_par_fold_job_submit.sh to get the model of MSNR on the original data, and perm_par_fold_job_submit.sh to get the permuted models of MSNR on the permutated data. I will add the analysis code later as well as you work through generate these results. Note, the run time is long since it's 5 fold over 1001 runs. On CBICA, it took me 2-3 days when everything ran perfectly.

Output Interpretation

The key outputs are model_out, best_lam1, best_lam2, As.valid.error, and As.test.matrix.

  • As.test.matrix: this is the cross-validation error matrix averaged across five folds.
  • best_lam1 and best_lam2 are the penalities gave the best (lowest) error in the 5-fold cross-validation.
  • As.valid.error is the error in the true validation set, which should be comparable to the lowest in the As.test.matrix. This is also the value to which all permutation runs should be compared to.
  • model_out contains all the meat! And the most important one is gamma, which contains the coefficient matrix for each covariate ran. Specifically, gamma is a 3d matrix, x * p * p, where x is the number of covariates and p is the number of community. For example, gamma[1,:,:] denotes the community-level relationship between covariate 1 and all the community connectivities. theta is the low-rank mean connectivity matrix across subjects.