INEQ = read.csv("INEQ_22.csv",
header = TRUE,
dec = ".")
library(ggplot2)
library(gridExtra)
library(lattice)
library(lme4)
## Loading required package: Matrix
library(arm)
## Loading required package: MASS
##
## arm (Version 1.12-2, built: 2021-10-15)
## Working directory is C:/Users/jc486457/Documents/PhD Thesis/EQUALITY R/R equality cris/Equality paper cris
library(scales)
##
## Attaching package: 'scales'
## The following object is masked from 'package:arm':
##
## rescale
library(DHARMa)
## This is DHARMa 0.4.5. For overview type '?DHARMa'. For recent changes, type news(package = 'DHARMa')
library(insight)
## Warning: package 'insight' was built under R version 4.1.3
##
## Attaching package: 'insight'
## The following object is masked from 'package:arm':
##
## display
#library(parameters)
library(performance)
##
## Attaching package: 'performance'
##
## The following object is masked from 'package:arm':
##
## display
#library(sjPlot)
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.1.3
## -- Attaching packages --------------------------------------- tidyverse 1.3.2 --
## v tibble 3.1.6 v dplyr 1.0.8
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## v purrr 0.3.4
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x readr::col_factor() masks scales::col_factor()
## x dplyr::combine() masks gridExtra::combine()
## x purrr::discard() masks scales::discard()
## x tidyr::expand() masks Matrix::expand()
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## x tidyr::pack() masks Matrix::pack()
## x dplyr::select() masks MASS::select()
## x tidyr::unpack() masks Matrix::unpack()
library(graphics)
library(vcd)
## Loading required package: grid
#library(ggstatsplot)
library(dplyr)
library(ggpubr)
library(MuMIn)
##
## Attaching package: 'MuMIn'
##
## The following object is masked from 'package:insight':
##
## get_call
##
## The following object is masked from 'package:arm':
##
## coefplot
library(car)
## Loading required package: carData
##
## Attaching package: 'car'
##
## The following object is masked from 'package:dplyr':
##
## recode
##
## The following object is masked from 'package:purrr':
##
## some
##
## The following object is masked from 'package:arm':
##
## logit
Meaning of variables:
site = community
OrgEffLivelihood = Impact on individual livelihoods. 5 point Likert scale
OrgEffComm = Impact on community. 5 point Likert scale
yrseducation = years of education
migrant = being a migrant or not
marlivprim = fishing is a primary livelihood
occdiv = occupational diversity
mslall = wealth, material life style
trustleaders = trust in leaders
decispart = level of participation in decision-making processes
CommEvent = participation in community events
popn = population size
distmktreg = distance to markets
regr = presence or absence of gear restrictions
regg = presence or absence of acess restrictions
rega = presence or absence of area restriction
clearboundaries = presence or absence of clear boundaries
confmechinter = conflict resolution mechanisms
GradSanctions = presence or absence of graduated sanctions
Eliminate don’t knows and NAs from OrgEffLivelihood and OrgEffComm.
str(INEQ$OrgEffLivelihood)
## int [1:1191] 3 4 3 4 3 5 2 4 1 4 ...
INEQ$OrgEffLivelihood_cat<-as.factor(INEQ$OrgEffLivelihood)
str(INEQ$OrgEffComm)
## int [1:1191] 1 5 1 3 5 4 1 4 2 4 ...
INEQ$OrgEffComm_cat<-as.factor(INEQ$OrgEffComm)
ggplot(INEQ,aes(OrgEffLivelihood_cat))+geom_bar()#there are more than 150 don't knows
ggplot(INEQ,aes(OrgEffComm_cat))+geom_bar()#there are less than 200 don't knows
#eliminate don't knows
INEQ <- INEQ[INEQ$OrgEffLivelihood!=0,]
INEQ <- INEQ[INEQ$OrgEffComm!=0,]
#eliminate NAs
which(is.na(INEQ$OrgEffLivelihood))
## [1] 847 858 882 895 904 906 927 960
INEQ<-INEQ[-c(847, 858, 882, 895, 904, 906, 927, 960),]
which(is.na(INEQ$OrgEffComm))
## integer(0)
colSums(is.na(INEQ))
## dbid sampleid datatype
## 0 0 0
## country site OrgEffLivelihood
## 0 0 0
## OrgEffComm sex yrseducation
## 0 0 1
## migrant marlivprim occdiv
## 1 0 0
## mslall trustleaders decispart
## 0 1 2
## CommEvent popn distmktreg
## 35 0 0
## regr regg rega
## 0 0 0
## clearboundaries confmechinter GradSanctions
## 0 0 0
## OrgEffLivelihood_cat OrgEffComm_cat
## 0 0
dim(INEQ)#968
## [1] 968 26
In this script disparity = inequality
Disparity 1 (Objective disparity) = (how the individual think he/she benefits from co-management) - (average of how individuals think they benefit from co-management)
# Inequality1 (or Disparity 1) = OrgEffLivelihood - average at
#community level of all OrgEffLivelihood
avgeffliv.table <- setNames(aggregate(as.numeric(INEQ$OrgEffLivelihood)~INEQ$site,FUN=mean),
c("site","avgeffliv"))#table with averages of how individual think they benefit
#per site ("objective measure" of how the community benefits)
INEQ.outcomes <- merge(INEQ,avgeffliv.table, by = intersect("site", "site"),
all=FALSE) #average has been added to the data frame INEQ
INEQ.outcomes$Inequality1_rec = as.numeric(INEQ.outcomes$OrgEffLivelihood) -
as.numeric(INEQ.outcomes$avgeffliv)
Disparity 2 (Subjective disparity, or perceived disparity) = (how the individual think he/she benefits from co-management) - (how the individual thinks the community benefits)
# Calculate Inequality2 (or Disparity 2) =(OrgEffLivelihood - OrgEffComm)
INEQ.outcomes$Inequality2_rec = as.numeric(INEQ.outcomes$OrgEffLivelihood) -
as.numeric(INEQ.outcomes$OrgEffComm)
# check distribution of new response variables
par(mfrow = c(1,2),mar=c(2,2,2,2))
hist(INEQ.outcomes$Inequality1_rec,main="Inequality1 (recalculated)",
breaks = c(-5,-4,-3,-2,-1,0,1,2,3,4,5))
hist(INEQ.outcomes$Inequality2_rec,main="Inequality2 (recalculated)",
breaks = c(-5,-4,-3,-2,-1,0,1,2,3,4,5))
INEQ=INEQ.outcomes
### Split Disparity1 data into losses (-5 to 0) and gains (0 to 5)
# 1. Create binary variable: 0 for equal, 1 for any disparity
INEQ$Ineq1_bin <- as.integer(ifelse(INEQ$Inequality1_rec < 0.5 & INEQ$Inequality1_rec > -0.5,0,1)
)#transform to 0 values between 0.5 and -0.5 (equality), transform to 1 the rest
#2. Create categorical variable with type of disparity: "equal", "loss", "gain"
INEQ$Ineq1_bintype <- as.factor(ifelse(INEQ$Inequality1_rec < -0.5,"loss",
ifelse(INEQ$Inequality1_rec>0.5,"gain","equal")))
### Split Disparity2 data into losses (-5 to 0) and gains (0 to 5)
# 1. Create binary variable: 0 for equal, 1 for any disparity
INEQ$Ineq2_bin <- as.integer(ifelse(INEQ$Inequality2_rec == 0,0,1))
# 2. Create categorical variable with type of disparity: "equal", "loss", "gain"
INEQ$Ineq2_bintype <- as.factor(ifelse(INEQ$Inequality2_rec < 0,"loss",
ifelse(INEQ$Inequality2_rec>0,"gain","equal")))
which(is.na(INEQ$trustleaders))
## [1] 597
INEQ<-INEQ[-c(597),]#eliminate NAs
INEQ <- INEQ[INEQ$trustleaders!=0,] #Eliminate don't knows
which(is.na(INEQ$ yrseducation))
## [1] 906
INEQ<-INEQ[-c(906),] #eliminate NAs
which(is.na(INEQ$migrant))
## [1] 913
INEQ<-INEQ[-c(913),] #eliminate NAs
which(is.na(INEQ$ decispart ))
## [1] 237 485
INEQ<-INEQ[-c(237,485),] #eliminate NAs
colSums(is.na(INEQ))
## site dbid sampleid
## 0 0 0
## datatype country OrgEffLivelihood
## 0 0 0
## OrgEffComm sex yrseducation
## 0 0 0
## migrant marlivprim occdiv
## 0 0 0
## mslall trustleaders decispart
## 0 0 0
## CommEvent popn distmktreg
## 34 0 0
## regr regg rega
## 0 0 0
## clearboundaries confmechinter GradSanctions
## 0 0 0
## OrgEffLivelihood_cat OrgEffComm_cat avgeffliv
## 0 0 0
## Inequality1_rec Inequality2_rec Ineq1_bin
## 0 0 0
## Ineq1_bintype Ineq2_bin Ineq2_bintype
## 0 0 0
colSums(is.na(INEQ))
## site dbid sampleid
## 0 0 0
## datatype country OrgEffLivelihood
## 0 0 0
## OrgEffComm sex yrseducation
## 0 0 0
## migrant marlivprim occdiv
## 0 0 0
## mslall trustleaders decispart
## 0 0 0
## CommEvent popn distmktreg
## 34 0 0
## regr regg rega
## 0 0 0
## clearboundaries confmechinter GradSanctions
## 0 0 0
## OrgEffLivelihood_cat OrgEffComm_cat avgeffliv
## 0 0 0
## Inequality1_rec Inequality2_rec Ineq1_bin
## 0 0 0
## Ineq1_bintype Ineq2_bin Ineq2_bintype
## 0 0 0
dim(INEQ)#955
## [1] 955 33
#oultiers community events
boxplot(INEQ$CommEvent, plot=FALSE)$out #Identify the outliers
## [1] 2.648649 2.648649 3.027027 2.648649 3.205212 4.273616 3.154102
## [8] 5.933763 2.736925 2.736925 4.273616 5.128339 3.205212 2.991531
## [15] 2.564169 10.684039 4.273616 10.684039 3.154102 4.352661 3.091020
## [22] 2.523282 3.154102 2.775610 3.154102 3.154102 3.193079 3.154102
## [29] 2.564169 3.205212 2.564169 2.736925 18.918919 2.648649 3.027027
## [36] 2.736925 2.736925 2.736925 2.554463 2.736925 3.154102 2.523282
## [43] 3.154102 2.964856 2.523282 3.154102 2.736925 2.736925 2.736925
## [50] 2.777850 4.747010 2.564169
hist(INEQ$CommEvent)
which(is.na(INEQ$ CommEvent )) #Identify NAs in community events
## [1] 99 207 210 213 214 215 217 218 220 231 250 257 379 403 404 406 408 409 410
## [20] 413 454 501 549 607 610 623 669 670 672 677 795 852 949 954
INEQ<-INEQ[-c(99, 207, 210, 213, 214, 215, 217, 218, 220, 231, 250, 257, 379, 403, 404,
406, 408, 409, 410, 413, 454, 501, 549, 607, 610, 623, 669, 670, 672, 677,
795, 852, 949, 954),] #eliminate NAs
colSums(is.na(INEQ))
## site dbid sampleid
## 0 0 0
## datatype country OrgEffLivelihood
## 0 0 0
## OrgEffComm sex yrseducation
## 0 0 0
## migrant marlivprim occdiv
## 0 0 0
## mslall trustleaders decispart
## 0 0 0
## CommEvent popn distmktreg
## 0 0 0
## regr regg rega
## 0 0 0
## clearboundaries confmechinter GradSanctions
## 0 0 0
## OrgEffLivelihood_cat OrgEffComm_cat avgeffliv
## 0 0 0
## Inequality1_rec Inequality2_rec Ineq1_bin
## 0 0 0
## Ineq1_bintype Ineq2_bin Ineq2_bintype
## 0 0 0
INEQ<-subset(INEQ,CommEvent<18)#Eliminate this outlier. It is an error
dim(INEQ)#920
## [1] 920 33
which(is.na(INEQ$ CommEvent ))
## integer(0)
Define factors
INEQ$decispart_cat <- as.factor(INEQ$decispart)
INEQ$sex_cat<-as.factor(INEQ$sex)
INEQ$site_cat<-as.factor(INEQ$site)
INEQ$migrant_cat<-as.factor(INEQ$migrant)
INEQ$marlivprim_cat<-as.factor(INEQ$marlivprim)
INEQ$regr_cat<-as.factor(INEQ$regr)
INEQ$regg_cat<-as.factor(INEQ$regg)
INEQ$rega_cat<-as.factor(INEQ$rega)
INEQ$GradSanctions_cat<-as.factor(INEQ$GradSanctions)
INEQ$clearboundaries_cat<-as.factor(INEQ$clearboundaries)
Standardize predictors
#continuous
#standardize (2sd)
INEQ$distmktreg_sd<-scale(INEQ$distmktreg)*0.5
INEQ$popn_sd<-scale(INEQ$popn)*0.5
INEQ$yrseducation_sd<-scale(INEQ$yrseducation)*0.5
INEQ$mslall_sd<-scale(INEQ$mslall)*0.5
INEQ$occdiv_sd<-scale(INEQ$occdiv)*0.5
INEQ$CommEvent_sd<-scale(INEQ$CommEvent)*0.5
INEQ$trustleaders_sd<-scale(INEQ$trustleaders)*0.5
INEQ$confmechinter_sd<-scale(INEQ$confmechinter)*0.5
Split initial INEQ data set into 4 data sets that will be used in the models: losses and gains for Inequality 1 (actual) and Inequality 2 (perceived) The 4 data sets are: 1) INEQ_loss1 (for objective losses) 2) INEQ_gain1 (for objective gains) 3) INEQ_loss2 (for subjective losses) 4) INEQ_gain2 (for subjective gains)
# LOSSES 1 (actual/objective): table containing only data for losses
#and equality for Inequality1 (disparity 1)
INEQ_loss1 <- INEQ[INEQ$Ineq1_bintype %in% c("loss","equal"),]
INEQ_loss1$site <- factor(INEQ_loss1$site)
INEQ_loss1$country <- factor(INEQ_loss1$country)
# GAINS 1 (actual): table containing only data for gains
#and equality for Inequality1 (disparity 1)
INEQ_gain1 <- INEQ[INEQ$Ineq1_bintype %in% c("gain","equal"),]
INEQ_gain1$site <- factor(INEQ_gain1$site)
INEQ_gain1$country <- factor(INEQ_gain1$country)
# LOSSES 2 (perceived): table containing only data for losses
#and equality for Inequality2 (disparity 2)
INEQ_loss2 <- INEQ[INEQ$Ineq2_bintype %in% c("loss","equal"),]
INEQ_loss2$site <- factor(INEQ_loss2$site)
INEQ_loss2$country <- factor(INEQ_loss2$country)
# GAINS 2 (perceived): table containing only data for gains
#and equality for Inequality2 (disparity 2)
INEQ_gain2 <- INEQ[INEQ$Ineq2_bintype %in% c("gain","equal"),]
INEQ_gain2$site <- factor(INEQ_gain2$site)
INEQ_gain2$country <- factor(INEQ_gain2$country)
Define the global model
M.loss1_global.model<-glmer(Ineq1_bin ~ migrant_cat+ sex_cat + yrseducation_sd +
trustleaders_sd +decispart_cat + marlivprim_cat +
mslall_sd + occdiv_sd + CommEvent_sd+
popn_sd + distmktreg_sd + regr_cat + regg_cat + rega_cat +
clearboundaries_cat + confmechinter_sd + GradSanctions_cat +(1 | site_cat),
data = INEQ_loss1,family=binomial(link = "logit"), na.action='na.fail',
control = glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=1000000)))
summary(M.loss1_global.model)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## Ineq1_bin ~ migrant_cat + sex_cat + yrseducation_sd + trustleaders_sd +
## decispart_cat + marlivprim_cat + mslall_sd + occdiv_sd +
## CommEvent_sd + popn_sd + distmktreg_sd + regr_cat + regg_cat +
## rega_cat + clearboundaries_cat + confmechinter_sd + GradSanctions_cat +
## (1 | site_cat)
## Data: INEQ_loss1
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+06))
##
## AIC BIC logLik deviance df.resid
## 790.7 880.8 -375.3 750.7 650
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.7786 -0.6043 -0.3383 0.7261 3.0061
##
## Random effects:
## Groups Name Variance Std.Dev.
## site_cat (Intercept) 1.695 1.302
## Number of obs: 670, groups: site_cat, 47
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.001068 0.840220 -0.001 0.998985
## migrant_cat1 0.277207 0.412852 0.671 0.501938
## sex_catM -0.175309 0.476396 -0.368 0.712880
## yrseducation_sd -0.030168 0.217163 -0.139 0.889516
## trustleaders_sd 0.279245 0.204582 1.365 0.172267
## decispart_cat1 -0.786738 0.297836 -2.642 0.008254 **
## decispart_cat2 -1.016430 0.275585 -3.688 0.000226 ***
## marlivprim_cat1 -0.485853 0.287127 -1.692 0.090624 .
## mslall_sd -0.151454 0.347532 -0.436 0.662983
## occdiv_sd -0.171685 0.281999 -0.609 0.542647
## CommEvent_sd 0.484582 0.227075 2.134 0.032841 *
## popn_sd -1.178851 0.591258 -1.994 0.046174 *
## distmktreg_sd 0.320699 0.409207 0.784 0.433211
## regr_cat1 -2.139454 0.675588 -3.167 0.001541 **
## regg_cat1 1.204969 0.709896 1.697 0.089623 .
## rega_cat1 0.392067 0.569423 0.689 0.491117
## clearboundaries_cat1 -0.297213 0.514986 -0.577 0.563852
## confmechinter_sd 0.488268 0.485464 1.006 0.314523
## GradSanctions_cat1 0.663163 0.536663 1.236 0.216564
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 19 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
vif(M.loss1_global.model)
## GVIF Df GVIF^(1/(2*Df))
## migrant_cat 1.058065 1 1.028623
## sex_cat 1.047986 1 1.023712
## yrseducation_sd 1.062701 1 1.030874
## trustleaders_sd 1.041249 1 1.020416
## decispart_cat 1.103221 2 1.024863
## marlivprim_cat 1.107630 1 1.052440
## mslall_sd 1.285081 1 1.133614
## occdiv_sd 1.160308 1 1.077176
## CommEvent_sd 1.045756 1 1.022622
## popn_sd 1.432817 1 1.197003
## distmktreg_sd 1.241261 1 1.114119
## regr_cat 1.355431 1 1.164230
## regg_cat 1.843736 1 1.357843
## rega_cat 1.589977 1 1.260943
## clearboundaries_cat 1.292948 1 1.137079
## confmechinter_sd 1.138007 1 1.066774
## GradSanctions_cat 1.362081 1 1.167082
We can conclude there is not multicollinearity
check_overdispersion(M.loss1_global.model)
## # Overdispersion test
##
## dispersion ratio = 0.835
## Pearson's Chi-Squared = 542.564
## p-value = 0.999
## No overdispersion detected.
check_singularity(M.loss1_global.model)#singularity is fine
## [1] FALSE
check_convergence(M.loss1_global.model)#convergence is fine
## [1] TRUE
## attr(,"gradient")
## [1] 3.129966e-06
Dharma residuals
resid.loss1=simulateResiduals(M.loss1_global.model, plot=TRUE)
#loss1.dredge<-dredge(global.model = M.loss1_global.model, trace = TRUE)#This line of code was
#run on the HPC of James Cook University. It will take a long time to run.
#Consider running this code in your own computer.
Load dredge output
loss1.2_dredge_sd<-readRDS(file="loss1.2.dredge.sd.rds")
Model average
loss1.average_sd<-summary(model.avg(loss1.2_dredge_sd, subset = delta <= 2))
loss1.average_sd
##
## Call:
## model.avg(object = loss1.2_dredge_sd, subset = delta <= 2)
##
## Component model call:
## glmer(formula = Ineq1_bin ~ <26 unique rhs>, data = INEQ_loss1, family
## = binomial(link = "logit"), control = glmerControl(optimizer =
## "bobyqa", optCtrl = list(maxfun = 1e+06)), na.action = na.fail)
##
## Component models:
## df logLik AICc delta weight
## 1+5+7+10+12+13 9 -378.93 776.13 0.00 0.07
## 1+5+7+10+12+13+14 10 -377.95 776.23 0.10 0.07
## 1+3+5+7+10+12+13 10 -378.15 776.64 0.51 0.05
## 1+5+10+12+13 8 -380.23 776.68 0.55 0.05
## 1+3+5+7+10+12+13+14 11 -377.19 776.77 0.64 0.05
## 1+2+5+7+10+12+13 10 -378.28 776.90 0.77 0.05
## 1+5+10+12+13+14 9 -379.32 776.91 0.78 0.05
## 1+2+5+7+10+12+13+14 11 -377.31 777.01 0.88 0.04
## 1+3+5+10+12+13 9 -379.48 777.23 1.10 0.04
## 1+2+5+10+12+13 9 -379.58 777.42 1.29 0.04
## 1+4+5+7+10+12+13 10 -378.54 777.42 1.29 0.04
## 1+3+5+10+12+13+14 10 -378.58 777.50 1.37 0.03
## 1+4+5+7+10+12+13+14 11 -377.56 777.52 1.39 0.03
## 1+5+6+7+10+12+13 10 -378.65 777.63 1.50 0.03
## 1+5+7+9+10+12+13 10 -378.67 777.67 1.54 0.03
## 1+2+5+10+12+13+14 10 -378.67 777.67 1.54 0.03
## 1+5+6+7+10+12+13+14 11 -377.66 777.72 1.59 0.03
## 1+4+5+10+12+13 9 -379.74 777.75 1.62 0.03
## 1+2+3+5+7+10+12+13 11 -377.68 777.77 1.64 0.03
## 1+5+7+9+10+12+13+14 11 -377.69 777.79 1.66 0.03
## 1+5+7+8+10+12+13 10 -378.74 777.81 1.68 0.03
## 1+2+3+5+7+10+12+13+14 12 -376.72 777.92 1.79 0.03
## 1+5+7+10+11+12+13 10 -378.81 777.95 1.82 0.03
## 1+4+5+10+12+13+14 10 -378.82 777.98 1.85 0.03
## 1+5+7+8+10+12+13+14 11 -377.80 778.00 1.87 0.03
## 1+5+7+10+11+12+13+14 11 -377.85 778.10 1.97 0.03
##
## Term codes:
## CommEvent_sd GradSanctions_cat clearboundaries_cat confmechinter_sd
## 1 2 3 4
## decispart_cat distmktreg_sd marlivprim_cat migrant_cat
## 5 6 7 8
## occdiv_sd popn_sd rega_cat regg_cat
## 9 10 11 12
## regr_cat trustleaders_sd
## 13 14
##
## Model-averaged coefficients:
## (full average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.13451 0.64156 0.64256 0.209 0.834187
## CommEvent_sd 0.47091 0.22903 0.22945 2.052 0.040132 *
## decispart_cat1 -0.77252 0.29560 0.29614 2.609 0.009090 **
## decispart_cat2 -1.03338 0.27345 0.27394 3.772 0.000162 ***
## marlivprim_cat1 -0.32350 0.31638 0.31670 1.021 0.307023
## popn_sd -1.27897 0.59014 0.59120 2.163 0.030516 *
## regg_cat1 1.63410 0.64311 0.64426 2.536 0.011200 *
## regr_cat1 -2.18065 0.66817 0.66939 3.258 0.001123 **
## trustleaders_sd 0.13872 0.20432 0.20451 0.678 0.497581
## clearboundaries_cat1 -0.13806 0.33940 0.33969 0.406 0.684431
## GradSanctions_cat1 0.12434 0.33592 0.33623 0.370 0.711533
## confmechinter_sd 0.05932 0.23438 0.23462 0.253 0.800380
## distmktreg_sd 0.01909 0.12325 0.12340 0.155 0.877038
## occdiv_sd -0.01315 0.08824 0.08835 0.149 0.881688
## migrant_cat1 0.01358 0.11171 0.11186 0.121 0.903396
## rega_cat1 0.01371 0.13835 0.13856 0.099 0.921196
##
## (conditional average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.1345 0.6416 0.6426 0.209 0.834187
## CommEvent_sd 0.4709 0.2290 0.2294 2.052 0.040132 *
## decispart_cat1 -0.7725 0.2956 0.2961 2.609 0.009090 **
## decispart_cat2 -1.0334 0.2734 0.2739 3.772 0.000162 ***
## marlivprim_cat1 -0.4631 0.2804 0.2810 1.648 0.099300 .
## popn_sd -1.2790 0.5901 0.5912 2.163 0.030516 *
## regg_cat1 1.6341 0.6431 0.6443 2.536 0.011200 *
## regr_cat1 -2.1807 0.6682 0.6694 3.258 0.001123 **
## trustleaders_sd 0.2888 0.2087 0.2091 1.381 0.167273
## clearboundaries_cat1 -0.5802 0.4770 0.4779 1.214 0.224757
## GradSanctions_cat1 0.5670 0.5134 0.5143 1.102 0.270322
## confmechinter_sd 0.4587 0.4915 0.4924 0.932 0.351549
## distmktreg_sd 0.2981 0.3924 0.3932 0.758 0.448317
## occdiv_sd -0.2106 0.2883 0.2889 0.729 0.465945
## migrant_cat1 0.2375 0.4064 0.4071 0.584 0.559545
## rega_cat1 0.2550 0.5427 0.5437 0.469 0.639047
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Relative influence
sw(loss1.average_sd)#Sum of model weights over all models including each explanatory variable.
## CommEvent_sd decispart_cat popn_sd regg_cat regr_cat
## Sum of weights: 1.00 1.00 1.00 1.00 1.00
## N containing models: 26 26 26 26 26
## marlivprim_cat trustleaders_sd clearboundaries_cat
## Sum of weights: 0.70 0.48 0.24
## N containing models: 18 13 6
## GradSanctions_cat confmechinter_sd distmktreg_sd occdiv_sd
## Sum of weights: 0.22 0.13 0.06 0.06
## N containing models: 6 4 2 2
## migrant_cat rega_cat
## Sum of weights: 0.06 0.05
## N containing models: 2 2
Confident intervals of the full model
confint(loss1.average_sd,full=T,level=0.9) #full model averages
## 5 % 95 %
## (Intercept) -1.19104579 0.9220230
## CommEvent_sd 0.09366994 0.8481576
## decispart_cat1 -1.25942311 -0.2856242
## decispart_cat2 -1.48377739 -0.5829792
## marlivprim_cat1 -0.84430315 0.1972955
## popn_sd -2.25099543 -0.3069369
## regg_cat1 0.57483656 2.6933723
## regr_cat1 -3.28123020 -1.0800713
## trustleaders_sd -0.19759915 0.4750408
## clearboundaries_cat1 -0.69668887 0.4205711
## GradSanctions_cat1 -0.42859548 0.6772734
## confmechinter_sd -0.32649574 0.4451454
## distmktreg_sd -0.18381953 0.2220044
## occdiv_sd -0.15842986 0.1321318
## migrant_cat1 -0.17035806 0.1975117
## rega_cat1 -0.21411910 0.2415335
ma.loss1<-summary(loss1.average_sd)#pulling out model averages
df.loss1<-as.data.frame(ma.loss1$coefmat.full)#selecting full model coefficient averages
CI<-as.data.frame(confint(loss1.average_sd,level=0.9,full=T))# to get confident intervals
#for full model
CI
## 5 % 95 %
## (Intercept) -1.19104579 0.9220230
## CommEvent_sd 0.09366994 0.8481576
## decispart_cat1 -1.25942311 -0.2856242
## decispart_cat2 -1.48377739 -0.5829792
## marlivprim_cat1 -0.84430315 0.1972955
## popn_sd -2.25099543 -0.3069369
## regg_cat1 0.57483656 2.6933723
## regr_cat1 -3.28123020 -1.0800713
## trustleaders_sd -0.19759915 0.4750408
## clearboundaries_cat1 -0.69668887 0.4205711
## GradSanctions_cat1 -0.42859548 0.6772734
## confmechinter_sd -0.32649574 0.4451454
## distmktreg_sd -0.18381953 0.2220044
## occdiv_sd -0.15842986 0.1321318
## migrant_cat1 -0.17035806 0.1975117
## rega_cat1 -0.21411910 0.2415335
df.loss1$CI.min <-CI$`5 %` #pulling out CIs and putting into same df as coefficient estimates
df.loss1$CI.max <-CI$`95 %`
library('data.table')
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
##
## between, first, last
## The following object is masked from 'package:purrr':
##
## transpose
df.loss1
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.13451139 0.64155579 0.64256424 0.20933532 0.8341865
## CommEvent_sd 0.47091376 0.22902640 0.22944669 2.05238854 0.0401319
## decispart_cat1 -0.77252365 0.29560354 0.29613984 2.60864476 0.0090902
## decispart_cat2 -1.03337830 0.27344687 0.27393876 3.77229674 0.0001618
## marlivprim_cat1 -0.32350384 0.31637982 0.31669836 1.02148885 0.3070229
## popn_sd -1.27896617 0.59013595 0.59120236 2.16333063 0.0305158
## regg_cat1 1.63410445 0.64310565 0.64426044 2.53640353 0.0111998
## regr_cat1 -2.18065075 0.66817069 0.66939162 3.25766067 0.0011233
## trustleaders_sd 0.13872083 0.20432398 0.20451229 0.67830074 0.4975810
## clearboundaries_cat1 -0.13805888 0.33939933 0.33969161 0.40642417 0.6844310
## GradSanctions_cat1 0.12433897 0.33591963 0.33623420 0.36979869 0.7115325
## confmechinter_sd 0.05932481 0.23437528 0.23461967 0.25285524 0.8003801
## distmktreg_sd 0.01909246 0.12324913 0.12339631 0.15472469 0.8770384
## occdiv_sd -0.01314904 0.08824171 0.08834988 0.14882914 0.8816885
## migrant_cat1 0.01357684 0.11170575 0.11186094 0.12137247 0.9033960
## rega_cat1 0.01370718 0.13834763 0.13855796 0.09892738 0.9211959
## CI.min CI.max
## (Intercept) -1.19104579 0.9220230
## CommEvent_sd 0.09366994 0.8481576
## decispart_cat1 -1.25942311 -0.2856242
## decispart_cat2 -1.48377739 -0.5829792
## marlivprim_cat1 -0.84430315 0.1972955
## popn_sd -2.25099543 -0.3069369
## regg_cat1 0.57483656 2.6933723
## regr_cat1 -3.28123020 -1.0800713
## trustleaders_sd -0.19759915 0.4750408
## clearboundaries_cat1 -0.69668887 0.4205711
## GradSanctions_cat1 -0.42859548 0.6772734
## confmechinter_sd -0.32649574 0.4451454
## distmktreg_sd -0.18381953 0.2220044
## occdiv_sd -0.15842986 0.1321318
## migrant_cat1 -0.17035806 0.1975117
## rega_cat1 -0.21411910 0.2415335
setDT(df.loss1, keep.rownames='coefficient')#put row names into columns
names(df.loss1) <- gsub(" ",'',names(df.loss1))#remove spaces from column headers
Plot standardized effects
ggplot(data=df.loss1, aes(x=coefficient, y=Estimate))+
geom_hline(yintercept=0, color='grey', linetype='dashed', lwd=1)+
geom_errorbar(aes(ymin=Estimate-Std.Error, ymax=Estimate+Std.Error), colour="pink",#SE
width=.1, lwd=1)+
coord_flip()+
geom_point(size=3)+theme_classic(base_size=20)+xlab("")+
geom_errorbar(aes(ymin=CI.min, ymax=CI.max), colour="blue", # CIs
width=.2,lwd=1)
Define global model
M.gains1_global.model<-glmer(Ineq1_bin ~ migrant_cat+ sex_cat + yrseducation_sd +
trustleaders_sd + decispart_cat + marlivprim_cat + mslall_sd + occdiv_sd + CommEvent_sd+
popn_sd + distmktreg_sd + regr_cat + regg_cat + rega_cat +
clearboundaries_cat + confmechinter_sd + GradSanctions_cat +(1 | site_cat),
data = INEQ_gain1,family=binomial(link = "logit"), na.action='na.fail',
control = glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=1000000)))
summary(M.gains1_global.model)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## Ineq1_bin ~ migrant_cat + sex_cat + yrseducation_sd + trustleaders_sd +
## decispart_cat + marlivprim_cat + mslall_sd + occdiv_sd +
## CommEvent_sd + popn_sd + distmktreg_sd + regr_cat + regg_cat +
## rega_cat + clearboundaries_cat + confmechinter_sd + GradSanctions_cat +
## (1 | site_cat)
## Data: INEQ_gain1
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+06))
##
## AIC BIC logLik deviance df.resid
## 724.0 814.1 -342.0 684.0 651
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0320 -0.5639 -0.1804 0.5585 2.9540
##
## Random effects:
## Groups Name Variance Std.Dev.
## site_cat (Intercept) 3.713 1.927
## Number of obs: 671, groups: site_cat, 47
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.80617 1.06821 -0.755 0.4504
## migrant_cat1 -0.11685 0.43052 -0.271 0.7861
## sex_catM -0.42489 0.51688 -0.822 0.4111
## yrseducation_sd 0.10765 0.22925 0.470 0.6387
## trustleaders_sd 0.36568 0.23111 1.582 0.1136
## decispart_cat1 0.07891 0.31043 0.254 0.7993
## decispart_cat2 -0.30516 0.29983 -1.018 0.3088
## marlivprim_cat1 -0.29669 0.31637 -0.938 0.3483
## mslall_sd 0.27085 0.34773 0.779 0.4360
## occdiv_sd 0.20746 0.29765 0.697 0.4858
## CommEvent_sd -0.16413 0.25176 -0.652 0.5144
## popn_sd -0.82336 0.80211 -1.026 0.3047
## distmktreg_sd 0.50535 0.56425 0.896 0.3705
## regr_cat1 -1.69247 0.86598 -1.954 0.0507 .
## regg_cat1 0.78121 0.95756 0.816 0.4146
## rega_cat1 0.69590 0.76365 0.911 0.3621
## clearboundaries_cat1 0.03733 0.69756 0.054 0.9573
## confmechinter_sd 0.96005 0.67999 1.412 0.1580
## GradSanctions_cat1 0.95870 0.72695 1.319 0.1872
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 19 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
check_overdispersion(M.gains1_global.model)
## # Overdispersion test
##
## dispersion ratio = 0.750
## Pearson's Chi-Squared = 488.179
## p-value = 1
## No overdispersion detected.
check_singularity(M.gains1_global.model)
## [1] FALSE
check_convergence(M.gains1_global.model)
## [1] TRUE
## attr(,"gradient")
## [1] 6.824324e-06
resid.gains1=simulateResiduals(M.gains1_global.model, plot=TRUE)
Although diagnostics showed minor problems with the deviation, they are known to be very sensitive with large data sets. Visually, the evaluation does not show any major problem
vif(M.gains1_global.model)
## GVIF Df GVIF^(1/(2*Df))
## migrant_cat 1.041859 1 1.020715
## sex_cat 1.026230 1 1.013030
## yrseducation_sd 1.101419 1 1.049485
## trustleaders_sd 1.039803 1 1.019707
## decispart_cat 1.105651 2 1.025426
## marlivprim_cat 1.090304 1 1.044176
## mslall_sd 1.194955 1 1.093140
## occdiv_sd 1.110375 1 1.053743
## CommEvent_sd 1.071672 1 1.035216
## popn_sd 1.273856 1 1.128652
## distmktreg_sd 1.238654 1 1.112948
## regr_cat 1.271643 1 1.127671
## regg_cat 1.733880 1 1.316769
## rega_cat 1.488955 1 1.220227
## clearboundaries_cat 1.230416 1 1.109241
## confmechinter_sd 1.105343 1 1.051353
## GradSanctions_cat 1.300527 1 1.140406
#gains1.dredge<-dredge(global.model = M.gains1_global.model, trace = TRUE)#This line of
#code was run on the HPC of James Cook University. It will take a long time to run.
#Consider running this code in your own computer.
Load dredge object
gains1.2_dredge_sd<-readRDS(file="gains1.2.dredge.sd.rds")
Model average
gains1.average_sd<-summary(model.avg(gains1.2_dredge_sd, subset = delta <= 2))
gains1.average_sd
##
## Call:
## model.avg(object = gains1.2_dredge_sd, subset = delta <= 2)
##
## Component model call:
## glmer(formula = Ineq1_bin ~ <384 unique rhs>, data = INEQ_gain1, family
## = binomial(link = "logit"), control = glmerControl(optimizer =
## "bobyqa", optCtrl = list(maxfun = 1e+06)), na.action = na.fail)
##
## Component models:
## df logLik AICc delta weight
## 2+13 4 -349.71 707.48 0.00 0.01
## 2+13+15 5 -348.70 707.50 0.02 0.01
## 2+7+13+15 6 -347.69 707.50 0.03 0.01
## 12+13+15 5 -348.71 707.51 0.03 0.01
## 4+12+13+15 6 -347.71 707.55 0.07 0.01
## 4+10+12+13+15 7 -346.70 707.57 0.09 0.00
## 4+12+13 5 -348.77 707.63 0.15 0.00
## 4+10+12+13 6 -347.77 707.67 0.19 0.00
## 12+13 4 -349.82 707.69 0.21 0.00
## 2+4+13 5 -348.83 707.75 0.27 0.00
## 10+12+13+15 6 -347.84 707.81 0.33 0.00
## 7+12+13+15 6 -347.85 707.82 0.34 0.00
## 2+7+13 5 -348.87 707.83 0.35 0.00
## 13+15 4 -349.89 707.85 0.37 0.00
## 4+13 4 -349.90 707.85 0.37 0.00
## 2+4+13+15 6 -347.87 707.87 0.39 0.00
## 13 3 -350.92 707.87 0.39 0.00
## 4+7+12+13+15 7 -346.85 707.87 0.39 0.00
## 2+4+7+13+15 7 -346.86 707.88 0.40 0.00
## 2+11+13 5 -348.90 707.90 0.42 0.00
## 7+13+15 5 -348.91 707.92 0.44 0.00
## 4+13+15 5 -348.92 707.93 0.45 0.00
## 2+15 4 -349.96 707.98 0.50 0.00
## 2+11+13+15 6 -347.93 707.98 0.51 0.00
## 4+15 4 -349.97 707.99 0.51 0.00
## 2+4 4 -349.97 708.00 0.53 0.00
## 4 3 -350.99 708.01 0.53 0.00
## 4+7+13+15 6 -347.94 708.01 0.53 0.00
## 10+12+13 5 -348.96 708.01 0.53 0.00
## 2+4+15 5 -348.96 708.02 0.54 0.00
## 2+7+11+13+15 7 -346.95 708.06 0.58 0.00
## 2 3 -351.02 708.08 0.60 0.00
## 2+4+11+13 6 -347.98 708.09 0.61 0.00
## 2+4+7+13 6 -347.99 708.11 0.63 0.00
## 2+7+15 5 -349.04 708.17 0.69 0.00
## 2+4+7+15 6 -348.04 708.21 0.73 0.00
## 15 3 -351.09 708.22 0.74 0.00
## 2+10+12+13+15 7 -347.03 708.22 0.74 0.00
## 4+7+15 5 -349.07 708.23 0.75 0.00
## 2+4+10+12+13+15 8 -346.01 708.24 0.77 0.00
## 2+4+10+12+13 7 -347.05 708.26 0.78 0.00
## 4+7+10+12+13+15 8 -346.02 708.27 0.79 0.00
## 4+7+13 5 -349.09 708.27 0.79 0.00
## 2+4+11+13+15 7 -347.05 708.27 0.80 0.00
## 4+7+12+13 6 -348.08 708.28 0.80 0.00
## 2+12+13+15 6 -348.08 708.29 0.81 0.00
## 7+13 4 -350.12 708.29 0.81 0.00
## 2+9+13+15 6 -348.09 708.31 0.83 0.00
## 2+7+11+13 6 -348.10 708.32 0.84 0.00
## 7+12+13 5 -349.12 708.33 0.86 0.00
## 2+10+12+13 6 -348.11 708.34 0.86 0.00
## 2+9+13 5 -349.13 708.34 0.87 0.00
## (Null) 2 -352.17 708.35 0.87 0.00
## 5+12+13+15 7 -347.09 708.36 0.88 0.00
## 2+4+7+11+13+15 8 -346.07 708.36 0.88 0.00
## 2+10+13 5 -349.14 708.37 0.89 0.00
## 2+12+13 5 -349.15 708.39 0.92 0.00
## 9+12+13+15 6 -348.14 708.40 0.92 0.00
## 2+4+6 5 -349.16 708.42 0.94 0.00
## 2+10+13+15 6 -348.15 708.43 0.95 0.00
## 2+5+13+15 7 -347.14 708.45 0.97 0.00
## 7+10+12+13+15 7 -347.14 708.46 0.98 0.00
## 7+15 4 -350.20 708.46 0.98 0.00
## 4+6 4 -350.20 708.46 0.98 0.00
## 4+9+12+13+15 7 -347.15 708.47 0.99 0.00
## 2+4+10+13 6 -348.18 708.48 1.00 0.00
## 2+7+12+13+15 7 -347.16 708.49 1.02 0.00
## 4+5+12+13+15 8 -346.14 708.50 1.02 0.00
## 2+4+7+11+13 7 -347.17 708.51 1.03 0.00
## 2+4+7 5 -349.22 708.52 1.05 0.00
## 2+4+6+15 6 -348.20 708.53 1.05 0.00
## 9+13+15 5 -349.22 708.53 1.05 0.00
## 4+6+15 5 -349.22 708.54 1.06 0.00
## 2+4+6+13 6 -348.21 708.54 1.06 0.00
## 2+4+12+13+15 7 -347.20 708.56 1.08 0.00
## 4+7 4 -350.26 708.57 1.09 0.00
## 2+4+12+13 6 -348.23 708.58 1.10 0.00
## 4+5+10+12+13+15 9 -345.16 708.59 1.11 0.00
## 4+9+12+13 6 -348.24 708.60 1.12 0.00
## 4+12+13+14+15 7 -347.21 708.60 1.12 0.00
## 2+7 4 -350.27 708.60 1.12 0.00
## 9+13 4 -350.28 708.61 1.13 0.00
## 2+4+6+7+15 7 -347.22 708.61 1.13 0.00
## 4+9+13 5 -349.27 708.62 1.14 0.00
## 9+12+13 5 -349.27 708.63 1.15 0.00
## 2+4+9+13 6 -348.25 708.63 1.16 0.00
## 4+9+13+15 6 -348.26 708.64 1.16 0.00
## 2+4+10+13+15 7 -347.24 708.65 1.17 0.00
## 2+7+10+13+15 7 -347.24 708.65 1.17 0.00
## 4+7+10+12+13 7 -347.24 708.65 1.17 0.00
## 8+10+12+13+15 7 -347.24 708.66 1.18 0.00
## 2+13+14+15 6 -348.27 708.66 1.18 0.00
## 2+4+6+7+13+15 8 -346.22 708.67 1.19 0.00
## 4+6+13 5 -349.29 708.67 1.19 0.00
## 4+6+7+15 6 -348.27 708.67 1.19 0.00
## 2+4+9+13+15 7 -347.26 708.69 1.21 0.00
## 12+13+14+15 6 -348.28 708.69 1.21 0.00
## 8+12+13+15 6 -348.28 708.69 1.21 0.00
## 5+13+15 6 -348.28 708.70 1.22 0.00
## 4+10+12+13+14+15 8 -346.25 708.71 1.23 0.00
## 5+10+12+13+15 8 -346.25 708.71 1.23 0.00
## 2+5+7+13+15 8 -346.25 708.72 1.24 0.00
## 1+2+7+13+15 7 -347.28 708.72 1.25 0.00
## 2+4+6+13+15 7 -347.28 708.74 1.26 0.00
## 2+13+14 5 -349.33 708.74 1.27 0.00
## 8+10+12+13 6 -348.31 708.75 1.27 0.00
## 8+12+13 5 -349.34 708.78 1.30 0.00
## 4+12+13+14 6 -348.33 708.79 1.31 0.00
## 2+9+11+13 6 -348.33 708.79 1.32 0.00
## 2+4+7+12+13+15 8 -346.29 708.79 1.32 0.00
## 2+7+10+12+13+15 8 -346.29 708.80 1.32 0.00
## 1+2+13 5 -349.36 708.81 1.33 0.00
## 2+4+6+7+13 7 -347.32 708.81 1.33 0.00
## 4+6+7+13+15 7 -347.32 708.82 1.34 0.00
## 2+9+11+13+15 7 -347.33 708.82 1.34 0.00
## 4+8+10+12+13+15 8 -346.30 708.82 1.35 0.00
## 4+6+13+15 6 -348.35 708.83 1.35 0.00
## 2+6+13 5 -349.37 708.83 1.35 0.00
## 2+4+6+7 6 -348.35 708.83 1.35 0.00
## 4+8+10+12+13 7 -347.33 708.84 1.36 0.00
## 2+6+7+13+15 7 -347.34 708.85 1.37 0.00
## 3+12+13+15 6 -348.36 708.85 1.37 0.00
## 2+7+9+13+15 7 -347.35 708.86 1.38 0.00
## 2+7+13+14+15 7 -347.35 708.87 1.39 0.00
## 2+4+7+10+12+13+15 9 -345.30 708.87 1.40 0.00
## 2+4+6+11+13 7 -347.36 708.88 1.40 0.00
## 4+5+13+15 7 -347.36 708.88 1.40 0.00
## 2+5+13 6 -348.38 708.89 1.41 0.00
## 2+10+11+13 6 -348.38 708.89 1.41 0.00
## 2+4+13+14 6 -348.38 708.89 1.42 0.00
## 2+4+7+10+13+15 8 -346.34 708.90 1.42 0.00
## 2+6+13+15 6 -348.39 708.90 1.42 0.00
## 2+4+13+14+15 7 -347.37 708.90 1.43 0.00
## 4+11+13 5 -349.41 708.91 1.43 0.00
## 4+10+12+13+14 7 -347.37 708.91 1.43 0.00
## 2+4+5+13+15 8 -346.35 708.91 1.43 0.00
## 5+7+12+13+15 8 -346.35 708.92 1.44 0.00
## 2+7+10+13 6 -348.40 708.92 1.44 0.00
## 3+12+13 5 -349.42 708.93 1.45 0.00
## 4+9+15 5 -349.42 708.93 1.45 0.00
## 7 3 -351.45 708.93 1.45 0.00
## 4+6+7 5 -349.42 708.93 1.45 0.00
## 2+4+10+11+13 7 -347.38 708.93 1.45 0.00
## 4+9+10+12+13+15 8 -346.36 708.93 1.45 0.00
## 2+7+12+13 6 -348.40 708.93 1.45 0.00
## 1+2+13+15 6 -348.40 708.93 1.45 0.00
## 2+5+15 6 -348.41 708.94 1.46 0.00
## 4+12+15 5 -349.42 708.94 1.46 0.00
## 1+12+13+15 6 -348.41 708.94 1.47 0.00
## 1+2+7+13 6 -348.41 708.95 1.47 0.00
## 2+5+11+13+15 8 -346.37 708.95 1.47 0.00
## 7+10+12+13 6 -348.42 708.96 1.48 0.00
## 4+13+14+15 6 -348.42 708.96 1.48 0.00
## 2+8+13 5 -349.44 708.96 1.48 0.00
## 4+5+15 6 -348.42 708.96 1.48 0.00
## 4+6+12+13+15 7 -347.40 708.96 1.48 0.00
## 4+6+12+13 6 -348.42 708.97 1.49 0.00
## 1+4+12+13 6 -348.42 708.97 1.49 0.00
## 12+13+14 5 -349.45 708.98 1.50 0.00
## 4+13+14 5 -349.45 708.98 1.51 0.00
## 1+4+12+13+15 7 -347.41 709.00 1.52 0.00
## 2+4+9+11+13 7 -347.42 709.00 1.52 0.00
## 4+9 4 -350.47 709.00 1.52 0.00
## 2+3+13 5 -349.46 709.01 1.53 0.00
## 13+14+15 5 -349.46 709.01 1.53 0.00
## 4+6+7+13 6 -348.44 709.01 1.53 0.00
## 2+10+11+13+15 7 -347.42 709.01 1.53 0.00
## 5+12+13 6 -348.45 709.02 1.54 0.00
## 1+12+13 5 -349.47 709.02 1.54 0.00
## 5+7+13+15 7 -347.43 709.02 1.54 0.00
## 11+13 4 -350.48 709.03 1.55 0.00
## 2+9+15 5 -349.47 709.03 1.55 0.00
## 4+11+13+15 6 -348.46 709.04 1.56 0.00
## 4+5+12+13 7 -347.44 709.04 1.56 0.00
## 3+4+12+13 6 -348.46 709.04 1.56 0.00
## 11+13+15 5 -349.48 709.05 1.57 0.00
## 2+13+16 5 -349.48 709.05 1.57 0.00
## 3+4+12+13+15 7 -347.44 709.05 1.57 0.00
## 2+8+13+15 6 -348.46 709.06 1.58 0.00
## 2+4+7+10+13 7 -347.44 709.06 1.58 0.00
## 2+4+10 5 -349.49 709.06 1.58 0.00
## 4+5+7+12+13+15 9 -345.40 709.07 1.59 0.00
## 4+9+10+12+13 7 -347.45 709.07 1.59 0.00
## 1+7+12+13+15 7 -347.45 709.07 1.59 0.00
## 4+8+12+13+15 7 -347.45 709.07 1.59 0.00
## 2+4+9+15 6 -348.47 709.07 1.59 0.00
## 4+12 4 -350.50 709.07 1.59 0.00
## 10+12+13+14+15 7 -347.45 709.08 1.60 0.00
## 2+4+5+15 7 -347.45 709.08 1.60 0.00
## 4+8+12+13 6 -348.48 709.08 1.60 0.00
## 5+15 5 -349.50 709.09 1.61 0.00
## 1+4+10+12+13 7 -347.46 709.09 1.61 0.00
## 1+4+10+12+13+15 8 -346.44 709.09 1.61 0.00
## 2+3+7+13+15 7 -347.46 709.09 1.61 0.00
## 1+2+4+13 6 -348.48 709.10 1.62 0.00
## 9+10+12+13+15 7 -347.47 709.10 1.62 0.00
## 2+3+13+15 6 -348.49 709.11 1.63 0.00
## 2+4+10+15 6 -348.49 709.11 1.63 0.00
## 2+4+9 5 -349.51 709.11 1.64 0.00
## 1+2+4+7+13+15 8 -346.45 709.12 1.64 0.00
## 2+4+9+11+13+15 8 -346.45 709.12 1.64 0.00
## 2+8 4 -350.53 709.12 1.64 0.00
## 2+6+7+13 6 -348.50 709.13 1.65 0.00
## 4+7+12+13+14+15 8 -346.46 709.13 1.65 0.00
## 2+6+15 5 -349.52 709.13 1.65 0.00
## 13+14 4 -350.54 709.13 1.65 0.00
## 2+8+15 5 -349.52 709.13 1.65 0.00
## 1+4+7+12+13+15 8 -346.46 709.13 1.65 0.00
## 2+4+7+12+13 7 -347.48 709.13 1.66 0.00
## 3+7+12+13+15 7 -347.48 709.14 1.66 0.00
## 7+8+12+13+15 7 -347.49 709.14 1.66 0.00
## 2+4+7+13+14+15 8 -346.46 709.14 1.66 0.00
## 9+15 4 -350.54 709.15 1.67 0.00
## 4+5+10+12+13 8 -346.47 709.15 1.67 0.00
## 2+4+6+11+13+15 8 -346.47 709.15 1.67 0.00
## 8+13 4 -350.55 709.15 1.67 0.00
## 2+4+6+7+11+13+15 9 -345.44 709.15 1.67 0.00
## 2+11+13+14+15 7 -347.49 709.15 1.68 0.00
## 7+9+13+15 6 -348.51 709.16 1.68 0.00
## 4+14+15 5 -349.53 709.16 1.68 0.00
## 2+4+10+11+13+15 8 -346.47 709.16 1.68 0.00
## 2+7+8+13+15 7 -347.50 709.16 1.68 0.00
## 1+2+11+13 6 -348.52 709.17 1.69 0.00
## 2+11+13+14 6 -348.52 709.17 1.69 0.00
## 2+6 4 -350.56 709.17 1.69 0.00
## 12+13+15+16 6 -348.52 709.17 1.69 0.00
## 7+11+13+15 6 -348.52 709.17 1.70 0.00
## 4+7+11+13+15 7 -347.50 709.18 1.70 0.00
## 2+9 4 -350.56 709.18 1.70 0.00
## 8+15 4 -350.56 709.18 1.70 0.00
## 2+4+7+10+12+13 8 -346.48 709.18 1.70 0.00
## 5+13 5 -349.54 709.18 1.70 0.00
## 8 3 -351.57 709.18 1.70 0.00
## 2+4+5+7+13+15 9 -345.46 709.18 1.71 0.00
## 1+7+13+15 6 -348.53 709.19 1.71 0.00
## 2+7+9+13 6 -348.53 709.19 1.71 0.00
## 7+9+12+13+15 7 -347.51 709.19 1.71 0.00
## 5+9+12+13+15 8 -346.49 709.19 1.71 0.00
## 3+13 4 -350.57 709.19 1.71 0.00
## 7+12+13+14+15 7 -347.51 709.20 1.72 0.00
## 2+5+9+13+15 8 -346.49 709.20 1.72 0.00
## 2+4+14+15 6 -348.54 709.20 1.72 0.00
## 2+13+15+16 6 -348.54 709.20 1.72 0.00
## 4+11+12+13+15 7 -347.52 709.20 1.72 0.00
## 4+5+7+13+15 8 -346.49 709.21 1.73 0.00
## 4+6+7+12+13+15 8 -346.50 709.21 1.73 0.00
## 12+13+16 5 -349.56 709.21 1.73 0.00
## 4+10+13 5 -349.56 709.21 1.73 0.00
## 1+2+7+11+13+15 8 -346.50 709.21 1.73 0.00
## 2+7+10+12+13 7 -347.52 709.21 1.73 0.00
## 2+4+6+7+11+13 8 -346.50 709.22 1.74 0.00
## 8+13+15 5 -349.56 709.22 1.74 0.00
## 2+5+12+13+15 8 -346.50 709.22 1.74 0.00
## 2+9+12+13+15 7 -347.53 709.22 1.74 0.00
## 11+12+13+15 6 -348.55 709.23 1.75 0.00
## 2+4+11+13+14 7 -347.53 709.23 1.75 0.00
## 4+11+12+13 6 -348.55 709.23 1.75 0.00
## 2+5+10+12+13+15 9 -345.48 709.23 1.75 0.00
## 2+4+5+13 7 -347.53 709.23 1.76 0.00
## 1+4+13 5 -349.57 709.24 1.76 0.00
## 1+2+4+7+13 7 -347.53 709.24 1.76 0.00
## 2+10+15 5 -349.57 709.24 1.76 0.00
## 4+5+13 6 -348.56 709.24 1.76 0.00
## 1+13 4 -350.59 709.24 1.76 0.00
## 2+6+7+15 6 -348.56 709.25 1.77 0.00
## 2+4+7+9+13+15 8 -346.52 709.25 1.78 0.00
## 4+7+13+14+15 7 -347.54 709.25 1.78 0.00
## 2+6+11+13 6 -348.57 709.26 1.78 0.00
## 4+12+13+16 6 -348.57 709.26 1.78 0.00
## 4+6+10+12+13+15 8 -346.52 709.26 1.78 0.00
## 12+15 4 -350.60 709.27 1.79 0.00
## 4+7+9+12+13+15 8 -346.52 709.27 1.79 0.00
## 3+13+15 5 -349.59 709.27 1.79 0.00
## 4+14 4 -350.60 709.27 1.79 0.00
## 4+7+9+13+15 7 -347.55 709.27 1.79 0.00
## 3+4+10+12+13+15 8 -346.53 709.28 1.80 0.00
## 4+8 4 -350.61 709.28 1.80 0.00
## 6+13 4 -350.61 709.28 1.80 0.00
## 2+4+6+9+13 7 -347.56 709.28 1.80 0.00
## 7+13+14+15 6 -348.58 709.28 1.80 0.00
## 2+8+11+13 6 -348.58 709.28 1.80 0.00
## 2+7+13+14 6 -348.58 709.28 1.81 0.00
## 4+6+9 5 -349.60 709.29 1.81 0.00
## 2+4+14 5 -349.60 709.29 1.81 0.00
## 4+6+9+13 6 -348.58 709.29 1.81 0.00
## 2+7+13+15+16 7 -347.56 709.29 1.81 0.00
## 4+6+10+12+13 7 -347.56 709.29 1.81 0.00
## 2+14+15 5 -349.60 709.29 1.81 0.00
## 3+4+10+12+13 7 -347.56 709.29 1.81 0.00
## 5+8+10+12+13+15 9 -345.51 709.29 1.81 0.00
## 1+4+7+13+15 7 -347.56 709.29 1.81 0.00
## 2+5+7+11+13+15 9 -345.51 709.29 1.82 0.00
## 6+13+15 5 -349.60 709.30 1.82 0.00
## 4+10+12+13+16 7 -347.56 709.30 1.82 0.00
## 2+7+10+11+13+15 8 -346.54 709.30 1.82 0.00
## 4+6+9+15 6 -348.59 709.30 1.82 0.00
## 4+12+13+15+16 7 -347.57 709.30 1.82 0.00
## 5+9+13+15 7 -347.57 709.31 1.83 0.00
## 6+12+13+15 6 -348.59 709.31 1.83 0.00
## 2+10 4 -350.62 709.31 1.83 0.00
## 3+7+13+15 6 -348.59 709.31 1.83 0.00
## 1+10+12+13+15 7 -347.57 709.31 1.83 0.00
## 2+8+10+12+13+15 8 -346.55 709.31 1.83 0.00
## 6+7+13+15 6 -348.59 709.31 1.83 0.00
## 2+4+11+13+14+15 8 -346.55 709.31 1.83 0.00
## 1+2+4+13+15 7 -347.57 709.32 1.84 0.00
## 4+10+13+15 6 -348.60 709.32 1.84 0.00
## 1+13+15 5 -349.61 709.32 1.84 0.00
## 1+2+4 5 -349.61 709.32 1.84 0.00
## 2+5+11+13 7 -347.58 709.32 1.84 0.00
## 5+8+12+13+15 8 -346.55 709.33 1.85 0.00
## 4+10+12+13+15+16 8 -346.56 709.33 1.85 0.00
## 9 3 -351.65 709.33 1.85 0.00
## 2+8+10+12+13 7 -347.58 709.33 1.85 0.00
## 2+3+7+13 6 -348.60 709.33 1.85 0.00
## 9+10+12+13 6 -348.61 709.34 1.86 0.00
## 2+4+5+11+13+15 9 -345.53 709.34 1.86 0.00
## 3+4+13 5 -349.63 709.35 1.87 0.00
## 4+8+15 5 -349.63 709.35 1.87 0.00
## 4+7+12+15 6 -348.61 709.36 1.88 0.00
## 3+10+12+13+15 7 -347.59 709.36 1.88 0.00
## 1+2+7+11+13 7 -347.59 709.36 1.88 0.00
## 2+4+5+10+12+13+15 10 -344.51 709.36 1.88 0.00
## 1+4 4 -350.65 709.36 1.88 0.00
## 2+4+6+9 6 -348.62 709.36 1.88 0.00
## 3+4+7+12+13+15 8 -346.57 709.36 1.88 0.00
## 1+2+11+13+15 7 -347.60 709.36 1.88 0.00
## 4+5+9+12+13+15 9 -345.54 709.36 1.88 0.00
## 11+12+13 5 -349.64 709.36 1.88 0.00
## 10+13+15 5 -349.64 709.36 1.88 0.00
## 10+13 4 -350.65 709.37 1.89 0.00
## 1+2+4+11+13 7 -347.60 709.37 1.89 0.00
## 1+2+7+15 6 -348.62 709.37 1.89 0.00
## 1+2 4 -350.66 709.38 1.90 0.00
## 2+9+12+13 6 -348.62 709.38 1.90 0.00
## 4+6+9+13+15 7 -347.60 709.38 1.90 0.00
## 10+12+13+14 6 -348.63 709.38 1.90 0.00
## 4+7+11+13 6 -348.63 709.38 1.90 0.00
## 1+2+15 5 -349.65 709.38 1.90 0.00
## 2+6+11+13+15 7 -347.61 709.39 1.91 0.00
## 2+5+7+15 7 -347.61 709.39 1.91 0.00
## 2+4+10+12+13+14+15 9 -345.56 709.39 1.91 0.00
## 13+16 4 -350.67 709.39 1.91 0.00
## 5+10+12+13 7 -347.61 709.40 1.92 0.00
## 2+7+8+13 6 -348.64 709.40 1.93 0.00
## 2+11+13+16 6 -348.64 709.41 1.93 0.00
## 7+8+13+15 6 -348.64 709.41 1.93 0.00
## 2+3+4+13 6 -348.64 709.41 1.93 0.00
## 2+4+6+9+15 7 -347.62 709.41 1.93 0.00
## 2+4+6+9+13+15 8 -346.60 709.41 1.93 0.00
## 2+6+7+11+13+15 8 -346.60 709.41 1.93 0.00
## 1+10+12+13 6 -348.64 709.42 1.94 0.00
## 1+4+13+15 6 -348.65 709.42 1.94 0.00
## 2+4+13+16 6 -348.65 709.42 1.94 0.00
## 1+4+7+12+13 7 -347.63 709.43 1.95 0.00
## 2+4+6+10+13 7 -347.63 709.43 1.95 0.00
## 1+2+4+7+15 7 -347.63 709.43 1.95 0.00
## 2+4+8 5 -349.67 709.43 1.95 0.00
## 2+7+9+11+13+15 8 -346.61 709.44 1.96 0.00
## 2+7+11+13+14+15 8 -346.61 709.44 1.96 0.00
## 6+15 4 -350.69 709.44 1.96 0.00
## 4+5+7+15 7 -347.64 709.44 1.96 0.00
## 2+5+10+13+15 8 -346.61 709.44 1.96 0.00
## 1+2+4+15 6 -348.66 709.44 1.96 0.00
## 4+5 5 -349.68 709.44 1.96 0.00
## 2+7+8+15 6 -348.66 709.45 1.97 0.00
## 2+11+12+13+15 7 -347.64 709.45 1.97 0.00
## 2+8+11+13+15 7 -347.64 709.45 1.97 0.00
## 4+8+13 5 -349.68 709.45 1.97 0.00
## 6+12+13 5 -349.68 709.45 1.97 0.00
## 1+4+15 5 -349.68 709.45 1.97 0.00
## 1+4+7+13 6 -348.66 709.45 1.97 0.00
## 2+4+7+13+14 7 -347.64 709.45 1.97 0.00
## 1+7+13 5 -349.68 709.46 1.98 0.00
## 2+11+12+13 6 -348.67 709.46 1.98 0.00
## 3+10+12+13 6 -348.67 709.46 1.98 0.00
## 4+10+11+12+13+15 8 -346.63 709.47 1.99 0.00
## 10+12+13+15+16 7 -347.65 709.47 1.99 0.00
## 2+12+13+14+15 7 -347.65 709.47 1.99 0.00
## 1+7+12+13 6 -348.67 709.47 1.99 0.00
## 2+5+7+13 7 -347.65 709.47 1.99 0.00
## 2+7+13+16 6 -348.67 709.48 2.00 0.00
## 2+4+7+10+11+13+15 9 -345.60 709.48 2.00 0.00
## 7+8+10+12+13+15 8 -346.63 709.48 2.00 0.00
##
## Term codes:
## CommEvent_sd GradSanctions_cat clearboundaries_cat confmechinter_sd
## 1 2 3 4
## decispart_cat distmktreg_sd marlivprim_cat mslall_sd
## 5 6 7 8
## occdiv_sd popn_sd rega_cat regg_cat
## 9 10 11 12
## regr_cat sex_cat trustleaders_sd yrseducation_sd
## 13 14 15 16
##
## Model-averaged coefficients:
## (full average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.609077 0.762034 0.762916 0.798 0.425
## GradSanctions_cat1 0.495862 0.695063 0.695617 0.713 0.476
## regr_cat1 -1.206107 0.966257 0.967287 1.247 0.212
## trustleaders_sd 0.193580 0.241356 0.241576 0.801 0.423
## marlivprim_cat1 -0.124430 0.252611 0.252816 0.492 0.623
## regg_cat1 0.440505 0.783141 0.783676 0.562 0.574
## confmechinter_sd 0.468704 0.667769 0.668341 0.701 0.483
## popn_sd -0.193279 0.525255 0.525664 0.368 0.713
## rega_cat1 0.110552 0.378076 0.378386 0.292 0.770
## occdiv_sd 0.038123 0.145818 0.145952 0.261 0.794
## decispart_cat1 0.010173 0.102954 0.103126 0.099 0.921
## decispart_cat2 -0.031014 0.130183 0.130304 0.238 0.812
## distmktreg_sd 0.062067 0.242802 0.243023 0.255 0.798
## sex_catM -0.040904 0.201324 0.201527 0.203 0.839
## mslall_sd 0.021389 0.116869 0.116988 0.183 0.855
## CommEvent_sd -0.015971 0.080263 0.080351 0.199 0.842
## clearboundaries_cat1 -0.020767 0.166686 0.166882 0.124 0.901
## yrseducation_sd 0.004102 0.044338 0.044396 0.092 0.926
##
## (conditional average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.60908 0.76203 0.76292 0.798 0.4247
## GradSanctions_cat1 1.03037 0.67315 0.67434 1.528 0.1265
## regr_cat1 -1.49661 0.85074 0.85219 1.756 0.0791 .
## trustleaders_sd 0.34314 0.22790 0.22831 1.503 0.1329
## marlivprim_cat1 -0.40692 0.30616 0.30671 1.327 0.1846
## regg_cat1 1.26750 0.84647 0.84789 1.495 0.1349
## confmechinter_sd 0.96573 0.66241 0.66360 1.455 0.1456
## popn_sd -0.98337 0.79167 0.79305 1.240 0.2150
## rega_cat1 0.80130 0.69467 0.69589 1.151 0.2495
## occdiv_sd 0.31173 0.29761 0.29815 1.046 0.2958
## decispart_cat1 0.09782 0.30553 0.30609 0.320 0.7493
## decispart_cat2 -0.29823 0.28857 0.28910 1.032 0.3023
## distmktreg_sd 0.51475 0.50587 0.50675 1.016 0.3097
## sex_catM -0.48302 0.51485 0.51578 0.936 0.3490
## mslall_sd 0.29411 0.32802 0.32860 0.895 0.3708
## CommEvent_sd -0.17739 0.20717 0.20755 0.855 0.3927
## clearboundaries_cat1 -0.49173 0.65291 0.65410 0.752 0.4522
## yrseducation_sd 0.13914 0.21883 0.21923 0.635 0.5256
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Relative influence
sw(gains1.average_sd)
## regr_cat trustleaders_sd confmechinter_sd
## Sum of weights: 0.81 0.56 0.49
## N containing models: 308 216 185
## GradSanctions_cat regg_cat marlivprim_cat popn_sd rega_cat
## Sum of weights: 0.48 0.35 0.31 0.20 0.14
## N containing models: 184 132 118 77 57
## occdiv_sd distmktreg_sd decispart_cat CommEvent_sd sex_cat
## Sum of weights: 0.12 0.12 0.10 0.09 0.08
## N containing models: 50 50 44 41 36
## mslall_sd clearboundaries_cat yrseducation_sd
## Sum of weights: 0.07 0.04 0.03
## N containing models: 32 19 14
confint(gains1.average_sd,full=T,level=0.9) #full model averages
## 5 % 95 %
## (Intercept) -1.86362129 0.64546790
## GradSanctions_cat1 -0.64811257 1.63983613
## regr_cat1 -2.79675534 0.38454066
## trustleaders_sd -0.20369167 0.59085127
## marlivprim_cat1 -0.54019536 0.29133583
## regg_cat1 -0.84831974 1.72933054
## confmechinter_sd -0.63039849 1.56780672
## popn_sd -1.05776141 0.67120336
## rega_cat1 -0.51171701 0.73282183
## occdiv_sd -0.20189431 0.27814099
## decispart_cat1 -0.15938814 0.17973325
## decispart_cat2 -0.24529849 0.18326956
## distmktreg_sd -0.33758494 0.46171805
## sex_catM -0.37230823 0.29049966
## mslall_sd -0.17099337 0.21377203
## CommEvent_sd -0.14810187 0.11616065
## clearboundaries_cat1 -0.29518786 0.25365352
## yrseducation_sd -0.06890069 0.07710551
ma.gains1<-summary(gains1.average_sd)#pulling out model averages
df.gains1<-as.data.frame(ma.gains1$coefmat.full)#selecting full model coefficient averages
CI<-as.data.frame(confint(gains1.average_sd,level=0.9,full=T))# to get confident intervals
#for full model
CI
## 5 % 95 %
## (Intercept) -1.86362129 0.64546790
## GradSanctions_cat1 -0.64811257 1.63983613
## regr_cat1 -2.79675534 0.38454066
## trustleaders_sd -0.20369167 0.59085127
## marlivprim_cat1 -0.54019536 0.29133583
## regg_cat1 -0.84831974 1.72933054
## confmechinter_sd -0.63039849 1.56780672
## popn_sd -1.05776141 0.67120336
## rega_cat1 -0.51171701 0.73282183
## occdiv_sd -0.20189431 0.27814099
## decispart_cat1 -0.15938814 0.17973325
## decispart_cat2 -0.24529849 0.18326956
## distmktreg_sd -0.33758494 0.46171805
## sex_catM -0.37230823 0.29049966
## mslall_sd -0.17099337 0.21377203
## CommEvent_sd -0.14810187 0.11616065
## clearboundaries_cat1 -0.29518786 0.25365352
## yrseducation_sd -0.06890069 0.07710551
df.gains1$CI.min <-CI$`5 %` #pulling out CIs and putting into same df as coefficient estimates
df.gains1$CI.max <-CI$`95 %`
df.gains1
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.609076692 0.76203361 0.76291639 0.79835313 0.4246656
## GradSanctions_cat1 0.495861784 0.69506313 0.69561725 0.71283711 0.4759466
## regr_cat1 -1.206107339 0.96625735 0.96728736 1.24689662 0.2124354
## trustleaders_sd 0.193579798 0.24135567 0.24157558 0.80132187 0.4229453
## marlivprim_cat1 -0.124429767 0.25261062 0.25281574 0.49217572 0.6225951
## regg_cat1 0.440505403 0.78314149 0.78367557 0.56210174 0.5740467
## confmechinter_sd 0.468704113 0.66776920 0.66834141 0.70129444 0.4831193
## popn_sd -0.193279028 0.52525509 0.52566409 0.36768543 0.7131078
## rega_cat1 0.110552413 0.37807641 0.37838561 0.29216865 0.7701577
## occdiv_sd 0.038123340 0.14581791 0.14595185 0.26120492 0.7939345
## decispart_cat1 0.010172554 0.10295418 0.10312593 0.09864205 0.9214225
## decispart_cat2 -0.031014467 0.13018327 0.13030375 0.23801669 0.8118682
## distmktreg_sd 0.062066556 0.24280202 0.24302272 0.25539405 0.7984188
## sex_catM -0.040904286 0.20132423 0.20152692 0.20297182 0.8391571
## mslall_sd 0.021389330 0.11686905 0.11698843 0.18283287 0.8549292
## CommEvent_sd -0.015970609 0.08026328 0.08035063 0.19876147 0.8424493
## clearboundaries_cat1 -0.020767169 0.16668642 0.16688185 0.12444235 0.9009650
## yrseducation_sd 0.004102408 0.04433849 0.04439632 0.09240423 0.9263769
## CI.min CI.max
## (Intercept) -1.86362129 0.64546790
## GradSanctions_cat1 -0.64811257 1.63983613
## regr_cat1 -2.79675534 0.38454066
## trustleaders_sd -0.20369167 0.59085127
## marlivprim_cat1 -0.54019536 0.29133583
## regg_cat1 -0.84831974 1.72933054
## confmechinter_sd -0.63039849 1.56780672
## popn_sd -1.05776141 0.67120336
## rega_cat1 -0.51171701 0.73282183
## occdiv_sd -0.20189431 0.27814099
## decispart_cat1 -0.15938814 0.17973325
## decispart_cat2 -0.24529849 0.18326956
## distmktreg_sd -0.33758494 0.46171805
## sex_catM -0.37230823 0.29049966
## mslall_sd -0.17099337 0.21377203
## CommEvent_sd -0.14810187 0.11616065
## clearboundaries_cat1 -0.29518786 0.25365352
## yrseducation_sd -0.06890069 0.07710551
setDT(df.gains1, keep.rownames='coefficient')#put row names into columns
names(df.gains1) <- gsub(" ",'',names(df.gains1))#remove spaces from column headers
Plot standardized effects
ggplot(data=df.gains1, aes(x=coefficient, y=Estimate))+
geom_hline(yintercept=0, color='grey', linetype='dashed', lwd=1)+
geom_errorbar(aes(ymin=Estimate-Std.Error, ymax=Estimate+Std.Error), colour="pink",#SE
width=.1, lwd=1)+
coord_flip()+
geom_point(size=3)+theme_classic(base_size=20)+xlab("")+
geom_errorbar(aes(ymin=CI.min, ymax=CI.max), colour="blue", # CIs
width=.2,lwd=1)
Global model
M.loss2_global.model<-glmer(Ineq2_bin ~ migrant_cat+ sex_cat + yrseducation_sd +
trustleaders_sd + decispart_cat + marlivprim_cat + mslall_sd + occdiv_sd +
CommEvent_sd+ popn_sd + distmktreg_sd + regr_cat + regg_cat +
rega_cat + clearboundaries_cat + confmechinter_sd + GradSanctions_cat +
(1 | site_cat), data = INEQ_loss2,family=binomial(link = "logit"),
na.action='na.fail',control = glmerControl(optimizer="bobyqa",
optCtrl=list(maxfun=1000000)))
summary(M.loss2_global.model)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## Ineq2_bin ~ migrant_cat + sex_cat + yrseducation_sd + trustleaders_sd +
## decispart_cat + marlivprim_cat + mslall_sd + occdiv_sd +
## CommEvent_sd + popn_sd + distmktreg_sd + regr_cat + regg_cat +
## rega_cat + clearboundaries_cat + confmechinter_sd + GradSanctions_cat +
## (1 | site_cat)
## Data: INEQ_loss2
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+06))
##
## AIC BIC logLik deviance df.resid
## 941.4 1035.8 -450.7 901.4 808
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.9062 -0.5958 -0.4329 0.7153 4.1493
##
## Random effects:
## Groups Name Variance Std.Dev.
## site_cat (Intercept) 0.2025 0.45
## Number of obs: 828, groups: site_cat, 47
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.57596 0.57497 -1.002 0.31647
## migrant_cat1 0.24940 0.33760 0.739 0.46006
## sex_catM 0.70237 0.43604 1.611 0.10723
## yrseducation_sd 0.06809 0.18589 0.366 0.71416
## trustleaders_sd 0.10030 0.17729 0.566 0.57156
## decispart_cat1 -0.12099 0.26185 -0.462 0.64404
## decispart_cat2 -0.06065 0.24451 -0.248 0.80410
## marlivprim_cat1 -0.30567 0.24896 -1.228 0.21952
## mslall_sd -0.76851 0.26171 -2.936 0.00332 **
## occdiv_sd -0.12498 0.24213 -0.516 0.60573
## CommEvent_sd 0.55632 0.19723 2.821 0.00479 **
## popn_sd 0.93795 0.30753 3.050 0.00229 **
## distmktreg_sd 0.44208 0.21851 2.023 0.04306 *
## regr_cat1 -0.06598 0.35213 -0.187 0.85137
## regg_cat1 -1.58473 0.37068 -4.275 1.91e-05 ***
## rega_cat1 0.88934 0.28080 3.167 0.00154 **
## clearboundaries_cat1 -0.25887 0.25701 -1.007 0.31382
## confmechinter_sd -0.66157 0.24033 -2.753 0.00591 **
## GradSanctions_cat1 0.34969 0.28766 1.216 0.22413
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 19 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
check_overdispersion(M.loss2_global.model)
## # Overdispersion test
##
## dispersion ratio = 0.979
## Pearson's Chi-Squared = 790.703
## p-value = 0.662
## No overdispersion detected.
check_singularity(M.loss2_global.model)
## [1] FALSE
check_convergence(M.loss2_global.model)
## [1] TRUE
## attr(,"gradient")
## [1] 2.204706e-06
resid.loss1=simulateResiduals(M.loss2_global.model, plot=TRUE)
vif(M.loss2_global.model)
## GVIF Df GVIF^(1/(2*Df))
## migrant_cat 1.158187 1 1.076191
## sex_cat 1.045524 1 1.022509
## yrseducation_sd 1.120330 1 1.058457
## trustleaders_sd 1.035175 1 1.017436
## decispart_cat 1.119675 2 1.028663
## marlivprim_cat 1.252481 1 1.119143
## mslall_sd 1.624475 1 1.274549
## occdiv_sd 1.390088 1 1.179020
## CommEvent_sd 1.060731 1 1.029918
## popn_sd 1.717362 1 1.310482
## distmktreg_sd 1.288776 1 1.135243
## regr_cat 1.386187 1 1.177364
## regg_cat 2.247337 1 1.499112
## rega_cat 1.602246 1 1.265799
## clearboundaries_cat 1.339496 1 1.157366
## confmechinter_sd 1.194874 1 1.093103
## GradSanctions_cat 1.609459 1 1.268644
#loss2.dredge<-dredge(global.model = M.loss2_global.model, trace = TRUE)#This line of code was
#run on the HPC of James Cook University. It will take a long time to run.
#Consider running this code in your own computer.
Load dredge output
loss2.2_dredge_sd<-readRDS(file="loss2.2.dredge.sd.rds")
average model
loss2.average_sd<-summary(model.avg(loss2.2_dredge_sd, subset = delta <= 2))
loss2.average_sd
##
## Call:
## model.avg(object = loss2.2_dredge_sd, subset = delta <= 2)
##
## Component model call:
## glmer(formula = Ineq2_bin ~ <14 unique rhs>, data = INEQ_loss2, family
## = binomial(link = "logit"), control = glmerControl(optimizer =
## "bobyqa", optCtrl = list(maxfun = 1e+06)), na.action = na.fail)
##
## Component models:
## df logLik AICc delta weight
## 1+4+5+8+9+10+11+12 10 -453.34 926.95 0.00 0.12
## 1+2+4+5+8+9+10+11+12 11 -452.53 927.38 0.43 0.10
## 1+4+5+8+9+10+11 9 -454.61 927.44 0.49 0.10
## 1+3+4+5+8+9+10+11+12 11 -452.69 927.70 0.75 0.09
## 1+4+5+6+8+9+10+11+12 11 -452.81 927.94 1.00 0.08
## 1+2+4+5+8+9+10+11 10 -453.87 928.01 1.06 0.07
## 1+3+4+5+8+9+10+11 10 -453.93 928.13 1.18 0.07
## 1+2+4+5+6+8+9+10+11+12 12 -451.90 928.17 1.23 0.07
## 1+2+3+4+5+8+9+10+11+12 12 -452.13 928.64 1.69 0.05
## 1+3+4+5+6+8+9+10+11+12 12 -452.13 928.65 1.70 0.05
## 1+4+5+7+8+9+10+11+12 11 -453.21 928.75 1.80 0.05
## 1+4+5+8+9+10+11+12+13 11 -453.21 928.75 1.80 0.05
## 1+4+5+6+8+9+10+11 10 -454.28 928.84 1.89 0.05
## 1+4+5+8+9+10+11+12+14 11 -453.28 928.87 1.93 0.05
##
## Term codes:
## CommEvent_sd GradSanctions_cat clearboundaries_cat confmechinter_sd
## 1 2 3 4
## distmktreg_sd marlivprim_cat migrant_cat mslall_sd
## 5 6 7 8
## popn_sd rega_cat regg_cat sex_cat
## 9 10 11 12
## trustleaders_sd yrseducation_sd
## 13 14
##
## Model-averaged coefficients:
## (full average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.661523 0.554615 0.555169 1.192 0.23343
## CommEvent_sd 0.498788 0.180450 0.180717 2.760 0.00578 **
## confmechinter_sd -0.624992 0.245707 0.246067 2.540 0.01109 *
## distmktreg_sd 0.509849 0.217568 0.217884 2.340 0.01928 *
## mslall_sd -0.619684 0.243684 0.244040 2.539 0.01111 *
## popn_sd 0.944203 0.293486 0.293914 3.213 0.00132 **
## rega_cat1 0.884043 0.270567 0.270943 3.263 0.00110 **
## regg_cat1 -1.490620 0.341848 0.342305 4.355 1.33e-05 ***
## sex_catM 0.482962 0.477930 0.478343 1.010 0.31266
## GradSanctions_cat1 0.104807 0.224971 0.225131 0.466 0.64154
## clearboundaries_cat1 -0.074946 0.182129 0.182269 0.411 0.68094
## marlivprim_cat1 -0.059454 0.157540 0.157670 0.377 0.70612
## migrant_cat1 0.008605 0.083823 0.083923 0.103 0.91833
## trustleaders_sd 0.004456 0.043940 0.043993 0.101 0.91932
## yrseducation_sd 0.003100 0.042097 0.042152 0.074 0.94137
##
## (conditional average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.66152 0.55461 0.55517 1.192 0.23343
## CommEvent_sd 0.49879 0.18045 0.18072 2.760 0.00578 **
## confmechinter_sd -0.62499 0.24571 0.24607 2.540 0.01109 *
## distmktreg_sd 0.50985 0.21757 0.21788 2.340 0.01928 *
## mslall_sd -0.61968 0.24368 0.24404 2.539 0.01111 *
## popn_sd 0.94420 0.29349 0.29391 3.213 0.00132 **
## rega_cat1 0.88404 0.27057 0.27094 3.263 0.00110 **
## regg_cat1 -1.49062 0.34185 0.34231 4.355 1.33e-05 ***
## sex_catM 0.67928 0.43349 0.43413 1.565 0.11765
## GradSanctions_cat1 0.35470 0.28749 0.28791 1.232 0.21795
## clearboundaries_cat1 -0.28604 0.25733 0.25771 1.110 0.26703
## marlivprim_cat1 -0.24230 0.23842 0.23877 1.015 0.31020
## migrant_cat1 0.16940 0.33329 0.33378 0.508 0.61180
## trustleaders_sd 0.08793 0.17537 0.17563 0.501 0.61663
## yrseducation_sd 0.06508 0.18211 0.18238 0.357 0.72122
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Relative influence
sw(loss2.average_sd)
## CommEvent_sd confmechinter_sd distmktreg_sd mslall_sd
## Sum of weights: 1.00 1.00 1.00 1.00
## N containing models: 14 14 14 14
## popn_sd rega_cat regg_cat sex_cat GradSanctions_cat
## Sum of weights: 1.00 1.00 1.00 0.71 0.30
## N containing models: 14 14 14 10 4
## clearboundaries_cat marlivprim_cat migrant_cat
## Sum of weights: 0.26 0.25 0.05
## N containing models: 4 4 1
## trustleaders_sd yrseducation_sd
## Sum of weights: 0.05 0.05
## N containing models: 1 1
confint(loss2.average_sd,full=T,level=0.9) #full model averages
## 5 % 95 %
## (Intercept) -1.57448009 0.25143386
## CommEvent_sd 0.20163765 0.79593818
## confmechinter_sd -1.02959655 -0.22038706
## distmktreg_sd 0.15158348 0.86811416
## mslall_sd -1.02095624 -0.21841159
## popn_sd 0.46092312 1.42748302
## rega_cat1 0.43852704 1.32955931
## regg_cat1 -2.05348559 -0.92775496
## sex_catM -0.30368241 1.26960691
## GradSanctions_cat1 -0.26543758 0.47505257
## clearboundaries_cat1 -0.37469787 0.22480671
## marlivprim_cat1 -0.31874708 0.19983982
## migrant_cat1 -0.12939782 0.14660806
## trustleaders_sd -0.06788479 0.07679734
## yrseducation_sd -0.06621240 0.07241312
ma.loss2<-summary(loss2.average_sd)#pulling out model averages
df.loss2<-as.data.frame(ma.loss2$coefmat.full)#selecting full model coefficient averages
CI<-as.data.frame(confint(loss2.average_sd,level=0.9,full=T))# to get confident intervals
#for full model
CI
## 5 % 95 %
## (Intercept) -1.57448009 0.25143386
## CommEvent_sd 0.20163765 0.79593818
## confmechinter_sd -1.02959655 -0.22038706
## distmktreg_sd 0.15158348 0.86811416
## mslall_sd -1.02095624 -0.21841159
## popn_sd 0.46092312 1.42748302
## rega_cat1 0.43852704 1.32955931
## regg_cat1 -2.05348559 -0.92775496
## sex_catM -0.30368241 1.26960691
## GradSanctions_cat1 -0.26543758 0.47505257
## clearboundaries_cat1 -0.37469787 0.22480671
## marlivprim_cat1 -0.31874708 0.19983982
## migrant_cat1 -0.12939782 0.14660806
## trustleaders_sd -0.06788479 0.07679734
## yrseducation_sd -0.06621240 0.07241312
df.loss2$CI.min <-CI$`5 %` #pulling out CIs and putting into same df as coefficient estimates
df.loss2$CI.max <-CI$`95 %`
df.loss2
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -0.661523117 0.55461452 0.55516858 1.19157160 0.2334293
## CommEvent_sd 0.498787918 0.18045003 0.18071731 2.76004507 0.0057793
## confmechinter_sd -0.624991806 0.24570706 0.24606668 2.53992863 0.0110875
## distmktreg_sd 0.509848822 0.21756796 0.21788412 2.33999997 0.0192837
## mslall_sd -0.619683913 0.24368421 0.24403976 2.53927441 0.0111083
## popn_sd 0.944203070 0.29348551 0.29391398 3.21251498 0.0013158
## rega_cat1 0.884043177 0.27056707 0.27094283 3.26284024 0.0011030
## regg_cat1 -1.490620274 0.34184831 0.34230511 4.35465392 0.0000133
## sex_catM 0.482962249 0.47792993 0.47834304 1.00965669 0.3126598
## GradSanctions_cat1 0.104807498 0.22497089 0.22513053 0.46554103 0.6415441
## clearboundaries_cat1 -0.074945578 0.18212939 0.18226933 0.41118041 0.6809402
## marlivprim_cat1 -0.059453631 0.15753996 0.15766971 0.37707707 0.7061163
## migrant_cat1 0.008605120 0.08382340 0.08392329 0.10253554 0.9183316
## trustleaders_sd 0.004456277 0.04393997 0.04399261 0.10129603 0.9193155
## yrseducation_sd 0.003100364 0.04209656 0.04215225 0.07355158 0.9413672
## CI.min CI.max
## (Intercept) -1.57448009 0.25143386
## CommEvent_sd 0.20163765 0.79593818
## confmechinter_sd -1.02959655 -0.22038706
## distmktreg_sd 0.15158348 0.86811416
## mslall_sd -1.02095624 -0.21841159
## popn_sd 0.46092312 1.42748302
## rega_cat1 0.43852704 1.32955931
## regg_cat1 -2.05348559 -0.92775496
## sex_catM -0.30368241 1.26960691
## GradSanctions_cat1 -0.26543758 0.47505257
## clearboundaries_cat1 -0.37469787 0.22480671
## marlivprim_cat1 -0.31874708 0.19983982
## migrant_cat1 -0.12939782 0.14660806
## trustleaders_sd -0.06788479 0.07679734
## yrseducation_sd -0.06621240 0.07241312
setDT(df.loss2, keep.rownames='coefficient')#put row names into columns
names(df.loss2) <- gsub(" ",'',names(df.loss2))#remove spaces from column headers
Plot standardized effects
ggplot(data=df.loss2, aes(x=coefficient, y=Estimate))+
geom_hline(yintercept=0, color='grey', linetype='dashed', lwd=1)+
geom_errorbar(aes(ymin=Estimate-Std.Error, ymax=Estimate+Std.Error), colour="pink",#SE
width=.1, lwd=1)+
coord_flip()+
geom_point(size=3)+theme_classic(base_size=20)+xlab("")+
geom_errorbar(aes(ymin=CI.min, ymax=CI.max), colour="blue", # CIs
width=.2,lwd=1)
Define global model
M.gains2_global.model<-glmer(Ineq2_bin ~ migrant_cat+ sex_cat + yrseducation_sd +
trustleaders_sd +decispart_cat + marlivprim_cat + mslall_sd + occdiv_sd + CommEvent_sd+
popn_sd + distmktreg_sd + regr_cat + regg_cat + rega_cat + clearboundaries_cat +
confmechinter_sd + GradSanctions_cat +(1 | site_cat),
data = INEQ_gain2,family=binomial(link = "logit"), na.action='na.fail',
control = glmerControl(optimizer="bobyqa",optCtrl=list(maxfun=1000000)))
summary(M.gains2_global.model)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula:
## Ineq2_bin ~ migrant_cat + sex_cat + yrseducation_sd + trustleaders_sd +
## decispart_cat + marlivprim_cat + mslall_sd + occdiv_sd +
## CommEvent_sd + popn_sd + distmktreg_sd + regr_cat + regg_cat +
## rega_cat + clearboundaries_cat + confmechinter_sd + GradSanctions_cat +
## (1 | site_cat)
## Data: INEQ_gain2
## Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+06))
##
## AIC BIC logLik deviance df.resid
## 532.6 622.5 -246.3 492.6 643
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.1603 -0.4236 -0.3269 -0.2363 5.8552
##
## Random effects:
## Groups Name Variance Std.Dev.
## site_cat (Intercept) 0.06087 0.2467
## Number of obs: 663, groups: site_cat, 47
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.18671 0.72052 -3.035 0.00241 **
## migrant_cat1 0.66240 0.47048 1.408 0.15916
## sex_catM -0.05559 0.51946 -0.107 0.91477
## yrseducation_sd -0.13734 0.25759 -0.533 0.59391
## trustleaders_sd 0.21903 0.24057 0.910 0.36257
## decispart_cat1 0.23820 0.34786 0.685 0.49349
## decispart_cat2 -0.02732 0.32885 -0.083 0.93379
## marlivprim_cat1 -0.07022 0.33548 -0.209 0.83420
## mslall_sd -0.72498 0.34490 -2.102 0.03555 *
## occdiv_sd -0.21754 0.29548 -0.736 0.46158
## CommEvent_sd 0.46586 0.22740 2.049 0.04049 *
## popn_sd 1.01549 0.36282 2.799 0.00513 **
## distmktreg_sd 0.31157 0.33472 0.931 0.35194
## regr_cat1 0.60831 0.39372 1.545 0.12234
## regg_cat1 -0.61179 0.47388 -1.291 0.19670
## rega_cat1 -0.15926 0.35153 -0.453 0.65051
## clearboundaries_cat1 0.65958 0.32879 2.006 0.04485 *
## confmechinter_sd -0.35536 0.30427 -1.168 0.24284
## GradSanctions_cat1 0.44555 0.36317 1.227 0.21988
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 19 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
check_overdispersion(M.gains2_global.model)
## # Overdispersion test
##
## dispersion ratio = 1.044
## Pearson's Chi-Squared = 671.279
## p-value = 0.213
## No overdispersion detected.
check_singularity(M.gains2_global.model)
## [1] FALSE
check_convergence(M.gains2_global.model)
## [1] TRUE
## attr(,"gradient")
## [1] 1.142812e-06
resid.loss1=simulateResiduals(M.gains2_global.model, plot=TRUE)
vif(M.gains2_global.model)
## GVIF Df GVIF^(1/(2*Df))
## migrant_cat 1.267181 1 1.125691
## sex_cat 1.081513 1 1.039958
## yrseducation_sd 1.172083 1 1.082628
## trustleaders_sd 1.083550 1 1.040937
## decispart_cat 1.124764 2 1.029830
## marlivprim_cat 1.223472 1 1.106107
## mslall_sd 1.851116 1 1.360557
## occdiv_sd 1.419366 1 1.191371
## CommEvent_sd 1.065046 1 1.032011
## popn_sd 2.132162 1 1.460192
## distmktreg_sd 1.374562 1 1.172417
## regr_cat 1.402307 1 1.184190
## regg_cat 2.334233 1 1.527820
## rega_cat 1.769661 1 1.330286
## clearboundaries_cat 1.517737 1 1.231965
## confmechinter_sd 1.441461 1 1.200608
## GradSanctions_cat 1.772031 1 1.331177
#gains2.dredge<-dredge(global.model = M.gains2_global.model, trace = TRUE) #This line of
#code was run on the HPC of James Cook University. It will take a long time to run.
#Consider running this code in your own computer.
Load dredge output
gains2.2_dredge_sd<-readRDS(file="gains2.2.dredge.sd.rds")
Model average
gains2.average_sd<-summary(model.avg(gains2.2_dredge_sd, subset = delta <= 2))
gains2.average_sd
##
## Call:
## model.avg(object = gains2.2_dredge_sd, subset = delta <= 2)
##
## Component model call:
## glmer(formula = Ineq2_bin ~ <46 unique rhs>, data = INEQ_gain2, family
## = binomial(link = "logit"), control = glmerControl(optimizer =
## "bobyqa", optCtrl = list(maxfun = 1e+06)), na.action = na.fail)
##
## Component models:
## df logLik AICc delta weight
## 1+3+7+8+10 7 -250.82 515.81 0.00 0.04
## 1+3+8+10 6 -252.00 516.12 0.31 0.04
## 1+7+8+10 6 -252.05 516.23 0.41 0.03
## 1+3+4+8+10 7 -251.04 516.25 0.44 0.03
## 1+4+8+10 6 -252.19 516.51 0.70 0.03
## 1+3+7+8+9+10 8 -250.16 516.54 0.73 0.03
## 1+3+8+9+10 7 -251.19 516.54 0.73 0.03
## 1+3+4+8+9+10 8 -250.20 516.63 0.81 0.03
## 1+8+10 5 -253.34 516.77 0.95 0.03
## 1+3+4+7+8+10 8 -250.29 516.80 0.99 0.03
## 1+4+7+8+10 7 -251.34 516.86 1.04 0.02
## 1+3+8+10+12 7 -251.36 516.90 1.08 0.02
## 1+3+7+8+10+12 8 -250.34 516.90 1.09 0.02
## 1+7+8+10+11 7 -251.44 517.05 1.24 0.02
## 1+3+7+8+10+13 8 -250.43 517.09 1.28 0.02
## 1+7+8+10+12 7 -251.46 517.10 1.29 0.02
## 1+3+7+8+10+14 8 -250.45 517.12 1.30 0.02
## 1+4+8+10+12 7 -251.51 517.18 1.37 0.02
## 1+4+7+8+10+11 8 -250.48 517.19 1.37 0.02
## 1+3+4+8+10+12 8 -250.48 517.19 1.38 0.02
## 1+8+10+12 6 -252.56 517.24 1.43 0.02
## 1+4+8+10+11 7 -251.54 517.25 1.43 0.02
## 1+3+8+10+14 7 -251.56 517.30 1.49 0.02
## 1+4+8+9+10 7 -251.58 517.32 1.51 0.02
## 1+7+8+9+10 7 -251.58 517.34 1.53 0.02
## 1+3+4+8+10+14 8 -250.56 517.34 1.53 0.02
## 1+3+7+8+9+10+13 9 -249.55 517.38 1.57 0.02
## 1+3+5+7+8+10 8 -250.58 517.38 1.57 0.02
## 1+3+8+9+10+13 8 -250.59 517.40 1.58 0.02
## 1+3+8+10+13 7 -251.64 517.46 1.65 0.02
## 1+3+4+7+8+9+10 9 -249.60 517.47 1.66 0.02
## 1+3+7+8+10+11 8 -250.63 517.49 1.68 0.02
## 1+2+3+7+8+10 8 -250.64 517.49 1.68 0.02
## 1+3+8+10+12+13 8 -250.66 517.55 1.73 0.02
## 1+3+7+8+10+12+13 9 -249.64 517.56 1.74 0.02
## 1+7+8+10+14 7 -251.71 517.60 1.79 0.02
## 1+3+6+7+8+10 8 -250.70 517.63 1.82 0.02
## 1+8+9+10 6 -252.75 517.63 1.82 0.02
## 1+4+8+10+14 7 -251.73 517.64 1.83 0.02
## 1+3+4+8+9+10+13 9 -249.71 517.70 1.88 0.02
## 1+3+5+8+10 7 -251.77 517.72 1.90 0.02
## 1+2+3+7+8+10+12 9 -249.73 517.73 1.91 0.02
## 3+4+8+10 6 -252.80 517.73 1.92 0.02
## 1+3+7+8+10+15 8 -250.76 517.73 1.92 0.02
## 1+3+4+8+10+13 8 -250.77 517.76 1.95 0.02
## 1+4+7+8+10+12 8 -250.79 517.80 1.99 0.02
##
## Term codes:
## CommEvent_sd GradSanctions_cat clearboundaries_cat confmechinter_sd
## 1 2 3 4
## distmktreg_sd marlivprim_cat migrant_cat mslall_sd
## 5 6 7 8
## occdiv_sd popn_sd rega_cat regg_cat
## 9 10 11 12
## regr_cat trustleaders_sd yrseducation_sd
## 13 14 15
##
## Model-averaged coefficients:
## (full average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -2.158001 0.347845 0.348224 6.197 < 2e-16 ***
## CommEvent_sd 0.424903 0.220172 0.220551 1.927 0.05404 .
## clearboundaries_cat1 0.338711 0.353359 0.353687 0.958 0.33824
## migrant_cat1 0.343213 0.468418 0.468810 0.732 0.46411
## mslall_sd -0.835173 0.335166 0.335736 2.488 0.01286 *
## popn_sd 0.957182 0.346518 0.347112 2.758 0.00582 **
## confmechinter_sd -0.147018 0.262647 0.262857 0.559 0.57595
## occdiv_sd -0.073726 0.193247 0.193411 0.381 0.70306
## regg_cat1 -0.090893 0.251860 0.252078 0.361 0.71842
## rega_cat1 -0.027721 0.133074 0.133194 0.208 0.83513
## regr_cat1 0.058685 0.206486 0.206682 0.284 0.77646
## trustleaders_sd 0.020997 0.099801 0.099908 0.210 0.83354
## distmktreg_sd 0.006730 0.062097 0.062175 0.108 0.91380
## GradSanctions_cat1 0.010165 0.085995 0.086084 0.118 0.90601
## marlivprim_cat1 0.002548 0.045138 0.045206 0.056 0.95505
## yrseducation_sd -0.001475 0.033889 0.033945 0.043 0.96534
##
## (conditional average)
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -2.15800 0.34785 0.34822 6.197 < 2e-16 ***
## CommEvent_sd 0.43182 0.21512 0.21552 2.004 0.04511 *
## clearboundaries_cat1 0.51855 0.31290 0.31346 1.654 0.09808 .
## migrant_cat1 0.68703 0.45056 0.45137 1.522 0.12799
## mslall_sd -0.83517 0.33517 0.33574 2.488 0.01286 *
## popn_sd 0.95718 0.34652 0.34711 2.758 0.00582 **
## confmechinter_sd -0.40586 0.29220 0.29272 1.387 0.16559
## occdiv_sd -0.34396 0.28509 0.28561 1.204 0.22847
## regg_cat1 -0.45547 0.38963 0.39034 1.167 0.24327
## rega_cat1 -0.33812 0.33323 0.33381 1.013 0.31111
## regr_cat1 0.40321 0.39247 0.39317 1.026 0.30512
## trustleaders_sd 0.22105 0.24624 0.24670 0.896 0.37023
## distmktreg_sd 0.19123 0.27255 0.27305 0.700 0.48372
## GradSanctions_cat1 0.29819 0.36202 0.36264 0.822 0.41092
## marlivprim_cat1 0.15118 0.31371 0.31429 0.481 0.63050
## yrseducation_sd -0.09208 0.25171 0.25217 0.365 0.71499
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Relative influence
sw(gains2.average_sd)
## mslall_sd popn_sd CommEvent_sd clearboundaries_cat
## Sum of weights: 1.00 1.00 0.98 0.65
## N containing models: 46 46 45 30
## migrant_cat confmechinter_sd occdiv_sd regg_cat regr_cat
## Sum of weights: 0.50 0.36 0.21 0.20 0.15
## N containing models: 23 17 10 10 8
## trustleaders_sd rega_cat distmktreg_sd GradSanctions_cat
## Sum of weights: 0.09 0.08 0.04 0.03
## N containing models: 5 4 2 2
## marlivprim_cat yrseducation_sd
## Sum of weights: 0.02 0.02
## N containing models: 1 1
confint(gains2.average_sd,full=T,level=0.9) #full model averages
## 5 % 95 %
## (Intercept) -2.73063233 -1.58536934
## CommEvent_sd 0.06227531 0.78752979
## clearboundaries_cat1 -0.24292573 0.92034783
## migrant_cat1 -0.42775981 1.11418513
## mslall_sd -1.38718952 -0.28315668
## popn_sd 0.38646257 1.52790150
## confmechinter_sd -0.57929826 0.28526260
## occdiv_sd -0.39179523 0.24434365
## regg_cat1 -0.50544067 0.32365418
## rega_cat1 -0.24675896 0.19131638
## regr_cat1 -0.28120104 0.39857035
## trustleaders_sd -0.14329495 0.18528942
## distmktreg_sd -0.09550829 0.10896879
## GradSanctions_cat1 -0.13139609 0.15172540
## marlivprim_cat1 -0.07178261 0.07687870
## yrseducation_sd -0.05728759 0.05433759
ma.gains2<-summary(gains2.average_sd)#pulling out model averages
df.gains2<-as.data.frame(ma.gains2$coefmat.full)#selecting full model coefficient averages
CI<-as.data.frame(confint(gains2.average_sd,level=0.9,full=T))# to get confident intervals
#for full model
CI
## 5 % 95 %
## (Intercept) -2.73063233 -1.58536934
## CommEvent_sd 0.06227531 0.78752979
## clearboundaries_cat1 -0.24292573 0.92034783
## migrant_cat1 -0.42775981 1.11418513
## mslall_sd -1.38718952 -0.28315668
## popn_sd 0.38646257 1.52790150
## confmechinter_sd -0.57929826 0.28526260
## occdiv_sd -0.39179523 0.24434365
## regg_cat1 -0.50544067 0.32365418
## rega_cat1 -0.24675896 0.19131638
## regr_cat1 -0.28120104 0.39857035
## trustleaders_sd -0.14329495 0.18528942
## distmktreg_sd -0.09550829 0.10896879
## GradSanctions_cat1 -0.13139609 0.15172540
## marlivprim_cat1 -0.07178261 0.07687870
## yrseducation_sd -0.05728759 0.05433759
df.gains2$CI.min <-CI$`5 %` #pulling out CIs and putting into same df as coefficient estimates
df.gains2$CI.max <-CI$`95 %`
df.gains2
## Estimate Std. Error Adjusted SE z value Pr(>|z|)
## (Intercept) -2.158000837 0.34784541 0.34822425 6.19715834 0.0000000
## CommEvent_sd 0.424902553 0.22017197 0.22055068 1.92655291 0.0540354
## clearboundaries_cat1 0.338711049 0.35335927 0.35368709 0.95765737 0.3382356
## migrant_cat1 0.343212662 0.46841819 0.46881008 0.73209318 0.4641117
## mslall_sd -0.835173101 0.33516626 0.33573601 2.48758868 0.0128612
## popn_sd 0.957182036 0.34651799 0.34711246 2.75755598 0.0058235
## confmechinter_sd -0.147017830 0.26264675 0.26285733 0.55930657 0.5759525
## occdiv_sd -0.073725790 0.19324724 0.19341097 0.38118722 0.7030643
## regg_cat1 -0.090893245 0.25186036 0.25207811 0.36057572 0.7184166
## rega_cat1 -0.027721290 0.13307363 0.13319365 0.20812771 0.8351292
## regr_cat1 0.058684654 0.20648642 0.20668173 0.28393731 0.7764584
## trustleaders_sd 0.020997239 0.09980107 0.09990759 0.21016661 0.8335376
## distmktreg_sd 0.006730251 0.06209703 0.06217492 0.10824704 0.9137997
## GradSanctions_cat1 0.010164659 0.08599478 0.08608372 0.11807875 0.9060053
## marlivprim_cat1 0.002548045 0.04513777 0.04520581 0.05636543 0.9550507
## yrseducation_sd -0.001474999 0.03388923 0.03394467 0.04345303 0.9653404
## CI.min CI.max
## (Intercept) -2.73063233 -1.58536934
## CommEvent_sd 0.06227531 0.78752979
## clearboundaries_cat1 -0.24292573 0.92034783
## migrant_cat1 -0.42775981 1.11418513
## mslall_sd -1.38718952 -0.28315668
## popn_sd 0.38646257 1.52790150
## confmechinter_sd -0.57929826 0.28526260
## occdiv_sd -0.39179523 0.24434365
## regg_cat1 -0.50544067 0.32365418
## rega_cat1 -0.24675896 0.19131638
## regr_cat1 -0.28120104 0.39857035
## trustleaders_sd -0.14329495 0.18528942
## distmktreg_sd -0.09550829 0.10896879
## GradSanctions_cat1 -0.13139609 0.15172540
## marlivprim_cat1 -0.07178261 0.07687870
## yrseducation_sd -0.05728759 0.05433759
setDT(df.gains2, keep.rownames='coefficient')#put row names into columns
names(df.gains2) <- gsub(" ",'',names(df.gains2))#remove spaces from column headers
Plot standardized effects
ggplot(data=df.gains2, aes(x=coefficient, y=Estimate))+
geom_hline(yintercept=0, color='grey', linetype='dashed', lwd=1)+
geom_errorbar(aes(ymin=Estimate-Std.Error, ymax=Estimate+Std.Error), colour="pink",#SE
width=.1, lwd=1)+
coord_flip()+
geom_point(size=3)+theme_classic(base_size=20)+xlab("")+
geom_errorbar(aes(ymin=CI.min, ymax=CI.max), colour="blue", # CIs
width=.2,lwd=1)