In a book i found the average of the squared expected value of difference between two random variables, but i'm not able to understand what calculations produced this series of equivalences, can you show me ?
$E(Y-\bar{Y})^{2}=E[f(X)+\varepsilon -\bar{f}(X))]^{2}=[f(X) -\bar{f}(X))]^{2}+Var(\varepsilon)$
ps: i know what an expected value is
You can write $$ E[f(X)+\varepsilon -\bar{f}(X))]^{2}=E\left[(f(X)-\bar{f}(X))^2 + 2\varepsilon(f(X)-\bar{f}(X)) + \varepsilon^2\right] $$ Now, they use that the expectation of $\varepsilon$ equals $0$ and they use that $f(X)$ and $\bar{f}(X)$ are determinstic.