How to compute the residual standard deviation from `glmer()` function in R? I want to extract standard deviation of residual from glmer() function in R .
So I wrote :
lmer_obj = glmer(Y ~ X1 + X2 + (1|Subj), data=D, family=binomial)
sigma(lmer_obj)

I noticed that the last command sigma(lmer_obj) returns always 1 irrespective of the data That is, whether I used the cbpp data or my own simulated data from multilevel logistic distribution, the residual standard error is always 1.
How can I get the residual standard deviation from glmer() function?
 A: Logistic regression models, whether they include random effects or not, do not have an error term (see: Logistic Regression - Error Term and its Distribution).  This is generally true of most GLiMs (although linear regression is a special case of GLiMs and does have an error term).  
Of course, given a predicted probability and an observed response value, various residuals can be formed (see: Logistic regression and error terms).  People naturally want to use these to assess their models, because that's what you do with linear models.  However, looking at these residuals will typically lead you astray (see: Interpretation of plot(glm.model)).  
Thus, you are better off abandoning your quest for the standard deviation of the residuals, in my honest opinion.  That said, if you are dead set on this, you could try:  
library(lme4)
data(cbpp)
m1 = glmer(cbind(incidence,size-incidence)~period+(1|herd), family=binomial, data=cbpp)
sd(residuals(m1, type="deviance"))  # [1] 1.133436
sd(residuals(m1, type="response"))  # [1] 0.1001946


(Edit: the question is somewhat ambiguous.)
If you want the estimated standard deviation of the population from which the sample was drawn, you could try:  
attr(summary(m1)$varcor$herd, "stddev")
# (Intercept) 
#   0.6420699 

If you want the standard deviation of the predicted random effects (these are not necessarily the same as above, see: Why do the estimated values from a Best Linear Unbiased Predictor (BLUP) differ from a Best Linear Unbiased Estimator (BLUE)?), you could try:  
sd(ranef(m1)$herd[,1])  # [1] 0.5342242

If you are interested in the dispersion, it is almost always necessarily $1$ for logistic regression models.  If the response data are binomial with $n>1$ (i.e., not Bernoulli), you can have over- (or, less likely, under-) dispersion, but introducing the random effects here gets you back to $1$.  That piece of information is what the sigma(m1) is giving you (i.e., not the standard deviation of the residuals); you could also get it via:  
summary(m1)$sigma  # [1] 1

