help > covariates
Showing 1-13 of 13 posts
Oct 24, 2017 10:10 PM | Heena Manglani - The Ohio State University
covariates
Hello,
I am getting an error when entering covariates for density calculations in the calcproperties GUI. My covariates are two variables in the MATLAB workspace with one number per variable for each participant. The error i'm getting is pasted below. Thank you in advance for your help!
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in GTG_calcproperties_GUI>Start_pushbutton_Callback (line 2431)
if
rank([out.denscalc_varmat,out.denscalc_covarmat,ones(size(out.denscalc_varmat,1),1)])==(size([out.denscalc_varmat,out.denscalc_covarmat],2)+1)
% If an intercept can be added without making the design matrix rank deficient
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GTG_calcproperties_GUI (line 126)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GTG_calcproperties_GUI('Start_pushbutton_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
Best,
Heena
I am getting an error when entering covariates for density calculations in the calcproperties GUI. My covariates are two variables in the MATLAB workspace with one number per variable for each participant. The error i'm getting is pasted below. Thank you in advance for your help!
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in GTG_calcproperties_GUI>Start_pushbutton_Callback (line 2431)
if
rank([out.denscalc_varmat,out.denscalc_covarmat,ones(size(out.denscalc_varmat,1),1)])==(size([out.denscalc_varmat,out.denscalc_covarmat],2)+1)
% If an intercept can be added without making the design matrix rank deficient
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GTG_calcproperties_GUI (line 126)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GTG_calcproperties_GUI('Start_pushbutton_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
Best,
Heena
Oct 25, 2017 02:10 PM | Jeffrey Spielberg
RE: covariates
It sounds like the dimensions of your variables are either
incorrect or inconsistent with each other/the data. They
should both be column variables with dimensions nx1 (n=number of
subjects). What sizes are your covariates?
Oct 25, 2017 03:10 PM | Heena Manglani - The Ohio State University
RE: covariates
Hi Jeff,
Both variables are in a 38x1 matrix and consist of z-transformed variables. My predictor variables are also z-transformed but in a 38x2 matrix with one column for each predictor. Does the matrices for the predictors and the covariates have to be the same size?
Thanks,
Heena
Both variables are in a 38x1 matrix and consist of z-transformed variables. My predictor variables are also z-transformed but in a 38x2 matrix with one column for each predictor. Does the matrices for the predictors and the covariates have to be the same size?
Thanks,
Heena
Oct 25, 2017 05:10 PM | Jeffrey Spielberg
RE: covariates
Are you getting this error when trying to input covariates in the
first place or after pressing start?
I'm not sure why this would matter, but try separating the predictor matrix into two 38x1 variables and inputing these first, then the covariates.
I'm not sure why this would matter, but try separating the predictor matrix into two 38x1 variables and inputing these first, then the covariates.
Oct 25, 2017 09:10 PM | Heena Manglani - The Ohio State University
RE: covariates
I am getting this error after hitting start. I also tried to split
my predictors so the matrices match with the covariates but I'm
still receiving the same error. Any other thoughts?
Oct 26, 2017 03:10 PM | Jeffrey Spielberg
RE: covariates
This sounds like a bug, which I will look into. In the
meantime, my experience has been that the inclusion of covariates
hasn't mattered (though, that depends on the intercorrelation of
course), so you are probably ok skipping that...
Nov 3, 2017 03:11 PM | Heena Manglani - The Ohio State University
RE: covariates
Hi Jeff,
I followed your advice and ran the calc properties step without any covariates. Now at the GLM stage, I am unable to enter the contrast weights for my IVs (which were entered in the calc properties step without any issues; see attached image). As an alternative, I tried re-entering the IVs by selecting new predictors. However, I am immediately getting the same error as before, "Error using horzcat. Dimensions of matrices being concatenated are not consistent."
I tried entering the IVs as 1 combined matrix (2 columns X 38 rows) and as separate matrices (1 X 38), but am still getting the same concatenation error. Is there some other format in which I need to set up my predictors?
A related concern is that I'm not being able to enter in my covariates as predictors (which I would weigh as 0 in the contrasts to partial out their variance), due to that same error. However, I believe that once the horzcat error is resolved I'll be able to enter in all my IVs and covariates.
Please let me know your thoughts.
Thank you!
Heena
I followed your advice and ran the calc properties step without any covariates. Now at the GLM stage, I am unable to enter the contrast weights for my IVs (which were entered in the calc properties step without any issues; see attached image). As an alternative, I tried re-entering the IVs by selecting new predictors. However, I am immediately getting the same error as before, "Error using horzcat. Dimensions of matrices being concatenated are not consistent."
I tried entering the IVs as 1 combined matrix (2 columns X 38 rows) and as separate matrices (1 X 38), but am still getting the same concatenation error. Is there some other format in which I need to set up my predictors?
A related concern is that I'm not being able to enter in my covariates as predictors (which I would weigh as 0 in the contrasts to partial out their variance), due to that same error. However, I believe that once the horzcat error is resolved I'll be able to enter in all my IVs and covariates.
Please let me know your thoughts.
Thank you!
Heena
Nov 4, 2017 11:11 AM | Jeffrey Spielberg
RE: covariates
If you have 38 participants, you want each predictor (IV or
covariate) to be 38x1 (not 1x38). Try selecting them all as
new predictors (it doesn't matter if they are IVs or covariates for
this - you pick out what you are interested in via the
contrasts).
One thought - make sure all of your variables are in the same format (double is safest).
One thought - make sure all of your variables are in the same format (double is safest).
Nov 4, 2017 09:11 PM | Heena Manglani - The Ohio State University
RE: covariates
Apologies for the confusion in the last message. I did indeed enter
each variable in a 38 x 1 (rows x column) matrix when I received
the concatenation error. The same error appears when I enter the
predictors separately and combined in one matrix.
Can you clarify how I should make my variables in the same double format?
Thanks!
Can you clarify how I should make my variables in the same double format?
Thanks!
Nov 6, 2017 09:11 PM | Heena Manglani - The Ohio State University
RE: covariates
Never mind Jeff, it worked! The cell2mat conversion of all the
predictors did the trick.
Thanks for your help!
Thanks for your help!
Nov 16, 2017 03:11 PM | Heena Manglani - The Ohio State University
RE: covariates
Hi Jeff,
I went back to calculating properties step to add in the predictors and covariates now in the double format and to calculate additional metrics. However, I am now getting the following error regarding line 3027 in the script (parfor curr_sub = 1:num_subs):
Error using GTG_calcproperties_GUI>Start_pushbutton_Callback (line 3027)
Subscripted assignment dimension mismatch.
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GTG_calcproperties_GUI (line 126)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GTG_calcproperties_GUI('Start_pushbutton_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
I encountered a few other errors before this regarding matlabpool and parpool and so I followed what we've done in the previous scripts and commented those lines out. I wonder if the current error is related to that? I've attached the GTG_calc_properties script I'm using to help identify the issue.
Thank you!!
-Heena
I went back to calculating properties step to add in the predictors and covariates now in the double format and to calculate additional metrics. However, I am now getting the following error regarding line 3027 in the script (parfor curr_sub = 1:num_subs):
Error using GTG_calcproperties_GUI>Start_pushbutton_Callback (line 3027)
Subscripted assignment dimension mismatch.
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GTG_calcproperties_GUI (line 126)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GTG_calcproperties_GUI('Start_pushbutton_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
I encountered a few other errors before this regarding matlabpool and parpool and so I followed what we've done in the previous scripts and commented those lines out. I wonder if the current error is related to that? I've attached the GTG_calc_properties script I'm using to help identify the issue.
Thank you!!
-Heena
Nov 17, 2017 05:11 PM | Jeffrey Spielberg
RE: covariates
Yes, the parpool can be finicky. Does everything work if you
comment out those lines?
Nov 17, 2017 08:11 PM | Heena Manglani - The Ohio State University
RE: covariates
Commenting out matlabpool and parpool has not worked. Do you have
other suggestions I could try?
Thanks,
Heena
Thanks,
Heena