library(fabricatr)
voters <- fabricate(
N = 1000,
group_id = rep(1:10, 100),
ideology = draw_normal_icc(mean = 0, N = N, clusters = group_id, ICC = 0.7),
ideological_label = draw_ordered(
x = ideology, break_labels = c("Very Conservative", "Conservative", "Liberal", "Very Liberal")
),
Q1_immigration = draw_likert(x = ideology, min = -5, max = 5, bins = 7),
Q2_defence = draw_likert(x = ideology + 0.5, min = -5, max = 5, bins = 7),
treatment = draw_binary(0.5, N = N),
proposition_vote = draw_binary(latent = ideology + 1.2 * treatment, link = "probit")
)
head(voters) ID group_id ideology ideological_label Q1_immigration Q2_defence
1 0001 1 -3.1214379 Very Conservative 2 2
2 0002 2 0.5875727 Liberal 4 5
3 0003 3 1.2026365 Very Liberal 5 5
4 0004 4 -1.0366495 Very Conservative 3 4
5 0005 5 0.2787654 Liberal 4 5
6 0006 6 -0.1366222 Conservative 4 4
treatment proposition_vote
1 1 0
2 1 1
3 0 1
4 0 0
5 0 0
6 0 1