I have a model that uses $n$ independent random variables $X_1,..., X_n$. I know the density function of each random variable.

I would like to calculate statistics such as $E(\sqrt{X_1+...+X_n})$ or $Var(X_1 \cdot...\cdot X_n)$.

Is there a computer tool to do it easily rather than finding by myself the correct integrals and use an integral solver?


closed as off-topic by kjetil b halvorsen, Michael Chernick, mkt, gung Jan 29 at 15:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – gung
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ I doubt that a general tool is available - outside some fairly special cases, closed-from results are often not available. Depending on the accuracy and explicitness you need, you could sample from the $X_i$ given that you know their density, and then simulate the moments of interest. $\endgroup$ – Christoph Hanck Nov 30 '18 at 9:14
  • $\begingroup$ @ChristophHanck. Thanks. I'm not interested in a closed form, but in a tool that knows how to "transform" these moments to their integral form, and then approximate this integral. $\endgroup$ – Roy Nov 30 '18 at 9:20
  • 1
    $\begingroup$ Something like reference.wolfram.com/language/ref/Integrate.html might help. I am still curious how explicit the answers will be in general. Also, for your above examples you would in any case need the joint distribution of the $X_i$ unless they are independent. $\endgroup$ – Christoph Hanck Nov 30 '18 at 10:19
  • 1
    $\begingroup$ A solution has been posted on statsSE to the question of the variance of a product of $n$ independent random variables: see stats.stackexchange.com/questions/52646/… ... Difficult to answer otherwise, unless your question is more specific. $\endgroup$ – wolfies Nov 30 '18 at 16:26
  • 2
    $\begingroup$ @Wolfies You are the developer of what is arguably the closest thing anyone can find to what is being requested :-). $\endgroup$ – whuber Nov 30 '18 at 21:20