title: Calculating the MSE by definition vs. Var - Bias
body: <p>So I am trying to calculate the MSE in two ways.</p>
  
  <p>Say T is an estimator for the value t.</p>
  
  <p>First I am trying to calculate it in R by using the theorem:</p>
  
  <p>MSE(T) = Var(T) + (Bias(T))^2</p>
  
  <p>Secondly, I am trying to calculate it in R by definition, i.e. MSE(T) = E((T-t)^2).</p>
  
  <p>And say that T is an unbiased estimator, i.e. Bias(T) = 0</p>
  
  <p>So in R, MSE(T) = Var(T) which we can just in R: var(T)</p>
  
  <p>But when I try calculating the MSE by definition I get a different number from Var(T)...</p>
  
  <p>And I think that my formula that I wrote in R is wrong, this is what I wrote for MSE definition in R:</p>
  
  <p>It was suggested that "weighted.mean" is equivalent to the "expected value" function.</p>
  
  <p>So I wrote: weighted.mean( (T - 2)^2) where my t = 2.</p>
  
  <p>I hope I provided enough information to get help, thanks in advance.</p>