# Simulation of a distribution

Hi all – and Merry Christmas to all of you,

I have a question just in front of the turn of the year. Background: I have two independent variables X and Y. The first two moments are as follows: Average of X is = a and standard deviation is st.dev X = b. The average of Y is = c and st.dev Y = d. Let’s say the variables are normally distributed. Problem: I’m interested in distribution of the product “Z” of the variables, i.e. the distribution of Z = XY. What is the average and the st.dev of Z and how can we visualize it? Question: How can Shazam be applied in a Monte Carlo/bootstrapping – simulation of the distribution of Z? Is it possible to write a Shazam script that selects one number for X and Y from a sample size of for example 200 (optional). Then multiply the selected numbers XY = Z, and Shazam repeats the selection and multiplication for example 1000 times (optional). Calculate the first two moments of Z (average and variance (st.dev)). Then plot (graph) the frequency distribution of the 1000 numbers of Z (Z measured on the horizontal axis and frequency on the vertical axis).

Great if anyone could help writing a Shazam-script which solves the problem.

Regards, P

edit retag close merge delete