#### ResampleExploreSpawML
# Exploratory spatially weighted multilevel analysis, with resampled
# both individual level indicators and contextual predictors for
# aggregation. Accepts only one contextual predictor. Predicting
# collective guilt acceptance. Contextual predictor weighted with
# geographical proximity weights, h=50,100,200.
# 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 contextual indicator for aggregation
data(traces_event)
# load distance matrix
data(d_geo)
acc_homog <- ResampleExploreSpawML(individual.level.data=traces_ind,
contextual.name="w_all", contextual.data=traces_event,
context.id="area", nb.resamples=5,formula=cg_acc ~ victim_d + comb_d +
male + age_1990 + high_school + higher_edu + (1|area),
distance.matrix=d_geo, multilevel.bandwidths=c(50,100,200))Run the code above in your browser using DataLab