# _meta.shrinkage_: An R Package for Meta-Analyses for Simultaneously Estimating Individual Means
## 2 Background
### Improved Estimation of Individual Means  
Meta-analyses often display individual estimates \((y_{1},\ldots,y_{G})\) along with their 95% confidence intervals (CIs): \((y_{1},\ldots,y_{G})\pm 1.96\times(\sigma_{1},\ldots,\sigma_{G})\). Similarly, the funnel plot shows \((y_{1},\ldots,y_{G})\) against \((\sigma_{1},\ldots,\sigma_{G})\) (see [1; 5; 23; 24] for these plots). These meta-analyses are possible without the assumptions of the fixed effect or random effect models. Therefore, looking at the individual estimates \((y_{1},\ldots,y_{G})\) is a part of meta-analysis.  
[PERSON] et al. [20] pointed out the need for improving the individual estimates by shrinkage estimation methods [11; 12; 25; 26]. They first regard \(\mathbf{Y}\equiv(Y_{1},\ldots,Y_{G})\) as an estimator of \(\mathbf{\mu}\equiv(\mu_{1},\ldots,\mu_{G})\). Then, they consider an estimator \(\delta(\mathbf{Y})\equiv(\delta_{1}(\mathbf{Y}),\ldots,\delta_{G}(\mathbf{Y}))\) that _improves_ upon \(\mathbf{Y}\) in terms of the weighted mean square error (WMSE) criteria:  
\[E\left[\sum_{i=1}^{G}\frac{(\delta_{i}(\mathbf{Y})-\mu_{i})^{2}}{ \sigma_{i}^{2}}\right]<E\left[\sum_{i=1}^{G}\frac{(Y_{i}-\mu_{i})^{2}}{\sigma _{i}^{2}}\right]=G,\quad\exists(\mu_{1},\ldots,\mu_{G}), \tag{1}\] \[E\left[\sum_{i=1}^{G}\frac{(\delta_{i}(\mathbf{Y})-\mu_{i})^{2}}{ \sigma_{i}^{2}}\right]\leq E\left[\sum_{i=1}^{G}\frac{(Y_{i}-\mu_{i})^{2}}{ \sigma_{i}^{2}}\right]=G,\quad\forall(\mu_{1},\ldots,\mu_{G}). \tag{2}\]  
The above \(\delta(\mathbf{Y})\) is called an _improved estimator_ of \(\mathbf{Y}\). If \"\(\forall(\mu_{1},\ldots,\mu_{G})\)\" in Equation (2) holds only for a restricted parameter space, \(\delta(\mathbf{Y})\) is _locally_ improved. Two locally improved estimators are relevant in this article. The first one is under ordered means, where the param eter space is restricted to \(\mu_{1}\leq\mu_{2}\leq\ldots\leq\mu_{G}\). The second one is under the sparse normal means ([PERSON] and [PERSON], 2017), where many \(\mu_{i}\) values are zero (e.g., \((\mu_{1},\ldots,\mu_{10})=(-1,0,0,0,0,0,0,0,1)\)).  
The inverse variance weights in Equation (1) and (2) make it convenient to apply the classical decision theory ([PERSON] et al., 2018). Consequently, [PERSON] et al. (2018) were able to theoretically verify the (local) improvement of their estimators upon \(Y\) in terms of the WMSE. In practice, one may also be interested in the total MSE (TMSE) criterion, defined as \(E\Big{[}\sum_{i=1}^{G}(\delta_{i}(\boldsymbol{Y})-\mu_{i})^{2}\Big{]}\)(Kal  
It was proven that \(\delta^{\text{JS}}\) has a smaller WMSE than Y when \(G\geq 3\)[20]. That is, Equations (1) and (2) hold. Thus, \(\delta^{\text{JS}}\) is an improve estimator without any restriction.  
The _positive-part [S estimator can further reduce the WMSE by avoiding the overshrinkage phenomenon of \((G-2)/(\sum_{i=1}^{G}Y_{i}^{2}/\sigma_{i}^{2})>1\)_:  
\[\delta^{\text{JS+}}\equiv\left(\delta_{1}^{\text{JS+}},\ldots,\delta_{G}^{ \text{JS+}}\right)\ \equiv\left(1-\frac{G-2}{\sum_{i=1}^{G}Y_{i}^{2}/\sigma_{i}^{2}} \right)^{+}\!\!Y,\]  
where \((.)^{+}\equiv\max(0,.)\).  
In our R package, the function \"js(.)\" can compute \(\delta^{\text{JS}}\) and \(\delta^{\text{JS+}}\).  
Below is the usage in the R console.  
\begin{tabular}{l l} \hline \(>\) & js(y,s) \\  & JS & JS\_plus \\
1 & -0.10111662 & -0.10111662 \\
2 & -0.39904400 & -0.39904400 \\
3 & -0.26784971 & -0.26784971 \\
4 & -0.13230971 & -0.13230971 \\
5 & -0.07303235 & -0.07303235 \\
6 & -0.15034968 & -0.15034968 \\
7 & -0.32396855 & -0.32396855 \\
8 & -0.07713511 & -0.07713511 \\
9 & -0.05543965 & -0.05543965 \\
10 & -0.17196783 & -0.17196783 \\
11 & -0.02732777 & -0.02732777 \\
12 & -0.06452314 & -0.06452314 \\
13 & -0.07202737 & -0.07202737 \\
14 & 0.02424656 & 0.02424656 \\ \hline \end{tabular}  
The values in the JS column are the shrunken values of y. The values are equivalent between the columns of JS and JS_plus because there is no overshrinkage.