close all
clear all
disp('Mean and Standard Deviation After Variable Change')
lw = 3;
set(0, 'DefaultAxesFontSize', 16);
fs = 15;
msize = 10;
% It is known that ybar = 11.6 , s_y= 4.4045, and sample size n=15.
% The observation y_12 = 7 is removed and observation y_ 13 was misrecorded,
% it was 20 instead of recorded 10.
% Find ybar_new$ and s_y (new) after the changes.
%sumy -> sum(y_i):old
%sumynew -> sum(y_i): new
%sumy2 -> sum(y_i^2): old
%sumy2new -> sum(y_i^2): new
%NEED: ybarnew and synew
sumy = 15 * 11.6;
sumynew = sumy - 7 - 10 + 20;
ybarnew = sumynew/14;
%recall sy = sqrt(1/14 (sumy2 - 15*11.6^2) )
sumy2 = 14*(4.4045)^2 + 15 * 11.6^2;
% now n=15 drops to n=14...
sumynew2 = sumy2 - 49 + 300; %300=20^2 - 10^2
synew = sqrt( 1/13 * (sumynew2 - 14 * ybarnew^2 ) );
disp(' New ybar New sy ')
disp( [ybarnew synew] )
% New ybar New sy
% 12.6429 4.8295