Pesaran's CCEP estimator in eviews I intend to use Pesaran's (2006) common correlated effects pooled (CCEP) estimator. However, I'm not yet very familiar with advanced econometrics and advanced use of eviews. More specifically I want to estimate this model:
\begin{equation} 
y_{it} = \alpha_{i} + \beta_{1}x_{1,it} + \beta_{2}x_{2,it}+\gamma_{i}F_{t}+\epsilon_{it}
\end{equation} 
in which $F_{t}$ is an unobserved common factor and $\gamma_{i}$ is a country-specific factor loading. We were taught that $F_{t}$ can be proxied by:
\begin{equation}
F_{t}=\frac{(\bar{y_{t}}-\bar{\alpha}-\beta_{1} \bar{x}_{{1,t}} -\beta_{2} \bar{x}_{{2,t}}-\bar{\epsilon}_{{t}})}{\bar{\gamma}},
\end{equation}
in which $\bar{y_{t}} = \frac{1}{N}\sum_{i=1}^{N} y_{it}$, and $\bar{\gamma_{}}=\frac{1}{N}\sum_{i=1}^{N} \gamma_{i}$, with $N$ the number of cross-sections.

Substituting the second equation into the first yields: 
\begin{equation}
y_{it} = \alpha_{i}-\frac{\gamma_{i}}{\bar{\gamma}}+\beta_{1} x_{1,it} +\beta_{2} x_{2,it} +\frac{\gamma_{i}}{\bar{\gamma}}\bar{y_{t}} - \beta_{1} \frac{\gamma_{i}}{\bar{\gamma}} \bar{x}_{1,t} -\beta_{2}\frac{\gamma_{i}}{\bar{\gamma}}\bar{x}_{2,t}+\epsilon_{it}-\frac{\gamma_{i}}{\bar{\gamma}}\bar{\epsilon_{t}}
\end{equation}
or with $\alpha_{i}-\frac{\gamma_{i}}{\bar{\gamma}}=\alpha'_{i}$ and $\frac{\gamma_{i}}{\bar{\gamma}}=\gamma'_{i}$:
\begin{equation}
y_{it} = \alpha'_{i}
+\beta_{1} x_{1,it} 
+\beta_{2} x_{2,it} 
+\gamma'_{i}\bar{y_{t}} 
- \beta_{1} \gamma'_{i} \bar{x}_{1,t}
-\beta_{2}\gamma'_{i}\bar{x}_{2,t}
+\epsilon_{it}-\gamma'_{i}\bar{\epsilon_{t}}.
\end{equation}

To estimate this in eviews, I had the following idea

The cross-sectional averages $\bar{y_{t}}$, $\bar{x}_{{1,t}}$, and $\bar{x}_{{2,t}}$ can be easily calculated from the dataset. I would use cross-sectional fixed effects to estimate all $\alpha'_{i}$. Next, I would need $N$ terms to estimate all $N$ $\gamma'_{i}$. To do this, I would include these $N$ terms: $\gamma'_{A}\bar{y}_{t}dum_{A} + \gamma'_{B}\bar{y}_{t}dum_{B} + ... + \gamma'_{N}\bar{y}_{t}dum_{N}$, in which each capital letter denotes one of the $N$ cross-sections and the dummy variable takes the value of $1$ once for each cross-section. Then, for each averaged explanatory  variable, $\bar{x}_{1t}$ and $\bar{x}_{2t}$, I would include these $2 \times N$ terms: $\beta_{1}\gamma'_{A}\bar{x}_{1,t} + \beta_{1}\gamma'_{B}\bar{x}_{1,t}+ ... + \beta_{1}\gamma'_{N}\bar{x}_{1,t}$ and $\beta_{2}\gamma'_{A}\bar{x}_{2,t} + \beta_{2}\gamma'_{B}\bar{x}_{2,t}+ ... + \beta_{2}\gamma'_{N}\bar{x}_{2,t}$.

So, to sum up, my suggested input for eviews (to estimate with cross-sectional fixed effects) is the following:
y = c(1)*x1 + c(2)*x2 + c(3)*y_avg*dumA + c(4)*y_avg*dumB + c(5)*y_avg*dumC + ... + c(1)*c(3)*x1_avg + c(1)*c(4)*x1_avg + c(1)*c(5)*x1_avg + ... + c(2)*c(3)*x2_avg + c(2)*c(4)*x2_avg + c(2)*c(5)*x2_avg + .....

In this equation:


c(1) = $\beta_{1}$;
c(2) = $\beta_{2}$;
c(3) = $\gamma'_{A}$;
c(4) = $\gamma'_{B}$;
c(5) = $\gamma'_{C}$.


These are my questions regarding this estimation:


First of all, confirmation of the correctness of my derivation would be welcome;
Would the estimation in eviews I suggest do the trick?
If so, should I include an intercept in the fixed-effects estimation?
If not, is there an alternative procedure to implement the CCEP estimator in eviews?
The estimated error terms should be $\epsilon-\gamma'_{i}\bar{\epsilon}$, is this structure automatically obtained? Or should this be imposed one way or another?
The same question for $\alpha'_{i}$: it should equal $\alpha_{i}-\frac{\gamma_{i}}{\bar{\gamma}}$. Should this condition be imposed, or is it automatically fulfilled when inputting my suggested input in eviews;
Other suggestions regarding the use of CCEP estimator in eviews are certainly welcome.


