Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error using -xtdpdml- package: T value is too small

    I am creating a cross-lagged panel data model using the user-contributed package -xtdpdml-. My model is similar to the example specified in The Stata Journal (2018) 18, Number 2, pp. 293–326 Linear dynamic panel-data estimation using maximum likelihood and structural equation modeling.

    Unlike the example in SJ, I have data at only 2 time points (T=2). This is my syntax:

    Code:
    xtdpdml outcome, pre(L.exposure) inv(cald) showcmd tfix
    This results in the following error:

    Code:
    T value is too small given the lags specified
    For example if xlag = 2 then T must equal at least 4
    I have looked at the source code and I'm unsure of what "xlag" means in a practical sense. In my case, by using "set trace on", I find that T=2 (which I know from my data) and Tmin=3.

    This leads to three questions:

    (A) What does "xlag" mean?
    (B) How is "Tmin" calculated? Why is this the minimum number of data points?
    (C) Is it possible to create a cross-lagged panel model using -xtdpdml- with only T=2? Or do I need more time points?

    The model runs fine when I use similar datasets with T=5 and T=7.
    Last edited by Max Rushden; 19 Oct 2021, 21:52.

  • #2
    Responding to this Q several months later because I didn't notice it before and because somebody else cited it:

    xlag is the maximum lag for an X variable. In this case you specify L.exposure so maximum xlag = 1.

    However, the default ylag value is also 1, so you would have gotten into trouble anyway.

    For convenience, I will self-plagiarize the response I just gave at

    https://www.statalist.org/forums/for...14#post1666714

    1. T can equal 2 if ylag = 0 AND none of the other variables in the model are lagged. Example:

    Code:
    use https://www3.nd.edu/~rwilliam/statafiles/wages, clear xtset id t keep if t<3 xtdpdml wks lwage, inv(ed) pre(union) ylag(0)
    If Daniel specifies ylag(0) and still gets the T is too small error message, I bet it is because he has one or more lagged Xs in his model. If that is NOT the case, I would like to see his code and output.

    2. In general, T must be at least equal to 2 + maximum # of lags. By default, ylag = 1 so T must be at at least 3 if default settings are used.

    As to why that is -- you need at least 2 time periods to estimate fixed effects for variables not in the model. If T = 2 and Ylag = 1, then you actually only have one time period, for Y time 2, the equation for which includes Y time 1 as an independent variable. You don't have an equation for Y time 1 because there is no Y time 0 to use as a lagged independent variable.

    In short, if T = 2, you cannot have any lagged Y or X variables if you want to use xtdpdml. With a strongly balanced panel, no missing data, no lagged Xs, and no effect of lagged y, xtdpdml produces results that are almost identical to xtreg -- so you may just want to use xtreg in such situations. But if there are missing data, the fiml option may make xtdpdml the better option.

    For those who have no idea what xtdpdml is, you can see the SJ article on it at

    https://journals.sagepub.com/doi/pdf...867X1801800201

    The support page for xtdpdml is at

    https://www3.nd.edu/~rwilliam/dynamic/index.html
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://academicweb.nd.edu/~rwilliam/

    Comment

    Working...
    X