Anovan random model with unbalanced data set
1 回表示 (過去 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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で ANOVA についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!