Question

Simulate n values of an exponential random variable X with parameter λ (of your choice), and compute the sample mean i, sampl

0 0
Add a comment Improve this question Transcribed image text
Answer #1

0 200 600 800 1000

oo po 3 000,0% 0a0 000 9 0 99-0 09-0 9PO OPO SCO OCO SCO 020 sue-pew eldwea

O o O o ふ。。 o O 0 200 400 600 800 1000

Here we take, X 2 rA exp (-rA) dr 0 : Var(X) = E(X2)-E2(X) SD(X) CDF of X is Fr(z) = P(X < x) = 1-e- log 2 Here we take, λ 2

#Lambda=2(population mean=1/2)
n=100
t=1000
x=matrix(0,nrow=t,ncol=n)
m1=1:t*0 # sample mean
m=1:t*0 # sample median
s=1:t*0 # sample sd
for(i in 1:t)
{
x[i,]=rexp(n,rate=2)
m1[i]=mean(x[i,])
m[i]=median(x[i,])
s[i]=sd(x[i,])
}
plot(m1,lwd=2,type="p",xlab="",ylab="sample means")
abline(h=0.5,lwd=2,col=2)
plot(m,lwd=2,type="p",xlab="",ylab="sample medians")
abline(h=0.35,lwd=2,col=2)
plot(s,lwd=2,type="p",xlab="",ylab="sample sds")
abline(h=0.5,lwd=2,col=2)
round(mean(m1),4)
round(mean(m),4)
round(mean(s),4)

Outputs:

> round(mean(m1),4)
[1] 0.5005
> round(mean(m),4)
[1] 0.3506
> round(mean(s),4)
[1] 0.4943

Add a comment
Know the answer?
Add Answer to:
Simulate n values of an exponential random variable X with parameter λ (of your choice), and comp...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT