IDS: Exam solution 10/09/2026

オープン
#223 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
18/100
issue の種類
ドキュメント
明瞭さ
説明が足りない
活発さ
活発
領域
content

調査の方向性

Read the attached IDS_2026_SeptemberOUT.pdf and compare Exercise II with the textbook exercises referenced in the issue. The body includes a submitted MATLAB script but does not specify a change to make or what completion would look like.

索引モデルが issue の本文から書いたものです。

説明

IDS_2026_SeptemberOUT.pdf

Exercise II was identical to two exercises in the textbook. Therefore, anyone who did not complete it had evidently not even looked through the book.

As usual there was one student who submitted the following exam completely done by AI and completely wrong
INCREDIBLE


load citiesItaly.mat

% Numeric vars
PUL = varfun(@isnumeric, citiesItaly, 'OutputFormat','uniform');
numT = citiesItaly(:, PUL);

meds = varfun(@median, numT);
mads = varfun(@(x) mad(x,1), numT);

medVals = table2array(meds);
madVals = table2array(mads);
sigma = madVals / 0.6745;

names = numT.Properties.VariableNames;
Z = table(); 
for k = 1:numel(names)
    col = numT.(names{k});
    Z.( [names{k} '_robustz'] ) = (col - medVals(k)) ./ sigma(k);
end

citiesItalyRobust = [citiesItaly Z];

