Hi I'm interested in running some analyses in matlab using freesurfer commands. I'm running an interaction effect, however I'm having issues residualizing the brain values to plot.
For running interaction effects I'm running it by inputting:
X=load('Xg.dat')
Y=load('ROI.dat')
C=load('C.dat')
[beta rvar]=fast_glmfit(y,x)
[F pvalues]=fast_fratio(beta,X.rvar.C)
Which works correctly, then to residualize the values to plot against my DV I was inputting:
X=load('Xg.dat')
Y=load('ROI.dat')
beta=inv(X'*X)*(X'*Y)
beta2=load('beta.txt) ; nuisance beta coefficients removed
X2=load('X2.dat') ; nuisance columns removed
yhat=X2*beta2
However the issue I'm having is when plotting the yhat against my variable of interest is that yhat is perfectly predicted by my DV. This is the case for any ROI I test which makes me suspect i have an error in the matrix somewhere. I've attached a graph and can send the .dat files if needed.
Thanks,
Cody