Announcement

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

  • Xtdata

    Hi all,

    I am trying to use the command xtdata to convert data in order to perform the regress command instead of the xtreg, fe command:
    Code:
    xtdata tasso_crescita_sales_prod L.log_sales L.dummy_2 L2.dummy_2 L3.dummy_2 mean_gr_rate_atc2 recalls_sales agepodcat1 ageprodcat2 ageprodcat3 ageprodcat4 newmolfirm newmolmarket i.Year, fe clear
    My data looks like follows:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(tasso_crescita_sales_prod log_sales dummy_2) byte ageprodcat1 float(newmolmarket newmolfirm newmolfirm_mean newmolmarket_mean newmolfirm_demeaned newmolmarket_demeaned)
            .  .7416294 0 1 1 .        1        .5         .         .5
            .  5.369557 1 1 0 1        1        .5         0        -.5
            .  5.839578 0 0 1 .        0      .125         .       .875
    3.1807585  5.907265 0 0 0 0        0      .125         0      -.125
            .  5.471926 0 0 0 0        0      .125         0      -.125
    12.165902  12.16714 0 0 0 0        0      .125         0      -.125
            . 12.115527 0 0 0 0        0      .125         0      -.125
            . 11.816388 1 0 0 0        0      .125         0      -.125
            .  8.943999 0 0 0 0        0      .125         0      -.125
            . 4.5496664 0 0 0 0        0      .125         0      -.125
            .  19.53829 1 1 1 .        0 .08333334         .   .9166667
    18.725441 19.905426 1 1 0 0        0 .08333334         0 -.08333334
    18.340553 20.095314 0 1 0 0        0 .08333334         0 -.08333334
    18.435717  20.26945 0 0 0 0        0 .08333334         0 -.08333334
     18.86105  20.48821 0 0 0 0        0 .08333334         0 -.08333334
     19.39682   20.7777 0 0 0 0        0 .08333334         0 -.08333334
    18.886513  20.91824 0 0 0 0        0 .08333334         0 -.08333334
    18.683449 21.019907 0 0 0 0        0 .08333334         0 -.08333334
    18.159758  21.07559 0 0 0 0        0 .08333334         0 -.08333334
    19.067064 21.201504 1 0 0 0        0 .08333334         0 -.08333334
     19.46246  21.36336 0 0 0 0        0 .08333334         0 -.08333334
            .  20.80426 0 0 0 0        0 .08333334         0 -.08333334
            . 17.326546 0 1 0 1 .0909091         0  .9090909          0
    16.825748 17.800322 0 1 0 0 .0909091         0 -.0909091          0
    17.012917 18.175344 0 1 0 0 .0909091         0 -.0909091          0
    14.926245 18.213419 0 1 0 0 .0909091         0 -.0909091          0
     15.29373 18.265965 1 1 0 0 .0909091         0 -.0909091          0
     15.47137 18.325308 0 0 0 0 .0909091         0 -.0909091          0
            . 18.301315 0 0 0 0 .0909091         0 -.0909091          0
    13.862047 18.313051 0 0 0 0 .0909091         0 -.0909091          0
    17.476244 18.672884 0 0 0 0 .0909091         0 -.0909091          0
    17.279263 18.894567 0 0 0 0 .0909091         0 -.0909091          0
      15.7814 18.938066 0 0 0 0 .0909091         0 -.0909091          0
            .  17.03001 0 0 1 .        0 .08333334         .   .9166667
            . 16.828316 0 0 0 0        0 .08333334         0 -.08333334
            . 16.688076 0 0 0 0        0 .08333334         0 -.08333334
            . 16.551435 0 0 0 0        0 .08333334         0 -.08333334
            . 16.434864 0 0 0 0        0 .08333334         0 -.08333334
            . 16.429157 1 0 0 0        0 .08333334         0 -.08333334
            . 16.322685 0 0 0 0        0 .08333334         0 -.08333334
            .  14.25576 0 0 0 0        0 .08333334         0 -.08333334
            . 13.470552 0 0 0 0        0 .08333334         0 -.08333334
            . 13.094532 0 0 0 0        0 .08333334         0 -.08333334
            . 13.000454 0 0 0 0        0 .08333334         0 -.08333334
    11.292548 13.167023 0 0 0 0        0 .08333334         0 -.08333334
            . 17.863958 0 0 1 .        0 .14285715         .   .8571429
            . 17.199493 0 0 0 0        0 .14285715         0 -.14285715
            . 16.519917 0 0 0 0        0 .14285715         0 -.14285715
            . 16.409594 0 0 0 0        0 .14285715         0 -.14285715
            . 16.395111 0 0 0 0        0 .14285715         0 -.14285715
            . 15.892983 1 0 0 0        0 .14285715         0 -.14285715
            .  8.252374 0 0 0 0        0 .14285715         0 -.14285715
            . 14.603676 0 0 1 .        0 .08333334         .   .9166667
            .  14.51075 0 0 0 0        0 .08333334         0 -.08333334
            .   14.3889 0 0 0 0        0 .08333334         0 -.08333334
            . 14.325128 0 0 0 0        0 .08333334         0 -.08333334
            . 14.145007 0 0 0 0        0 .08333334         0 -.08333334
    14.164447  14.84792 0 0 0 0        0 .08333334         0 -.08333334
            . 14.070683 0 1 0 0        0 .08333334         0 -.08333334
            .  13.99402 1 1 0 0        0 .08333334         0 -.08333334
            . 13.883517 0 1 0 0        0 .08333334         0 -.08333334
            . 13.849677 0 1 0 0        0 .08333334         0 -.08333334
            .  13.78515 0 0 0 0        0 .08333334         0 -.08333334
     10.16614 13.811604 0 0 0 0        0 .08333334         0 -.08333334
            . 16.196678 0 0 1 .        0 .08333334         .   .9166667
            . 16.078794 0 0 0 0        0 .08333334         0 -.08333334
     13.10945 16.128859 0 0 0 0        0 .08333334         0 -.08333334
            . 16.032457 0 0 0 0        0 .08333334         0 -.08333334
            .  15.83086 0 0 0 0        0 .08333334         0 -.08333334
            .  15.58876 1 0 0 0        0 .08333334         0 -.08333334
            . 14.223525 1 0 0 0        0 .08333334         0 -.08333334
            . 13.396545 0 0 0 0        0 .08333334         0 -.08333334
            . 12.554374 0 0 0 0        0 .08333334         0 -.08333334
            .  12.13077 0 0 0 0        0 .08333334         0 -.08333334
            .   11.3143 0 0 0 0        0 .08333334         0 -.08333334
            .  10.44372 0 0 0 0        0 .08333334         0 -.08333334
            .  13.82824 0 1 1 .        0 .08333334         .   .9166667
    13.415682 14.336234 0 1 0 0        0 .08333334         0 -.08333334
    13.316372 14.644193 0 1 0 0        0 .08333334         0 -.08333334
      13.7403 14.984222 0 1 0 0        0 .08333334         0 -.08333334
    14.663067  15.52963 0 1 0 0        0 .08333334         0 -.08333334
    14.747814 15.906404 0 0 0 0        0 .08333334         0 -.08333334
    14.361357 16.099749 1 0 0 0        0 .08333334         0 -.08333334
    14.021648 16.217682 1 0 0 0        0 .08333334         0 -.08333334
            . 16.159006 0 0 0 0        0 .08333334         0 -.08333334
            .  14.90529 0 0 0 0        0 .08333334         0 -.08333334
            . 14.298444 0 0 0 0        0 .08333334         0 -.08333334
            .  13.88967 0 0 0 0        0 .08333334         0 -.08333334
            . 11.630756 0 1 1 .        0 .08333334         .   .9166667
            .  11.62534 0 1 0 0        0 .08333334         0 -.08333334
     9.691856 11.760434 0 1 0 0        0 .08333334         0 -.08333334
    12.495008 12.886854 0 1 0 0        0 .08333334         0 -.08333334
    10.372454  12.96466 0 1 0 0        0 .08333334         0 -.08333334
    12.004423 13.288772 0 0 0 0        0 .08333334         0 -.08333334
            . 13.182534 0 0 0 0        0 .08333334         0 -.08333334
     10.91284  13.28088 0 0 0 0        0 .08333334         0 -.08333334
    11.242186 13.403274 0 0 0 0        0 .08333334         0 -.08333334
            . 13.243154 0 0 0 0        0 .08333334         0 -.08333334
            . 13.002064 0 0 0 0        0 .08333334         0 -.08333334
            . 12.948288 1 0 0 0        0 .08333334         0 -.08333334
    end
    where ageprodcat2, ageprodcat3 and ageprodcat4 look like ageprodcat1. So the problem is that when using xtdata , I receive the following error:

    factor variables and time-series operators not allowed

    How ca I solve it?
    The xtreg equation was:

    Code:
     xtreg tasso_crescita_sales_prod L.log_sales L.dummy_2 L2.dummy_2 L3.dummy_2 mean_gr_rate_atc2 recalls_sales ageprodcat1 ageprodcat2 ageprodcat3 ageprodcat4 newmolfirm newmolmarket i.Year, fe vce(cluster idpr)
    Thank you a lot,

    Federico

  • #2
    It means exactly what it says - xtdata doesn't allow time series operators or factor variable notation. So generate your lagged variables before running xtdata. [I'm not sure what happens if you generate them afterwards - read the pdf manual.] By the way, xtreg usually runs quickly. It might run faster for you if you delete observations with missing data before running xtreg.

    Comment

    Working...
    X