MATLAB: Fitrm with NaN values

problems of fitrm with nan valuesStatistics and Machine Learning Toolbox

Hello: I am having difficulties fitting a repeated measures model (fitrm) for matrices that contain a large amount of NaN values. I have seen few posts in this regard but haven't found a way to resolve it. Any suggestions?

Best Answer

Yes, I get an error as below:
Subscript indices must either be real positive integers or logicals.
Error in classreg.regr.modelutils.designmatrix>dummyVars (line 460) X0(end,:) = -1;
Error in classreg.regr.modelutils.designmatrix (line 290) [Xj,dummynames] = dummyVars(dummyCoding{j},Xj,catLevels{j});
Error in RepeatedMeasuresModel.fit (line 1326) = classreg.regr.modelutils.designmatrix(ds(~missing,:),...
Error in fitrm (line 67) s = RepeatedMeasuresModel.fit(ds,model,varargin{:});
Error in multistats (line 62) rm = fitrm(NewT,strcat('stimnod1-stimnod',num2str(s),'~Var1'),'WithinDesign',STIMNOD)
Error in script_NHP_v15 (line 534) [tblAmp3,tbmAmp3,NewTAmp3,LabelStatsAmp3]=multistats(AmpStimOut2Nod,AmpStimOut2Neighb,AmpStimOut2Out);