I'd like to ask a question about possible rules of expectation when we can and can't use them "as if" they were scalars.
Given Random Variables: $X_i \underset{iid}{\sim} z$ forming a random sample of z where z is some distribution and two given functions f and g.
lets define $\mathbb{E}_{g}[f(X)]=\int_{-\infty}^{\infty} f(X)g(X)~dx$ as the weighted expectation of f wrt to g.
From my understanding this is a number... it has a value and is not a "random variable" (even though i know constants are technically random variables with constant value)...
so if we were to calculate for example: $$Var[h(X)] = \sum\limits_{1}^{n}Var_{g}[\mathbb{E}_{g}[f(X_i)]w(X_i)]$$ In this instance, would it be correct to consider the expectation as if it's acting as a scalar (since it's value is constant for each defined observation) and so we could rewrite this as $$\sum\limits_{1}^{n}\mathbb{E}_{g}[f(X_i)]Var_{g}[w(X_i)]$$ where the $Var_g$ is defined analogously to $\mathbb{E}_{g}$
Thanks.
The way you have written it, the expected value term is a constant; hence, $$\sum\limits_{1}^{n}Var_{g}[\mathbb{E}_{g}[f(X_i)] w(X_i)] =\sum\limits_{1}^{n} (\mathbb{E}_{g}[f(X_i)])^2 Var_{g}[ w(X_i)]. $$ Note that is different from what you wrote since $\mathsf{Var}(aX)=a^2\mathsf{Var}(X)\neq a\mathsf{Var}(X)$.