Any help, also partial answers, is appreciated!
The technique described in the question is almost correct. Consider a panel data set consisting of three cross-sections ($a$, $b$, and $c$) and three time-periods ($1$, $2$, and $3$). Let y denote the column vector with the observations of the dependent variable, x the column vector with observations of the first explanatory variable, and z the column vector with observations of the second explanatory variable. They take these forms respectively:

$\textbf{y} = 
\begin{bmatrix} y_{a1} \\ y_{a2} \\ y_{a3} \\  y_{b1} \\ y_{b2} \\ y_{b3} \\ y_{c1} \\ y_{c2} \\ y_{c3} \end{bmatrix}$
; $\textbf{x} = \begin{bmatrix} x_{a1} \\ x_{a2} \\ x_{a3} \\  x_{b1} \\ x_{b2} \\ x_{b3} \\ x_{c1} \\ x_{c2} \\ x_{c3} \end{bmatrix}$;  $\textbf{z} = \begin{bmatrix} z_{a1} \\ z_{a2} \\ z_{a3} \\  z_{b1} \\ z_{b2} \\ z_{b3} \\ z_{c1} \\ z_{c2} \\ z_{c3} \end{bmatrix}$.

Let $\bar{y}_{i} = \frac{1}{3}(y_{ai} + y_{bi}+y_{ci})$, with $i = 1, 2, 3$, and equivalently for $x$ and $z$: $\bar{x}_{i} = \frac{1}{3}(x_{ai} + x_{bi}+x_{ci})$ and  $\bar{z}_{i} = \frac{1}{3}(z_{ai} + z_{bi}+z_{ci})$, both for  $i = 1, 2, 3$.

This is the correct way to get the CCEP estimator allowing for one common factor, as in the model described in the question:
\begin{equation*}
\begin{split}
\begin{bmatrix} y_{a1} \\ y_{a2} \\ y_{a3} \\  y_{b1} \\ y_{b2} \\ y_{b3} \\ y_{c1} \\ y_{c2} \\ y_{c3} \end{bmatrix} = \beta_{1} \begin{bmatrix} x_{a1} \\ x_{a2} \\ x_{a3} \\  x_{b1} \\ x_{b2} \\ x_{b3} \\ x_{c1} \\ x_{c2} \\ x_{c3} \end{bmatrix}+\beta_{2}\begin{bmatrix} z_{a1} \\ z_{a2} \\ z_{a3} \\  z_{b1} \\ z_{b2} \\ z_{b3} \\ z_{c1} \\ z_{c2} \\ z_{c3} \end{bmatrix}+
\gamma_{a} \begin{bmatrix} \bar{y}_{1} \\ \bar{y}_{2} \\ \bar{y}_{3} \\  0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}
+\gamma_{b} \begin{bmatrix}  0 \\ 0 \\ 0 \\ \bar{y}_{1} \\ \bar{y}_{2} \\ \bar{y}_{3} \\  0 \\ 0 \\ 0 \end{bmatrix} + 
\gamma_{c}  \begin{bmatrix}  0 \\ 0 \\ 0 \\  0 \\ 0 \\ 0 \\ \bar{y}_{1} \\ \bar{y}_{2} \\ \bar{y}_{3}  \end{bmatrix} \\
- \beta_{1}\gamma_{a} \begin{bmatrix} \bar{x}_{1} \\ \bar{x}_{2} \\ \bar{x}_{3} \\  0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}
- \beta_{1}\gamma_{b}  \begin{bmatrix}  0 \\ 0 \\ 0 \\ \bar{x}_{1} \\ \bar{x}_{2} \\ \bar{x}_{3} \\  0 \\ 0 \\ 0 \end{bmatrix}
-\beta_{1} \gamma_{c} \begin{bmatrix}  0 \\ 0 \\ 0 \\  0 \\ 0 \\ 0 \\ \bar{x}_{1} \\ \bar{x}_{2} \\ \bar{x}_{3}  \end{bmatrix}
-\beta_{2} \gamma_{a}  \begin{bmatrix} \bar{z}_{1} \\ \bar{z}_{2} \\ \bar{z}_{3} \\  0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}
-\beta_{2} \gamma_{b} \begin{bmatrix}  0 \\ 0 \\ 0 \\ \bar{z}_{1} \\ \bar{z}_{2} \\ \bar{z}_{3} \\  0 \\ 0 \\ 0 \end{bmatrix}
-\beta_{2} \gamma_{c} \begin{bmatrix}  0 \\ 0 \\ 0 \\  0 \\ 0 \\ 0 \\ \bar{z}_{1} \\ \bar{z}_{2} \\ \bar{z}_{3}  \end{bmatrix} \\
+ \phi_{a} + \phi_{b} + \phi_{c} + \mu_{it}
\end{split}
\end{equation*}
Here, $\phi_{a},\ \phi_{b},$ and  $\phi_{c}$ are cross-sectional fixed effects and $\mu_{it}$ a well-behaved error-term that does not require any restrictions. 

An interesting remark is that if the six $\beta$s that appear together with the $\gamma$s are not restricted to be equal to each other and equal to the first two $\beta$s,   more than one common factor is allowed.