In: Statistics and Probability
lambda=c(.5,1,10);n=50;nboot=100
est=matrix(0,nboot,2)
for(i in 1:3)
{
x=NULL;y=NULL;z=NULL
x=rpois(n,lambda[i])
l1=mean(x)
l2=log(n/length(x[x==0]))
y = rpois(n*nboot, l1);z=rpois(n*nboot, l2)
bootstrapsample1 = matrix(y, nrow=nboot, ncol=n)
bootstrapsample2 = matrix(z, nrow=nboot, ncol=n)
for(j in 1:nboot)
{
est[j,1]=mean(bootstrapsample1[j,])
est[j,2]=log(length(bootstrapsample1[j,][bootstrapsample1[j,]>0]))
}
}