Implementing dummy
Posted: Tue Aug 12, 2014 5:50 am
Hi there,
I have a question concerning dummy variable implementation.
I'm working on the relation between commodity price returns and a set of weather variables.
I want to look into 2 things:
1) If the effect of the weather on returns during the period when the crop is out on the field (March - December)
2) If the effect of the weather on returns has become bigger the last 10 years.
The current code doesn't include dummies, but simply makes several regressions.
I could compare the significant coefficients with z = (B1 - B2) / SQRT ( (STDerror1^2) + STDerror2^2)) right?
smpl @all
genr returns = dlog(price)
genr Fog_ice_Freezing = wt01
genr Heavyfog = wt02
genr Thunder = wt03
genr Ice_or_snow_pellets = wt04
genr Hail = wt05
genr Glaze_or_rime = wt06
genr Volcanic_ash = wt07
genr Smoke_or_haze = wt08
genr Blowing_or_drifting_snow = wt09
genr Tornado_Watersprout = wt10
genr Damaging_winds = wt11
genr Mist = wt13
genr Drizzle = wt14
genr Freezing_drizzle = wt15
genr Rain = wt16
genr Freezing_rain = wt17
genr Unknown_source_precip = wt19
genr Ground_fog = wt21
genr Ice_or_freezing_fog = wt22
genr Fog2 = wv01
genr Thunder2 = wv03
genr Ash2 = wv07
genr Rain2 = wv20
equation reg.ls returns c Heavyfog Thunder Ice_or_snow_pellets Hail Glaze_or_rime Volcanic_ash Smoke_or_Haze Blowing_or_drifting_snow Tornado_Watersprout Damaging_winds Drizzle Freezing_drizzle Freezing_rain Ice_or_freezing_fog
equation reg1.ls returns c Heavyfog(-1) Thunder(-1) Ice_or_snow_pellets(-1) Hail(-1) Glaze_or_rime(-1) Volcanic_ash(-1) Smoke_or_Haze(-1) Blowing_or_drifting_snow(-1) Tornado_Watersprout(-1) Damaging_winds(-1) Drizzle(-1) Freezing_drizzle(-1) Freezing_rain(-1) Ice_or_freezing_fog(-1)
equation regmin.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation regmin1.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
smpl if @month>=3 and @month<=12
equation regA.ls returns c Heavyfog Thunder Ice_or_snow_pellets Hail Glaze_or_rime Volcanic_ash Smoke_or_Haze Blowing_or_drifting_snow Tornado_Watersprout Damaging_winds Drizzle Freezing_drizzle Freezing_rain Ice_or_freezing_fog
equation reg1A.ls returns c Heavyfog(-1) Thunder(-1) Ice_or_snow_pellets(-1) Hail(-1) Glaze_or_rime(-1) Volcanic_ash(-1) Smoke_or_Haze(-1) Blowing_or_drifting_snow(-1) Tornado_Watersprout(-1) Damaging_winds(-1) Drizzle(-1) Freezing_drizzle(-1) Freezing_rain(-1) Ice_or_freezing_fog(-1)
equation regminA.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation regmin1A.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
smpl 2004M1 @last
equation extreme.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation extreme1.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
smpl 2004M1 @last if @month>=3 and @month<=12
equation extremea.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation extreme1a.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
I have tried to implement the following code to insert the dummy to check if the coefficients are significantly different.
Dummy on the field
series field=@recode(@month>=3 and @month<=12,1,0)
Dummy last 10 years
series lastten=recode(@year>2003,1,0)
Code is for shortest model:
Field:
equation regminfield.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds field Thunder*field Hail*field Volcanic_ash*field Tornado_Watersprout*field Damaging_winds*field
I implement te same interaction variable for the last ten years dummy, but for both of the dummies I get a "near singular matrix error".
Someone knows what im doing wrong?
I can compare the results for the regressions seperately however, I would like to implement a dummy variable
I have a question concerning dummy variable implementation.
I'm working on the relation between commodity price returns and a set of weather variables.
I want to look into 2 things:
1) If the effect of the weather on returns during the period when the crop is out on the field (March - December)
2) If the effect of the weather on returns has become bigger the last 10 years.
The current code doesn't include dummies, but simply makes several regressions.
I could compare the significant coefficients with z = (B1 - B2) / SQRT ( (STDerror1^2) + STDerror2^2)) right?
smpl @all
genr returns = dlog(price)
genr Fog_ice_Freezing = wt01
genr Heavyfog = wt02
genr Thunder = wt03
genr Ice_or_snow_pellets = wt04
genr Hail = wt05
genr Glaze_or_rime = wt06
genr Volcanic_ash = wt07
genr Smoke_or_haze = wt08
genr Blowing_or_drifting_snow = wt09
genr Tornado_Watersprout = wt10
genr Damaging_winds = wt11
genr Mist = wt13
genr Drizzle = wt14
genr Freezing_drizzle = wt15
genr Rain = wt16
genr Freezing_rain = wt17
genr Unknown_source_precip = wt19
genr Ground_fog = wt21
genr Ice_or_freezing_fog = wt22
genr Fog2 = wv01
genr Thunder2 = wv03
genr Ash2 = wv07
genr Rain2 = wv20
equation reg.ls returns c Heavyfog Thunder Ice_or_snow_pellets Hail Glaze_or_rime Volcanic_ash Smoke_or_Haze Blowing_or_drifting_snow Tornado_Watersprout Damaging_winds Drizzle Freezing_drizzle Freezing_rain Ice_or_freezing_fog
equation reg1.ls returns c Heavyfog(-1) Thunder(-1) Ice_or_snow_pellets(-1) Hail(-1) Glaze_or_rime(-1) Volcanic_ash(-1) Smoke_or_Haze(-1) Blowing_or_drifting_snow(-1) Tornado_Watersprout(-1) Damaging_winds(-1) Drizzle(-1) Freezing_drizzle(-1) Freezing_rain(-1) Ice_or_freezing_fog(-1)
equation regmin.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation regmin1.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
smpl if @month>=3 and @month<=12
equation regA.ls returns c Heavyfog Thunder Ice_or_snow_pellets Hail Glaze_or_rime Volcanic_ash Smoke_or_Haze Blowing_or_drifting_snow Tornado_Watersprout Damaging_winds Drizzle Freezing_drizzle Freezing_rain Ice_or_freezing_fog
equation reg1A.ls returns c Heavyfog(-1) Thunder(-1) Ice_or_snow_pellets(-1) Hail(-1) Glaze_or_rime(-1) Volcanic_ash(-1) Smoke_or_Haze(-1) Blowing_or_drifting_snow(-1) Tornado_Watersprout(-1) Damaging_winds(-1) Drizzle(-1) Freezing_drizzle(-1) Freezing_rain(-1) Ice_or_freezing_fog(-1)
equation regminA.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation regmin1A.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
smpl 2004M1 @last
equation extreme.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation extreme1.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
smpl 2004M1 @last if @month>=3 and @month<=12
equation extremea.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds
equation extreme1a.ls returns c Thunder(-1) Hail(-1) Volcanic_ash(-1) Tornado_Watersprout(-1) Damaging_winds(-1)
I have tried to implement the following code to insert the dummy to check if the coefficients are significantly different.
Dummy on the field
series field=@recode(@month>=3 and @month<=12,1,0)
Dummy last 10 years
series lastten=recode(@year>2003,1,0)
Code is for shortest model:
Field:
equation regminfield.ls returns c Thunder Hail Volcanic_ash Tornado_Watersprout Damaging_winds field Thunder*field Hail*field Volcanic_ash*field Tornado_Watersprout*field Damaging_winds*field
I implement te same interaction variable for the last ten years dummy, but for both of the dummies I get a "near singular matrix error".
Someone knows what im doing wrong?
I can compare the results for the regressions seperately however, I would like to implement a dummy variable