{smcl}
{* *! version 1.0.0 02mar2018} {...}
{cmd:help xtpdyn}
{hline}

{title:Title}

{p2colset 5 16 20 2}{...}
{p2col :{hi:xtpdyn} {hline 2}}estimates dynamic random effects probit model 
with unobserved heterogeneity{p_end}
{p2colreset}{...}


{title:Sintax}

{p 4 10 2}
Model specification

{p 4 10 2}
{cmd:xtpdyn} {depvar} {indepvars} {ifin} [{it:{help meprobit##weight:weight}}]
{cmd:, uh({varlist})} [{cmd:re({it:{help meprobit##reoptions:RE_options}})}]


{p 4 10 2}
Utilities

{p 4 10 2}
{cmd:xtpdyn} {cmd:[, keep | drop]}


{title:Description}

{p 4 4 2} 
{cmd:xtpdyn} fits dynamic random-effects probit models ({help meprobit} and {help xtprobit}) with
unobserved heterogeneity. It implements Wooldridge simple solution to the 
initial condition problem (2005) in the alternative proposed by Rabe-Hesketh 
and Skrondal (2013).
Unobserved heterogeneity is address by the inclusion in the model of the initial
period value of the dependent variable and the initial period and within-unit averages
of time-varying explanatory variables.

{p 4 4 2} 
State dependence is modelled as a t-1 lag in the outcome variable. Note that the lag
respects the time variable, being it a time-series operator. Compact panels
are thus preferable.

{p 4 4 2} 
{cmd:xtpdyn} supports {help probat} postestimation command.

{p 4 4 2} 
{cmd:xtpdyn} supports {help meprobit_postestimation}. This requires the needed
variables to be created using {cmd: xtpdyn, keep}.

{phang}
{cmd:by} is allowed.


{marker options}{...}
{title:Options}

{dlgtab:Main}

{phang}
{cmd:uh({varlist})} specifies time-varying {indepvars} that contribute 
to unobserved heterogeneity in {varlist}. This option is required.

{phang}
{cmd:re({it:{help meprobit##reoptions:RE_options}})} random-effects 
options for {help meprobit} are allowed.{p_end}


{dlgtab:Utilities}

{phang}
{cmd:xtpdyn} shows the last {cmd:xtpdyn} estimates

{phang}
{cmd:keep} re-generates and keeps the variables in {cmd:uh()}.

{phang}
{cmd:drop} drops the variables in {cmd:uh()} generated by {cmd:keep}.{p_end}


{marker results}{...}
{title:Stored results}

{pstd}
In addition to the results stored by {help meprobit},
{cmd:xtpdyn} stores the following in {cmd:e()}:

{synoptset 20 tabbed}{...}
{p2col 5 20 24 2: Macros}{p_end}
{synopt:{cmd:e(depvar)}}dependent variable name{p_end}
{synopt:{cmd:e(varlist)}}list of independent variables{p_end}
{synopt:{cmd:e(uh)}}list of variables specified in {cmd:uh()}{p_end}
{synopt:{cmd:e(if)}}content of the {cmd:if} qualifier{p_end}


{marker examples}{...}
{title:Examples}

{pstd}Setup{p_end}
{phang2}{cmd:. use poverty}{p_end}

{phang2}{cmd:. xtset id year}{p_end}

{pstd}Dynaminc random-effects probit model with unobserved heterogeneity{p_end}
{phang2}{cmd:. xtpdyn poor black c.age i.edu i.emp i.marstat, uh(i.emp i.marstat age)}

{pstd}Dynaminc random-effects probit model with unobserved heterogeneity and robust variance{p_end}
{phang2}{cmd:. xtpdyn poor black c.age i.edu i.emp i.marstat, uh(i.emp i.marstat age) re(vce(robust))}

{pstd}Generate variables contributing to unobserved heterogeneity{p_end}
{phang2}{cmd:. xtpdyn, keep}


{marker references}{...}
{title:References}

{p 4 8 2}
Rabe-Hesketh, S. and A. Skrondal 2013.
Avoiding biased versions of Wooldridge's simple solution to the initial conditions problem.
{it:Economics Letters} 120: 346{c -}349.

{p 4 8 2}
Wooldridge, J.M. 2005. 
Simple solutions to the initial conditions problem in dynamic, nonlinear panel data
models with unobserved heterogeneity.
{it:Journal of Applied Econometrics} 20: 39{c -}54.


{title:Authors}

{phang}Raffaele Grotti <raffaele.grotti@esri.ie>{p_end}
{phang}The Economic and Social Research Institute{p_end}
{phang}Whitaker Square{p_end}
{phang}Sir John Rogerson's Quay, Dublin 2{p_end}
{phang}Ireland{p_end}

{phang}Giorgio Cutuli <g.cutuli@unitn.it>{p_end}
{phang}Department of Sociology and Social Research{p_end}
{phang}University of Trento{p_end}
{phang}Via Verdi, 26-I-38122 Trento{p_end}
{phang}Italy{p_end}


{title:Also see}

{phang} {help probat} {help meprobit} {help meprobit_postestimation} {help xtprobit}

{p 4 4 2}
For further details on model implementation and a more detailed example see:

{p 4 8 2}
Grotti, R. and G. Cutuli 2018.
{browse "https://www.researchgate.net/publication/323524968_Estimating_dynamic_random_effects_probit_model_with_unobserved_heterogeneity_using_Stata":Estimating dynamic random effects probit model with unobserved heterogeneity using Stata}