Mixed Model: Creating p maps using R but modeling for random factors

Written by Owen Phillips. Email Dr. Katherine Narr if you have any questions. For more information, see the protocols page.

Mapping Random Effects in R.


As of now, the mixed model needs to be run using a script on qsub.loni.ucla.edu

  1. Download the script here.
  2. Edit the inputs, outputs, and variables to fit your needs. Follow the protocol outlined in "Running R Statistical Analyses on MRI Data" to prepare your inputs. The main difference between the two protocols is the random factor for the "-formulay" and "-reducedy" will be in brackets. ex: (1|family_mixed)
  3. Below is a sample command line where family_mixed is our random factor. The mixed model is used when related subjects are included in the analysis. Note-This approach may reduce power.

    /ifs/woods/R/R-2.7.2/bin/R CMD BATCH --no-save --no-restore --quiet '--args -table/ifs/xxxxxx.txt -formulay~diagnosis+age+sex+BV_cubed+(1|family_mixed) -reducedy~age+sex+BV_cubed+(1|family_mixed) -output/ifs/xxxxxxxx.ucf' /ifs/woods/rshape/batch_commands/anova_mixed_shape_batch.R /ifs/xxxxxxxxx_error_log.txt
  4. To run on qsub, first ssh -X username@qsub.loni.ucla.edu
  5. Submit on the command line using : qsub R.qsub.sample
  6. Note-effects are only shown in the positive direction.
  7. Note-the random factor variable will need to be in a string format. For example, if you are trying to covary for family, and each family is coded with a number, add a letter in front of the family ID. Example: 101 to X101, 102 to X102..ect