Dear Stata users,
I want to obtain a similar graph, that is commonly used to analyse trends in difference-in-differences.
Array
I am using the following code:
xtset municipality year
xtreg voting time2##newspapers controls, fe vce(cluster municipality)
margins time2#newspapers
marginsplot, xdimension(time2)
time is a variable that takes values between -24 and 23, but when I use it after xtreg, Stata replies "time: factor variables may not contain negative values". So I did: gen time2=time+25.
When I run the above code, I obtain after xtreg:
note: 44.time2 omitted because of collinearity
note: 46.time2 omitted because of collinearity
note: 47.time2 omitted because of collinearity
note: 48.time2 omitted because of collinearity
note: 1.newspapers omitted because of collinearity
note: 10b.time2#0b.newspapers identifies no observations in the sample
note: 11.time2#0b.newspapers identifies no observations in the sample
note: 11.time2#1.newspapers omitted because of collinearity
note: 12.time2#0b.newspapers identifies no observations in the sample
note: 12.time2#1.newspapers omitted because of collinearity
note: 13.time2#0b.newspapers identifies no observations in the sample
note: 13.time2#1.newspapers omitted because of collinearity
note: 14.time2#0b.newspapers identifies no observations in the sample
note: 14.time2#1.newspapers omitted because of collinearity
note: 15.time2#0b.newspapers identifies no observations in the sample
note: 15.time2#1.newspapers omitted because of collinearity
note: 16.time2#0b.newspapers identifies no observations in the sample
note: 16.time2#1.newspapers omitted because of collinearity
note: 17.time2#0b.newspapers identifies no observations in the sample
note: 17.time2#1.newspapers omitted because of collinearity
note: 18.time2#0b.newspapers identifies no observations in the sample
note: 18.time2#1.newspapers omitted because of collinearity
note: 19.time2#0b.newspapers identifies no observations in the sample
note: 19.time2#1.newspapers omitted because of collinearity
note: 20.time2#0b.newspapers identifies no observations in the sample
note: 20.time2#1.newspapers omitted because of collinearity
note: 21.time2#0b.newspapers identifies no observations in the sample
note: 21.time2#1.newspapers omitted because of collinearity
note: 22.time2#0b.newspapers identifies no observations in the sample
note: 22.time2#1.newspapers omitted because of collinearity
note: 23.time2#0b.newspapers identifies no observations in the sample
note: 23.time2#1.newspapers omitted because of collinearity
note: 24.time2#0b.newspapers identifies no observations in the sample
note: 24.time2#1.newspapers omitted because of collinearity
note: 25.time2#1.newspapers omitted because of collinearity
note: 26.time2#0b.newspapers identifies no observations in the sample
note: 26.time2#1.newspapers omitted because of collinearity
note: 27.time2#0b.newspapers identifies no observations in the sample
note: 27.time2#1.newspapers omitted because of collinearity
note: 28.time2#0b.newspapers identifies no observations in the sample
note: 28.time2#1.newspapers omitted because of collinearity
note: 29.time2#0b.newspapers identifies no observations in the sample
note: 29.time2#1.newspapers omitted because of collinearity
For this reason, I obtain an empty graph. Could anyone explain me what I am doing wrong?
Here is an example of my data:
input long municipality float(year newspapers time)
1 1995 0 0
1 2002 0 0
1 2007 0 0
1 2012 0 0
1 2017 0 0
2 1995 1 0
2 2002 1 7
2 2007 1 12
2 2017 1 22
3 1995 0 0
3 2002 0 0
3 2007 0 0
3 2012 0 0
3 2017 0 0
4 1995 1 -13
4 2002 1 -6
4 2012 1 4
4 2017 1 9
Related Posts with Graph trend time DID xtreg
Joint coefficientsDear Statalist users, This is my first post here and sorry in advance if the post does not fully com…
Random sample by unique observationsHello Statlists, I'm currently struggling with my dataset. I have a large dataset of around 7 000 0…
splitting stringDear all, I am wondering how to split data from a long string on the comma (like for example: Colru…
Lagged time dummies, panel regressionHello all, I am trying to estimate a panel regression measuring the effect of different events on d…
Error Message: command makecns not defined by makecns.adoHi, I've been trying to run a bivariate logistic regression using a binary dependant and categorica…
Subscribe to:
Post Comments (Atom)
0 Response to Graph trend time DID xtreg
Post a Comment