Help with student grades categorization for ANOVA-n
2 次查看(过去 30 天)
显示 更早的评论
Hello. I need some help formatting a table (attached) of student grades for an ANOVA-n analysis. I want to perform the ANOVA-n with outcome (y) as PHS_Grades, which are letter categorical currently, based on multiple factors, such as MAT_Grade (also letter categorical), SEX, ETHNICITY, and AGE (which falls into one of 5 ranges: 0-17; 18-21; 22-25; etc.). I have converted SEX and ETHNICITY to binary variables, but not sure how to code the AGE groups, nor the letter grades from PHS_Grade (outcome) nor MAT_Grade (one factor). Thanks for any help
load Grades.mat; % loads a table named PHS131
p = anovan(PHS131.PHS_Grade, {'SEX'}) % an example category factor
% ERROR OUTPUT:
%Check for incorrect argument data type or missing argument in call to
%function 'isnan'.
%Error in anovan>removenans (line 1183)
%nanrow = isnan(y);
%Error in anovan (line 190)
%[y,allgrps,nanrow,varinfo] = removenans(y,group,continuous);
0 个评论
采纳的回答
Sulaymon Eshkabilov
2023-6-28
The variable Grade needs to be numerical values - double or single, then it should work. Also, a small syntax correction with the variable names is needed, e.g.:
load Grades.mat; % loads a table named PHS131
Grade = randi([60, 100], numel(PHS131.SEX), 1); % Grade is a numerical data
p1 = anovan(Grade, PHS131.SEX)
p2 = anovan(Grade, {PHS131.SEX, PHS131.PREREQ})
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!