Programming the statistical procedures from SAS

Simulation Question

Posts: 0

Simulation Question

Suppose a one unit line is divided randomly in two pieces. How can I use simulation to find E(the short piece divided by the long piece)?

Thank You!
Super Contributor
Posts: 281

Re: Simulation Question

You can't find E(the short piece divided by the long piece) via simulation, if I am understanding you properly, that E is Expected value.

You can find the mean of the randomly generated numbers.
Respected Advisor
Posts: 2,655

Re: Simulation Question

I love "A-ha" moments. I prepared the following, and thought it a neat approach, but then the "A-ha" occurred shortly before posting. I offer the following in quotes, and give the "A-ha" afterwards.

"I'm curious as to why you can't find this. If X is a random value from the univariate distribution on [0,1] and Y is 1-X, then I would think that the formula (via a Taylor's series expansion) could be applied:

E(X/Y) = E(X)/E(Y) * [1 + (V(Y)/(E(Y)^2) - (cov(X,Y)/E(X)*E(Y))]

where E(a) is the expected value of a, V(a) is the variance of a, and cov(a,b) is the covariance between a and b. By using the sample values for each run of the simulation, approximate values of E(X/Y) could be calculated, and then averaged across all runs. It seems like a perfect bootstrap opportunity. I must be missing something here."

Well, I missed a key something. The OP wants the short divided by the long. Consequently, X and Y as I tried to define them do not meet this definition. Sometimes X>Y, sometimes Y>X, so they do NOT define the short and the long pieces. I suppose that if you think about this hard enough, you see that the ratio would follow some kind of Cauchy distribution, implying that the expectation doesn't exist. One could simulate as much as you want, but the thing you end up calculating? I don't know what to call it.


Steve Denham
Super Contributor
Posts: 281

Re: Simulation Question


I agree with your comments.

My point is that E(X), E(Y), etc. etc. are quantities that cannot be computed via simulation. E(X), E(Y) and the other moments are integrals, and SAS doesn't do integrals. You cannot evaluate integrals via simulation. You can however obtain an ESTIMATE of E(X), or E(Y), or E(the short piece divided by the long piece) via simulation.
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation