# Variance calculation for a nonlinear combination of random variables

How do a find the variance of a nonlinear combination of random variables. Say I want to find the variance of the quantity

$$\hat{\beta} = AB\exp(AC) + C$$

in function of the variances and covariances of A, B and C, which are known. Consider A, B and C estimators, with also values of their estimates available. What is ${\rm Var}(\hat{\beta})$?

• I don't see why any symbolic software such as Mathematica wouldn't work? – Aksakal Feb 20 '18 at 17:37
• I think Stata can do this with the lincom command. – AdamO Feb 20 '18 at 17:40
• @AdamO I am guessing you meant nlcom. However, that will only work after an actual estimation command, rather taking an immediate argument. – Dimitriy V. Masterov Feb 20 '18 at 17:54
• @Knarpie, do you know the derivation? Would you want to post it as an answer, if this thread were reopened? Asking for software is off topic here, but asking for the derivation isn't. – gung - Reinstate Monica Feb 21 '18 at 14:27
• @gung Yes please. I thought I had a software issue, but it turns out my understanding of the stats was lacking. I removed the part on the software, even though I disagree about it being off topic. When the questions get so technical, only statisticians will be able to point you to the right software. Also the wide interest in this question shows that it is useful to many. – Knarpie Feb 21 '18 at 15:27

Even though the original question was asking for a software, the "hard" part is in statistical theory. The answer is called the multivariate delta method, which states that, given a variance-covariance matrix

$$V = \begin{bmatrix} \sigma^2_{A} & \sigma_{A, B} & \sigma_{A, C}\\ \sigma_{A, B} & \sigma^2_{B} & \sigma_{B, C} \\ \sigma_{A, C} & \sigma_{B, C} & \sigma^2_{C} & \end{bmatrix}$$

and defining the gradient of $\hat{\beta}$

$$\nabla \hat{\beta}(A,B,C) = \begin{bmatrix} \frac{\partial \beta}{\partial A}\\ \frac{\partial \beta}{\partial B}\\ \frac{\partial \beta}{\partial C}\\ \end{bmatrix}$$

The required variance is approximately

$$Var(\hat{\beta}) \approx \nabla \hat{\beta}^t V \nabla \hat{\beta}$$

Given the difficult formula for $\hat{\beta}$, finding the gradient is the "difficult" part, but indeed any symbolic software is able to carry out this symbolic derivation.

• The delta method is an approximation, an important point to note. The delta method does work in all scenarios, and Mathematica can find the derivatives. The question could be made much more sophisticated by considering that certain linear and nonlinear combinations of RVs form known RVs whose variance could be expressed exactly. – AdamO Feb 21 '18 at 15:51
• First, the delta method is an approximation -- and it may not necessarily be a good approximation. Second, you are seeking the answer in terms of the known variances and covariances of $A$, $B$ and $C$. It is not transparent to me that the delta method will provide a solution in terms of the known variances and covariances. Third, given your functional form [with exp($AC$) ], it will not be possible to provide a general solution just in terms of the variances and covariances of $A$, $B$ and $C$. Even without the exponent, say $Z = A B C +C$ it would be tough to express $Var(Z)$ as requested. – wolfies Feb 21 '18 at 16:10
• @wolfies I agree to your first point. Concerning your second and third: I modified the question such that also estimates of A, B and C are available, which will also be present in the final solution for the variance. Does this address your concerns? – Knarpie Feb 21 '18 at 16:41