Help replicating a results from a Bayes paper in R I am interested in reproducing consumer intent results found in An Introduction to Empirical Bayes by Casella.
I have made it as far as calculating beta priors, but got stuck there. 
This is what I have so far
>customer_intent_ungrouped <- tibble(intent = c(rep(0,293),rep(.1,26),rep(.2,21),rep(.3,21),rep(.4,10),rep(.5,9), rep(.6,12),rep(.7,13), rep(.8,11),rep(.9,10),rep(1.0,21)))

>customer_intent <-  customer_intent_ungrouped %>% count(intent)

>customer_intent$level <- cut(customer_intent$intent, breaks = c(0,.1,.4,.7,1,Inf), right = F, labels = c('none', 'low','med', 'high','very_high'))
>customer_intent_totals <- customer_intent  %>% group_by(level) %>% mutate(group_totals = sum(n)) 

The resulting data looks like this
>customer_intent_totals 

   intent     n     level group_totals
    <dbl> <int>    <fctr>        <int>
 1    0.0   293      none          293
 2    0.1    26       low           68
 3    0.2    21       low           68
 4    0.3    21       low           68
 5    0.4    10       med           31
 6    0.5     9       med           31
 7    0.6    12       med           31
 8    0.7    13      high           34
 9    0.8    11      high           34
10    0.9    10      high           34
11    1.0    21 very_high           21

I believe, and this is where I could be wrong, that this is the data that is used to get estimated alpha and beta terms for a beta distribution. I get those terms using ebbr with the following code.
customer_intent_totals %>% ebbr::ebb_fit_prior(x=n,n=group_totals)

The problem is that the paper, in figure 5, reports an alpha=.25 and beta=.43. My results are alpha=0.84 and beta = 0.65. This leads to very different results. 
In the end I am trying to get the same empirical Bayes estimates, in R, the author is getting, which are 
intent_group   emp_bayes
0               0.07
.1-.3           .18
.4-.6           .36
.7-.9           .54
1               .67

 A: Well found +1. This is quite a rough problem due to the confusing statements in the referenced works. 
The article from Casella
To me it seems that the article from Casella contains an error in using the $\alpha = 0.25$ and $\beta = 0.43$. 
It should already be clear, from a sanity check, that $\frac{0.25}{0.25+0.43}$ is in no way resulting in the 0.172 value for the mean $\bar{l_s}$ 
(also, if you fill in these values for $\alpha$ and $\beta$ into equation (4.4), then you do not get to the result of equation (4.6)). 
It is unclear to me what they did there, to get these results, but a mistake in the algebra seems easy.
Expression for $\alpha$ and $\beta$
If we take their equation (4.5) 
$$E(I_i^S) = \frac{\alpha}{\alpha+\beta} \\
var(I_i^S) = \frac{1}{10} \left( \frac{\alpha}{\alpha+\beta} \right) \left(1 - \frac{\alpha}{\alpha+\beta}  \right) \left( \frac{\alpha + \beta + 10}{\alpha + \beta + 1}\right)$$
(Where we note that these are the moments for $I_i^S \sim \frac{1}{10}  binomial(10,I_i^T)$ and not as stated in their equation (4.2) $I_i^S \sim   binomial(10,I_i^T)$. This is a detail, yet important nuance, which they treat by a "this can, of course, be handled easily, and we will not go into such detail here.")
we can write, using simplifications $\mu = E(I_i^S)$ and $vr = var(I_i^S)$, the following:
$$\alpha = \frac{(\mu(1-\mu)-vr)\mu}{vr-\frac{1}{10}\mu(1-\mu)} \\
\beta = \alpha \frac{1-\mu}{\mu} $$
(many other forms of this exist, the point is that the expression is now expressing $\alpha$ and $\beta$ as functions of $\mu$ and $vr$ )
And we get with mean 0.172 and variance 0.091 the following:
$$\alpha = 0.11 \quad, \qquad \beta=0.55$$
filling these into the (4.4) gives an expression that is very close equation (4.6)
$$\hat{I}_i^S = (.401)(.172) + (.599) I_i^S $$
(The contrast with the equation (4.6) is the terms $.401$ and $.599$ instead of $.405$ and $.595$. We would get these terms exactly for $\alpha=.25$ and $\beta=.43$, but then the $.172$ term is completely wrong )
So this result is again the same, and it may seem that Casella, did not see reason to re-check the equations because the result was still good (yet missing the striking error in the expression $\mu \neq \frac{0.25}{0.25+0.43}$).
The use of ebbr
There are some problems in your expressions. I actually do not get so much what you are trying to do. The following is an expression that works (using the method of moments, which is also done above and in the article by Casella):
> # number of successes (multiplying the intent data by 10)
> x <- c(rep(0,293),
       rep(1,26),
       rep(2,21),
       rep(3,21),
       rep(4,10),
       rep(5,9),
       rep(6,12),
       rep(7,13),
       rep(8,11),
       rep(9,10),
       rep(10,21))

> # total number of trials (n = 10 for every person according to the Morrison 1979 model)
> n <- rep(10,447)

> # table
> tab <-tibble(x=x,n=n)

> # beta-model (note this not really doing a beta-binomial distribution)
> tab %>% ebbr::ebb_fit_prior(x=intent,n=n,method = "mm")
Empirical Bayes binomial fit with method mm 
Parameters:
# A tibble: 1 x 2
       alpha      beta
       <dbl>     <dbl>
1 0.09694816 0.4680561

Note that there is a discrepancy. This is because the ebbr function is not really doing a beta-binomial distribution. What it is doing under the hood is calculating the probabilities in each single binomial experiment $p=x/n$ and doing calculations on those values $p$, using $\mu(p)$ and $var(p)$, instead of $\mu(x)$ and $var(x)$. This results in:
$$\alpha = \frac{(\mu(1-\mu)-vr)\mu}{vr} \\
\beta = \alpha \frac{1-\mu}{\mu} $$
The difference with earlier expressions is that the variance in the data, due to the binomial distribution is not taken into account (this is not a very correct practice). The variance of the beta-binomial distribution has an extra term $n(\alpha + \beta + n)$ that is only accounted for in the 'ebbr' package by approximating with $n^2$ (using a simple division by n for all the x values).
Another note
The article from Casella seems to be very brief in explaining how they obtain equation (4.4)  which looks like equation (2.7), but the relation is not explained and remains rather vague.
