# Homework Help: Weak Law of Large Numbers

1. Jan 29, 2013

### Artusartos

1. The problem statement, all variables and given/known data
Recall that $log 2 = \int_0^1 1/(x+1) dx$. Hence, by using a uniform(0,1) generator, apprximate log 2. Obtain an error of estimation in terms of a large sample 95% confidence interval. If you have access to the statistical package R, write an R function for the estimate and the error of estimation. Obtain your estimate for 10,000 simulations and compare it to the true value.

2. Relevant equations

3. The attempt at a solution

$$\int_0^1 1/(x+1) dx = (1-0)\int_0^1 1/(x+1) dx/(1-0) = \int_0^1 1/(x+1) f(x) dx = E(1/(x+1))$$

Where f(x)=1, 0<x<1

And then I calculated log 2 from the calculator and got 0.6931471806

From R, I got 0.6920717

So, from the weak law of large numbers, we can see that the sample mean is approaching the actual mean as n gets larger.

My Question:

Is my answer correct? Can I use the calculator to approximate log 2? If I shouldn't be using it...the problem that I'm having is if I try to compute the expected value, I get log 2. So it doesn't help much. Can anybody give me a hint if my answer is wrong? By the way, I know I didn't compute the confidence interval yet...but I'm just asking if this portion of the problem is correct.

Last edited: Jan 29, 2013
2. Jan 29, 2013

### haruspex

I'm not certain I understand what you're being asked to do. What is "an error of estimation"? Should that be "an estimate of error"? Reading what you've actually done doesn't make it any clearer.
I think the question is asking you to:
1. Figure out how to generate random variable with an expected value of log2 from one that's uniform in (0,1). You've done that.
2. Obtain an approximate value for log2 by averaging many samples of this r.v. Did you do that? You mention "approximating" log 2 by using a calculator, which I would have thought was far more accurate than they intend.
3. Given the size of the sample, estimate the 95% confidence interval for the value approximated by sampling. I see no attempt to do that.

3. Jan 29, 2013

### Artusartos

Yes, I didn't do 3 yet. I want to know if I did 2 correctly. I used R to see what the mean would be for a sample size of 10,000. I then compared that with what I got from the calculator. Do you think that's right?

4. Jan 29, 2013

### haruspex

Not sure how you're numbering sections. You appear to have done the last part, "Obtain your estimate for 10,000 simulations and compare it to the true value", and that's fine. It's not clear to me what they want you to write down to demonstrate that you compared them.

5. Jan 29, 2013

### Artusartos

I'm numbering them according to the numbering that you gave in your first post.

6. Jan 29, 2013

### haruspex

Ah yes - sorry.
Then yes, what you have done for 1 and 2 looks fine, but none of that involved checking with a calculator. That's the last part of the OP, which I did not get as far as assigning a number to.

7. Jan 29, 2013

### Artusartos

By the way, what does "OP" mean?

8. Jan 29, 2013

### haruspex

Original Post (i.e. the start of the thread)

9. Jan 29, 2013

Ok thanks :)