# Dynamic unobserved effects model

A dynamic unobserved effects model is a statistical model used in econometrics for panel analysis. It is characterized by the influence of previous values of the dependent variable on its present value, and by the presence of unobservable explanatory variables.
The term “dynamic” here means the dependence of the dependent variable on its past history; this is usually used to model the “state dependence” in economics. For instance, for a person who cannot find a job this year, it will be harder to find a job next year because her present lack of a job will be a negative signal for the potential employers. “Unobserved effects” means that one or some of the explanatory variables are unobservable: for example, consumption choice of one flavor of ice cream over another is a function of personal preference, but preference is unobservable.

## Censored dependent variable

In a panel data tobit model, if the outcome $Y_{i,t}$ partially depends on the previous outcome history $Y_{i,0},\ldots ,Y_{t-1}$ this tobit model is called "dynamic". For instance, taking a person who finds a job with a high salary this year, it will be easier for her to find a job with a high salary next year because the fact that she has a high-wage job this year will be a very positive signal for the potential employers. The essence of this type of dynamic effect is the state dependence of the outcome. The "unobservable effects" here refers to the factor which partially determines the outcome of individual but cannot be observed in the data. For instance, the ability of a person is very important in job-hunting, but it is not observable for researchers. A typical dynamic unobserved effects tobit model can be represented as
    $Y_{i,t}=Y_{i,t}^{1}[Y_{i,t}>0];$
    $Y_{i,t}=z_{i,t}\delta +\rho y_{i,t-1}+c_{i}+u_{i,t};$
    $c_{i}\mid y_{i,0},\ldots ,y_{i,t-1}\sim F(y_{i,0}x_{i});$
    $u_{i,t}\mid z_{i,t},y_{i,0},\ldots ,y_{i,t-1}\sim N(0,1).$
In this specific model, $\rho y_{i,t-1}$ is the dynamic effect part and $c_{i}$ is the unobserved effect part whose distribution is determined by the initial outcome of individual i and some exogenous features of individual i.
Based on this setup, the likelihood function conditional on $\{y_{i,0}\}_{i-1}^{N}$ can be given as
    $\prod _{i=1}^{N}\int f_{\theta }(c_{i}\mid y_{i,0},x_{i})\left[\prod _{t=1}^{T}{\Bigl1[y_{i,t}=0][1-\Phi (z_{i,t}\delta +\rho y_{i,t-1}>0]{\frac {\varphi (z_{i,t}\delta +\rho y_{i,t-1}+c_{i})}{\Phi (z_{i,t}\delta +\rho y_{i,t-1}+c_{i})}}{\biggr )}\right]\,dc_{i}$
For the initial values $\{y_{i,0}\}_{i-1}^{N}$, there are two different ways to treat them in the construction of the likelihood function: treating them as constant or imposing a distribution on them and calculate out the unconditional likelihood function. But whichever way is chosen to treat the initial values in the likelihood function, we cannot get rid of the integration inside the likelihood function when estimating the model by maximum likelihood estimation (MLE). Expectation Maximum (EM) algorithm is usually a good solution for this computation issue. Based on the consistent point estimates from MLE, Average Partial Effect (APE) can be calculated correspondingly.

## Binary dependent variable
### Formulation

A typical dynamic unobserved effects model with a binary dependent variable is represented as:
    $P(y_{it}=1\mid y_{i,t-1},\dots ,y_{i,0},z_{i},c_{i})=G(z_{it}\delta +\rho y_{i,t-1}+c_{i})$
where c$_i$ is an unobservable explanatory variable, z$_{it}$ are explanatory variables which are exogenous conditional on the c$_i$, and G(∙) is a cumulative distribution function.

### Estimates of parameters

In this type of model, economists have a special interest in ρ, which is used to characterize the state dependence. For example, y$_{i,t}$ can be a woman's choice whether to work or not, z$_{it}$ includes the i-th individual's age, education level, number of children, and other factors. c$_i$ can be some individual specific characteristic which cannot be observed by economists. It is a reasonable conjecture that one's labor choice in period t should depend on his or her choice in period t − 1 due to habit formation or other reasons. This dependence is characterized by parameter ρ.
There are several MLE-based approaches to estimate δ and ρ consistently. The simplest way is to treat y$_{i,0}$ as non-stochastic and assume c$_i$ is independent with z$_i$. Then by integrating P(y$_{i,t}$ , y$_{i,t-1}$ , … , y$_{i,1}$ | y$_{i,0}$ , z$_i$ , c$_i$) against the density of c$_i$, we can obtain the conditional density P(y$_{i,t}$ , y$_{i,t-1}$ , ... , y$_{i,1}$ |y$_{i,0}$ , z$_i$). The objective function for the conditional MLE can be represented as: $\sum _{i=1}^{N}$ log (P (y$_{i,t}$ , y$_{i,t-1}$, … , y$_{i,1}$ | y$_{i,0}$ , z$_i$)).
Treating y$_{i,0}$ as non-stochastic implicitly assumes the independence of y$_{i,0}$ on z$_i$. But in most cases in reality, y$_{i,0}$ depends on c$_i$ and c$_i$ also depends on z$_i$. An improvement on the approach above is to assume a density of y$_{i,0}$ conditional on (c$_i$, z$_i$) and conditional likelihood P(y$_{i,t}$ , y$_{i,t-1}$ , … , y$_{t,1}$,y$_{i,0}$ | c$_i$, z$_i$) can be obtained. By integrating this likelihood against the density of c$_i$ conditional on z$_i$, we can obtain the conditional density P(y$_{i,t}$ , y$_{i,t-1}$ , … , y$_{i,1}$ , y$_{i,0}$ | z$_i$). The objective function for the conditional MLE is $\sum _{i=1}^{N}$ log (P (y$_{i,t}$ , y$_{i,t-1}$, … , y$_{i,1}$ | y$_{i,0}$ , z$_i$)).
Based on the estimates for (δ, ρ) and the corresponding variance, values of the coefficients can be tested and the average partial effect can be calculated.