0

my task is to provide a table (row = state; column = specification) of (the absolute value of) own-price elasticities for the OLS specification and my preferred IV specification of this equation: qmt =α1m +α2t +γmYmt +βpmt +εdmt

--> q_{mt}= \alpha_{1m} + \alpha _{2t} + \gamma _{m}Y_{mt} + \beta p_{mt} + \varepsilon _{mt}^{d}

dc$fdate <- as.factor(dc$date)
# Benchmark: OLS
ols4_2 <- feols(q ~ rp | region + fdate, dc, vcov = "HC1")

# preferred IV specification
iv1a_3 <- feols(q ~ 1 | region + fdate | rp ~ ripnatgas_epe:region, dc, vcov = "HC1") 
iv1a_3$collin.var 

# irrelevant IV specifation
iv1a_7 <- feols(q ~ 1 | region + fdate | rp ~ ripdiesel_epe:region + ripfueloil_epe:region + ripnatgas_epe:region + ripindelectric:region + ripcoal_epe:region + ripvegcoal_epe:region , dc, vcov = "HC1") 
iv1a_7$collin.var 

gof <-  data.frame(raw = c("nobs", "adj.r.squared"),
                   clean = c("Observations", "R2 adj."),
                   fmt = c(0,3))
fe2 <- data.frame(FE = c("Region FE", "Date FE"),
                 mod1 = c("Yes", "Yes"),
                 mod2 = c("Yes", "Yes"),
                 mod3 = c("Yes", "Yes"))
                 
attr(fe, "position") <- c(5,6)

modelsummary(list(ols4_2, iv1a_3, iv1a_7),
             stars = c("*" = .1, "**" = .05, "***" = .01),
             gof_map = gof, add_rows = fe2, ouput = "markdown")

I am working with data from different states concerning the price of a good. The elasticity is then supposed to be plotted against rigdp_state_pc (real interpolated per capita state GDP).

structure(list(month = c("JAN", "JAN", "JAN", "JAN"), region = c("MW", 
"MW", "MW", "MW"), state = c("DISTRITO FEDERAL", "MATO GROSSO DO SUL", 
"MATO GROSSO", "GOI\xc1S"), price = c(240000, 390000, 340000, 
260000), igdp_state_pc = c(38.3153638179, 14.795105851475, 14.862983224375, 
12.58653688675), date = structure(c(12418, 12418, 12418, 12418
), class = "Date"), ripnatgas_epe = c(0.197602421045303, 0.197602421045303, 
0.197602421045303, 0.197602421045303)), row.names = c(1321L, 
1329L, 1333L, 1338L), class = "data.frame")

As I am quite inexperienced with R, any help is much appreciated :)

emilyinr
  • 1
  • 1

0 Answers0