Help with student grades categorization for ANOVA-n

조회 수: 2 (최근 30일)
Douglas Leaffer
Douglas Leaffer 2023년 6월 28일
답변: Sulaymon Eshkabilov 2023년 6월 28일
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);

채택된 답변

Sulaymon Eshkabilov
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)
p1 = 0.9555
p2 = anovan(Grade, {PHS131.SEX, PHS131.PREREQ})
p2 = 2×1
0.9443 0.8672

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Analysis of Variance and Covariance에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by