# Spatially weighted multilevel analysis, with resampled individual
# level indicators and precise contextual indicator. Predicting collective
#guilt acceptance.
# load individual level data, remove collective guilt assignment for the
#data frame, and remove NA's
data(traces_ind)
traces_ind <- traces_ind[,-7]
traces_ind <- na.exclude(traces_ind)
# load precise contextual indicator
data(homog_census)
# load distance matrix and create weights
data(d_geo)
geow_100 <- WeightMatrix(d_geo, bandwidth=100)
# perform ResampleExactSpawML
acc_homog00_100 <- ResampleExactSpawML(individual.level.data=traces_ind,
contextual.names="Homog_00", context.id="area", formula=cg_acc ~
victim_d + comb_d + male + age_1990 + high_school + higher_edu +
(1|area), precise.data=homog_census,
contextual.weight.matrices=geow_100, nb.resamples=10)Run the code above in your browser using DataLab