diff --git a/CanlabCore/@fmri_data/model_brain_pathway.m b/CanlabCore/@fmri_data/model_brain_pathway.m index 1c569a45..07190407 100644 --- a/CanlabCore/@fmri_data/model_brain_pathway.m +++ b/CanlabCore/@fmri_data/model_brain_pathway.m @@ -323,8 +323,8 @@ [~,~,xs_pathway_three, ys_pathway_three] = plsregress(source_one_train',target_two_train',ndim); [~,~,xs_pathway_four, ys_pathway_four] = plsregress(source_two_train',target_two_train',ndim); - Z_pathway_one = pinv(source_one_train') * ys_pathway_one; % Z = pattern across X voxels (source), predicting latent Y target - V_pathway_one = pinv(target_one_train') * xs_pathway_one; % V = pattern across Y voxels (target), predicting latent X source + Z_pathway_one = pinv(source_one_train') * ys_pathway_one; % Z = pattern across Y voxels (target), predicting latent Y target + V_pathway_one = pinv(target_one_train') * xs_pathway_one; % V = pattern across Z voxels (source), predicting latent X source Z_pathway_two = pinv(source_two_train') * ys_pathway_two; V_pathway_two = pinv(target_one_train') * xs_pathway_two; @@ -361,25 +361,28 @@ % optimized models % Revision 6/4/2021, Phil Kragel and Tor Wager - documentation - + % YS: linear combinations of target voxels chosen to covary with X (source) - YS_Test_target_one_pathway_one = Ytest_target_one * V_pathway_one; % Fitted (predicted) latent Y, based on observed Y. V = pattern across Y (target), predicting latent X source + % YS = T_hat: Predicted latent timeseries of Source (X) covarying with Target (Y) + % Linear combination of target test data and spatial patterns of X (V) + YS_Test_target_one_pathway_one = Ytest_target_one * V_pathway_one; YS_Test_target_one_pathway_two = Ytest_target_one * V_pathway_two; YS_Test_target_two_pathway_three = Ytest_target_two * V_pathway_three; YS_Test_target_two_pathway_four = Ytest_target_two * V_pathway_four; - - % XS: linear combinations of source voxels chosen to covary with Y (target) - XS_Test_source_one_pathway_one = Xtest_source_one * Z_pathway_one; % Fitted (predicted) latent X, based on observed Y; Z = pattern across X (source), predicting latent Y target + + % XS = U_hat: Predicted latent timeseries of Target (Y) covarying with Source (X) + % Linear combination of source test data and spatial patterns of Y (Z) + XS_Test_source_one_pathway_one = Xtest_source_one * Z_pathway_one; % Fitted (predicted) latent X, based on observed Y; Z = pattern across X (source), predicting latent Y target XS_Test_source_two_pathway_two = Xtest_source_two * Z_pathway_two; XS_Test_source_one_pathway_three = Xtest_source_one * Z_pathway_three; XS_Test_source_two_pathway_four = Xtest_source_two * Z_pathway_four; - - stats.latent_timeseries_source(indices==k, 1) = XS_Test_source_one_pathway_one(:, 1); % (cross-validated) time series of the latent var for X, pathway 1 + + stats.latent_timeseries_source(indices==k, 1) = XS_Test_source_one_pathway_one(:, 1); stats.latent_timeseries_source(indices==k, 2) = XS_Test_source_two_pathway_two(:, 1); stats.latent_timeseries_source(indices==k, 3) = XS_Test_source_one_pathway_three(:, 1); stats.latent_timeseries_source(indices==k, 4) = XS_Test_source_two_pathway_four(:, 1); - stats.latent_timeseries_target(indices==k, 1) = YS_Test_target_one_pathway_one(:, 1); % (cross-validated) time series of the latent var for Y, pathway 1 + stats.latent_timeseries_target(indices==k, 1) = YS_Test_target_one_pathway_one(:, 1); stats.latent_timeseries_target(indices==k, 2) = YS_Test_target_one_pathway_two(:, 1); stats.latent_timeseries_target(indices==k, 3) = YS_Test_target_two_pathway_three(:, 1); stats.latent_timeseries_target(indices==k, 4) = YS_Test_target_two_pathway_four(:, 1);