# Variance of a function of a normal random variable

I want to define a new random variable $f$ as a function of a normal random variable $v$: $$f(v)=\begin{cases}C&\text{if } v\ge C\\ \gamma v &\text{otherwise}\end{cases}$$

where $v\sim N(v_0,\sigma_v)$ and $C$ is constant.

How should I compute the variance of $f$? Can anyone help me? Thanks, PM

-
I don't think this is a valid density function. How can you have finite probability on the interval from $C$ to infinity? –  trb456 Feb 10 '13 at 12:21
@trb456: As $v$ is normally distributed, the variance of $f$ will be finite. –  Ron Gordon Feb 10 '13 at 12:53
@user61677: As my comments are suggesting, I think some editing to your question would help clarify what you want. Instead of your function f, which I am likely mistaking for a pdf, do instead mean you want to define a new random variable as a function of an existing normal random variable? This may seem picky, but I think it would be more clear. –  trb456 Feb 10 '13 at 13:29
Twice the post mentions $f$ and twice it should read $f(v)$. (Note furthermore that random variables are most often denoted by capital letters, in which case the random variable of interest would be $f(V)$.) –  Did Feb 10 '13 at 14:10

I think the way you want to go about this is to express the expected value of $f$ as

$$E[f(V)] = \frac{\gamma}{\sqrt{2 \pi} \sigma_0} \int_{-\infty}^C dv \: v \exp{\left [ - \frac{(v-v_0)^2}{2 \sigma_0^2} \right ]} + \frac{C}{\sqrt{2 \pi} \sigma_0} \int_{C}^{\infty} dv \: \exp{\left [ - \frac{(v-v_0)^2}{2 \sigma_0^2} \right ]}$$

where $V$ is the normally distributed random variable. Also,

$$E[f(V)^2] = \frac{\gamma^2}{\sqrt{2 \pi} \sigma_0} \int_{-\infty}^C dv \: v^2 \exp{\left [ - \frac{(v-v_0)^2}{2 \sigma_0^2} \right ]} + \frac{C^2}{\sqrt{2 \pi} \sigma_0} \int_{C}^{\infty} dv \: \exp{\left [ - \frac{(v-v_0)^2}{2 \sigma_0^2} \right ]}$$

The variance is

$$\mathrm{Var}[f(V)] = E[f(V)^2] - E[f(V)]^2$$

-
I'm sorry, but what you are integrating is not the OP's function, which I again reiterate is not a valid density function as written. –  trb456 Feb 10 '13 at 13:03
@trb456: Where did the OP say that $f$ is a density function? $f$ is not a density function, but rather a function of the random variable $V$. –  Ron Gordon Feb 10 '13 at 13:05
@rlgordonna: The new random variable still needs a density function, and what you are integrating is not it. At a minimum, you have the support backwards (constant above $C$ as written). But more seriously, what is the pdf when the normal random variable exceeds $C$? You seem to want to assume it's normally distributed above $C$, and you are likely be right that this is what the OP meant, but if so then this could be better expressed than currently. –  trb456 Feb 10 '13 at 13:26
@trb456: thanks for catching my error. As for the density function of $f(V)$, I am not assuming anything that the OP hasn't stated. –  Ron Gordon Feb 10 '13 at 13:30
Thanks a lot!! f is not a density function, but a function of the random variable v. –  user61677 Feb 10 '13 at 13:30

You can use the results for a truncated normal distribution. I assume $\sigma_v$ is a standard deviation rather than a variance.

Let $\beta = \dfrac{C-v_0}{\sigma_v}$, $b=\phi(\beta)$ and $B=\Phi(\beta)$ using the PDF and CDF of a standard normal distribution. Then the first moment about zero could be something like $$E[f] = B \gamma \left( v_0 - \frac{b}{B} \sigma_v \right) +(1-B)C$$

which you can simplify.

You can then work out the second moment in a similar way and thus the variance of $f$, but I will leave that for you. For what it is worth, my attempt at the second moment (before I decided to stop, so unchecked) was

$$B \gamma^2 \left(\sigma_v \left( 1 - \frac{b \beta}{ B} -\frac{b^2}{B^2} \right) + \left(v_0 - \frac{b}{B} \sigma_v\right)^2\right) +(1-B)C^2$$ and you just need to subtract the square of the first moment to give the variance.

-