External Email - Use Caution Hi Kersten,
I followed your mail and even also I got stuck at the contrast matrix i.e CM: I have given the code below which I used to execute the longitudinal pipeline. [aseg, asegrows,asegcols] = fast_ldtable(['aseg.long.table']); asegcols=cellstr(asegcols); [Y,mri] = fs_read_Y('rh.thickness_sm10.mgh'); rhsphere = fs_read_surf('/usr/local/freesurfer/subjects/fsaverage/surf/rh.sphere'); rhcortex = fs_read_label('/usr/local/freesurfer/subjects/fsaverage/label/rh.cortex.label'); Qdec = fReadQdec('long.qdec.table.dat'); Qdec = rmQdecCol(Qdec,1); sID = Qdec(2:end,1); Qdec = rmQdecCol(Qdec,1); M = Qdec2num(Qdec); [M,Y,ni] = sortData(M,1,Y,sID); Y(:,all(Y==0))=[]; %lme_lowessPlot(M(:,1),Y(:,1)+Y(:,2),0.70,M(:,2)); X = [ones(length(M),1) M M(:,1).*M(:,2)]; [lhTh0,lhRe] = lme_mass_fit_EMinit(X,[1 2],Y,ni,[],3); %[lhTh0,lhRe] = lme_mass_fit_EMinit(X,[1 2],Y,ni,[],5); [lhRgs,lhRgMeans] = lme_mass_RgGrow(rhsphere,lhRe,lhTh0,[],2,95); %[lhRgs,lhRgMeans] = lme_mass_RgGrow(lhsphere,lhRe,lhTh0,[],2,95); lhstats = lme_mass_fit_Rgw(X,[1 2],Y,ni,lhTh0,lhRgs,rhsphere); lhTh0_1RF = lme_mass_fit_EMinit(X,[1],Y,ni,rhcortex,3); lhstats_1RF = lme_mass_fit_Rgw(X,[1],Y,ni,lhTh0_1RF,lhRgs,rhsphere); LR_pval = lme_mass_LR(lhstats,lhstats_1RF,1); CM = [0 1 0 0 0 0 0]; %%%%%%%%%%%% F_lhstats = lme_mass_F(lhstats,CM); My design matrix i.e X has 7 columns ['subjID(1)', 'time_years', 'Age', 'Years_of_education', 'Gender', 'ICV', 'time_yearsXAge' ] So I kept the contrast vector as CM = [0 1 0 0 0 0 0] (if you remember my mails, this study doesn't have a control group). Matlab threw an error for this design and the same is highlighted below: > > > *F_lhstats = lme_mass_F(lhstats,CM);Error using lme_mass_F (line 44)The > number of elements (contrasts) in CM must be equal to the number of > locations (length(stats))length(stats)= 149995 * > *length(CM)= 7* I know it may sound silly but I am really stuck at this point in time. Would be glad if you could let me know where I am going off the path! Thanks, Vittal On Fri, Dec 11, 2020 at 10:29 PM vittal korann <vittalkor...@gmail.com> wrote: > Thanks, Kersten. > > I am sorry, I didn't see your response in the FS blog. > I will go through it once and let you know! > > Once again thanks a lot for your kind mail! > > With regards > Vittal > > > > On Thu, Dec 10, 2020 at 6:35 PM Diers, Kersten /DZNE < > kersten.di...@dzne.de> wrote: > >> Hello Vittal, >> >> I am (again) attaching my response to your message. This response has >> been on the freesurfer list since Nov 30, maybe you did not see it? >> >> Best, Kersten >> >> *From:* Diers, Kersten /DZNE >> *Sent:* Monday, November 30, 2020 6:27 PM >> *To:* Freesurfer support list >> *Subject:* Re: Longitudinal pipeline >> >> Hello VIttal, >> >> thanks for the info about the design. >> >> You wrote before that the Matlab variable X (i.e., the design matrix) has >> a dimension of 47x6. X is a translation of the study design into a >> numerical matrix, which is part of the statistical model. In your case, I >> assume that he first column is a vector of ones (i.e. the >> intercept/constant of the statistical model), and that the other columns >> reflect the numerical data in the table that you sent, in the same order. >> Correct me if I am wrong. >> >> Now, the contrast "matrix“ specifies the questions that you want to ask >> to the data, i.e. the effect of a certain variable (or sometimes >> combinations of variables) onto the outcome variable Y. I put "matrix" in >> quotes, because in many cases a simple vector is sufficient; contrasts need >> not necessarily be specified as a matrix, and contrasts specified as a >> matrix are typically more complex than those specified by a vector. >> >> In any case, the contrast vector/matrix needs to have as many >> elements/columns as there are columns in X, because the elements/columns >> oft the contrast vector/matrix will be matched with (and therefore need to >> correspond to) the columns of X. I.e. the nth element/column in your >> contrast vector/matrix refers to the nth predictor variable in the >> statistical model, i.e. the nth column of X. There are 6 columns in X in >> your case. >> >> The entries in the contrast vector/matrix represent weights that you >> assign to each variable in order to test for its effect. One often (but not >> always or necessarily) uses +1 to test for a positive relation of the >> chosen variable on Y, -1 for a negative effect, and zero for not >> considering a variable for a given contrast. Therefore, the simplest >> contrast is a vector with a single non-zero entry, and this already allows >> for the testing of effects. In other cases, contrasts can have more than >> one non-zero entry, or can be formulated as a matrix, but we don’t need >> this at the moment. >> >> The major issue with your design in its current form is that you will not >> be able to distinguish effects of time from effects of treatment, due to >> the absence of a control group. This precludes, as far as I can see, a >> clear interpretation of any changes in Y that you might observe. If you >> still want to go ahead and test the time/treatment effect, just set the >> corresponding element of the contrast vector to +1 or -1. >> >> Best, >> >> Kersten >> >> Am 10.12.2020 um 09:10 schrieb vittal korann <vittalkor...@gmail.com>: >> >> Hi Kersten >> >> Thank you for kind response. >> >> I think we need to talk about the design matrix X first (sorry, I did not >> look at your xlsx file; I think it's probably better to send simple csv >> files if at all). >> I attached longitudinal data in csv format. >> >> Besides the covariates that you mention, the matrix needs to contain an >> intercept, a variable for ?time?, a variable for ?group? (assuming you have >> a control group also), and a group-by-time interaction term in order to >> asses differential change over time (again, if you have a control group). >> I do not have a control group. Right now I have only schizophrenia >> patients who underwent 2 scans: first is baseline and second one is after 3 >> months of yoga therapy. Wish to know the how can I proceed with my availabe >> data. >> >> Just to make sure: ?age? should be ?age at baseline? (i.e. constant >> across time per subject), otherwise it will be confounded with time. >> Yes, I used same across the study. >> >> Could you review (and possibly adapt) your design matrix X with respect >> to which columns it contains, and write it in the reply? >> I tried but couldn't get there. >> >> Any help would be greatly appreciated! >> >> Thanks, >> Vittal >> >> >> >> >> >> <longitudinal_data (1).csv> >> >> >> -- >> Kersten Diers >> Image Analysis Group (AG Reuter) >> German Center for Neurodegenerative Diseases (DZNE) >> B.1.114 | Building 99 | Venusberg-Campus 1 | 53127 Bonn | Germany >> https://secure-web.cisco.com/1QEbnXQmS5z7LkqTPYTOn3q8tRJjlV7vi2P1a882OfirZspsbiYPIXn8GmkFqEa80Nmr4a62SzuJZgAlB8brmvdIHrcrHVaKt4A8PO5ebQbZEugej_SXZQ5iYAqKfJFv-QrIbiVvgT-wGP6OXHCzNdWplr4CdZ6nTJ1HMnJt49iwko9bWAwU9KwslrxwCtQbZI8Rah3P4d-KBFoKjNkDG6ciRlEAwYKIqOBQWJ3FKJ7j0zQ9x-uHkq0bZOIZgCp5mGAUyO_Q-G9H2x-5m7ijUmQ/https%3A%2F%2Fwww.dzne.de%2Fen%2Fsites%2Fbonn%2Fresearch-groups%2Freuter.html >> Phone: +49 / 228 / 43302 - 381 >> >>
_______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer