Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+28
- LICENSE.txtAdded+208
- README.mdAdded+75
- data/14000_1_QUINN_3AOB.matAdded+3
- data/18367_1_QUINN_3AOB.matAdded+3
- data/19759_1_QUINN_3AOB.matAdded+3
- data/20543_1_QUINN_3AOB.matAdded+3
- data/3001_1_3AOB.matAdded+3
- data/3001_2_3AOB.matAdded+3
- data/3001_3_3AOB.matAdded+3
- data/3002_1_3AOB.matAdded+3
- data/3002_2_3AOB.matAdded+3
- data/3002_3_3AOB.matAdded+3
- data/3003_1_3AOB.matAdded+3
- data/3003_2_3AOB.matAdded+3
- data/3003_3_3AOB.matAdded+3
- data/3004_1_3AOB.matAdded+3
- data/3004_2_3AOB.matAdded+3
- data/3004_3_3AOB.matAdded+3
- data/3005_1_3AOB.matAdded+3
- data/3005_2_3AOB.matAdded+3
- data/3005_3_3AOB.matAdded+3
- data/3006_1_3AOB.matAdded+3
- data/3007_1_3AOB.matAdded+3
- data/3007_2_3AOB.matAdded+3
- data/3007_3_3AOB.matAdded+3
- data/3008_1_3AOB.matAdded+3
- data/3009_1_3AOB.matAdded+3
- data/93385_1_QUINN_3AOB.matAdded+3
- data/94391_1_QUINN_3AOB.matAdded+3
- data/97750_1_QUINN_3AOB.matAdded+3
- scripts/BV_Chanlocs_60.matAdded
- scripts/BigAgg_Data.matAdded
- scripts/Manuscript_3AOB.mAdded+110
- scripts/ORIGINAL_README.txtAdded+10
- scripts/QUALITY_CHECK.xlsxAdded
- scripts/QUINN_QUALITY_CHECK.xlsxAdded
- scripts/Run_Thresh_1D.mAdded+61
- scripts/STEP1_3AOB_JFC.mAdded+192
- scripts/STEP2_3AOB_Process.mAdded+250
- scripts/s1_Load_Data.mAdded+121
- scripts/s2_Kill_Data.mAdded+54
- scripts/s3_Demographics.mAdded+88
- scripts/s4_Example_ERPs.mAdded+30
- scripts/s5_ERPs_by_Group.mAdded+137
- scripts/s6_Correlations.mAdded+36
- scripts/s6_Correlations_S1EEG_With_FrSBediffs.mAdded+111
- scripts/s6_FOR_SPSS.mAdded+111
- scripts/s7_Mengs_z.mAdded+51
- scripts/sx_Predict_Attrition.mAdded+85
56 unmodified lines57585956 unmodified lines# Video files - compressed*.mp4 filter=lfs diff=lfs merge=lfs -text*.webm filter=lfs diff=lfs merge=lfs -text56 unmodified lines5758596061626364656667686970717273747576777879808182838485868756 unmodified lines# Video files - compressed*.mp4 filter=lfs diff=lfs merge=lfs -text*.webm filter=lfs diff=lfs merge=lfs -textdata/93385_1_QUINN_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/94391_1_QUINN_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/97750_1_QUINN_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/14000_1_QUINN_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/18367_1_QUINN_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/19759_1_QUINN_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/20543_1_QUINN_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3001_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3001_2_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3001_3_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3002_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3002_2_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3002_3_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3003_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3003_2_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3003_3_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3004_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3004_2_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3004_3_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3005_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3005_2_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3005_3_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3006_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3007_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3007_2_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3007_3_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3008_1_3AOB.mat filter=lfs diff=lfs merge=lfs -textdata/3009_1_3AOB.mat filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208Public Domain Dedication and License (PDDL)
Preamble
The Open Data Commons – Public Domain Dedication and Licence is a document intended to allow you to freely share, modify, and use this work for any purpose and without any restrictions. This licence is intended for use on databases or their contents (“data”), either together or individually.
Many databases are covered by copyright. Some jurisdictions, mainly in Europe, have specific special rights that cover databases called the “sui generis” database right. Both of these sets of rights, as well as other legal rights used to protect databases and data, can create uncertainty or practical difficulty for those wishing to share databases and their underlying data but retain a limited amount of rights under a “some rights reserved” approach to licensing as outlined in the Science Commons Protocol for Implementing Open Access Data. As a result, this waiver and licence tries to the fullest extent possible to eliminate or fully license any rights that cover this database and data. Any Community Norms or similar statements of use of the database or data do not form a part of this document, and do not act as a contract for access or other terms of use for the database or data.
The position of the recipient of the work
Because this document places the database and its contents in or as close as possible within the public domain, there are no restrictions or requirements placed on the recipient by this document. Recipients may use this work commercially, use technical protection measures, combine this data or database with other databases or data, and share their changes and additions or keep them secret. It is not a requirement that recipients provide further users with a copy of this licence or attribute the original creator of the data or database as a source. The goal is to eliminate restrictions held by the original creator of the data and database on the use of it by others.
The position of the dedicator of the work
Copyright law, as with most other law under the banner of “intellectual property”, is inherently national law. This means that there exists several differences in how copyright and other IP rights can be relinquished, waived or licensed in the many legal jurisdictions of the world. This is despite much harmonisation of minimum levels of protection. The internet and other communication technologies span these many disparate legal jurisdictions and thus pose special difficulties for a document relinquishing and waiving intellectual property rights, including copyright and database rights, for use by the global community. Because of this feature of intellectual property law, this document first relinquishes the rights and waives the relevant rights and claims. It then goes on to license these same rights for jurisdictions or areas of law that may make it difficult to relinquish or waive rights or claims.
The purpose of this document is to enable rightsholders to place their work into the public domain. Unlike licences for free and open source software, free cultural works, or open content licences, rightsholders will not be able to “dual license” their work by releasing the same work under different licences. This is because they have allowed anyone to use the work in whatever way they choose. Rightsholders therefore can’t re-license it under copyright or database rights on different terms because they have nothing left to license. Doing so creates truly accessible data to build rich applications and advance the progress of science and the arts.
This document can cover either or both of the database and its contents (the data). Because databases can have a wide variety of content – not just factual data – rightsholders should use the Open Data Commons – Public Domain Dedication & Licence for an entire database and its contents only if everything can be placed under the terms of this document. Because even factual data can sometimes have intellectual property rights, rightsholders should use this licence to cover both the database and its factual data when making material available under this document; even if it is likely that the data would not be covered by copyright or database rights.
Rightsholders can also use this document to cover any copyright or database rights claims over only a database, and leave the contents to be covered by other licences or documents. They can do this because this document refers to the “Work”, which can be either – or both – the database and its contents. As a result, rightsholders need to clearly state what they are dedicating under this document when they dedicate it.
Just like any licence or other document dealing with intellectual property, rightsholders should be aware that one can only license what one owns. Please ensure that the rights have been cleared to make this material available under this document.
This document permanently and irrevocably makes the Work available to the public for any use of any kind, and it should not be used unless the rightsholder is prepared for this to happen.
Part I: Introduction
The Rightsholder (the Person holding rights or claims over the Work) agrees as follows:
1.0 Definitions of Capitalised Words
“Copyright” – Includes rights under copyright and under neighbouring rights and similarly related sets of rights under the law of the relevant jurisdiction under Section 6.4.
“Data” – The contents of the Database, which includes the information, independent works, or other material collected into the Database offered under the terms of this Document.
“Database” – A collection of Data arranged in a systematic or methodical way and individually accessible by electronic or other means offered under the terms of this Document.
“Database Right” – Means rights over Data resulting from the Chapter III (“sui generis”) rights in the Database Directive (Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases) and any future updates as well as any similar rights available in the relevant jurisdiction under Section 6.4.
“Document” – means this relinquishment and waiver of rights and claims and back up licence agreement.
“Person” – Means a natural or legal person or a body of persons corporate or incorporate.
“Use” – As a verb, means doing any act that is restricted by Copyright or Database Rights whether in the original medium or any other; and includes modifying the Work as may be technically necessary to use it in a different mode or format. This includes the right to sublicense the Work.
“Work” – Means either or both of the Database and Data offered under the terms of this Document.
“You” – the Person acquiring rights under the licence elements of this Document.
Words in the singular include the plural and vice versa.
2.0 What this document covers
2.1. Legal effect of this Document. This Document is:
a. A dedication to the public domain and waiver of Copyright and Database Rights over the Work; and
b. A licence of Copyright and Database Rights over the Work in jurisdictions that do not allow for relinquishment or waiver.
2.2. Legal rights covered.
a. Copyright. Any copyright or neighbouring rights in the Work. Copyright law varies between jurisdictions, but is likely to cover: the Database model or schema, which is the structure, arrangement, and organisation of the Database, and can also include the Database tables and table indexes; the data entry and output sheets; and the Field names of Data stored in the Database. Copyright may also cover the Data depending on the jurisdiction and type of Data; and
b. Database Rights. Database Rights only extend to the extraction and re-utilisation of the whole or a substantial part of the Data. Database Rights can apply even when there is no copyright over the Database. Database Rights can also apply when the Data is removed from the Database and is selected and arranged in a way that would not infringe any applicable copyright.
2.2 Rights not covered.
a. This Document does not apply to computer programs used in the making or operation of the Database;
b. This Document does not cover any patents over the Data or the Database. Please see Section 4.2 later in this Document for further details; and
c. This Document does not cover any trade marks associated with the Database. Please see Section 4.3 later in this Document for further details.
Users of this Database are cautioned that they may have to clear other rights or consult other licences.
2.3 Facts are free. The Rightsholder takes the position that factual information is not covered by Copyright. This Document however covers the Work in jurisdictions that may protect the factual information in the Work by Copyright, and to cover any information protected by Copyright that is contained in the Work.
Part II: Dedication to the public domain
3.0 Dedication, waiver, and licence of Copyright and Database Rights
3.1 Dedication of Copyright and Database Rights to the public domain. The Rightsholder by using this Document, dedicates the Work to the public domain for the benefit of the public and relinquishes all rights in Copyright and Database Rights over the Work.
a. The Rightsholder realises that once these rights are relinquished, that the Rightsholder has no further rights in Copyright and Database Rights over the Work, and that the Work is free and open for others to Use.
b. The Rightsholder intends for their relinquishment to cover all present and future rights in the Work under Copyright and Database Rights, whether they are vested or contingent rights, and that this relinquishment of rights covers all their heirs and successors.
The above relinquishment of rights applies worldwide and includes media and formats now known or created in the future.
3.2 Waiver of rights and claims in Copyright and Database Rights when Section 3.1 dedication inapplicable. If the dedication in Section 3.1 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder waives any rights and claims that the Rightsholder may have or acquire in the future over the Work in:
a. Copyright; and
b. Database Rights.
To the extent possible in the relevant jurisdiction, the above waiver of rights and claims applies worldwide and includes media and formats now known or created in the future. The Rightsholder agrees not to assert the above rights and waives the right to enforce them over the Work.
3.3 Licence of Copyright and Database Rights when Sections 3.1 and 3.2 inapplicable. If the dedication and waiver in Sections 3.1 and 3.2 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder and You agree as follows:
a. The Licensor grants to You a worldwide, royalty-free, non-exclusive, licence to Use the Work for the duration of any applicable Copyright and Database Rights. These rights explicitly include commercial use, and do not exclude any field of endeavour. To the extent possible in the relevant jurisdiction, these rights may be exercised in all media and formats whether now known or created in the future.
3.4 Moral rights. This section covers moral rights, including the right to be identified as the author of the Work or to object to treatment that would otherwise prejudice the author’s honour and reputation, or any other derogatory treatment:
a. For jurisdictions allowing waiver of moral rights, Licensor waives all moral rights that Licensor may have in the Work to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4;
b. If waiver of moral rights under Section 3.4 a in the relevant jurisdiction is not possible, Licensor agrees not to assert any moral rights over the Work and waives all claims in moral rights to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4; and
c. For jurisdictions not allowing waiver or an agreement not to assert moral rights under Section 3.4 a and b, the author may retain their moral rights over the copyrighted aspects of the Work.
Please note that some jurisdictions do not allow for the waiver of moral rights, and so moral rights may still subsist over the work in some jurisdictions.
4.0 Relationship to other rights
4.1 No other contractual conditions. The Rightsholder makes this Work available to You without any other contractual obligations, either express or implied. Any Community Norms statement associated with the Work is not a contract and does not form part of this Document.
4.2 Relationship to patents. This Document does not grant You a licence for any patents that the Rightsholder may own. Users of this Database are cautioned that they may have to clear other rights or consult other licences.
4.3 Relationship to trade marks. This Document does not grant You a licence for any trade marks that the Rightsholder may own or that the Rightsholder may use to cover the Work. Users of this Database are cautioned that they may have to clear other rights or consult other licences.
Part III: General provisions
5.0 Warranties, disclaimer, and limitation of liability
5.1 The Work is provided by the Rightsholder “as is” and without any warranty of any kind, either express or implied, whether of title, of accuracy or completeness, of the presence of absence of errors, of fitness for purpose, or otherwise. Some jurisdictions do not allow the exclusion of implied warranties, so this exclusion may not apply to You.
5.2 Subject to any liability that may not be excluded or limited by law, the Rightsholder is not liable for, and expressly excludes, all liability for loss or damage however and whenever caused to anyone by any use under this Document, whether by You or by anyone else, and whether caused by any fault on the part of the Rightsholder or not. This exclusion of liability includes, but is not limited to, any special, incidental, consequential, punitive, or exemplary damages. This exclusion applies even if the Rightsholder has been advised of the possibility of such damages.
5.3 If liability may not be excluded by law, it is limited to actual and direct financial loss to the extent it is caused by proved negligence on the part of the Rightsholder.
6.0 General
6.1 If any provision of this Document is held to be invalid or unenforceable, that must not affect the validity or enforceability of the remainder of the terms of this Document.
6.2 This Document is the entire agreement between the parties with respect to the Work covered here. It replaces any earlier understandings, agreements or representations with respect to the Work not specified here.
6.3 This Document does not affect any rights that You or anyone else may independently have under any applicable law to make any use of this Work, including (for jurisdictions where this Document is a licence) fair dealing, fair use, database exceptions, or any other legally recognised limitation or exception to infringement of copyright or other applicable laws.
6.4 This Document takes effect in the relevant jurisdiction in which the Document terms are sought to be enforced. If the rights waived or granted under applicable law in the relevant jurisdiction includes additional rights not waived or granted under this Document, these additional rights are included in this Document in order to meet the intent of this Document.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475---license: pddltags:- eeg- medical- clinical- classification- mtbi- tbi- oddball---# Cavanagh2019: EEG mTBI Classification Dataset with Auditory Oddball TaskThe Cavanagh2019 dataset includes EEG recordings collected during a 3-stimulus auditory oddball paradigm in participants with mild traumatic brain injury (mTBI) and matched healthy controls. A total of 96 participants took part: 45 sub-acute mTBI patients (tested within 2 weeks post-injury), 26 healthy controls, and 25 chronic TBI patients (mild to moderate severity). Sub-acute mTBI and control participants completed two or three EEG sessions - at 3-14 days after the injury, and again after approximately 2 months - while chronic TBI participants completed a single session.
The task involved 260 trials: 70% standard tones (440 Hz), 15% target tones (660 Hz), and 15% novel naturalistic sounds. Stimuli were presented binaurally, and participants were instructed to count target tones while ignoring the others. EEG was recorded from 60 channels at a 500 Hz sampling rate.## PaperCavanagh, J. F., Wilson, J. K., Rieger, R. E., Gill, D., Broadway, J. M., Remer, J. H. S., Fratzke, V., Mayer, A. R., & Quinn, D. K. (2019). **ERPs predict symptomatic distress and recovery in sub-acute mild traumatic brain injury**. _Neuropsychologia_, 132, 107125.
DISCLAIMER: We (DISCO) are NOT the owners or creators of this dataset, but we merely uploaded it here, to support our's ("EEG-Bench") and other's work on EEG benchmarking.## Dataset Structure- `data/` contains the annotated experiment EEG data.- `scripts/` contains MATLAB scripts that produced the paper's results.- `scripts/BigAgg_Data.mat` contains information about the subjects.- `scripts/QUALITY_CHECK.xlsx` and `scripts/QUINN_QUALITY_CHECK.xlsx` contain information about bad quality recordings.
A `.mat` file can be read in python as follows:```pythonfrom scipy.io import loadmatmat = loadmat(filepath, simplify_cells=True)```(A field "fieldname" can be read from `mat` as `mat["fieldname"]`.)
Subject information can be read from `scripts/BigAgg_Data.mat` from the following fields (among others):- `DEMO`: information about mTBI and control subjects - `ID`: subject IDs, as included in the filename of the corresponding EEG recording under `data/` - `Group_CTL1`: for each subject, whether it belongs to the control group (which is the case if and only if the corresponding `Group_CTL1`-entry is `1`) or not - `Sex_F1`: gender of the subject (`1` means female, everything else means male) - `Age`: age of the subject- `Q_DEMO`: information about chronic TBI subjects - `URSI`: subject IDs, as included in the filename of the corresponding EEG recording under `data/` - `Sex_F1`: gender of the subject (`1` means female, everything else means male) - `Age`: age of the subject- `NP`: mTBI and control subjects' TOMM, TOPF, HVLT and other scores- `Q_NP`: chronic TBI subjects' TOMM, TOPF, HVLT and other scores- `QUEX`: mTBI and control BDI and other scores- `Q_QUEX`: chronic TBI BDI and other scores- `TBIfields`: information about mTBI subjects' injury- `Q_TBIfields`: information about chronic TBI subjects' injury
### Filename Format
```[PID]_[SESSION]_3AOB.mat (or [PID]_[SESSION]_QUINN_3AOB.mat for chronic TBI participants)```PID is the patient ID (e.g. `3001`), while SESSION distinguishes different days of recording (can be `1`, `2` or `3` for patients with mTBI or control patients and is always `1` for patients with chronic TBI).
### Fields in each FileLet `mat` be an EEG `.mat` file from the `data/` directory.Then `mat` contains (among others) the following fields and subfields- `EEG` - `data`: EEG data of shape `(#channels, trial_len, #trials)`. E.g. a recording of 247 trials/epochs with 60 channels, each trial having a duration of 4 seconds and a sampling rate of 500 Hz will have shape `(60, 2000, 247)`. - `event`: Contains a list of dictionaries, each entry (each event) having the following description: - `latency`: The onset of the event, measured as the index in the merged time-dimension `#trials x trial_len` (note `#trials` being the _outer_ and `trial_len` being the _inner_ array when merging). The duration of each event is 200ms. Hence, with a 500 Hz sampling rate, the EEG data `event_data` corresponding to the `i`-th event is ```python start_index = mat["EEG"]["event"][i]["latency"] event_data = numpy.transpose(mat["EEG"]["data"], [1, 2]).reshape([num_channels, num_trials * trial_len])[:, start_index:start_index+100] # shape (#channels, 100) ``` - `type`: The type of event. Can be `"S200"` (660 Hz tone), `"S201"` (440 Hz tone) or `"S202"` (naturalistic). - `chanlocs`: A list of channel descriptors - `nbchan`: Number of channels - `trials`: Number of trials/epochs in this recording - `srate`: Sampling Rate (Hz)
## LicenseBy the original authors of this work, this work has been licensed under the PDDL v1.0 license (see LICENSE.txt).123version https://git-lfs.github.com/spec/v1oid sha256:237765c1f2338d31a2542c2a10e558d1a1238fd70804d2ed94be218c1343c0f1size 477373827123version https://git-lfs.github.com/spec/v1oid sha256:ce3926646d3708e761de99c6d8a8e4781fa2ae7f260dc75ea507f558f98c6862size 467408442123version https://git-lfs.github.com/spec/v1oid sha256:96741bacc20feff34dc79a6e0d6273aabf200d5e3cc89af9aa1f5730d695a41csize 471988655123version https://git-lfs.github.com/spec/v1oid sha256:ce25742f58da4d907478876304401cc13a0a41be0f689b49efbb86d1ea0f7175size 487027572123version https://git-lfs.github.com/spec/v1oid sha256:d83b16fd4173acc142429f2848c5e27ecbd69b75b134dfaa8904d92f1fc24e8fsize 207860776123version https://git-lfs.github.com/spec/v1oid sha256:864ac7503f94f3936f75aa2249dee8f0ef0038b363a40215e51e2a329c131111size 207441186123version https://git-lfs.github.com/spec/v1oid sha256:6d7ce2ceb6f08dff284037d15c27f67cfbdeced3a9f7a24d6c3d52cabb9f9612size 211375742123version https://git-lfs.github.com/spec/v1oid sha256:a43aa053b4b9a182f082caa642cb07e4bd8989fd362cc131c35fa5e981205d47size 205726401123version https://git-lfs.github.com/spec/v1oid sha256:84d6d458769d932a10bb7b56f39150cd579262afb87a28aafef1f4fc56366b21size 208852720123version https://git-lfs.github.com/spec/v1oid sha256:efb2d3ec3011249d25c320e0b7ba413a4d58a3fcef31143994f0a10a61808ebcsize 207989868123version https://git-lfs.github.com/spec/v1oid sha256:76b4fd1c30858080300e9d8bfe0890f400f83d729c87ce5ae0dd3611dde2a5e0size 208254692123version https://git-lfs.github.com/spec/v1oid sha256:03476a9b854410ef3629eaa6a078d395999908297919179535eae5e04cc4ed2bsize 209728409123version https://git-lfs.github.com/spec/v1oid sha256:61d5575270a301880ec57c348db6eab9a5362d10894469808637014a7bac9f3fsize 206735253123version https://git-lfs.github.com/spec/v1oid sha256:c71f52c98b013d605b6c7330bf66dd7b3bb247dc181e1c378819f90892d45264size 214132459123version https://git-lfs.github.com/spec/v1oid sha256:bf7eadb1d134ff4caf497908e4c6666043895bed5cdaba825f8f4446456f8d42size 215338995123version https://git-lfs.github.com/spec/v1oid sha256:2bd90b4f00adb16f0cb46ba5e35e50ac5fe86242ca4017a437f864ab61db36f6size 212704950123version https://git-lfs.github.com/spec/v1oid sha256:4e01e0b6dd770f40833cbaecfb07b6d83396127238f1a26551342d4c9a7bf19asize 213404324123version https://git-lfs.github.com/spec/v1oid sha256:3d6b2e859a03ed4b2b2dfc8a8686edb3f0030fe8b505cfe30bfbcdadbdb20aadsize 211399673123version https://git-lfs.github.com/spec/v1oid sha256:3f609344a8517dd49d89a13caf2b6f1f123c1ce9d9050fc39b4ce0e5af906ccesize 209733608123version https://git-lfs.github.com/spec/v1oid sha256:44d9151a92ca04ca8f278edb4417574062ce18820a339efc26c221602b1401c9size 207559817123version https://git-lfs.github.com/spec/v1oid sha256:49277baee0415db1ec03067051ce9606fd21d85d564646fe887df8f956b809e1size 214527656123version https://git-lfs.github.com/spec/v1oid sha256:2b6e92caa9aab318f0aac8422ca46675697c4039ce4e907893f480282c00d863size 210261649123version https://git-lfs.github.com/spec/v1oid sha256:48e16387bb9591d6ae6480f355f37c300f97496965862d24003967f1e5d3a04dsize 200034154123version https://git-lfs.github.com/spec/v1oid sha256:cb85217860131012c298b886c56e75853fb1e1aca705ec40d1001e2af9574a3csize 209273569123version https://git-lfs.github.com/spec/v1oid sha256:0c2fbf9e92a7fb8e082886de823ed73a7a5b482cc920612fa7b5e5239d135ba4size 207644251123version https://git-lfs.github.com/spec/v1oid sha256:93c270eb4c33b18ebf92cd65ec6b4029b9eb66fea64bb0377096712feeedcef6size 482612470123version https://git-lfs.github.com/spec/v1oid sha256:bec68e4c6208acba23004f35b3ca28c1c2aae76948452b61fce0106aabe7ef5esize 467689543123version https://git-lfs.github.com/spec/v1oid sha256:a4c13374fcbd0f629958a8b22e6f3dc9c966f4751582bd6e23da19079e58a561size 474848275123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110%% Step 3 3AOB
clear all; clc
addpath('Z:\EXPERIMENTS\mTBICoBRE\EEG\');
datadir='Z:\EXPERIMENTS\mTBICoBRE\EEG\3AOB Processed\';
homedir='Z:\EXPERIMENTS\mTBICoBRE\MANUSCRIPT 3AOB\';
cd(homedir);
load('Z:\EXPERIMENTS\mTBICoBRE\EEG\BV_Chanlocs_60.mat');
tx2disp=-500:2:1000;
% Load Data
s1_Load_Data;
% Kill Data
s2_Kill_Data;
%% Demographics
s3_Demographics;
sx_Predict_Attrition;
%% Example ERPs
StdSite=find(strcmpi('FCz',{BV_Chanlocs_60.labels}));
StdT1=300; StdT2=450;
TargSite=find(strcmpi('Pz',{BV_Chanlocs_60.labels}));
TargT1=400; TargT2=600;
NovSite=find(strcmpi('FCz',{BV_Chanlocs_60.labels}));
NovT1=300; NovT2=450;
ERPSITE=[StdSite,TargSite,NovSite];
ERPWINS=[StdT1,StdT2;TargT1,TargT2;NovT1,NovT2];
ERPWINS_tx2disp=[[find(tx2disp==StdT1),find(tx2disp==StdT2)];...
[find(tx2disp==TargT1),find(tx2disp==TargT2)];...
[find(tx2disp==NovT1),find(tx2disp==NovT2)] ];
s4_Example_ERPs
%% ERPs by Group
time=1;
s5_ERPs_by_Group
%% For SPSS
s6_FOR_SPSS
figure; boxplot(FORSPSS(:,[10,11,16,17,22,23])); % Raw, Scaled
skewness(FORSPSS(:,[10,11,16,17,22,23])) % not skewed
% Calculate reliability for controls
CTL_REL=FORSPSS(FORSPSS(:,3)==1,:);
[REL.rho.F12,REL.p.F12]=corr(CTL_REL(:,11),CTL_REL(:,17),'type','Spearman','rows','pairwise'); % F_Tot 1 & 2
[REL.rho.F13,REL.p.F13]=corr(CTL_REL(:,11),CTL_REL(:,23),'type','Spearman','rows','pairwise'); % F_Tot 1 & 3
[REL.rho.F23,REL.p.F23]=corr(CTL_REL(:,17),CTL_REL(:,23),'type','Spearman','rows','pairwise'); % F_Tot 2 & 3
[REL.rho.P3b12,REL.p.P3b12]=corr(CTL_REL(:,11+1),CTL_REL(:,17+1),'type','Spearman','rows','pairwise'); % P3b 1 & 2
[REL.rho.P3b13,REL.p.P3b13]=corr(CTL_REL(:,11+1),CTL_REL(:,23+1),'type','Spearman','rows','pairwise'); % P3b 1 & 3
[REL.rho.P3b23,REL.p.P3b23]=corr(CTL_REL(:,17+1),CTL_REL(:,23+1),'type','Spearman','rows','pairwise'); % P3b 2 & 3
[REL.rho.P3a12,REL.p.P3a12]=corr(CTL_REL(:,11+2),CTL_REL(:,17+2),'type','Spearman','rows','pairwise'); % P3a 1 & 2
[REL.rho.P3a13,REL.p.P3a13]=corr(CTL_REL(:,11+2),CTL_REL(:,23+2),'type','Spearman','rows','pairwise'); % P3a 1 & 3
[REL.rho.P3a23,REL.p.P3a23]=corr(CTL_REL(:,17+2),CTL_REL(:,23+2),'type','Spearman','rows','pairwise'); % P3a 2 & 3
%% Correlations
DV=IDENTITY.QUEX(:,find(strcmp('F_Tot',IDENTITY_QUEX_HDR)));
time=1;
CONDI4Corr=3; % Std, Targ, Nov
s6_Correlations
%% Predictions
quexidx=find(strcmp('F_Tot',IDENTITY_QUEX_HDR));
CONDI4Corr=2; % Std, Targ, Nov
s6_Correlations_S1EEG_With_FrSBediffs
%% -------------- Between-Group rho-to-z
% Just type 'em in here from the plots (remember number on plots is df, not N):
r1=-.11
n1=38
r2=-.46
n2=23
clc;
t_r1 = 0.5*log((1+r1)/(1-r1));
t_r2 = 0.5*log((1+r2)/(1-r2));
z = (t_r1-t_r2)/sqrt(1/(n1-3)+1/(n2-3))
p = (1-normcdf(abs(z),0,1))*2
%% -------------- Within-Group rho-to-z
s7_Mengs_z
12345678910All data are the output of STEP1_3AOB_JFC.m. I didn't include raw data here since that contains things like date and time that need to be stripped out.
Files are labeled: ID _ session _ task.mat (e.g. 3001_1_3AOB.mat)
These have already been cleaned using APPLE; bad ICs are identified in the QUALITY CHECK.xls sheets.
I could be convinced to convert the raw data to .mat data so it could be run through STEP1 and people could clean it as they see fit - but otherwise having the data already pre-processed may help people get to some results quicker.
You can run STEP2_3AOB_Process.m to get the processed data, then run Manuscript_3AOB.m to call all the sub-routines that output the data in the paper.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061function [Corrected_P] = Run_Thresh_1D(TEMP1,TEMP2,site,ttesttype)
SHUFFLES=5000;
for shuffi=1:SHUFFLES
tempA=squeeze(mean(TEMP1(:,site,251:1001),2));
tempB=squeeze(mean(TEMP2(:,site,251:1001),2));
tempAB=[tempA;tempB];
idx=shuffle([ones(1,25),zeros(1,25)]);
A=tempAB(idx==1,:);
B=tempAB(idx==0,:);
if strmatch(ttesttype,'between')
[H,P,CI,STATS]=ttest2(A,B);
elseif strmatch(ttesttype,'within')
[H,P,CI,STATS]=ttest(A,B);
end
P(P<=.05)=NaN; P(P>.05)=0; P(isnan(P))=1;
P=squeeze(P);
l=bwlabel(P);
if max(l)>0
for ei=1:max(l)
idxs = find(l == ei);
tempthresh(ei) = sum(abs(STATS.tstat(idxs)));
end
THRESH(shuffi) = max(tempthresh);
clear idxs tempthresh ;
else
THRESH(shuffi) = 0;
end
clear H CI P STATS temp* A B idx l dims lmax;
end
THRESH=sort(THRESH);
ThisThreshold=THRESH(end-SHUFFLES*.05);
% NOW Run 1D size of effects
if strmatch(ttesttype,'between')
[H,P,CI,STATS]=ttest2(squeeze(mean(TEMP1(:,site,251:1001),2)),squeeze(mean(TEMP2(:,site,251:1001),2)));
elseif strmatch(ttesttype,'within')
[H,P,CI,STATS]=ttest(squeeze(mean(TEMP1(:,site,251:1001),2)),squeeze(mean(TEMP2(:,site,251:1001),2)));
end
P(P<=.05)=NaN; P(P>.05)=0; P(isnan(P))=1;
P=squeeze(P);
l=bwlabel(P);
Corrected_P=NaN*ones(1,751);
if max(l)>0
for ei=1:max(l)
idxs = find(l == ei);
if sum(abs(STATS.tstat(idxs))) > ThisThreshold
Corrected_P(idxs) = 1;
end
end
end
clear H CI P STATS temp* A B idx l dims lmax idxs;
clear THRESH ThisThreshold
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192%% 3AOB JFC
clear all; clc
addpath('Z:\EXPERIMENTS\mTBICoBRE\EEG\');
addpath(genpath('Y:\Programs\eeglab12_0_2_1b'));
rmpath('Y:\Programs\eeglab12_0_2_1b\functions\octavefunc');
rmpath('Y:\Programs\eeglab14_0_0b\functions\octavefunc');
datadir='Y:\EEG_Data\mTBICoBRE\'; % Data are here
saveloc='Z:\EXPERIMENTS\mTBICoBRE\EEG\3AOB Preproc\';
load('Z:\EXPERIMENTS\mTBICoBRE\EEG\BV_Chanlocs_60.mat');
cd(saveloc);
sx_dirs=dir([datadir,'M*']);
for sxi=1:length(sx_dirs)
for ses=1:3
sessdir=[datadir,sx_dirs(sxi).name,'\eeg\RawEEG\'];
sx_sess{sxi}{1,ses}=dir([sessdir,'*_',num2str(ses),'_ODDBALL.vhdr']);
sx_sess{sxi}{2,ses}=sessdir;
sx_sess{sxi}{3,ses}=sx_dirs(sxi).name;
end
end
LOG=[];
for sxi=1:size(sx_sess,2)
for sess=1:3
if ~isempty( sx_sess{sxi}{1,sess} )
subno=str2num(sx_sess{sxi}{1,sess}.name(1:4));
URSI=sx_sess{sxi}{3,sess};
LOG(subno-3000,sess+1)=subno;
LOG(subno-3000,1)=str2num(URSI(end-4:end));
end
end
end
for sxi=1:size(sx_sess,2)
for sess=1:3
if ~isempty( sx_sess{sxi}{1,sess} )
subno=str2num(sx_sess{sxi}{1,sess}.name(1:4));
thisdir=sx_sess{sxi}{2,sess};
URSI=sx_sess{sxi}{3,sess};
LOG2(sxi,sess)=subno;
if ~exist([saveloc,num2str(subno),'_',num2str(sess),'_3AOB.mat']);
% Data are 65 chans: 1=63 is EEG, 64 is VEOG, 65 is EKG Ref'd to CPz - - will want to retrieve that during re-referencing
EEG = pop_loadbv(thisdir,[num2str(subno),'_',num2str(sess),'_ODDBALL.vhdr']); clc; disp(['Loading ',num2str(subno),' s',num2str(sess)]);
% Run PATCH for sx<3003 s<2 AND for bad templates
PATCH
% Get Locs
locpath=('Y:\Programs\eeglab12_0_2_1b\plugins\dipfit2.2\standard_BESA\standard-10-5-cap385.elp');
EEG = pop_chanedit(EEG, 'lookup', locpath);
EEG = eeg_checkset( EEG );
% Get event types
for ai=2:length(EEG.event); clear temp; temp=EEG.event(ai).type;
if isempty(strmatch('boundary',temp)); TYPES(ai)=str2num(temp(2:end)) ; clear temp; end
end
UNIQUE_TYPES=unique(TYPES);
for ai=1:length(UNIQUE_TYPES); UNIQUE_TYPES_COUNT(ai)=sum(TYPES==UNIQUE_TYPES(ai)); end
clc; TRIGGERS=[UNIQUE_TYPES;UNIQUE_TYPES_COUNT] % Trigger type, Frequency
% Epoch
All_STIM={'S201','S200','S202'}; % Std, Target, Novel
EEG = pop_epoch( EEG, All_STIM, [-2 2], 'newname', 'Epochs', 'epochinfo', 'yes');
EEG = eeg_checkset( EEG );
% Remove VEOG and EKG
EEG.EKG=squeeze(EEG.data(65,:,:));
EEG.VEOG=squeeze(EEG.data(64,:,:));
EEG.data=EEG.data(1:63,:,:);
EEG.nbchan=63;
EEG.chanlocs(65)=[]; EEG.chanlocs(64)=[];
% Fix BV-specific issue - - - only needed for APPLE
for ai=1:size(EEG.urevent,2), EEG.urevent(ai).bvtime=EEG.urevent(ai).bvmknum; end
for ai=1:size(EEG.event,2), EEG.event(ai).bvtime=EEG.event(ai).bvmknum; end
for ai=1:size(EEG.epoch,2), EEG.epoch(ai).eventbvtime=EEG.epoch(ai).eventbvmknum; end
% Add CPz
EEG = pop_chanedit(EEG,'append',63,'changefield',{64 'labels' 'CPz'});
EEG = pop_chanedit(EEG,'lookup', locpath);
% Re-Ref to Average Ref and recover CPz
EEG = pop_reref(EEG,[],'refloc',struct('labels',{'CPz'},'type',{''},'theta',{180},'radius',{0.12662},'X',{-32.9279},'Y',{-4.0325e-15},'Z',{78.363},...
'sph_theta',{-180},'sph_phi',{67.208},'sph_radius',{85},'urchan',{64},'ref',{''}),'keepref','on');
% Remove everything else NOW that CPz has been reconstructed from the total
EEG.MASTOIDS = squeeze(mean(EEG.data([10,21],:,:),1));
EEG.data = EEG.data([1:4,6:9,11:20,22:26,28:64],:,:);
EEG.nbchan=60;
EEG.chanlocs(27)=[]; EEG.chanlocs(21)=[]; EEG.chanlocs(10)=[]; EEG.chanlocs(5)=[]; % Have to be in this order!
% Should probably re-ref to average again now that the contaminated channels are gone
EEG = pop_reref(EEG,[]);
% Remove mean
EEG = pop_rmbase(EEG,[],[]);
% ----------------------
% Setup APPLE to interp chans, reject epochs, & ID bad ICs. Output will be Avg ref'd and ICA'd.
eeg_chans=1:60;
Do_ICA=1;
ref_chan=36; % Re-Ref to FCz [WEIRD STEP, BUT THIS IS FOR FASTER, which is a part of APPLE]
EEG = pop_reref(EEG,ref_chan,'keepref','on');
% Run APPLE (will re-ref data to avg ref)
[EEG,EEG.bad_chans,EEG.bad_epochs,EEG.bad_ICAs]=APPLE_3AOB(EEG,eeg_chans,ref_chan,Do_ICA,subno,EEG.VEOG,sess,BV_Chanlocs_60);
% Save
save([num2str(subno),'_',num2str(sess),'_3AOB.mat'],'EEG');
% ----------------------
%% Remove the (presumptive) bad ICAs:
bad_ICAs_To_Remove=EEG.bad_ICAs{2};
if bad_ICAs_To_Remove==0, bad_ICAs_To_Remove=1; end
EEG = pop_subcomp( EEG, bad_ICAs_To_Remove, 0);
% Get the good info out of the epochs
for ai=1:size(EEG.epoch,2)
% Initialize
EEG.epoch(ai).CUE=NaN;
for bi=1:size(EEG.epoch(ai).eventlatency,2)
% Get STIMTYPE
if EEG.epoch(ai).eventlatency{bi}==0 && isempty(strmatch(EEG.epoch(ai).eventtype{bi},'N999')); % If this bi is the event
% Get StimType
FullName=EEG.epoch(ai).eventtype{bi};
EEG.epoch(ai).CUE=str2num(FullName(2:end)) ;
clear FullName
VECTOR(ai,1)=EEG.epoch(ai).CUE;
end
end
end
% Let's just do this for display
dims=size(EEG.data);
EEG.data=eegfilt(EEG.data,500,[],20);
EEG.data=reshape(EEG.data,dims(1),dims(2),dims(3));
% Set Params
tx=-2000:2:1998;
b1=find(tx==-200); b2=find(tx==0);
t1=find(tx==-500); t2=find(tx==1000);
toporange1=find(tx==250); toporange2=find(tx==600); toporangetot=250:2:600;
tx2disp=-500:2:1000;
MAPLIMS=[-8 8];
% Basecor your ERPs here so they are pretty.
BASE=squeeze( mean(EEG.data(:,b1:b2,:),2) );
for ai=1:dims(1)
EEG.data(ai,:,:)=squeeze(EEG.data(ai,:,:))-repmat( BASE(ai,:),dims(2),1 );
end
% Get max of P2 across all condis
site=11; % Pz
ERP4topo=mean(EEG.data(site,toporange1:toporange2,VECTOR(:,1)==200),3);
topomax_P3b=toporangetot(find(ERP4topo==max(ERP4topo)));
topotoplot_P3b=find(tx==topomax_P3b);
site=36; % FCz
ERP4topo=mean(EEG.data(site,toporange1:toporange2,VECTOR(:,1)==202),3);
topomax_P3a=toporangetot(find(ERP4topo==max(ERP4topo)));
topotoplot_P3a=find(tx==topomax_P3a);
% --------------
figure;
site=11; % Pz
subplot(3,4,1:4); hold on
plot(tx2disp,mean(EEG.data(site,t1:t2,VECTOR(:,1)==201),3),'k');
plot(tx2disp,mean(EEG.data(site,t1:t2,VECTOR(:,1)==200),3),'r');
plot(tx2disp,mean(EEG.data(site,t1:t2,VECTOR(:,1)==202),3),'b');
plot([topomax_P3b topomax_P3b],[-2 2],'m','linewidth',2); % indicate the max with a magenta line
title(['Pz Subno: ',num2str(subno),' Sess:',num2str(sess)]);
legend({'Std','Target','Novel'},'Location','NorthWest');
% --------------
site=36; % FCz
subplot(3,4,5:8); hold on
plot(tx2disp,mean(EEG.data(site,t1:t2,VECTOR(:,1)==201),3),'k');
plot(tx2disp,mean(EEG.data(site,t1:t2,VECTOR(:,1)==200),3),'r');
plot(tx2disp,mean(EEG.data(site,t1:t2,VECTOR(:,1)==202),3),'b');
plot([topomax_P3a topomax_P3a],[-2 2],'m','linewidth',2); % indicate the max with a magenta line
title(['FCz Subno: ',num2str(subno),' Sess:',num2str(sess)]);
% --------------
subplot(3,4,9); hold on
topoplot( mean(EEG.data(:,topotoplot_P3b,VECTOR(:,1)==201),3) , BV_Chanlocs_60,'maplimits',MAPLIMS); title('Std @ P3b')
subplot(3,4,10); hold on
topoplot( mean(EEG.data(:,topotoplot_P3b,VECTOR(:,1)==200),3) , BV_Chanlocs_60,'maplimits',MAPLIMS); title('Targ')
subplot(3,4,11); hold on
topoplot( mean(EEG.data(:,topotoplot_P3a,VECTOR(:,1)==202),3) , BV_Chanlocs_60,'maplimits',MAPLIMS); title('Novel')
saveas(gcf, [num2str(subno),'_',num2str(sess),'_3AOB_ERPs.png'],'png');
close all;
clear EEG VECTOR BASE PROBE TRIGGERS TYPES UNIQUE* did* topo* ERP* URSI dims eeg_chans;
end
end
end
end
%%
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250%% Step 2 Oddball
clear all; clc
addpath('Z:\EXPERIMENTS\mTBICoBRE\EEG\');
savedir='Z:\EXPERIMENTS\mTBICoBRE\EEG\3AOB Processed\';
load('Z:\EXPERIMENTS\mTBICoBRE\EEG\BV_Chanlocs_60.mat');
% ########## For Cavanagh data
datadir='Z:\EXPERIMENTS\mTBICoBRE\EEG\3AOB Preproc\';
[D_DAT,D_HDR,D_ALL]=xlsread('Z:\EXPERIMENTS\mTBICoBRE\ANALYSIS\QUALITY_CHECK.xlsx','ODDBALL_ICAs');
FILEENDER='_3AOB.mat';
% % % ########## For Quinn data
% % datadir='Z:\EXPERIMENTS\mTBICoBRE\EEG\QUINN 3AOB Preproc\';
% % [D_DAT,D_HDR,D_ALL]=xlsread('Z:\EXPERIMENTS\mTBICoBRE\ANALYSIS\QUINN_QUALITY_CHECK.xlsx','ODDBALL_ICAs');
% % FILEENDER='_QUINN_3AOB.mat';
cd(datadir);
% ############# Set Params
srate=500;
tx=-2000:1000/srate:1998;
B1=find(tx==-300); B2=find(tx==-200);
T1=find(tx==-500); T2=find(tx==1000);
tx2disp=-500:2:1000;
% #############
for si=1:length(D_DAT)
for sess=1:size(D_DAT,2)-1 % should be '2' for Quinn data, '3' for Cavanagh data
subno=D_DAT(si,1);
skip=0;
INFO=D_ALL{si+1,sess+1}; % +1's b/c of subno column and header row
disp(['TRYOUT ',num2str(subno),' S',num2str(sess)]);
if isnumeric(INFO), bad_ICAs_To_Remove=INFO; end
if isnan(INFO), skip=1; end % not done yet
if strmatch('BAD',INFO), skip=1; end % Bad data
if ~isnumeric(INFO), bad_ICAs_To_Remove=str2num(INFO); end
% Don't repeat if already done
if exist([savedir,num2str(subno),'_',num2str(sess),'_3AOB_TFandERPs_L.mat'])==2, skip=1; end
if skip==0
load([num2str(subno),'_',num2str(sess),FILEENDER]); disp(['DOING: ',num2str(subno),'_',num2str(sess),'_3AOB.mat']);
% Remove the bad ICAs:
disp(['BAD ICAS: ', num2str(bad_ICAs_To_Remove)]);
EEG = pop_subcomp( EEG, bad_ICAs_To_Remove, 0);
% Get the good info out of the epochs
for ai=1:size(EEG.epoch,2)
% Initialize
EEG.epoch(ai).EEG=NaN;
for bi=1:size(EEG.epoch(ai).eventlatency,2)
% Get STIMTYPE
if EEG.epoch(ai).eventlatency{bi}==0 && isempty(strmatch(EEG.epoch(ai).eventtype{bi},'N999')); % If this bi is the event
% Get StimType
FullName=EEG.epoch(ai).eventtype{bi};
EEG.epoch(ai).EEG=str2num(FullName(2:end)) ;
clear FullName
VECTOR(ai,1)=EEG.epoch(ai).EEG; All_STIM={'S201','S200','S202'}; % Std, Target, Novel
end
end
end
% Only as many STD as NOV
N_n=sum(VECTOR(:,1)==202);
temp_idxs=find(VECTOR(:,1)==201);
temp_idxs=shuffle(temp_idxs);
VECTOR(temp_idxs(N_n+1:end),1)=999; clear temp_idxs;
% Save trial counts
TRL_ct(1)=sum(VECTOR(:,1)==201);
TRL_ct(2)=sum(VECTOR(:,1)==200);
TRL_ct(3)=sum(VECTOR(:,1)==202);
%%
% $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$
% $$$$$$$$$$$$$$$$$$$$$$$ Time-Freq
% $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$
% Setup Wavelet Params
num_freqs=50;
frex=logspace(.01,1.7,num_freqs);
s=logspace(log10(3),log10(10),num_freqs)./(2*pi*frex);
t=-2:1/EEG.srate:2;
% Definte Convolution Parameters
dims = size(EEG.data);
n_wavelet = length(t);
n_data = dims(2)*dims(3);
n_convolution = n_wavelet+n_data-1;
n_conv_pow2 = pow2(nextpow2(n_convolution));
half_of_wavelet_size = (n_wavelet-1)/2;
% For Laplacian
X = [BV_Chanlocs_60.X]; Y = [BV_Chanlocs_60.Y]; Z = [BV_Chanlocs_60.Z];
% Pick channel
chans=[36,33,56]; % FCz, F5, F6
for REFi=1:2
if REFi==1, TAG='V';
elseif REFi==2, TAG='L';
[EEG.data,~,~] = laplacian_perrinX(EEG.data,X,Y,Z,[],1e-6);
end
% Get FFT of data
for chani=1:3
EEG_fft(chani,:) = fft(reshape(EEG.data(chans(chani),:,:),1,n_data),n_conv_pow2);
end
for fi=1:num_freqs
wavelet = fft( exp(2*1i*pi*frex(fi).*t) .* exp(-t.^2./(2*(s(fi)^2))) , n_conv_pow2 ); % sqrt(1/(s(fi)*sqrt(pi))) *
% convolution
for chani=1:3
temp_conv = ifft(wavelet.*EEG_fft(chani,:));
temp_conv = temp_conv(1:n_convolution);
temp_conv = temp_conv(half_of_wavelet_size+1:end-half_of_wavelet_size);
EEG_conv(chani,:,:) = reshape(temp_conv,dims(2),dims(3));
clear temp_conv;
% Common pre-EEG baseline
temp_BASE(chani,:) = mean(mean(abs(EEG_conv(chani,B1:B2,:)).^2,2),3);
end
for idx=1:3
if idx==1, idx_V=VECTOR(:,1)==201; % STD
elseif idx==2, idx_V=VECTOR(:,1)==200; % TARG
elseif idx==3, idx_V=VECTOR(:,1)==202; % NOV
end
for chani=1:3
temp_PWR = squeeze(mean(abs(EEG_conv(chani,T1:T2,idx_V)).^2,3));
POWER(chani,fi,:,idx) = 10* ( log10(temp_PWR') - log10(repmat(temp_BASE(chani,:),size(tx2disp,2),1)) );
ITPC(chani,fi,:,idx) = abs(mean(exp(1i*( angle(EEG_conv(chani,T1:T2,idx_V)) )),3));
if chani==1, seed=1; targ=2;
elseif chani==2, seed=1; targ=3;
elseif chani==3, seed=2; targ=3;
end
ISPC(chani,fi,:,idx) = abs(mean(exp(1i*( angle(EEG_conv(seed,T1:T2,idx_V)) - angle(EEG_conv(targ,T1:T2,idx_V)) )),3));
clear temp_PWR;
end
clear idx_V ;
end
clear wavelet idx_V temp_BASE EEG_conv;
end
%%
% $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$
% $$$$$$$$$$$$$$$$$$$$$$$ Theta Topo
% $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$
topofrex=4.5;
s=logspace(log10(3),log10(10),num_freqs)./(2*pi*topofrex);
wavelet = fft( exp(2*1i*pi*frex(fi).*t) .* exp(-t.^2./(2*(s(fi)^2))) , n_conv_pow2 ); % sqrt(1/(s(fi)*sqrt(pi))) *
seed=36;
EEG_fft_4TOPO = fft(reshape(EEG.data(seed,:,:),1,n_data),n_conv_pow2);
seed_EEG_conv_4TOPO = ifft(wavelet.*EEG_fft_4TOPO);
seed_EEG_conv_4TOPO = seed_EEG_conv_4TOPO(1:n_convolution);
seed_EEG_conv_4TOPO = seed_EEG_conv_4TOPO(half_of_wavelet_size+1:end-half_of_wavelet_size);
seed_EEG_conv_4TOPO = reshape(seed_EEG_conv_4TOPO,dims(2),dims(3));
clear EEG_fft_4TOPO ;
% Common pre-EEG SEED baseline
seed_BASE = mean(mean(abs(seed_EEG_conv_4TOPO(B1:B2,:)).^2,1),2);
for chani=1:60
EEG_fft_4TOPO = fft(reshape(EEG.data(chani,:,:),1,n_data),n_conv_pow2);
EEG_conv_4TOPO = ifft(wavelet.*EEG_fft_4TOPO);
EEG_conv_4TOPO = EEG_conv_4TOPO(1:n_convolution);
EEG_conv_4TOPO = EEG_conv_4TOPO(half_of_wavelet_size+1:end-half_of_wavelet_size);
EEG_conv_4TOPO = reshape(EEG_conv_4TOPO,dims(2),dims(3));
% Common pre-EEG baseline
temp_BASE = mean(mean(abs(EEG_conv_4TOPO(B1:B2,:)).^2,1),2);
for idx=1:3
if idx==1, idx_V=VECTOR(:,1)==201; % STD
elseif idx==2, idx_V=VECTOR(:,1)==200; % TARG
elseif idx==3, idx_V=VECTOR(:,1)==202; % NOV
end
temp_PWR = squeeze(mean(abs(EEG_conv_4TOPO(T1:T2,idx_V)).^2,2));
POWER_TOPO(chani,:,idx) = 10* ( log10(temp_PWR) - log10(repmat(temp_BASE,size(tx2disp,2),1)) );
S4cor=10* ( log10(abs(seed_EEG_conv_4TOPO(T1:T2,idx_V)).^2) - log10(repmat(seed_BASE,size(tx2disp,2),sum(idx_V))) );
T4cor=10* ( log10(abs(EEG_conv_4TOPO(T1:T2,idx_V)).^2) - log10(repmat(temp_BASE,size(tx2disp,2),sum(idx_V))) );
CORREL_TOPO(chani,:,idx)= diag(corr(S4cor',T4cor','type','Spearman'));
SYNCH_TOPO(chani,:,idx) = abs(mean(exp(1i*( angle(seed_EEG_conv_4TOPO(T1:T2,idx_V)) - angle(EEG_conv_4TOPO(T1:T2,idx_V)) )),2));
clear idx_V temp_PWR S4cor T4cor;
end
clear EEG_fft_4TOPO EEG_conv_4TOPO TOPO_conv temp_BASE;
end
%%
% $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$
% $$$$$$$$$$$$$$$$$$$$$$$ ERPs
% $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$
% Filter
dims=size(EEG.data);
EEG.data=eegfilt(EEG.data,500,[],20);
EEG.data=eegfiltfft(EEG.data,500,.1,[]);
EEG.data=reshape(EEG.data,dims(1),dims(2),dims(3));
% Basecor your ERPs here so they are pretty.
EEG_BASE=squeeze( mean(EEG.data(:,find(tx==-200):find(tx==0),:),2) );
for ai=1:dims(1)
EEG.data(ai,:,:)=squeeze(EEG.data(ai,:,:))-repmat( EEG_BASE(ai,:),dims(2),1 );
end
% Get ERPs
for idx=1:3
if idx==1, idx_V=VECTOR(:,1)==201; % STD
elseif idx==2, idx_V=VECTOR(:,1)==200; % TARG
elseif idx==3, idx_V=VECTOR(:,1)==202; % NOV
end
ERP(:,:,idx)=squeeze(mean(EEG.data(:,find(tx==-500):find(tx==1000),idx_V),3));
clear DATA_erp idx_V ;
end
save([savedir,num2str(subno),'_',num2str(sess),'_3AOB_TFandERPs_',TAG,'.mat'],'ERP','ISPC','ITPC','POWER','VECTOR','SYNCH_TOPO','TRL_ct','POWER_TOPO','CORREL_TOPO');
clear ERP ISPC ITPC POWER RT;
end
clearvars -except datadir savedir FILEENDER BV_Chanlocs_60 D_DAT D_HDR D_ALL tx B1 B2 T1 T2 tx2disp si sess
end
end
end
%%123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
cd(datadir);
filz=dir(['*_3AOB_TFandERPs_V.mat']);
Nsubjs=length(filz);
% Load BigAgg_Data
load('Z:\EXPERIMENTS\mTBICoBRE\MANUSCRIPT 3AOB\BigAgg_Data.mat');
% Preallocate
IDENTITY.DEMO=NaN(Nsubjs,7);
IDENTITY.TBI=NaN(Nsubjs,9);
IDENTITY.NP=NaN(Nsubjs,8);
IDENTITY.QUEX=NaN(Nsubjs,25);
% ^^^^^^^^^^
MEGA_PWR=NaN(Nsubjs,3,50,751,3);
MEGA_PHS=NaN(Nsubjs,3,50,751,3);
MEGA_SYNCH=NaN(Nsubjs,3,50,751,3);
MEGA_SYNCH_TOPO=NaN(Nsubjs,60,751,3);
MEGA_POWER_TOPO=NaN(Nsubjs,60,751,3);
MEGA_CORREL_TOPO=NaN(Nsubjs,60,751,3);
MEGA_ERP=NaN(Nsubjs,60,751,3);
MEGA_TRL_ct=NaN(Nsubjs,3);
for si=1:Nsubjs
subno = str2double(filz(si).name(1:end-23)) ; % B/C some Quinn ones have 5 digit IDs, some 4
session = str2double(filz(si).name(end-21)) ;
if subno<3500 % Cavanagh
if mod(subno,2)==1, group=1; % ODD - Ctl
elseif mod(subno,2)==0,group=2; % EVEN - mTBI
end
else % Quinn
group=3; % Chronic TBI (cTBI)
end
IDENTITY_DEMO_HDR{1}={'subno'}; IDENTITY_DEMO_HDR{2}='session'; IDENTITY_DEMO_HDR{3}='group';
IDENTITY_TBI_HDR{1}={'subno'}; IDENTITY_TBI_HDR{2}='session'; IDENTITY_TBI_HDR{3}='group';
IDENTITY_NP_HDR{1}={'subno'}; IDENTITY_NP_HDR{2}='session'; IDENTITY_NP_HDR{3}='group';
IDENTITY_QUEX_HDR{1}={'subno'}; IDENTITY_QUEX_HDR{2}='session'; IDENTITY_QUEX_HDR{3}='group';
IDENTITY.DEMO(si,1:3)=[subno,session,group];
IDENTITY.TBI(si,1:3)=[subno,session,group];
IDENTITY.NP(si,1:3)=[subno,session,group];
IDENTITY.QUEX(si,1:3)=[subno,session,group];
% --------------- QUEX
if group<3 % Cavanagh data
if any(DEMO.ID(:,1)==subno)
bigagg_idx=find(DEMO.ID(:,1)==subno);
IDENTITY.DEMO(si,4)=DEMO.URSI(bigagg_idx,1); IDENTITY_DEMO_HDR{4}='URSI';
IDENTITY.DEMO(si,5)=DEMO.Sex_F1(bigagg_idx); IDENTITY_DEMO_HDR{5}='SexF1';
IDENTITY.DEMO(si,6)=DEMO.Age(bigagg_idx); IDENTITY_DEMO_HDR{6}='Age';
IDENTITY.DEMO(si,7)=DEMO.SES(bigagg_idx); IDENTITY_DEMO_HDR{7}='YrsEd'; % That's what this actually is.
if session==1
IDENTITY.TBI(si,4)=TBIfields.Glasgow(bigagg_idx); IDENTITY_TBI_HDR{4}='GCS';
IDENTITY.TBI(si,5)=TBIfields.LOC(bigagg_idx); IDENTITY_TBI_HDR{5}='LOC';
IDENTITY.TBI(si,6)=TBIfields.LOCtime(bigagg_idx); IDENTITY_TBI_HDR{6}='LOCtime';
IDENTITY.TBI(si,7)=TBIfields.LOM(bigagg_idx); IDENTITY_TBI_HDR{7}='LOM';
IDENTITY.TBI(si,8)=TBIfields.DaysSinceInjury(bigagg_idx); IDENTITY_TBI_HDR{8}='Days';
% ---------------------
IDENTITY.NP(si,4)=NP.TOPF_Score(bigagg_idx); IDENTITY_NP_HDR{4}='TOPF';
IDENTITY.NP(si,5)=NP.Coding(bigagg_idx); IDENTITY_NP_HDR{5}='Coding';
IDENTITY.NP(si,6)=NP.SPAN.Tot(bigagg_idx); IDENTITY_NP_HDR{6}='Span';
IDENTITY.NP(si,7)=mean([NP.HVLT.T1(bigagg_idx),NP.HVLT.T2(bigagg_idx),NP.HVLT.T3(bigagg_idx)]'); IDENTITY_NP_HDR{7}='HVLT13';
IDENTITY.NP(si,8)=NP.HVLT.DelayRecall(bigagg_idx); IDENTITY_NP_HDR{8}='HVLTdelay';
end
IDENTITY.QUEX(si,4)=QUEX.BDI(bigagg_idx,session); IDENTITY_QUEX_HDR{4}='BDI';
IDENTITY.QUEX(si,5)=QUEX.NSI.tot(bigagg_idx,session); IDENTITY_QUEX_HDR{5}='NSItot';
IDENTITY.QUEX(si,6)=QUEX.NSI.somatic(bigagg_idx,session); IDENTITY_QUEX_HDR{6}='NSIsom';
IDENTITY.QUEX(si,7)=QUEX.NSI.cog(bigagg_idx,session); IDENTITY_QUEX_HDR{7}='NSIcog';
IDENTITY.QUEX(si,8)=QUEX.NSI.emo(bigagg_idx,session); IDENTITY_QUEX_HDR{8}='NSIemo';
IDENTITY.QUEX(si,9)=QUEX.FRSBE.Tot_B4(bigagg_idx,session); IDENTITY_QUEX_HDR{9}='F_Tot_B4';
IDENTITY.QUEX(si,10)=QUEX.FRSBE.Tot_Now(bigagg_idx,session); IDENTITY_QUEX_HDR{10}='F_Tot';
IDENTITY.QUEX(si,11)=EX.EX(bigagg_idx,session); IDENTITY_QUEX_HDR{11}='EX_EX';
IDENTITY.QUEX(si,12)=EX.CC(bigagg_idx,session); IDENTITY_QUEX_HDR{12}='EX_CC';
IDENTITY.QUEX(si,13)=EX.FL(bigagg_idx,session); IDENTITY_QUEX_HDR{13}='EX_FL';
IDENTITY.QUEX(si,14)=EX.WM(bigagg_idx,session); IDENTITY_QUEX_HDR{14}='EX_WM';
end
elseif group==3
if any(Q_DEMO.URSI==subno)
bigagg_idx=find(Q_DEMO.URSI==subno);
%^^^^^^^^^^^
IDENTITY.DEMO(si,4)=Q_DEMO.URSI(bigagg_idx,1);
IDENTITY.DEMO(si,5)=Q_DEMO.Sex_F1(bigagg_idx);
IDENTITY.DEMO(si,6)=Q_DEMO.Age(bigagg_idx);
IDENTITY.DEMO(si,7)=Q_DEMO.SES(bigagg_idx);
% ---------------------
IDENTITY.TBI(si,6)=Q_TBIfields.LOCdurMINS(bigagg_idx);
IDENTITY.TBI(si,9)=Q_TBIfields.YearsSinceInjury(bigagg_idx); IDENTITY_TBI_HDR{9}='Years';
% ---------------------
IDENTITY.NP(si,4)=Q_NP.TOPF_Score(bigagg_idx);
IDENTITY.NP(si,5)=Q_NP.Coding(bigagg_idx);
IDENTITY.NP(si,6)=Q_NP.SPAN.Tot(bigagg_idx);
IDENTITY.NP(si,7)=mean([Q_NP.HVLT.T1(bigagg_idx),Q_NP.HVLT.T2(bigagg_idx),Q_NP.HVLT.T3(bigagg_idx)]');
IDENTITY.NP(si,8)=Q_NP.HVLT.DelayRecall(bigagg_idx);
% ---------------------
IDENTITY.QUEX(si,4)=Q_QUEX.BDI(bigagg_idx);
IDENTITY.QUEX(si,5)=Q_QUEX.NSI.tot(bigagg_idx);
IDENTITY.QUEX(si,6)=Q_QUEX.NSI.somatic(bigagg_idx);
IDENTITY.QUEX(si,7)=Q_QUEX.NSI.cog(bigagg_idx);
IDENTITY.QUEX(si,8)=Q_QUEX.NSI.emo(bigagg_idx);
IDENTITY.QUEX(si,9)=Q_QUEX.FRSBE.RAW_Tot_Now(bigagg_idx);
IDENTITY.QUEX(si,10)=Q_QUEX.FRSBE.Tot_Now(bigagg_idx);
end
end
clear bigagg_idx
% EEG
load([filz(si).name(1:end-5),'V.mat'],'ERP','TRL_ct');
MEGA_ERP(si,:,:,:)=ERP;
MEGA_TRL_ct(si,:)=TRL_ct;
clear ERP ISPC ITPC POWER VECTOR RT SYNCH_TOPO TRL_ct subno session group BEH ACC RT POWER_TOPO CORREL_TOPO;
end
clear DEMO QUEX NP EX TBIfields Q_*
cd(homedir);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354% Kill Quinn S2
for si=1:length(IDENTITY.DEMO)
if IDENTITY.DEMO(si,3)==3 && IDENTITY.DEMO(si,2)==2
IDENTITY.DEMO(si,:)=NaN; IDENTITY.TBI(si,:)=NaN; IDENTITY.NP(si,:)=NaN; IDENTITY.QUEX(si,:)=NaN;
% % MEGA_PWR(si,:,:,:,:)=NaN;
% % MEGA_PHS(si,:,:,:,:)=NaN;
% % MEGA_SYNCH(si,:,:,:,:)=NaN;
% % MEGA_SYNCH_TOPO(si,:,:,:)=NaN;
MEGA_ERP(si,:,:,:)=NaN;
end
end
% Kill malingering Quinn patient # 43047 (is already excluded... but this will make sure!)
if any(IDENTITY.DEMO(:,1)==43047); BOOM; end
% Kill any Quinn patients who were Cavanagh patients
% F48 3032(Cav URSI: 30454; Quinn URSI: 35957) & F22 3004(Cav URSI: 69117; Quinn URSI: 48880)
badidx=find(IDENTITY.DEMO(:,1)==35957);
IDENTITY.DEMO(badidx,:)=NaN; IDENTITY.TBI(badidx,:)=NaN; IDENTITY.NP(badidx,:)=NaN; IDENTITY.QUEX(badidx,:)=NaN; clear badidx;
% The other was 3004, who is killed below due to no LOC
% Kill 2 mTBI with out LOC 3004, 3056 == no LOC
badidx=find(IDENTITY.DEMO(:,1)==3004);
IDENTITY.DEMO(badidx,:)=NaN; IDENTITY.TBI(badidx,:)=NaN; IDENTITY.NP(badidx,:)=NaN; IDENTITY.QUEX(badidx,:)=NaN; clear badidx;
badidx=find(IDENTITY.DEMO(:,1)==3056);
IDENTITY.DEMO(badidx,:)=NaN; IDENTITY.TBI(badidx,:)=NaN; IDENTITY.NP(badidx,:)=NaN; IDENTITY.QUEX(badidx,:)=NaN; clear badidx;
% Kill people with pre-existing head injuries
badidx=find(IDENTITY.DEMO(:,1)==3024);
IDENTITY.DEMO(badidx,:)=NaN; IDENTITY.TBI(badidx,:)=NaN; IDENTITY.NP(badidx,:)=NaN; IDENTITY.QUEX(badidx,:)=NaN; clear badidx;
% Kill *sessions* if they had an intervening head injury
for si=1:length(IDENTITY.DEMO)
if IDENTITY.DEMO(si,1)==3034 && IDENTITY.DEMO(si,2)==3
badidx=si;
end
end
IDENTITY.DEMO(badidx,:)=NaN; IDENTITY.TBI(badidx,:)=NaN; IDENTITY.NP(badidx,:)=NaN; IDENTITY.QUEX(badidx,:)=NaN; clear badidx;
% Kill people with TOMM score<45
badidx=find(IDENTITY.DEMO(:,1)==14000);
IDENTITY.DEMO(badidx,:)=NaN; IDENTITY.TBI(badidx,:)=NaN; IDENTITY.NP(badidx,:)=NaN; IDENTITY.QUEX(badidx,:)=NaN; clear badidx;
% Assessment > 2 weeks
badidx=find(IDENTITY.TBI(:,8)>14);
IDENTITY.DEMO(badidx,:)=NaN; IDENTITY.TBI(badidx,:)=NaN; IDENTITY.NP(badidx,:)=NaN; IDENTITY.QUEX(badidx,:)=NaN; clear badidx;
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788% #######################################################################################################
% Count
for groupi=1:2
for time=1:3
Sx=logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==groupi) );
TABLE1_COUNT(groupi,time,:)=[sum(Sx),nansum(IDENTITY.DEMO(Sx,5))];
end
end
% Other neat stuff
for groupi=1:3
time=1;
Sx=logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==groupi) );
TABLE1_VARS(1,groupi,:)=[mean(IDENTITY.DEMO(Sx,6)),std(IDENTITY.DEMO(Sx,6))]; % Age
TABLE1_VARS(2,groupi,:)=[mean(IDENTITY.DEMO(Sx,7)),std(IDENTITY.DEMO(Sx,7))]; % YrsEd
for npi=1:5
TABLE1_VARS(2+npi,groupi,:)=[nanmean(IDENTITY.NP(Sx,3+npi)),nanstd(IDENTITY.NP(Sx,3+npi))];
end
end
CTL_Sx=logical( double(IDENTITY.DEMO(:,2)==1) .* double(IDENTITY.DEMO(:,3)==1) );
Acute_Sx=logical( double(IDENTITY.DEMO(:,2)==1) .* double(IDENTITY.DEMO(:,3)==2) );
Chronic_Sx=logical( double(IDENTITY.DEMO(:,2)==1) .* double(IDENTITY.DEMO(:,3)==3) );
[~,T1_P,~,T1_STATS]=ttest2([IDENTITY.DEMO(CTL_Sx,[6,7]),IDENTITY.NP(CTL_Sx,4:8)],[IDENTITY.DEMO(Acute_Sx,[6,7]),IDENTITY.NP(Acute_Sx,4:8)])
[~,T1_P,~,T1_STATS]=ttest2([IDENTITY.DEMO(CTL_Sx,[6,7]),IDENTITY.NP(CTL_Sx,4:8)],[IDENTITY.DEMO(Chronic_Sx,[6,7]),IDENTITY.NP(Chronic_Sx,4:8)])
% TABLE 2
IDENTITY.TBI(Acute_Sx,4) % GCS
nanmedian(IDENTITY.TBI(Acute_Sx,6)) % LOCmins median
iqr(IDENTITY.TBI(Acute_Sx,6)) % LOCmins iqr
nansum(IDENTITY.TBI(Acute_Sx,7))
nanmedian(IDENTITY.TBI(Acute_Sx,8)) % Days median
iqr(IDENTITY.TBI(Acute_Sx,8)) % Days iqr
nanmedian(IDENTITY.TBI(Chronic_Sx,6)) % LOCmins median
iqr(IDENTITY.TBI(Chronic_Sx,6)) % LOCmins iqr
nansum(IDENTITY.TBI(Chronic_Sx,7)) % Data not here
nanmedian(IDENTITY.TBI(Chronic_Sx,9)) % Days median
iqr(IDENTITY.TBI(Chronic_Sx,9)) % Days iqr
%% ###########################################################################
clear INTERCOR_Rho INTERCOR_P;
INDEX=[find(strcmp('BDI',IDENTITY_QUEX_HDR)),find(strcmp('NSItot',IDENTITY_QUEX_HDR)),find(strcmp('F_Tot_B4',IDENTITY_QUEX_HDR)),find(strcmp('F_Tot',IDENTITY_QUEX_HDR))];
COL={'bd','rd','md'};
SHIFT=[-.05,.05,0];
figure; hold on;
for groupi=1:2
for timei=1:3
Sx=logical( double(IDENTITY.DEMO(:,2)==timei) .* double(IDENTITY.DEMO(:,3)==groupi) );
for idxi=1:4
subplot(2,2,idxi); hold on;
ThisN=sum(~isnan(IDENTITY.QUEX(Sx,INDEX(idxi))));
plot(timei+SHIFT(groupi),nanmean(IDENTITY.QUEX(Sx,INDEX(idxi))),COL{groupi});
errorbar(timei+SHIFT(groupi),nanmean(IDENTITY.QUEX(Sx,INDEX(idxi))),nanstd(IDENTITY.QUEX(Sx,INDEX(idxi)))./sqrt(ThisN),'k.');
set(gca,'xlim',[0 4],'xtick',[1:1:3]);
title(IDENTITY_QUEX_HDR{INDEX(idxi)});
% ---
Sx1=logical( double(IDENTITY.DEMO(:,2)==1) .* double(IDENTITY.DEMO(:,3)==groupi) );
Sx2=logical( double(IDENTITY.DEMO(:,2)==2) .* double(IDENTITY.DEMO(:,3)==groupi) );
Sx3=logical( double(IDENTITY.DEMO(:,2)==3) .* double(IDENTITY.DEMO(:,3)==groupi) );
plot([1+SHIFT(groupi) 2+SHIFT(groupi)],[nanmean(IDENTITY.QUEX(Sx1,INDEX(idxi))), nanmean(IDENTITY.QUEX(Sx2,INDEX(idxi)))],'k-');
plot([2+SHIFT(groupi) 3+SHIFT(groupi)],[nanmean(IDENTITY.QUEX(Sx2,INDEX(idxi))), nanmean(IDENTITY.QUEX(Sx3,INDEX(idxi)))],'k-');
% ---
end
if time==1
[INTERCOR_Rho{groupi},INTERCOR_P{groupi}]=corr(IDENTITY.QUEX(Sx,[4,5,10]),'type','Spearman','rows','pairwise');
end
end
end
groupi=3; timei=1;
Sx=logical( double(IDENTITY.DEMO(:,2)==timei) .* double(IDENTITY.DEMO(:,3)==groupi) );
for idxi=1:4
subplot(2,2,idxi); hold on;
ThisN=sum(~isnan(IDENTITY.QUEX(Sx,INDEX(idxi))));
plot(timei+SHIFT(groupi),nanmean(IDENTITY.QUEX(Sx,INDEX(idxi))),COL{groupi});
errorbar(timei+SHIFT(groupi),nanmean(IDENTITY.QUEX(Sx,INDEX(idxi))),nanstd(IDENTITY.QUEX(Sx,INDEX(idxi)))./sqrt(ThisN),'k.');
set(gca,'xlim',[0 4],'xtick',[1:1:3]);
title(IDENTITY_QUEX_HDR{INDEX(idxi)});
[INTERCOR_Rho{3},INTERCOR_P{3}]=corr(IDENTITY.QUEX(Sx,[4,5,10]),'type','Spearman','rows','pairwise');
end
%%
123456789101112131415161718192021222324252627282930%% Example P3a, P3b
V = logical( double(IDENTITY.DEMO(:,2)<4) );
SIZEALL=sum( V );
figure; subplot(3,3,[1:6]); hold on
plot(tx2disp,squeeze(nanmean( MEGA_ERP(V,NovSite,:,1) ,1)),'k','Linewidth',2);
plot(tx2disp,squeeze(nanmean( MEGA_ERP(V,TargSite,:,2) ,1)),'g','Linewidth',2);
plot(tx2disp,squeeze(nanmean( MEGA_ERP(V,StdSite,:,3) ,1)),'c','Linewidth',2);
shadedErrorBar(tx2disp,squeeze(nanmean( MEGA_ERP(V,NovSite,:,1) ,1)),...
squeeze(nanstd( MEGA_ERP(V,NovSite,:,1) ,1)) ./ sqrt(SIZEALL),'k');
shadedErrorBar(tx2disp,squeeze(nanmean( MEGA_ERP(V,TargSite,:,2) ,1)),...
squeeze(nanstd( MEGA_ERP(V,TargSite,:,2) ,1)) ./ sqrt(SIZEALL),'g');
shadedErrorBar(tx2disp,squeeze(nanmean( MEGA_ERP(V,StdSite,:,3) ,1)),...
squeeze(nanstd( MEGA_ERP(V,StdSite,:,3) ,1)) ./ sqrt(SIZEALL),'c');
legend({'Std','Targ','Nov'},'Location','NorthWest');
title(['N DataSets =',num2str(SIZEALL)])
plot([0 0],[-6 6],'k:'); plot([-500 1000],[0 0],'k:');
plot([NovT1 NovT1],[4 5],'m:'); plot([NovT2 NovT2],[4 5],'m:');
plot([TargT1 TargT1],[5.1 6],'r:'); plot([TargT2 TargT2],[5.1 6],'r:');
MAPLIMS=[-5 5];
subplot(3,3,7); topoplot( squeeze(nanmean(mean( MEGA_ERP(V,:,ERPWINS_tx2disp(1,1):ERPWINS_tx2disp(1,2),1) ,3) ,1)) ,...
BV_Chanlocs_60,'maplimits',MAPLIMS,'emarker2',{StdSite,'d','k'}); title('Std')
subplot(3,3,8); topoplot( squeeze(nanmean(mean( MEGA_ERP(V,:,ERPWINS_tx2disp(2,1):ERPWINS_tx2disp(2,2),2) ,3) ,1)) ,...
BV_Chanlocs_60,'maplimits',MAPLIMS,'emarker2',{TargSite,'d','k'}); title('Targ')
subplot(3,3,9); topoplot( squeeze(nanmean(mean( MEGA_ERP(V,:,ERPWINS_tx2disp(3,1):ERPWINS_tx2disp(3,2),3) ,3) ,1)) ,...
BV_Chanlocs_60,'maplimits',MAPLIMS,'emarker2',{NovSite,'d','k'}); title('Nov') 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137%%
TITLES={'Std','Targ','Nov'};
COL={'b','r','m'};
YLIM=[-6 8];
figure;
for ai=1:3
subplot(3,1,ai); hold on;
for gi=1:3
V = logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==gi) );
plot(tx2disp,squeeze(nanmean( MEGA_ERP(V,ERPSITE(ai),:,ai) ,1)),COL{gi},'Linewidth',2);
clear V;
end
for gi=1:3
V = logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==gi) );
shadedErrorBar(tx2disp,squeeze(nanmean( MEGA_ERP(V,ERPSITE(ai),:,ai) ,1)),squeeze(nanstd( MEGA_ERP(V,ERPSITE(ai),:,ai) ,1))./sqrt(sum(V)),COL{gi});
clear V;
end
for gi=1:3
V = logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==gi) );
plot(tx2disp,squeeze(nanmean( MEGA_ERP(V,ERPSITE(ai),:,ai) ,1)),COL{gi},'Linewidth',2);
set(gca,'ylim',YLIM);
clear V;
end
plot([ERPWINS(ai,1) ERPWINS(ai,1)],[5 7],'k:'); plot([ERPWINS(ai,2) ERPWINS(ai,2)],[5 7],'k:');
title(TITLES{ai});
V_ctl = logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==1) );
V_acute = logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==2) );
V_chronic = logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==3) );
ERPs_ctl=squeeze(MEGA_ERP(V_ctl,ERPSITE(ai),:,ai));
ERPs_acute=squeeze(MEGA_ERP(V_acute,ERPSITE(ai),:,ai));
ERPs_chronic=squeeze(MEGA_ERP(V_chronic,ERPSITE(ai),:,ai));
[H,P,CI,STATS]=ttest2(ERPs_ctl,ERPs_acute); P(P>.05)=NaN; P(P<=.05)=1;
plot(tx2disp,-4.*P,'r'); clear H P CI STATS TEMP*;
[H,P,CI,STATS]=ttest2(ERPs_ctl,ERPs_chronic); P(P>.05)=NaN; P(P<=.05)=1;
plot(tx2disp,-4.5.*P,'m'); clear H P CI STATS TEMP*;
clear V_ctl V_acute V_chronic ERPs_ctl ERPs_acute ERPs_chronic
end
legend({'CTL','Acute','Chronic'},'Location','NorthWest')
%%
figure;
for ai=1:3 % Condi
subplot(3,1,ai); hold on;
for gi=1:3 % Group
for time=1:3
V = logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==gi) );
plot(time,squeeze(nanmean(mean( MEGA_ERP(V,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3),1)),[COL{gi},'d']);
errorbar(time,squeeze(nanmean(mean( MEGA_ERP(V,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3),1)),...
squeeze(nanstd(mean( MEGA_ERP(V,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3),1)) ./sqrt(sum(V)),'k.');
BIG_OL_N(gi,time)=sum(V);
clear V;
end
% ---
V1 = logical( double(IDENTITY.DEMO(:,2)==1) .* double(IDENTITY.DEMO(:,3)==gi) );
V2 = logical( double(IDENTITY.DEMO(:,2)==2) .* double(IDENTITY.DEMO(:,3)==gi) );
V3 = logical( double(IDENTITY.DEMO(:,2)==3) .* double(IDENTITY.DEMO(:,3)==gi) );
plot([1 2],[squeeze(nanmean(mean( MEGA_ERP(V1,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3),1)) ,...
squeeze(nanmean(mean( MEGA_ERP(V2,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3),1))],'k-');
plot([2 3],[squeeze(nanmean(mean( MEGA_ERP(V2,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3),1)) ,...
squeeze(nanmean(mean( MEGA_ERP(V3,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3),1))],'k-');
clear V*;
% ---
end
set(gca,'xlim',[0 4],'xtick',[1:1:3])
title(TITLES{ai});
end
%%
STATS{1}=[]; STATS{2}=[]; % Targ, Nov
for si=1:2 % CTL, Acute
Sx=logical( double(IDENTITY.DEMO(:,3)==si) );
Sx_idxs=unique(IDENTITY.DEMO(Sx,1));
for sxi=1:length(Sx_idxs)
thisguy=Sx_idxs(sxi);
FIRST=[]; SECOND=[]; THIRD=[];
FIRST=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==1) ));
SECOND=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==2) ));
THIRD=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==3) ));
ai=2;
ERP1=NaN; ERP2=NaN; ERP3=NaN;
if ~isempty(FIRST), ERP1=mean( MEGA_ERP(FIRST,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
if ~isempty(SECOND), ERP2=mean( MEGA_ERP(SECOND,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
if ~isempty(THIRD), ERP3=mean( MEGA_ERP(THIRD,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
STATS{ai-1}=[STATS{ai-1};thisguy,si,ERP1,ERP2,ERP3];
ai=3;
ERP1=NaN; ERP2=NaN; ERP3=NaN;
if ~isempty(FIRST), ERP1=mean( MEGA_ERP(FIRST,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
if ~isempty(SECOND), ERP2=mean( MEGA_ERP(SECOND,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
if ~isempty(THIRD), ERP3=mean( MEGA_ERP(THIRD,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
STATS{ai-1}=[STATS{ai-1};thisguy,si,ERP1,ERP2,ERP3];
clear thisguy;
end
clear Sx Sx_idxs;
end
si=3; clear Sx Sx_idxs; % chronic
Sx=logical( double(IDENTITY.DEMO(:,3)==si) );
Sx_idxs=unique(IDENTITY.DEMO(Sx,1));
for sxi=1:length(Sx_idxs)
thisguy=Sx_idxs(sxi);
FIRST=[];
FIRST=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==1) ));
ai=2;
ERP1=NaN;
if ~isempty(FIRST), ERP1=mean( MEGA_ERP(FIRST,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
STATS{ai-1}=[STATS{ai-1};thisguy,si,ERP1,NaN,NaN];
ai=3;
ERP1=NaN;
if ~isempty(FIRST), ERP1=mean( MEGA_ERP(FIRST,ERPSITE(ai),ERPWINS_tx2disp(ai,1):ERPWINS_tx2disp(ai,2),ai) ,3); end
STATS{ai-1}=[STATS{ai-1};thisguy,si,ERP1,NaN,NaN];
clear thisguy;
end
123456789101112131415161718192021222324252627282930313233343536%%
COLS={'b','r','m'};
figure;
for si=1:3
Sx=logical( double(IDENTITY.DEMO(:,2)==time) .* double(IDENTITY.DEMO(:,3)==si) );
% --------------------
IV=squeeze(mean(MEGA_ERP(Sx,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
[rho,rho_p]=corr(IV,DV(Sx),'type','Spearman','rows','pairwise');
[r,p]=corr(IV,DV(Sx),'type','Pearson','rows','pairwise');
subplot(2,3,si); hold on
scatter(IV,DV(Sx),COLS{si}); lsline
set(gca,'xlim',[-10 20],'ylim',[20 120]);
% text(.1,.7,['df=',num2str(sum(logical(double(~isnan(IV)).*double(~isnan(DV(Sx))))) -2 ),' r=',num2str(r),' p=',num2str(p)],'sc');
text(.1,.6,['df=',num2str(sum(logical(double(~isnan(IV)).*double(~isnan(DV(Sx))))) -2 ),' rho=',num2str(rho),' p=',num2str(rho_p)],'sc');
clear rho rho_p r p IV
title( BV_Chanlocs_60(ERPSITE(CONDI4Corr)).labels );
% --------------------
IV=squeeze(mean(MEGA_ERP(Sx,:,ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
[rho,rho_p]=corr(IV,DV(Sx),'type','Spearman','rows','pairwise');
subplot(2,3,3+si); hold on
rho_p(rho_p>=.05)=NaN; rho_p(rho_p<.05)=1; rho_p(isnan(rho_p))=0;
topoplot(rho,BV_Chanlocs_60,'emarker2',{find(rho_p==1),'d','k',10,1});
clear rho rhop_p IV;
% --------------------
end
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111%%
COLS={'c','m'};
ROWS={'1-2','1-3','2-3'};
figure;
for si=1:2
Sx=logical( double(IDENTITY.DEMO(:,3)==si) );
Sx_idxs=unique(IDENTITY.DEMO(Sx,1));
clear IV* DV* *12 *23 *13;
for sxi=1:length(Sx_idxs)
thisguy=Sx_idxs(sxi);
FIRST=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==1) ));
SECOND=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==2) ));
THIRD=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==3) ));
if ~isempty(FIRST) && ~isempty(SECOND)
IVs12(sxi,:)= squeeze(mean(MEGA_ERP(FIRST,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3)) ;
DVs12(sxi,:)=IDENTITY.QUEX(SECOND,quexidx)-IDENTITY.QUEX(FIRST,quexidx);
age12(sxi,:)=IDENTITY.QUEX(FIRST,6);
TOPF12(sxi,:)=IDENTITY.NP(FIRST,4);
sex12(sxi,:)=IDENTITY.DEMO(FIRST,5);
% NP vars that also predicted dropout
Span12(sxi,:)=IDENTITY.NP(FIRST,6);
Coding12(sxi,:)=IDENTITY.NP(FIRST,5);
else
IVs12(sxi,:)=NaN;
DVs12(sxi,:)=NaN;
age12(sxi,:)=NaN;
TOPF12(sxi,:)=NaN;
sex12(sxi,:)=NaN;
end
if ~isempty(SECOND) && ~isempty(THIRD)
IVs23(sxi,:)= squeeze(mean(MEGA_ERP(SECOND,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3)) ;
DVs23(sxi,:)=IDENTITY.QUEX(THIRD,quexidx)-IDENTITY.QUEX(SECOND,quexidx);
else
IVs23(sxi,:)=NaN;
DVs23(sxi,:)=NaN;
end
if ~isempty(FIRST) && ~isempty(THIRD)
IVs13(sxi,:)= squeeze(mean(MEGA_ERP(FIRST,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3)) ;
DVs13(sxi,:)=IDENTITY.QUEX(THIRD,quexidx)-IDENTITY.QUEX(FIRST,quexidx);
else
IVs13(sxi,:)=NaN;
DVs13(sxi,:)=NaN;
end
end
% --------------------
[rho,rho_p]=corr(IVs12,DVs12,'type','Spearman','rows','pairwise');
[r,p]=corr(IVs12,DVs12,'type','Pearson','rows','pairwise');
subplot(3,2,si); hold on
scatter(IVs12,DVs12,COLS{si}); lsline
set(gca,'xlim',[-10 20],'ylim',[-40 40]);
text(.1,.7,['df=',num2str(sum(logical(double(~isnan(IVs12)).*double(~isnan(DVs12)))) -2 ),' r=',num2str(r),' p=',num2str(p)],'sc');
text(.1,.6,['df=',num2str(sum(logical(double(~isnan(IVs12)).*double(~isnan(DVs12)))) -2 ),' rho=',num2str(rho),' p=',num2str(rho_p)],'sc');
clear rho rho_p r p IV
title( [BV_Chanlocs_60(ERPSITE(CONDI4Corr)).labels,' S1EEG ',ROWS{1}] );
% --------------------
[rho,rho_p]=corr(IVs13,DVs13,'type','Spearman','rows','pairwise');
[r,p]=corr(IVs13,DVs13,'type','Pearson','rows','pairwise');
subplot(3,2,si+2); hold on
scatter(IVs13,DVs13,COLS{si}); lsline
set(gca,'xlim',[-10 20],'ylim',[-40 40]);
text(.1,.7,['df=',num2str(sum(logical(double(~isnan(IVs13)).*double(~isnan(DVs13)))) -2 ),' r=',num2str(r),' p=',num2str(p)],'sc');
text(.1,.6,['df=',num2str(sum(logical(double(~isnan(IVs13)).*double(~isnan(DVs13)))) -2 ),' rho=',num2str(rho),' p=',num2str(rho_p)],'sc');
clear rho rho_p r p IV
title( [BV_Chanlocs_60(ERPSITE(CONDI4Corr)).labels,' S1EEG ',ROWS{2}] );
% --------------------
[rho,rho_p]=corr(IVs23,DVs23,'type','Spearman','rows','pairwise');
[r,p]=corr(IVs23,DVs23,'type','Pearson','rows','pairwise');
subplot(3,2,si+4); hold on
scatter(IVs23,DVs23,COLS{si}); lsline
set(gca,'xlim',[-10 20],'ylim',[-40 40]);
text(.1,.7,['df=',num2str(sum(logical(double(~isnan(IVs23)).*double(~isnan(DVs23)))) -2 ),' r=',num2str(r),' p=',num2str(p)],'sc');
text(.1,.6,['df=',num2str(sum(logical(double(~isnan(IVs23)).*double(~isnan(DVs23)))) -2 ),' rho=',num2str(rho),' p=',num2str(rho_p)],'sc');
clear rho rho_p r p IV
title( [BV_Chanlocs_60(ERPSITE(CONDI4Corr)).labels,' S1EEG ',ROWS{3}] );
% --------------------
end
% Check demographic (S1) vars in the sub-acute group on FrSBe change
[r,p]=corr(DVs12,age12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs12,TOPF12,'type','Spearman','rows','pairwise')
[H,P,CI,STATS]=ttest2(DVs12(sex12==1),DVs12(sex12==0))
[r,p]=corr(DVs12,Span12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs12,Coding12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs13,age12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs13,TOPF12,'type','Spearman','rows','pairwise')
[H,P,CI,STATS]=ttest2(DVs13(sex12==1),DVs13(sex12==0))
[r,p]=corr(DVs13,Span12,'type','Spearman','rows','pairwise')
[r,p]=corr(DVs13,Coding12,'type','Spearman','rows','pairwise')123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111for CONDI4Corr=2:3; % Std, Targ, Nov
IDENTITY.ERP(:,CONDI4Corr-1)=squeeze(mean(MEGA_ERP(:,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
end
UNIQUE_SX=unique(IDENTITY.DEMO(~isnan(IDENTITY.DEMO(:,1)),1));
for sxi=1:length(UNIQUE_SX)
thisguy=UNIQUE_SX(sxi);
FIRST=[]; SECOND=[]; THIRD=[];
FIRST=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==1) ));
SECOND=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==2) ));
THIRD=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==3) ));
% for standard models
if ~isempty(FIRST) % B/C of bad EEG
FORSPSS(sxi,1)=IDENTITY.DEMO(FIRST,1); FORSPSS_HDR{1}='subno';
FORSPSS(sxi,2)=IDENTITY.DEMO(FIRST,find(strcmp('session',IDENTITY_DEMO_HDR))); FORSPSS_HDR{2}='session';
FORSPSS(sxi,3)=IDENTITY.DEMO(FIRST,find(strcmp('group',IDENTITY_DEMO_HDR))); FORSPSS_HDR{3}='group';
FORSPSS(sxi,4)=IDENTITY.DEMO(FIRST,find(strcmp('SexF1',IDENTITY_DEMO_HDR))); FORSPSS_HDR{4}='SexF1';
FORSPSS(sxi,5)=IDENTITY.DEMO(FIRST,find(strcmp('Age',IDENTITY_DEMO_HDR))); FORSPSS_HDR{5}='Age';
FORSPSS(sxi,6)=IDENTITY.NP(FIRST,find(strcmp('TOPF',IDENTITY_NP_HDR))); FORSPSS_HDR{6}='TOPF';
FORSPSS(sxi,7)=IDENTITY.TBI(FIRST,find(strcmp('Days',IDENTITY_TBI_HDR))); FORSPSS_HDR{7}='Days';
FORSPSS(sxi,8)=IDENTITY.QUEX(FIRST,find(strcmp('BDI',IDENTITY_QUEX_HDR))); FORSPSS_HDR{8}='BDI_1';
FORSPSS(sxi,9)=IDENTITY.QUEX(FIRST,find(strcmp('NSItot',IDENTITY_QUEX_HDR))); FORSPSS_HDR{9}='NSI_1';
FORSPSS(sxi,10)=IDENTITY.QUEX(FIRST,find(strcmp('F_Tot_B4',IDENTITY_QUEX_HDR))); FORSPSS_HDR{10}='F_B4_1';
FORSPSS(sxi,11)=IDENTITY.QUEX(FIRST,find(strcmp('F_Tot',IDENTITY_QUEX_HDR))); FORSPSS_HDR{11}='F_Tot_1';
FORSPSS(sxi,12)=IDENTITY.ERP(FIRST,1); FORSPSS_HDR{12}='P3b_1';
FORSPSS(sxi,13)=IDENTITY.ERP(FIRST,2); FORSPSS_HDR{13}='P3a_1';
else
FORSPSS(sxi,1)=IDENTITY.DEMO(SECOND,1);
FORSPSS(sxi,2)=IDENTITY.DEMO(SECOND,find(strcmp('session',IDENTITY_DEMO_HDR)));
FORSPSS(sxi,3)=IDENTITY.DEMO(SECOND,find(strcmp('group',IDENTITY_DEMO_HDR)));
FORSPSS(sxi,4)=IDENTITY.DEMO(SECOND,find(strcmp('SexF1',IDENTITY_DEMO_HDR)));
FORSPSS(sxi,5)=IDENTITY.DEMO(SECOND,find(strcmp('Age',IDENTITY_DEMO_HDR)));
FORSPSS(sxi,6)=NaN;
FORSPSS(sxi,7)=NaN;
FORSPSS(sxi,8)=NaN;
FORSPSS(sxi,9)=NaN;
FORSPSS(sxi,10)=NaN;
FORSPSS(sxi,11)=NaN;
FORSPSS(sxi,12)=NaN;
FORSPSS(sxi,13)=NaN;
end
if ~isempty(SECOND)
FORSPSS(sxi,14)=IDENTITY.QUEX(SECOND,find(strcmp('BDI',IDENTITY_QUEX_HDR))); FORSPSS_HDR{14}='BDI_2';
FORSPSS(sxi,15)=IDENTITY.QUEX(SECOND,find(strcmp('NSItot',IDENTITY_QUEX_HDR))); FORSPSS_HDR{15}='NSI_2';
FORSPSS(sxi,16)=IDENTITY.QUEX(SECOND,find(strcmp('F_Tot_B4',IDENTITY_QUEX_HDR))); FORSPSS_HDR{16}='F_B4_2';
FORSPSS(sxi,17)=IDENTITY.QUEX(SECOND,find(strcmp('F_Tot',IDENTITY_QUEX_HDR))); FORSPSS_HDR{17}='F_Tot_2';
FORSPSS(sxi,18)=IDENTITY.ERP(SECOND,1); FORSPSS_HDR{18}='P3b_2';
FORSPSS(sxi,19)=IDENTITY.ERP(SECOND,2); FORSPSS_HDR{19}='P3a_2';
else
FORSPSS(sxi,14)=NaN;
FORSPSS(sxi,15)=NaN;
FORSPSS(sxi,16)=NaN;
FORSPSS(sxi,17)=NaN;
FORSPSS(sxi,18)=NaN;
FORSPSS(sxi,19)=NaN;
end
if ~isempty(THIRD)
FORSPSS(sxi,20)=IDENTITY.QUEX(THIRD,find(strcmp('BDI',IDENTITY_QUEX_HDR))); FORSPSS_HDR{20}='BDI_3';
FORSPSS(sxi,21)=IDENTITY.QUEX(THIRD,find(strcmp('NSItot',IDENTITY_QUEX_HDR))); FORSPSS_HDR{21}='NSI_3';
FORSPSS(sxi,22)=IDENTITY.QUEX(THIRD,find(strcmp('F_Tot_B4',IDENTITY_QUEX_HDR))); FORSPSS_HDR{22}='F_B4_3';
FORSPSS(sxi,23)=IDENTITY.QUEX(THIRD,find(strcmp('F_Tot',IDENTITY_QUEX_HDR))); FORSPSS_HDR{23}='F_Tot_3';
FORSPSS(sxi,24)=IDENTITY.ERP(THIRD,1); FORSPSS_HDR{24}='P3b_3';
FORSPSS(sxi,25)=IDENTITY.ERP(THIRD,2); FORSPSS_HDR{25}='P3a_3';
else
FORSPSS(sxi,20)=NaN;
FORSPSS(sxi,21)=NaN;
FORSPSS(sxi,22)=NaN;
FORSPSS(sxi,23)=NaN;
FORSPSS(sxi,24)=NaN;
FORSPSS(sxi,25)=NaN;
end
end
% For Mixed Linear Modeling
for sxi=1:length(IDENTITY.DEMO)
FORMLM(sxi,1)=IDENTITY.DEMO(sxi,1); FORMLM_HDR{1}='subno';
FORMLM(sxi,2)=IDENTITY.DEMO(sxi,find(strcmp('session',IDENTITY_DEMO_HDR))); FORMLM_HDR{2}='session';
FORMLM(sxi,3)=IDENTITY.DEMO(sxi,find(strcmp('group',IDENTITY_DEMO_HDR))); FORMLM_HDR{3}='group';
FORMLM(sxi,4)=IDENTITY.DEMO(sxi,find(strcmp('SexF1',IDENTITY_DEMO_HDR))); FORMLM_HDR{4}='SexF1';
FORMLM(sxi,5)=IDENTITY.DEMO(sxi,find(strcmp('Age',IDENTITY_DEMO_HDR))); FORMLM_HDR{5}='Age';
FORMLM(sxi,6)=IDENTITY.NP(sxi,find(strcmp('TOPF',IDENTITY_NP_HDR))); FORMLM_HDR{6}='TOPF';
FORMLM(sxi,7)=IDENTITY.TBI(sxi,find(strcmp('Days',IDENTITY_TBI_HDR))); FORMLM_HDR{7}='Days';
FORMLM(sxi,8)=IDENTITY.QUEX(sxi,find(strcmp('BDI',IDENTITY_QUEX_HDR))); FORMLM_HDR{8}='BDI';
FORMLM(sxi,9)=IDENTITY.QUEX(sxi,find(strcmp('NSItot',IDENTITY_QUEX_HDR))); FORMLM_HDR{9}='NSI';
FORMLM(sxi,10)=IDENTITY.QUEX(sxi,find(strcmp('F_Tot_B4',IDENTITY_QUEX_HDR))); FORMLM_HDR{10}='F_B4';
FORMLM(sxi,11)=IDENTITY.QUEX(sxi,find(strcmp('F_Tot',IDENTITY_QUEX_HDR))); FORMLM_HDR{11}='F_Tot';
FORMLM(sxi,12)=IDENTITY.ERP(sxi,1); FORMLM_HDR{12}='P3b';
FORMLM(sxi,13)=IDENTITY.ERP(sxi,2); FORMLM_HDR{13}='P3a';
end
FORMLM_HDR=FORMLM_HDR';
FORSPSS_HDR=FORSPSS_HDR';
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051% mengz_JFC(r1, r2, r12, n) compares two correlations r1 and r2:
% r1: correlation between X and Y
% r2: correlation between X and Z
% r12: correlation between Y and Z
% n: number of observations used to compute correlations
%% ---------------
clear Sx CONDI4Corr rhoXY rhoXZ rhoYZ n menghyp mengp mengzscore
Sx=logical( double(IDENTITY.DEMO(:,2)==1) .* double(IDENTITY.DEMO(:,3)==3) );
CONDI4Corr=2;
MING_CHRONIC.P3b=squeeze(mean(MEGA_ERP(Sx,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
CONDI4Corr=3;
MING_CHRONIC.P3a=squeeze(mean(MEGA_ERP(Sx,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
rhoXY=-.46; % FrSBe & P3b
rhoXZ=.08; % FrSBe & P3a
rhoYZ=corr(MING_CHRONIC.P3b,MING_CHRONIC.P3a,'type','Spearman','rows','pairwise'); % P3a & PBb
n=sum(Sx);
[menghyp,mengp,mengzscore] = mengz_JFC(rhoXY,rhoXZ,rhoYZ,n)
%% ---------------
clear Sx CONDI4Corr rhoXY rhoXZ rhoYZ n menghyp mengp mengzscore
Sx=logical( double(IDENTITY.DEMO(:,2)==1) .* double(IDENTITY.DEMO(:,3)==2) );
CONDI4Corr=2;
MING_ACUTE.P3b=squeeze(mean(MEGA_ERP(Sx,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
CONDI4Corr=3;
MING_ACUTE.P3a=squeeze(mean(MEGA_ERP(Sx,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
rhoXY=-.11; % FrSBe & P3b
rhoXZ=-.44; % FrSBe & P3a
rhoYZ=corr(MING_ACUTE.P3b,MING_ACUTE.P3a,'type','Spearman','rows','pairwise'); % P3a & PBb
n=sum(Sx);
[menghyp,mengp,mengzscore] = mengz_JFC(rhoXY,rhoXZ,rhoYZ,n)
%% ---------------
clear Sx CONDI4Corr rhoXY rhoXZ rhoYZ n menghyp mengp mengzscore
Sx=logical( double(IDENTITY.DEMO(:,2)==2) .* double(IDENTITY.DEMO(:,3)==2) );
CONDI4Corr=2;
MING_ACUTE_S2.P3b=squeeze(mean(MEGA_ERP(Sx,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
CONDI4Corr=3;
MING_ACUTE_S2.P3a=squeeze(mean(MEGA_ERP(Sx,ERPSITE(CONDI4Corr),ERPWINS_tx2disp(CONDI4Corr,1):ERPWINS_tx2disp(CONDI4Corr,2),CONDI4Corr),3));
rhoXY=-.11; % FrSBe & P3b
rhoXZ=-.49; % FrSBe & P3a
rhoYZ=corr(MING_ACUTE_S2.P3b,MING_ACUTE_S2.P3a,'type','Spearman','rows','pairwise'); % P3a & PBb
n=sum(Sx);
[menghyp,mengp,mengzscore] = mengz_JFC(rhoXY,rhoXZ,rhoYZ,n)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485%%
acuteTBI=IDENTITY.DEMO(:,3)==2;
Sx_idxs=unique(IDENTITY.DEMO(acuteTBI,1));
AttritionPredictors=NaN(length(Sx_idxs),14);
for sxi=1:length(Sx_idxs)
thisguy=Sx_idxs(sxi);
FIRST=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==1) ));
SECOND=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==2) ));
THIRD=find(logical( double(IDENTITY.DEMO(:,1)==thisguy) .* double(IDENTITY.DEMO(:,2)==3) ));
if ~isempty(FIRST), Attrition(sxi,1)=1;
AttritionPredictors_HDR={'age';'sex';'TOPF';'Coding';'Span';'HVLT13';'HVLTDelay';'GCS';'LOCtime';'LOM';'Days';'BDI';'NSI';'FrSBe'};
AttritionPredictors(sxi,:)=[...
IDENTITY.DEMO(FIRST,6:7),...
IDENTITY.NP(FIRST,4:8),...
IDENTITY.TBI(FIRST,[4,6:8]),...
IDENTITY.QUEX(FIRST,[4,5,10]),...
];
else Attrition(sxi,1)=0; end
if ~isempty(SECOND), Attrition(sxi,2)=1; else Attrition(sxi,2)=0; end
if ~isempty(THIRD), Attrition(sxi,3)=1; else Attrition(sxi,3)=0; end
clear thisguy FIRST SECOND THIRD;
end
% Clear NaNs
AttritionPredictors=AttritionPredictors(~isnan(AttritionPredictors(:,1)),:);
Attrition=Attrition(~isnan(AttritionPredictors(:,1)),:);
for atti=1:size(AttritionPredictors,2)
for sessi=1:3 % 1 doesn't really make sense, but added here to keep columns nice
A=AttritionPredictors(:,atti);
B=Attrition(:,sessi);
A2=A(~isnan(A));
B2=B(~isnan(A));
% B_acc is [constant, v1, v2,v1*v2] [validated by SPSS]
% STATS_acc.p is the p value for each
[B_acc,DEV_acc,STATS_acc] = glmfit(zscore(A2),B2, 'binomial','link','logit');
Predictors_Logistic{sessi}(atti,1)=B_acc(2);
Predictors_Logistic{sessi}(atti,2)=STATS_acc.p(2);
[~,P,~,STATS]=ttest2(A2(B2==1),A2(B2==0));
Predictors_t{sessi}(atti,1)=STATS.tstat;
Predictors_t{sessi}(atti,2)=P;
[P,~,U]=ranksum(A2(B2==1),A2(B2==0));
Predictors_u{sessi}(atti,1)=U.zval;
Predictors_u{sessi}(atti,2)=P;
clear B_acc DEV_acc STATS_acc A B A2 B2 STATS P U;
end
end
% % % S2:
% Logistic - 5
% t-test - 5
% U-test - 5
% % % S3:
% Logistic - 3,5 [almost 4]
% t-test - 3,5 [almost 4]
% U-test - 3,4,5
% 3=TOPF
% 4=Coding
% 5=Span
% Sess 2 dropouts:
nanmean(AttritionPredictors(Attrition(:,2)==0,3:5))
% Sess 2 stays:
nanmean(AttritionPredictors(Attrition(:,2)==1,3:5))
% Sess 3 dropouts:
nanmean(AttritionPredictors(Attrition(:,3)==0,3:5))
% Sess 3 stays:
nanmean(AttritionPredictors(Attrition(:,3)==1,3:5))
% So Lower Span predicts S2 dropout and Lower Span, Coding, and TOPF predict S3 dropout.gitattributes+28
LICENSE.txtAdded+208
README.mdAdded+75
data/14000_1_QUINN_3AOB.matAdded+3
data/18367_1_QUINN_3AOB.matAdded+3
data/19759_1_QUINN_3AOB.matAdded+3
data/20543_1_QUINN_3AOB.matAdded+3
data/3001_1_3AOB.matAdded+3
data/3001_2_3AOB.matAdded+3
data/3001_3_3AOB.matAdded+3
data/3002_1_3AOB.matAdded+3
data/3002_2_3AOB.matAdded+3
data/3002_3_3AOB.matAdded+3
data/3003_1_3AOB.matAdded+3
data/3003_2_3AOB.matAdded+3
data/3003_3_3AOB.matAdded+3
data/3004_1_3AOB.matAdded+3
data/3004_2_3AOB.matAdded+3
data/3004_3_3AOB.matAdded+3
data/3005_1_3AOB.matAdded+3
data/3005_2_3AOB.matAdded+3
data/3005_3_3AOB.matAdded+3
data/3006_1_3AOB.matAdded+3
data/3007_1_3AOB.matAdded+3
data/3007_2_3AOB.matAdded+3
data/3007_3_3AOB.matAdded+3
data/3008_1_3AOB.matAdded+3
data/3009_1_3AOB.matAdded+3
data/93385_1_QUINN_3AOB.matAdded+3
data/94391_1_QUINN_3AOB.matAdded+3
data/97750_1_QUINN_3AOB.matAdded+3
scripts/BV_Chanlocs_60.matAdded
scripts/BigAgg_Data.matAdded
scripts/Manuscript_3AOB.mAdded+110
scripts/ORIGINAL_README.txtAdded+10
scripts/QUALITY_CHECK.xlsxAdded
scripts/QUINN_QUALITY_CHECK.xlsxAdded
scripts/Run_Thresh_1D.mAdded+61
scripts/STEP1_3AOB_JFC.mAdded+192
scripts/STEP2_3AOB_Process.mAdded+250
scripts/s1_Load_Data.mAdded+121
scripts/s2_Kill_Data.mAdded+54
scripts/s3_Demographics.mAdded+88
scripts/s4_Example_ERPs.mAdded+30
scripts/s5_ERPs_by_Group.mAdded+137
scripts/s6_Correlations.mAdded+36
scripts/s6_Correlations_S1EEG_With_FrSBediffs.mAdded+111
scripts/s6_FOR_SPSS.mAdded+111
scripts/s7_Mengs_z.mAdded+51
scripts/sx_Predict_Attrition.mAdded+85