 padZeros(model.w, ndx, [d, 1]);
    yhat = linregPredict(model, X);
    mse(i) = mean((yhat - y).^2);
<span class="keyword">end</span>
mse0 = mean((y - mean(y)).^2);
mse = [mse0; mse];
sz = [0; cellfun(@numel, ss)]; <span class="comment">% sizes of each subset.</span>
figure; hold <span class="string">on</span>;
plot(sz, mse, <span class="string">'.'</span>, <span class="string">'markersize'</span>, 40);
bestScores = zeros(1, d + 1);
<span class="keyword">for</span> i=0:d
    bestScores(i+1) = min(mse(sz==