MATLAB Answers

vartestn error line 272

3 views (last 30 days)
Thibaut Deville
Thibaut Deville on 9 Jun 2020
Commented: Chidvi Modala on 23 Jun 2020
Hi everyone,
I'm trying to make vartestn works but everytime I get :
Unrecognized function or variable 'testname'.
Error in vartestn (line 272)
Table{k+4,1} = testname;
Error in Statistiques (line 69)
Could someone help me to solve this problem ?
A part of my currently code if it could help :
Thibaut Deville.


Sign in to comment.

Answers (1)

Chidvi Modala
Chidvi Modala on 16 Jun 2020
Are you trying to use the Levene's tests for data with a single group?


Thibaut Deville
Thibaut Deville on 16 Jun 2020
No, I am not.
I have 6 groups to compare 1 to 1.
Here, some code to simulate my data and getting the same error :
%Data simulation
for i=1:2
Test(i).data=rand(24,1); %group 1-2
Test(i+2).data=rand(17,1); %group 3-4
Test(i+4).data=rand(12,1); %group 5-6
%Levene's test
for i=1:5
for j=1:5
if i+j < 7
p(counter,1) = vartestn(A,B,'TestType','LeveneAbsolute');
clear A B
Chidvi Modala
Chidvi Modala on 18 Jun 2020
This is a bug. I have brought this issue to the notice of our developers and will try to fix it in future releases.
Chidvi Modala
Chidvi Modala on 23 Jun 2020
The vartestn function wants data as the first input and grouping information as the second. It looks like you are supplying the first data sample as the first input and the second data sample as the second. May be you can change the code from
p(counter,1) = vartestn(A,B,'TestType','LeveneAbsolute');
p(counter,1) = vartestn([A;B],[zeros(size(A));ones(size(B))],'testtype','leveneabsolute')
Also the original line of code above is defining a series of single-observation groups. It is not possible to estimate the variance from single observations, so the vartestn is going into a piece of code to deal with this edge case of no information.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!