title: MLE bootstrap on poisson distribution
body: <p>I have the following <code>Poisson</code> distribution:</p>
  
  <pre><code>Data
  3 5 3 1 2 1 2 1 0 2 4 3 1 4 1 2 2 0 4 2 2 4 0 2 1 0 5 2 0 1 
  2 1 3 0 2 1 1 2 2 0 3 2 1 1 2 2 5 0 4 3 1 2 3 0 0 0 2 1 2 2 
  3 2 4 4 2 1 4 3 2 0 3 1 2 1 3 2 6 0 3 5 1 3 0 1 2 0 1 0 0 1 
  1 0 3 1 2 3 3 3 2 1 1 2 3 0 0 1 5 1 1 3 1 2 2 1 0 3 1 0 1 1
  </code></pre>
  
  <p>I used the following code to find the MLE &Theta;&#x0302; </p>
  
  <pre><code>lik&lt;-function(lam) prod(dpois(data,lambda=lam)) #likelihood function
  nlik&lt;- function(lam) -lik(lam) #negative-likelihood function
  optim(par=1, nlik) 
  </code></pre>
  
  <p>What I want to do is create a bootstrap confidence interval to test the null hypothesis that &Theta; = 1 at level 0.05 and find the p-value using the numerical optimization that I used above. 
  I thought it would be something along the lines of this</p>
  
  <pre><code>n&lt;-length(data)
  nboot&lt;-1000
  boot.xbar &lt;- rep(NA, nboot)
  for (i in 1:nboot) {
  data.star &lt;- data[sample(1:n,replace=TRUE)]
  boot.xbar[i]&lt;-mean(data.star)
  }
  quantile(boot.xbar,c(0.025,0.975))
  </code></pre>
  
  <p>But I don't think this utilizes the optimization, and I am not sure how to get the p-value. </p>