Hello everyone,
I am currently working on my master's thesis. My professor and I are analysing the effect of winning the lottery on crime.
My professor wants me to use 'csdid' for our analysis. I am familiar with 'DiD' but not with 'csdid'.
I have been trying to learn about csdid, but everytime I try to insert the command, it comes back with "repeated time values within panel".
I've attached my data file to this post and these have been the commands I've been using. One is by postcode level, the second one is by LSOA level:
Merged Data - correct.dta
Currently I think the problem has to do with there being multiple crimes reported within the same postcode within the same month. I have no idea however on how to fix this.
It could also be that I'm just doing a lot of things wrong. Like approaching the 'csdid' command completely wrong. If any of this is the case, please don't be afraid to let me know.
Also, I have had to merge the data twice. I really hope that this is not an issue.
If anyone could help me, I would be very grateful!
Glen
PS. I'm not sure if I can attach a datafile so to be safe I've attached a 'dataex' below this line:
I am currently working on my master's thesis. My professor and I are analysing the effect of winning the lottery on crime.
My professor wants me to use 'csdid' for our analysis. I am familiar with 'DiD' but not with 'csdid'.
I have been trying to learn about csdid, but everytime I try to insert the command, it comes back with "repeated time values within panel".
I've attached my data file to this post and these have been the commands I've been using. One is by postcode level, the second one is by LSOA level:
Merged Data - correct.dta
Code:
csdid property_dummy value, ivar(ID) time(month) gvar(won) csdid property_dummy value, ivar(IDPS) time(month) gvar(won)
It could also be that I'm just doing a lot of things wrong. Like approaching the 'csdid' command completely wrong. If any of this is the case, please don't be afraid to let me know.
Also, I have had to merge the data twice. I really hope that this is not an issue.
If anyone could help me, I would be very grateful!
Glen
PS. I'm not sure if I can attach a datafile so to be safe I've attached a 'dataex' below this line:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str8 postcode_ws long averageincome str9 lsoacode str33 lsoaname str7 postcode_zs long value float month byte merge1 float(property violent) long crime_num float(property_dummy violent_dummy) byte merge2 float(won ID IDPS) "BA1 6FD" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16FD" 1000 1 3 0 14 14 0 1 3 1 1 1095 "BA1 6SF" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SF" 1000 1 3 2 0 2 1 0 3 1 1 1225 "BA1 6NU" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NU" 1000 1 3 0 0 1 0 0 3 1 1 1167 "BA1 6PA" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16PA" 1000 1 3 0 14 14 0 1 3 1 1 1172 "BA1 6SE" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SE" 1000 1 3 7 0 7 1 0 3 1 1 1224 "BA1 6TG" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TG" 1000 1 3 0 14 14 0 1 3 1 1 1244 "BA1 6FD" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16FD" 1000 1 3 0 0 1 0 0 3 1 1 1095 "BA1 6TF" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TF" 1000 1 3 0 0 1 0 0 3 1 1 1243 "BA1 6QX" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16QX" 1000 1 3 0 0 1 0 0 3 1 1 1204 "BA1 6NR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NR" 1000 2 3 0 0 1 0 0 3 2 1 1164 "BA1 6SR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SR" 1000 2 3 0 0 1 0 0 3 2 1 1232 "BA1 6SF" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SF" 1000 2 3 0 14 14 0 1 3 2 1 1225 "BA1 7AY" 54000 "E01014409" "Bath and North East Somerset 004A" "BA17AY" 1000 2 3 3 0 3 1 0 3 2 1 1268 "BA1 6NX" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NX" 1000 2 3 0 0 1 0 0 3 2 1 1169 "BA1 6NU" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NU" 1000 2 3 0 0 9 0 0 3 2 1 1167 "BA1 6NS" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NS" 1000 2 3 0 0 4 0 0 3 2 1 1165 "BA1 6SH" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SH" 1000 3 3 0 0 4 0 0 3 3 1 1227 "BA1 6PA" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16PA" 1000 3 3 7 0 7 1 0 3 3 1 1172 "BA1 6SE" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SE" 1000 3 3 0 0 9 0 0 3 3 1 1224 "BA1 6NY" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NY" 1000 3 3 7 0 7 1 0 3 3 1 1170 "BA1 6SR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SR" 1000 3 3 0 14 14 0 1 3 3 1 1232 "BA1 6TB" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TB" 1000 4 3 0 0 9 0 0 3 4 1 1240 "BA1 6SF" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SF" 1000 4 3 0 0 4 0 0 3 4 1 1225 "BA1 6SG" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SG" 1000 5 3 0 0 4 0 0 3 5 1 1226 "BA1 7BB" 54000 "E01014409" "Bath and North East Somerset 004A" "BA17BB" 1000 5 3 0 14 14 0 1 3 5 1 1271 "BA1 6SG" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SG" 1000 5 3 7 0 7 1 0 3 5 1 1226 "BA1 6NR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NR" 1000 5 3 0 0 1 0 0 3 5 1 1164 "BA1 6NX" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NX" 1000 5 3 0 14 14 0 1 3 5 1 1169 "BA1 6FD" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16FD" 1000 5 3 0 0 1 0 0 3 5 1 1095 "BA1 6NR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NR" 1000 6 3 0 0 4 0 0 3 6 1 1164 "BA1 6SE" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SE" 1000 7 3 0 14 14 0 1 3 7 1 1224 "BA1 6FD" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16FD" 1000 7 3 0 0 4 0 0 3 7 1 1095 "BA1 6NR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NR" 1000 7 3 0 14 14 0 1 3 7 1 1164 "BA1 6SE" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SE" 500 8 3 . . . . . 1 8 1 1224 "BA1 6TL" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TL" 1000 8 3 . . . . . 1 8 1 1246 "BA1 6NR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NR" 500 8 3 . . . . . 1 8 1 1164 "BA1 6TG" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TG" 1000 8 3 . . . . . 1 8 1 1244 "BA1 6NX" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NX" 500 8 3 . . . . . 1 8 1 1169 "BA1 6SG" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SG" 500 8 3 . . . . . 1 8 1 1226 "BA1 6SR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SR" 500 8 3 . . . . . 1 8 1 1232 "BA1 6TH" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TH" 1000 8 3 . . . . . 1 8 1 1245 "BA1 6SJ" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SJ" 500 8 3 . . . . . 1 8 1 1228 "BA1 6NU" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NU" 500 8 3 . . . . . 1 8 1 1167 "BA1 6SR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SR" 1000 8 3 . . . . . 1 8 1 1232 "BA1 6SE" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SE" 1000 8 3 . . . . . 1 8 1 1224 "BA1 6SG" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SG" 1000 8 3 . . . . . 1 8 1 1226 "BA1 6NT" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NT" 1000 8 3 . . . . . 1 8 1 1166 "BA1 6TH" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TH" 1000 9 3 0 0 1 0 0 3 9 1 1245 "BA1 6TG" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TG" 1000 9 3 0 0 1 0 0 3 9 1 1244 "BA1 6RD" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16RD" 1000 10 3 0 0 4 0 0 3 10 1 1208 "BA1 6NR" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NR" 1000 10 3 2 0 2 1 0 3 10 1 1164 "BA1 6SJ" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SJ" 1300 11 3 0 0 13 0 0 3 11 1 1228 "BA1 6NS" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NS" 1000 11 3 0 0 4 0 0 3 11 1 1165 "BA1 6SE" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SE" 1000 11 3 0 14 14 0 1 3 11 1 1224 "BA1 6TH" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16TH" 1000 11 3 0 14 14 0 1 3 11 1 1245 "BA1 6NZ" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16NZ" 1000 11 3 0 14 14 0 1 3 11 1 1171 "BA1 7BB" 54000 "E01014409" "Bath and North East Somerset 004A" "BA17BB" 1000 11 3 0 14 14 0 1 3 11 1 1271 "BA1 6FD" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16FD" 1000 11 3 0 14 14 0 1 3 11 1 1095 "BA1 6SE" 54000 "E01014409" "Bath and North East Somerset 004A" "BA16SE" 1000 12 3 0 0 1 0 0 3 12 1 1224 "BA1 6SA" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1222 "BA1 6BZ" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1054 "BA1 6PB" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1173 "BA1 6TE" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1242 "BA1 6SX" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1236 "BA1 6SL" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1229 "BA1 6TP" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1247 "BA1 6SZ" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1238 "BA1 6RA" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1207 "BA1 6TQ" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1248 "BA1 6SW" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1235 "BA1 6SQ" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1231 "BA1 6QY" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1205 "BA1 6SP" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1230 "BA1 6SY" 54000 "E01014409" "Bath and North East Somerset 004A" "" . . 1 . . . . . 1 0 1 1237 "BA1 6HA" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HA" 1000 1 3 0 0 13 0 0 3 1 2 1099 "BA1 6HW" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HW" 1000 1 3 0 14 14 0 1 3 1 2 1114 "BA1 6PD" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16PD" 1000 1 3 0 14 14 0 1 3 1 2 1174 "BA1 6HR" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HR" 1000 1 3 0 14 14 0 1 3 1 2 1110 "BA1 6HD" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HD" 1000 1 3 0 14 14 0 1 3 1 2 1101 "BA1 6QW" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16QW" 1000 2 3 3 0 3 1 0 3 2 2 1203 "BA1 6HG" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HG" 1000 2 3 0 0 1 0 0 3 2 2 1103 "BA1 6NN" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16NN" 1000 2 3 11 0 11 1 0 3 2 2 1161 "BA1 6NE" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16NE" 1000 2 3 0 14 14 0 1 3 2 2 1155 "BA1 6HD" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HD" 1000 3 3 11 0 11 1 0 3 3 2 1101 "BA1 6JP" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16JP" 1000 3 3 0 0 1 0 0 3 3 2 1128 "BA1 6HD" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HD" 1000 3 3 0 0 1 0 0 3 3 2 1101 "BA1 6HR" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HR" 1000 3 3 0 0 1 0 0 3 3 2 1110 "BA1 6NN" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16NN" 1000 3 3 11 0 11 1 0 3 3 2 1161 "BA1 6PD" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16PD" 1000 4 3 11 0 11 1 0 3 4 2 1174 "BA1 6NW" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16NW" 1000 4 3 11 0 11 1 0 3 4 2 1168 "BA1 6JN" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16JN" 1000 4 3 11 0 11 1 0 3 4 2 1127 "BA1 6PE" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16PE" 1000 5 3 0 0 9 0 0 3 5 2 1175 "BA1 6HG" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HG" 500 5 3 0 0 9 0 0 3 5 2 1103 "BA1 6NN" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16NN" 1000 5 3 0 0 9 0 0 3 5 2 1161 "BA1 6HR" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HR" 1000 5 3 0 0 9 0 0 3 5 2 1110 "BA1 6RE" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16RE" 1000 5 3 0 0 9 0 0 3 5 2 1209 "BA1 6QZ" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16QZ" 1300 5 3 0 0 9 0 0 3 5 2 1206 "BA1 6NP" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16NP" 500 5 3 0 0 9 0 0 3 5 2 1162 "BA1 6JP" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16JP" 500 5 3 0 0 9 0 0 3 5 2 1128 "BA1 6HR" 54000 "E01014410" "Bath and North East Somerset 004B" "BA16HR" 1000 6 3 0 0 13 0 0 3 6 2 1110 end label values merge1 _merge label values merge2 _merge label def _merge 1 "Master only (1)", modify label def _merge 3 "Matched (3)", modify label values crime_num crime_num label def crime_num 1 "Anti-social behaviour", modify label def crime_num 2 "Bicycle theft", modify label def crime_num 3 "Burglary", modify label def crime_num 4 "Criminal damage and arson", modify label def crime_num 7 "Other theft", modify label def crime_num 9 "Public order", modify label def crime_num 11 "Shoplifting", modify label def crime_num 13 "Vehicle crime", modify label def crime_num 14 "Violence and sexual offences", modify
Comment