m0g <- glmer(unempl~1+(1|country), data=alldat,family=binomial, control = glmerControl(optimizer = "bobyqa") )
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.0359952 (tol = 0.002, component 1)
print(icc(m0g, by_group = TRUE))
## # ICC by Group
##
## Group | ICC
## ---------------
## country | 0.046
####does not work with year in random effect
fm1 <- glmer(unempl~ country +factor(year) +sex+ +age +countrybirth +education +yearsar +compo + (1|country), data=alldat, family=binomial, control = glmerControl(optimizer = "bobyqa", calc.derivs = FALSE))
## Warning in commonArgs(par, fn, control, environment()): maxfun < 10 *
## length(par)^2 is not recommended.
htmlreg(list("Multilevel 0"=m0g, "Fixed-Effect 1"=fm1))
| Multilevel 0 | Fixed-Effect 1 | |
|---|---|---|
| (Intercept) | -2.46*** | -2.36*** |
| (0.00) | (0.19) | |
| countryBG | 0.81*** | |
| (0.01) | ||
| countryCY | 1.02*** | |
| (0.01) | ||
| countryCZ | 0.78*** | |
| (0.01) | ||
| countryDE | 0.06*** | |
| (0.01) | ||
| countryDK | 0.24*** | |
| (0.02) | ||
| countryEE | 0.95*** | |
| (0.01) | ||
| countryEL | 1.79*** | |
| (0.01) | ||
| countryES | 1.77*** | |
| (0.01) | ||
| countryFI | 0.80*** | |
| (0.01) | ||
| countryFR | 1.11*** | |
| (0.01) | ||
| countryHU | 0.93*** | |
| (0.01) | ||
| countryIE | 1.18*** | |
| (0.01) | ||
| countryIT | 1.00*** | |
| (0.01) | ||
| countryLT | 1.33*** | |
| (0.01) | ||
| countryLU | 0.29*** | |
| (0.02) | ||
| countryLV | 1.35*** | |
| (0.01) | ||
| countryNL | 0.24*** | |
| (0.01) | ||
| countryPT | 1.05*** | |
| (0.01) | ||
| countryUK | 0.49*** | |
| (0.01) | ||
| factor(year)2009 | 0.35*** | |
| (0.00) | ||
| factor(year)2010 | 0.49*** | |
| (0.00) | ||
| factor(year)2011 | 0.57*** | |
| (0.00) | ||
| factor(year)2012 | 0.76*** | |
| (0.00) | ||
| factor(year)2013 | 0.83*** | |
| (0.00) | ||
| factor(year)2014 | 0.78*** | |
| (0.00) | ||
| factor(year)2015 | 0.70*** | |
| (0.00) | ||
| factor(year)2016 | 0.62*** | |
| (0.00) | ||
| factor(year)2017 | 0.51*** | |
| (0.01) | ||
| factor(year)2018 | 0.40*** | |
| (0.01) | ||
| factor(year)2019 | 0.32*** | |
| (0.01) | ||
| sexfemale | 0.15*** | |
| (0.00) | ||
| age26-34 | -0.57*** | |
| (0.00) | ||
| age35-44 | -0.98*** | |
| (0.00) | ||
| age45-54 | -1.26*** | |
| (0.00) | ||
| age55-65 | -1.37*** | |
| (0.00) | ||
| countrybirthEU/EFTA | 0.22 | |
| (0.19) | ||
| countrybirthNew_Member | 0.27 | |
| (0.19) | ||
| countrybirthEurope_nEU/nEFTA | 0.44* | |
| (0.19) | ||
| countrybirthNon_Europe | 0.51** | |
| (0.19) | ||
| educationISCED3/4 | -0.51*** | |
| (0.00) | ||
| educationISCED5+ | -1.02*** | |
| (0.00) | ||
| yearsar5-9years | -0.09*** | |
| (0.01) | ||
| yearsar>10years | -0.00 | |
| (0.01) | ||
| yearsarnative | -0.04 | |
| (0.19) | ||
| compoadult_ch | 0.22*** | |
| (0.01) | ||
| compocouple | -0.44*** | |
| (0.00) | ||
| compocouple_ch | -0.46*** | |
| (0.00) | ||
| compoconf_adults | -0.02*** | |
| (0.00) | ||
| compoconf_adults_ch | -0.06*** | |
| (0.00) | ||
| AIC | 13689325.13 | 8154600.32 |
| BIC | 13689355.09 | 8155339.65 |
| Log Likelihood | -6844660.56 | -4077249.16 |
| Num. obs. | 23758491 | 14600295 |
| Num. groups: country | 20 | 20 |
| Var: country (Intercept) | 0.16 | 0.00 |
| ***p < 0.001; **p < 0.01; *p < 0.05 | ||
summary(m0g)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [glmerMod] Family: binomial ( logit ) Formula: unempl ~ 1 + (1 | country) Data: alldat Control: glmerControl(optimizer = “bobyqa”)
AIC BIC logLik deviance df.resid
13689325 13689355 -6844661 13689321 23758489
Scaled residuals: Min 1Q Median 3Q Max -0.4351 -0.3289 -0.3047 -0.2393 4.8478
Random effects: Groups Name Variance Std.Dev. country (Intercept)
0.1604 0.4005
Number of obs: 23758491, groups: country, 20
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.456526 0.002017 -1218 <2e-16 *** — Signif. codes: 0
‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ’ ’ 1
optimizer (bobyqa) convergence code: 0 (OK) Model failed to converge
with max|grad| = 0.0359952 (tol = 0.002, component 1)
summary(fm1)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod] Family: binomial ( logit ) Formula: unempl ~
country + factor(year) + sex + +age + countrybirth +
education + yearsar + compo + (1 | country) Data: alldat Control:
glmerControl(optimizer = “bobyqa”, calc.derivs = FALSE)
AIC BIC logLik deviance df.resid
8154600 8155340 -4077249 8154498 14600244
Scaled residuals: Min 1Q Median 3Q Max -1.7040 -0.3443 -0.2529 -0.1761 13.6431
Random effects: Groups Name Variance Std.Dev. country (Intercept) 0
0
Number of obs: 14600295, groups: country, 20
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.359969 0.193860 -12.174 < 2e-16 countryBG
0.809957 0.007535 107.500 < 2e-16 countryCY 1.021607
0.008875 115.108 < 2e-16 countryCZ 0.775839 0.007925
97.895 < 2e-16 countryDE 0.061263 0.006369 9.619 <
2e-16 countryDK 0.237136 0.015283 15.516 < 2e-16
countryEE 0.949694 0.011028 86.120 < 2e-16
countryEL 1.787535 0.005652 316.238 < 2e-16
countryES 1.769388 0.006338 279.181 < 2e-16
countryFI 0.797219 0.009078 87.816 < 2e-16
countryFR 1.111627 0.006761 164.429 < 2e-16
countryHU 0.926046 0.006078 152.364 < 2e-16
countryIE 1.181569 0.006097 193.802 < 2e-16
countryIT 1.002984 0.005511 182.003 < 2e-16
countryLT 1.334706 0.007569 176.332 < 2e-16
countryLU 0.293899 0.016562 17.745 < 2e-16
countryLV 1.345414 0.009013 149.273 < 2e-16
countryNL 0.242677 0.008008 30.305 < 2e-16
countryPT 1.046255 0.006213 168.388 < 2e-16
countryUK 0.493482 0.008133 60.679 < 2e-16
factor(year)2009 0.354847 0.004838 73.341 < 2e-16
factor(year)2010 0.489904 0.004758 102.958 < 2e-16
factor(year)2011 0.574763 0.004804 119.648 < 2e-16
factor(year)2012 0.758693 0.004666 162.607 < 2e-16
factor(year)2013 0.832287 0.004684 177.706 < 2e-16
factor(year)2014 0.778806 0.004750 163.969 < 2e-16
factor(year)2015 0.699263 0.004851 144.156 < 2e-16
factor(year)2016 0.617126 0.004921 125.405 < 2e-16
factor(year)2017 0.507343 0.005060 100.257 < 2e-16
factor(year)2018 0.401336 0.005155 77.858 < 2e-16
factor(year)2019 0.315577 0.005332 59.186 < 2e-16
sexfemale 0.145584 0.001912 76.126 < 2e-16
age26-34 -0.573652 0.003027 -189.492 < 2e-16
age35-44 -0.981822 0.003110 -315.748 < 2e-16
age45-54 -1.258426 0.002986 -421.452 < 2e-16
age55-65 -1.368932 0.003590 -381.347 < 2e-16
countrybirthEU/EFTA 0.218257 0.193740 1.127 0.25993
countrybirthNew_Member 0.271467 0.193733 1.401 0.16114
countrybirthEurope_nEU/nEFTA 0.439845 0.193701 2.271 0.02316 *
countrybirthNon_Europe 0.508784 0.193669 2.627 0.00861 **
educationISCED3/4 -0.511572 0.002196 -232.982 < 2e-16
educationISCED5+ -1.023143 0.002893 -353.619 < 2e-16
yearsar5-9years -0.085168 0.008246 -10.328 < 2e-16
yearsar>10years -0.001182 0.007130 -0.166 0.86836
yearsarnative -0.037703 0.193733 -0.195 0.84569
compoadult_ch 0.221820 0.006057 36.625 < 2e-16
compocouple -0.436728 0.003905 -111.846 < 2e-16
compocouple_ch -0.463997 0.003577 -129.727 < 2e-16
compoconf_adults -0.021587 0.003286 -6.569 5.06e-11
compoconf_adults_ch -0.056514 0.003756 -15.046 < 2e-16
— Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05
‘.’ 0.1 ’ ’ 1
##
## Correlation matrix not shown by default, as p = 50 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK) maxfun < 10 * length(par)^2 is not recommended.
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.