Calculating variance of $\beta$ for a Wald Test I am getting stuck on what seems to be quite a simple issue but I cannot move forward.  Here's the problem in a nutshell.  I have two treatments A and B, where treatment A has responses 8,7,6,6,3,4,7,2,3,4, and treatment B has responses 9,9,8,14,8,13,11,5,7,6.  We treat the counts as independent Poisson variates with means $\lambda_A$ and $\lambda_B$.  
I calculated the means as $\lambda_A=5$.  And $\lambda_B=9$.  I then fit the model $log(\lambda)=a+bx$, where $x=0$ if treatment A is used and $x=1$ if treatment B is used.  Then I calculate the model to be 
$$log(\lambda)=1.6094+0.5878x$$
Now I want to test the Hypothesis $H_0:\lambda_A=\lambda_B$ with a Wald test using $H_0:b=0$.  Then I want to find the statistic for the Wald test which is
$$\frac{(\widehat{b})^2}{var(\widehat{b})}$$
I know that $\widehat{b}=0.588$ here.  However, I am having trouble with the variance.  I know that it is equal to the inverse of $X^TWX$, but I am having issues calculating this.  Any help or hints would be greatly appreciated. Thank you in advance.
 A: I do not fully understand the rationale for your test, but it seems to
be an asymptotic test with two samples of only ten observations each.
However, the two groups are quite different, so that it seems any 
reasonable test would reject.
I ran a (simulated) permutation test using differences in means as the metric.
And got a P-value less than 0.001 against the two sided alternative.
This test permutes the 20 observations and finds the difference between
the first and last ten of the permuted values. With 10,000 permutations,
the P-value should be accurate. R code is as follows:
a = c(8,7,6,6,3,4,7,2,3,4)
b = c(9,9,8,14,8,13,11,5,7,6)
all = c(a,b)
m = 10^4;  d.perm = numeric(m)
for(i in 1:m) {
  perm = sample(all, 20)
  d.perm[i] = mean(perm[1:10]) - mean(perm[11:20]) }
d.obs = mean(b) - mean(a)
mean(abs(d.perm) > abs(d.obs))
## 0.001   # P-value, first run
## 9e-04   # second run.

In the histogram of the permutation distribution below, the P-value
is represented by the area outside the vertical red lines.

Notes: (1) In the Wald test with which I am familiar, the test statistic
(assumed approximately normal) is
$$Z = \frac{\hat \lambda_A - \hat \lambda_B}{\sqrt{\hat \lambda_A/n_1 + \hat \lambda_B/n_2}} = \frac{4}{\sqrt{14/10}} = 3.38,$$
where rejection would be for $|Z| > 1.96.$ For your data the P-value
is about 0.0007, which is roughly comparable to results from the
permutation test.
(2) Also assuming normality of the data, a Welch two-sample t test has T = 3.55 and P-value 0.0026.
(3) Maybe someone at our sister site Cross-validated can give a direct
answer for your version of the Wald test.
