N Parameters

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(primer.data)
library(brms)
Loading required package: Rcpp
Loading 'brms' package (version 2.21.0). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').

Attaching package: 'brms'

The following object is masked from 'package:stats':

    ar
library(tidybayes)

Attaching package: 'tidybayes'

The following objects are masked from 'package:brms':

    dstudent_t, pstudent_t, qstudent_t, rstudent_t
library(gtsummary)
set.seed(9)

ch10_data<- shaming  |>mutate(p_00 = (primary_00 == "Yes"), p_02 = (primary_02 == "Yes"),
       p_04 = (primary_04 == "Yes"), g_00 = (general_00 == "Yes"),
       g_02 = (general_02 == "Yes"), g_04 = (general_04 == "Yes"),
civ_engage = p_00 + p_02 + p_04 + g_00 + g_02 + g_04,
voter_class = case_when(civ_engage %in% c(5, 6) ~ "Always Vote",
                        civ_engage %in% c(3, 4) ~ "Sometimes Vote",
                        civ_engage %in% c(1, 2) ~ "Rarely Vote"),
voter_class = factor(voter_class, levels = c("Rarely Vote", "Sometimes Vote", "Always Vote")), age_z = as.numeric(scale(age))) |>
rename(voted=primary_06) |>select(voted, treatment, sex, age_z, civ_engage, voter_class) |>
drop_na() |>
slice_sample(prop=0.1)

ch10_data |> 
sample_frac(0.5) |>
ggplot(aes(x=civ_engage,y=voted))+
geom_jitter(alpha=0.03, height=0.1)+
scale_x_continuous(breaks=1:6)+
scale_y_continuous(breaks=c(0,1),labels=c("No","Yes"))+
labs(title="Civic Engagement and Voting Behavior",y="Voted in 2006 Primary Election",x="Civic Engagement")

fit_postcard_vote<-brm(formula = voted ~ age_z + sex + treatment + voter_class + treatment*voter_class, data = ch10_data, family = gaussian(), refresh = 0, silent = 2, seed = 19)
fit_postcard_vote |>
tbl_regression(intercept=TRUE,estimate_fun = function(x) style_sigfig(x, digits = 3))
Warning in tidy.brmsfit(x, ..., effects = "fixed"): some parameter names
contain underscores: term naming may be unreliable!

Characteristic

Beta

95% CI

1
(Intercept) 0.155 0.136, 0.174
age_z 0.036 0.031, 0.041
sex

    sexMale 0.004 -0.005, 0.014
treatment

    No Postcard
    treatmentCivicDuty 0.016 -0.026, 0.059
    Hawthorne 0.005 -0.034, 0.047
    Self -0.007 -0.049, 0.035
    Neighbors 0.084 0.041, 0.125
voter_class

    Rarely Vote
    voter_classSometimesVote 0.115 0.096, 0.134
    voter_classAlwaysVote 0.298 0.275, 0.321
treatment * voter_class

    treatmentCivicDuty * voter_classSometimesVote -0.005 -0.052, 0.041
    Hawthorne * voter_classSometimesVote 0.009 -0.035, 0.054
    Self * voter_classSometimesVote 0.059 0.013, 0.105
    Neighbors * voter_classSometimesVote -0.009 -0.054, 0.037
    treatmentCivicDuty * voter_classAlwaysVote -0.009 -0.063, 0.044
    Hawthorne * voter_classAlwaysVote 0.033 -0.020, 0.085
    Self * voter_classAlwaysVote 0.047 -0.007, 0.102
    Neighbors * voter_classAlwaysVote -0.003 -0.057, 0.050
1

CI = Credible Interval

\[y_{i} = \beta_{0} + \beta_{1} age\_z + \beta_{2}male_i + \beta_{3}civic\_duty_i + \\ \beta_{4}hawthorne_i + \beta_{5}self_i + \beta_{6}neighbors_i + \\ \beta_{7}Sometimes\ vote_i + \beta_{8}Always\ vote_i + \\ \beta_{9}civic\_duty_i Sometimes\ vote_i + \beta_{10}hawthorne_i Sometimes\ vote_i + \\ \beta_{11}self_i Sometimes\ vote_i + \beta_{11}neighbors_i Sometimes\ vote_i + \\ \beta_{12}civic\_duty_i Always\ vote_i + \beta_{13}hawthorne_i Always\ vote_i + \\ \beta_{14}self_i Always\ vote_i + \beta_{15}neighbors_i Always\ vote_i + \epsilon_{i}\] We are using data from a postcard mailers study from the 2006 primary election in Michigan to attempt to forecast the causal effect of postcard mailers on voter participation in the Texas gubernatorial general election. One problem which may cast doubt on our approach is the difference in electorate between Michigan and Texas. We are using a linear model with error terms on the dependent variable of whether someone has voted. Our model predicts a positive relationship between age and likelihood to vote. One QoI is the correlation between receiving a postcard about neighbors and voting, which has a correlation of 8.4%, with a confidence interval between 4.1% and 12.5%.