Anovan random model with unbalanced data set

3 次查看(过去 30 天)
Hello, I'm running a 2-way random model anova with unbalanced data using anovan. I know anovan can deal with unbalanced data, but I'm confused as to how. When I run my code, the empty cells are replaced with '0', but those zeros are used in calculating that group mean. I therefore end up with an incorrect value for that group and wrong statistics. I have tried putting NaN in those empty cells but then none of the data for that subject is used. Thoughts? Thanks, Jen
data_ANOVA = data(:,col_1:col_2);
data_ANOVA = data_ANOVA(:);
% Factor A, Speed
numA = (col_2 - col_1)+1;
speed = repmat(1:numA, r,1);
speed = speed(:);
% Factor B, Subject (random factor)
numB = 10; % number of reps per subjects
subject = [ones(numB,numA); 2*ones(numB,numA); 3*ones(numB,numA); 4*ones(numB,numA); 5*ones(numB,numA); 6*ones(numB,numA); 7*ones(numB,numA); 8*ones(numB,numA); 9*ones(numB,numA); 10*ones(numB,numA); 11*ones(numB,numA); 12*ones(numB,numA); 13*ones(numB,numA); 14*ones(numB,numA); 15*ones(numB,numA); 16*ones(numB,numA); 17*ones(numB,numA)];
subject = subject(:);
[p, table, stats] = anovan(data_ANOVA,{speed subject},'model',2,'random',2,'varnames',{'Speed';'Subject'});

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Analysis of Variance and Covariance 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by