Mean And Varience And Standard Deviation

866 days ago by mineungi

$\begin{array}{rcl} \displaystyle \text{Mean : } m &=&\displaystyle\frac{x_1+x_2+x_3+\cdots+x_n}{n} \\ &=&\displaystyle \frac{1}{n}\sum_{i=1}^n x_i \\ \end{array}$

$\begin{array}{rcl} \displaystyle \displaystyle \text{Variance : } \sigma^2& =&\displaystyle\frac{(x_1-m)^2+(x_2-m)^2+\cdots+(x_n-m)^2}{n} \\ &=&\displaystyle \frac{1}{n}\sum_{i=1}^n(x_i-m)^2 =\displaystyle \frac{1}{n}\sum_{i=1}^n(x_i^2-2mx_i+m^2) \\ &=&\displaystyle \frac{1}{n}\sum_{i=1}^n x_i^2 - 2m \times \frac{1}{n}\sum_{i=1}^n x_i +m^2 \times \frac{1}{n}\sum_{i=1}^n 1 \\ &=&\displaystyle \frac{1}{n}\sum_{i=1}^n x_i^2 - 2m \times m +m^2 \times \frac{1}{n} \times n \\ &=&\displaystyle \frac{1}{n}\sum_{i=1}^n x_i^2 - 2m^2 + m^2 =\displaystyle \frac{1}{n}\sum_{i=1}^n x_i^2 -m^2\\ \end{array}$

$\text{Standard Deviation } : \sigma=\sqrt{\sigma^2}$

variate_list=[1,2,3,4,5] 
       
%latex Variate list: $\displaystyle=\sage{latex(variate_list)}$ 
       
mean_of_variate_list=mean(variate_list) 
       
%latex $m=\displaystyle\sage{latex(mean_of_variate_list)}$ 
       
variance_of_variate_list=variance(variate_list, bias=True) 
       
%latex $\sigma^2\displaystyle=\sage{latex(variance_of_variate_list)}$ 
       
standard_deviation_of_variate_list=std(variate_list, bias=True) 
       
%latex $\sigma\displaystyle=\sage{latex(standard_deviation_of_variate_list.simplify())}$ 
       
squar_of_variate_list=[] for i in range(len(variate_list)): squar_of_variate_list.insert(i,variate_list[i]^2) 
       
%latex squar of variate list : $\displaystyle=\sage{latex(squar_of_variate_list)}$ 
       
temp=mean(squar_of_variate_list)-mean(variate_list)^2 
       
%latex $\sigma^2\displaystyle=\sage{latex(temp)}$