library(dplyr)
library(wooldridge)
data("vote1")

(i)

(ii)

model <- lm(voteA ~ prtystrA + expendA + expendB + expendA*expendB, data = vote1)
summary(model)
## 
## Call:
## lm(formula = voteA ~ prtystrA + expendA + expendB + expendA * 
##     expendB, data = vote1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -28.9999  -8.7632  -0.1726   8.2310  29.7325 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      3.212e+01  4.591e+00   6.995 5.99e-11 ***
## prtystrA         3.419e-01  8.799e-02   3.886 0.000146 ***
## expendA          3.828e-02  4.960e-03   7.718 1.00e-12 ***
## expendB         -3.172e-02  4.588e-03  -6.915 9.32e-11 ***
## expendA:expendB -6.629e-06  7.186e-06  -0.923 0.357584    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11.13 on 168 degrees of freedom
## Multiple R-squared:  0.5708, Adjusted R-squared:  0.5606 
## F-statistic: 55.86 on 4 and 168 DF,  p-value: < 2.2e-16

The p-value indicates that the interaction term is statistically insignificant.

(iii)

mean(vote1$expendA)
## [1] 310.611

The average expenditure of candidate A in the sample is $310,611.

beta3 <- model$coefficients[4]  
beta4 <- model$coefficients[5]
expendA <- 300

partial_effect_expendB <- beta3 + beta4 * expendA
effect_100k_expendB <- partial_effect_expendB * 100

effect_100k_expendB
##   expendB 
## -3.371269

(iv)

beta2 <- model$coefficients[3]  
beta4 <- model$coefficients[5]
expendB <- 100

partial_effect_expendA <- beta2 + beta4 * expendB
effect_100k_expendA <- partial_effect_expendA * 100

effect_100k_expendA
##  expendA 
## 3.761799

(v)

It does make sense to replace the interaction term with \(\text{shareA}\) if you’re focusing on the effect of presidential support on congressional vote share. However, holding \(\text{expendA}\) and \(\text{expendB}\) fixed while changing \(\text{shareA}\) may not fully capture the dynamics, since campaign spending is often influenced by factors like voter support. This approach isolates the effect of \(\text{shareA}\), but could miss the interaction between spending and support.

(vi)

model_shareA <- lm(voteA ~ prtystrA + expendA + expendB + shareA, data = vote1)
beta3 <- coef(model_shareA)["expendB"]
partial_effect_expendB <- beta3

partial_effect_expendB
##    expendB 
## 0.00426694

The positive partial effect of expendB on voteA is somewhat unusual in the context of a typical election model, where higher spending by one candidate generally reduces the vote share of the opposing candidate. However, in this case, it suggests that the spending by candidate B may have a positive or neutral effect on candidate A’s vote share, possibly due to other dynamics captured by the model