summaryStats = table(names', medVals', sigma', 'VariableNames', {'Variable','Median','UnbiasedMAD'});

robCols = endsWith(citiesItalyRobust.Properties.VariableNames,"_robustz");
Trob = citiesItalyRobust(:, robCols);
X = table2array(Trob);
names = Trob.Properties.VariableNames;
p = size(X,2);

figure;
hold on;
for k = 1:p
    h = boxchart(k*ones(size(X,1),1), X(:,k));  
    h.BoxFaceColor = [0.6 0.6 0.9];                
    h.MarkerStyle = 'none';
    h.DisplayName = names{k};                     
end
hold off;
xlim([0.5 p+0.5]);
set(gca, 'XTick', 1:p, 'XTickLabel', names, 'XTickLabelRotation', 45);

ylabel("addedval(1)");
title("addedval(1)");
legend("show", "Location", "bestoutside");

s = skewness(X,0);                 

% Find largest absolute skewness
[~, idxAbsMax] = max(abs(s));
varAbsMax = names{idxAbsMax};
skewAbsMax = s(idxAbsMax);

[skewPosMax, idxPosMax] = max(s);
[skewNegMin, idxNegMin] = min(s);
varPosMax = names{idxPosMax};
varNegMax = names{idxNegMin};

disp(table(names', s', 'VariableNames', {'Variable','Skewness'}));
fprintf('Largest absolute skewness: %s (skewness = %.4g)\n', varAbsMax, skewAbsMax);
fprintf('Largest positive skewness: %s (skewness = %.4g)\n', varPosMax, skewPosMax);
fprintf('Largest negative skewness: %s (skewness = %.4g)\n', varNegMax, skewNegMin);


load citiesItaly.mat   

want = {'addedval','depos'};
vars = citiesItaly.Properties.VariableNames;
if all(ismember(want,vars))
    sel = want;
else
    PUL = varfun(@isnumeric, citiesItaly, 'OutputFormat','uniform');
    numVars = citiesItaly.Properties.VariableNames(PUL);
    if numel(numVars) < 2
        error('Need at least two numeric variables in the table.');
    end
    sel = numVars(1:2);
end

x = table2array(citiesItaly(:,sel(1)));
y = table2array(citiesItaly(:,sel(2)));
XY = [x(:) y(:)];

if size(XY,2) ~= 2
    error('XY must be n-by-2.');
end
if size(XY,1) < 2 || all(var(XY)==0)
    error('Need at least two nonidentical observations.');
end

% Scatter
figure; hold on; axis equal;
scatter(XY(:,1), XY(:,2), 30, [0 0.4470 0.7410], 'filled');

mu = mean(XY,1);
S = cov(XY);

if ~isequal(size(S),[2 2])
    error('Covariance matrix is not 2-by-2. Check input data.');
end

k = chi2inv(0.99,2);

[V,D] = eig(S);

% Semi-axis lengths 
a = sqrt(k * D(1,1));
b = sqrt(k * D(2,2));

% Ellipse in eigen-coordinates and transform back
t = linspace(0,2*pi,300);
ellipse_eig = [a*cos(t); b*sin(t)];
ellipse = (V * ellipse_eig)' + mu;

% Plot ellipse and principal axes
plot(ellipse(:,1), ellipse(:,2), 'r-', 'LineWidth',1.5);
for i = 1:2
    vec = V(:,i) * sqrt(k * D(i,i));
    plot([mu(1)-vec(1), mu(1)+vec(1)], [mu(2)-vec(2), mu(2)+vec(2)], 'k--', 'LineWidth',1.2);
end

xlabel(sel{1}); ylabel(sel{2});
title(sprintf('Scatter of %s vs %s with 99%% Confidence Ellipse', sel{1}, sel{2}));
legend('Data','99% ellipse','Principal axes','Location','best');
grid on; hold off;


load citiesItaly.mat

% Select first two numeric variables
PUL = varfun(@isnumeric, citiesItaly, 'OutputFormat','uniform');
numVars = citiesItaly.Properties.VariableNames(PUL);
if numel(numVars) < 2
    error('Need at least two numeric variables in the table.');
end
x = table2array(citiesItaly(:,numVars{1}));
y = table2array(citiesItaly(:,numVars{2}));

figure('Name','Scatter with Bivariate (marginal) Boxplots','NumberTitle','off');

% Main scatter axes
mainPos = [0.15 0.15 0.65 0.65];
axMain = axes('Position',mainPos);
scatter(axMain, x, y, 30, [0 0.4470 0.7410], 'filled');
axis(axMain,'equal');
xlabel(axMain, numVars{1}); ylabel(axMain, numVars{2});
grid(axMain,'on');

% Top boxplot for X
topPos = [mainPos(1) mainPos(2)+mainPos(4)+0.02 mainPos(3) 0.12];
axTop = axes('Position',topPos);
boxplot(axTop, x, 'Orientation','horizontal','Labels',{''}, 'Colors','k');
set(axTop,'XAxisLocation','top','XTick',[],'YTick',[]);
xlim(axTop, xlim(axMain));

% Right boxplot for Y 
rightPos = [mainPos(1)+mainPos(3)+0.02 mainPos(2) 0.12 mainPos(4)];
axRight = axes('Position',rightPos);
boxplot(axRight, y, 'Orientation','vertical','Labels',{''}, 'Colors','k');
set(axRight,'YTick',[],'XTick',[]);
ylim(axRight, ylim(axMain));

% Link limits so they stay consistent when zooming/panning
linkaxes([axMain axTop], 'x');
linkaxes([axMain axRight], 'y');

box(axTop,'off'); box(axRight,'off');


load citiesItaly.mat   

% Pick first two numeric vars
PUL = varfun(@isnumeric, citiesItaly, 'OutputFormat','uniform');
numVars = citiesItaly.Properties.VariableNames(PUL);
if numel(numVars) < 2
    error('Need at least two numeric variables.');
end
X = table2array(citiesItaly(:, numVars(1:2)));

[robCov,robMean] = robustcov(X,'Method','fmcd');

md2 = sum(((X - robMean) / robCov) .* (X - robMean), 2);  

cut = chi2inv(0.99,2);

outIdx = find(md2 > cut);

if ~isempty(citiesItaly.Properties.RowNames)
    outNames = citiesItaly.Properties.RowNames(outIdx);
    disp('Rows outside robust bivariate boxplot (row names):');
    disp(outNames);
else
    disp('Rows outside robust bivariate boxplot (row indices):');
    disp(outIdx);
end
主要言語
MATLAB
スター
30
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

UniprJRC/DSwithMATLAB のほかの issue

UniprJRC/DSwithMATLAB の issue をすべて見る

似ている issue

MATLAB の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。