- #1
Jameson
Gold Member
MHB
- 4,541
- 13
I am trying to use a generated random sample in R to estimate the mean and variance for a Poisson random variable. The first one is a Poisson random variable with mean 5.
To estimate the above I generate a random sample in R with the following code:
Given the above I want to find $E[\sqrt{X}]$. Easy enough. To estimate the expected value of the square of X, I can take the square root of the sample and divide by 100.
The above comes out to be 2.292802 and $\sqrt{5}=2.2346$ so all looks good.
Now I want to estimate the $\text{Var}[\sqrt{X}]$. I can use the following formula to help: $\text{Var}[\sqrt{X}]=E[X]-E[\sqrt{X}]^2$
From the above I get 0.2230577 but to honest, I can't figure out what the ideal value should be. Plugging in $\lambda$ into the variance formula is seems like this should be $\lambda-\sqrt{\lambda}^2=0$.
Any insight as to how to get this value?
To estimate the above I generate a random sample in R with the following code:
Code:
P5 <- rpois(100,5)
Given the above I want to find $E[\sqrt{X}]$. Easy enough. To estimate the expected value of the square of X, I can take the square root of the sample and divide by 100.
Code:
mean(sqrt(P5))
The above comes out to be 2.292802 and $\sqrt{5}=2.2346$ so all looks good.
Now I want to estimate the $\text{Var}[\sqrt{X}]$. I can use the following formula to help: $\text{Var}[\sqrt{X}]=E[X]-E[\sqrt{X}]^2$
Code:
sum((P5))/100-(sum(sqrt(P5))/100)^2
From the above I get 0.2230577 but to honest, I can't figure out what the ideal value should be. Plugging in $\lambda$ into the variance formula is seems like this should be $\lambda-\sqrt{\lambda}^2=0$.
Any insight as to how to get this value?