Hi all,
This is my first post (so apologies if do not do everything right):
I'm working with quarterly panel data (basically looking at credit aggregates in different countries over time). My Date variable Date starts in 1950q1 and ends in 2020q2. I would like to adjust the credit data for seasonality, so I tried using the usual procedure by regressing my credit variable privcredit over quarterly dummies:
reg privcredit i.Date
But I get an error message from Stata saying:
Date: factor variables may not contain negative values
So I guess there is a problem with my Date variable... My date variable takes values ranging from -40 in 1950q1 (the first quarter of 1950 is indeed 40 quarters before 1960q1) to 1410 in 2020q2. Then I just told Stata that my time variable was quarterly (code is my panel variable, it takes different values for every country):
xtset code Date, quarterly
And Stata outputs:
panel variable: code (strongly balanced)
time variable: Date, 1950q1 to 2020q2
delta: 1 quarter
So I don't know where's the problem... Why cannot I use:
i.Date
Even if I run the regression for the post-1960 period (for which the variable Date takes positive values), Stata doesn't seem to understand that I want Date to be transformed into a set of quarterly dummies. Using this code:
reg privcredit i.Date if Date>0
Outputs one coefficient for every single quarter...
Here's a little snapshot of my data:
Example generated by -dataex-. To install: ssc install dataex
clear
input float Date str7 Country float(code rgdpSA grrgdp privcredit privcreditSA grprivcredit publcredit publcreditSA grpublcredit stirUS1 stirGER1)
-40 "FRANCE" 1 70.999 . 3.5019214 . . . . . . .
-39 "FRANCE" 1 72.78 .025084835 3.660585 . . . . . . .
-38 "FRANCE" 1 74.579 .02471838 3.6379185 . . . . . . .
-37 "FRANCE" 1 76.4 .02441705 3.7852485 . . . . . . .
-36 "FRANCE" 1 76.599 .002604679 3.992077 . . . . . . .
-35 "FRANCE" 1 77.201 .007859076 4.2895703 . . . . . . .
-34 "FRANCE" 1 78.308 .014339223 4.456733 . . . . . . .
-33 "FRANCE" 1 79.098 .01008838 5.046053 . . . . . . .
-32 "FRANCE" 1 80.278 .014918206 5.785537 . . . . . . .
-31 "FRANCE" 1 79.854 -.005281691 5.850702 . . . . . . .
-30 "FRANCE" 1 80.641 .00985552 5.9527 . . . . . . .
-29 "FRANCE" 1 80.502 -.0017236882 6.253026 . . . . . . .
-28 "FRANCE" 1 81.503 .012434467 6.185028 . . . . . . .
-27 "FRANCE" 1 82.843 .01644116 6.440022 . . . . . . .
-26 "FRANCE" 1 83.209 .004417963 6.595852 . . . . . . .
-25 "FRANCE" 1 84.52 .01575547 7.134173 . . . . . . .
-24 "FRANCE" 1 85.703 .013996762 6.96701 . . . . . . .
-23 "FRANCE" 1 87.182 .017257228 7.202172 . . . . . . .
-22 "FRANCE" 1 88.54 .01557663 7.584663 . . . . . . .
-21 "FRANCE" 1 89.186 .007296093 8.080485 . . 2410 . . . .
-20 "FRANCE" 1 90.382 .013410253 8.222149 . . 2483 . . 1.41 .
Anyway, hope this is clear enough; please tell me if information are missing!
0 Response to Adjusting for seasonality quarterly variable since 1950
Post a Comment