What do the weights
argument in glmer
refer to? I used sample sizes as weights
with glm
, but here I am not sure. The variance of sample sizes is quite low, but including it or not in glmer
gives me a huge difference. For example, in the dataset below, using only one independant variable, the difference in results is huge (estimate, BIC, p.value). Does anyone have experience using weights in glmer and confirm if it works as expected or if I ma doing it right?
Here http://comments.gmane.org/gmane.comp.lang.r.lme4.devel/10160 and in github pages, there seems to be an issue with weights
argument in glmer, but since my knowledge of mixed-models in only weeks old, I am not able to follow it.
My data
cv<-structure(list(name = c("AlfF", "AndH", "AntH", "BerG", "BerR", "FreZ", "GerB", "GerT", "GueS", "GueV", "HanN", "HeiW", "JakW", "KarN", "KerG", "KlaS", "ManS", "MarS", "SilN", "TheG", "UweP", "WerT", "AlfF", "AndH", "AntH", "BerG", "BerR", "FreZ", "GerB", "GerT", "GueS", "GueV", "HanN", "HeiW", "JakW", "KarN", "KerG", "KlaS", "ManS", "MarS", "SilN", "TheG", "UweP", "WerT", "AlfF", "AndH", "AntH", "BerG", "BerR", "FreZ", "GerB", "GerT", "GueS", "GueV", "HanN", "HeiW", "JakW", "KarN", "KerG", "KlaS", "ManS", "SilN", "TheG", "UweP", "WerT", "AlfF", "AndH", "AntH", "BerG", "BerR", "FreZ", "GerB", "GerT", "GueS", "GueV", "HanN", "HeiW", "JakW", "KarN", "KerG", "KlaS", "ManS", "SilN", "TheG", "UweP", "WerT", "AlfF", "AndH", "AntH", "BerK", "BerR", "ChrG", "FraR", "FreZ", "GerB", "GerB", "GerT", "GueS", "GueV", "HanN", "HeiW", "JakW", "KlaS", "ManS", "MarH", "PetS", "SilN", "TheG", "UweP", "WerT", "AlfF", "AndH", "BerK", "BerR", "ChrG", "FraR", "FreZ", "GerB", "GerB", "GerT", "GueV", "HanN", "HeiW", "JakW", "KlaS", "ManS", "MarH", "PetS", "PetW", "SilN", "SveR", "UweP", "WerT", "AlfF", "AndH", "AntH", "BerK", "BerR", "ChrG", "FraR", "FreZ", "GerB", "GerB", "GerT", "GueS", "GueV", "HanN", "HeiW", "JakW", "KlaS", "ManS", "MarH", "MicH", "PetS", "SilN", "SveR", "UweP", "WerT"), prop_yes = c(0, 0.2, 0.6, 0.1, 0, 0, 0.1, 0, 0.3, 0, 0, 0, 0, 0.1, 0.8, 0.1, 0.1, 0, 0, 0, 0, 0, 0, 0, 0.3, 0, 0.3, 0.3, 0.5, 0.4, 0.778, 0, 0.05, 0.5, 0, 0, 0.4, 0.2, 0, 0, 0, 0.2, 0.2, 0.3, 0.2, 0.6, 0.2, 0.2, 0.1, 0.1, 0.1, 0, 0.1, 0.3, 0.4, 0.1, 0.111, 0, 0.2, 0.1, 0.2, 0.8, 0, 0.111, 0, 0.1, 0, 0.2, 0.3, 0.1, 0.4, 0.333, 0.2, 0.1, 0.2, 0, 0.2, 0.182, 0, 0.1, 0.364, 0.1, 0.3, 0.375, 0, 0, 0, 0.2, 0, 0.1, 0, 0, 0, 0, 0.1, 0.1, 0, 0.3, 0, 0, 0.3, 0, 0.333, 0, 0, 0.667, 0.2, 0.571, 0.2, 0, 0.2, 0.6, 0.2, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0.2, 0.3, 0, 0.7, 0.3, 0, 0.2, 0.75, 0.2, 0.1, 0.1, 0.4, 0.1, 0.4, 0.3, 0.222, 0.2, 0.1, 0.1, 0.5, 0.2, 0.6, 0, 0, 0.1, 0.167, 0.333, 0, 0.222, 0.4, 0.5, 0, 0.3, 0.1, 0), size = c(10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 19L, 10L, 6L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 10L, 6L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 10L, 20L, 10L, 8L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 10L, 10L, 10L, 10L, 10L, 11L, 10L, 10L, 11L, 10L, 10L, 8L, 7L, 10L, 10L, 10L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 10L, 10L, 4L, 6L, 10L, 9L, 9L, 10L, 7L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 8L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 9L, 10L, 10L, 10L, 10L, 5L, 10L, 10L, 10L, 10L, 12L, 12L, 10L, 9L, 10L, 10L, 9L, 10L, 10L, 10L), tmean_winter = c(-3.83, -4.31, -3.97, -5.21, -4.6, -4.09, -4.05, -4.09, -4.85, -4.48, -4.77, -6.66, -4.16, -4.68, -4.48, -5.07, -3.83, -4.28, -4.79, -4.83, -4.09, -4.43, 2.36, 1.47, 2.13, 1.09, 1.93, 2.26, 2.28, 1.98, 1.66, 1.3, 1.69, -1.01, 2.22, 1.89, 2, 1.23, 2.33, 2.1, 1.68, 1.66, 1.95, 1.38, 1.61, 0.86, 1.82, 0.48, 1.45, 1.74, 1.5, 1.78, 1.14, 0.65, 1.17, -1.59, 1.69, 1.55, 1.44, 0.65, 1.59, 1.16, 1.14, 1.23, 0.81, -1.53, -2.61, -1.52, -2.7, -1.77, -1.54, -1.68, -1.32, -2.16, -2.82, -1.95, -4.56, -1.57, -1.77, -1.76, -2.55, -1.51, -1.98, -2.05, -1.97, -2.62, -4.48, -5.25, -4.04, -4.92, -4.59, -5.34, -5.09, -4.12, -4.36, -5.23, -4.94, -4.7, -5.28, -4.55, -7.07, -4.18, -5.17, -4.56, -4.56, -4.74, -4.58, -4.62, -5.08, -5.25, -1.87, -2.67, -2.84, -2.47, -3.11, -2.3, -2.01, -2.05, -2.96, -2.57, -2.75, -2.54, -4.18, -2.07, -3.04, -1.81, -2.39, -2.24, -2.75, -2.75, -2.79, -2.44, -2.85, -0.35, -1.47, -0.43, -1.02, -0.76, -1.23, -1.57, -0.48, -0.65, -1.18, -0.58, -0.92, -1.58, -1.07, -4.05, -0.52, -2.1, -0.36, -0.75, -1.04, -0.67, -1.05, -1.81, -0.61, -1.64)), .Names = c("name", "prop_yes", "size", "tmean_winter"), row.names = c(NA, -158L), class = "data.frame")
glmer(prop_yes~tmean_winter+(1|name),family='binomial',data=cv)
glmer(prop_yes~tmean_winter+(1|name),family='binomial',weights=size,data=cv)