# “Input to EIG must not contain NaN or Inf” error in fitrm for 18 subjects and 6 levels

Hi,

I am getting the following Matlab error: “Input to EIG must not contain NaN or Inf.” when I run the fitrm function.

I am trying to test the differences between the 6 levels.

I have 18 subjects and 6 levels.

My table with the formatted data looks like this:

**The code:**

subj = {'Subj1','Subj2','Subj3','Subj4','Subj5','Subj6','Subj7','Subj8','Subj9','Subj10','Subj11','Subj12','Subj13','Subj14','Subj15','Subj16','Subj17','Subj18'}';t_loud_fc = table(subj,fc_y_250_mean,fc_y_500_mean,fc_y_1000_mean,fc_y_2000_mean,fc_y_3000_mean,fc_y_4000_mean,...

'VariableNames',{'subj','Cond1','Cond2','Cond3','Cond4','Cond5','Cond6'});cond_loud_fc = dataset([1 2 3 4 5 6]','VarNames',{'Conditions'});rm_loud_fc = fitrm(t_loud_fc,'Cond1-Cond6~subj','WithinDesign',cond_loud_fc);ranovatbl_loud_fc = ranova(rm_loud_fc);

**The output from the console window is:**

Error using eig

Input to EIG must not contain NaN or Inf.Error in RepeatedMeasuresModel>mauchlyTest (line 1921)

lam = eig(C'*S*C);Error in RepeatedMeasuresModel.fit (line 1369)

[this.Mauchly,this.Epsilon] = mauchlyTest(this.Cov,size(Xmat,1),rank(Xmat));Error in fitrm (line 67)

s = RepeatedMeasuresModel.fit(ds,model,varargin{:});Error in RunStatAnalysis (line 51)

rm_loud_fc = fitrm(t_loud_fc,'Cond1-Cond6~subj','WithinDesign',cond_loud_fc);

I have traced the problem to line 1347 in RepeatedMeasuresModel.m. Here, the variable dfe is equal to zero and thus the covariance becomes 0 as well.. How do I avoid this?

The variable dfe is given by dfe = size(Xmat,1)-size(Xmat,2); , where Xmat is a 18x18 matrix and thus dfe becomes zero….

*NOTE:-*

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

Hello, I have a similar problem and don’t understand how to solve it. I tried looking for missing values but don’t seem to find them. This is my code:

V1 = (41 + 47 + 42)/x;

V2 = (54 + 97 + 58)/x;

V3 = (46 + 49 + 26)/x;

V4 = (28 + 40 + 45)/x;

V5 = (104 + 126 + 70)/x;

S1 = [V1 31 51 35 34];

S2 = [V2 22 75 42 55];

S3 = [V3 45 83 31 24];

S4 = [V4 54 67 10 55];

S5 = [V5 71 156 61 91];

vehicle = [S1(1) S2(1) S3(1) S4(1) S5(1)];

cloz_0_08 = [S1(2) S2(2) S3(2) S4(2) S5(2)];

cloz_0_1 = [S1(3) S2(3) S3(3) S4(3) S5(3)];

cloz_0_3 = [S1(4) S2(4) S3(4) S4(4) S5(4)];

cloz_1 = [S1(5) S2(5) S3(5) S4(5) S5(5)];

animals{1} = ‘rat4’;

animals{2} = ‘rat15’;

animals{3} = ‘rat20’;

animals{4} = ‘rat21’;

**SEE COMPLETE ANSWER CLICK THE LINK**