I am confused with ranef function in R Do the ranef and fixef functions in lmer give the random and fixed effect coefficients? If not what do they really give?
Data looks something like (this is a fake data):
id      1  1  1  2  2  2 
weight 34 45 56 78 12 45
count  23 12 13 16 14 22

Model looks like mod <- lmer(weight ~ count + (1+count|id), data=d1)
where id is a random effect in the model and count is fixed effect. 
I believed that the statement coef(model)$id[,"count"] in R will give the random coefficients for count by each id. 
Am I correct? 
If yes then what does ranef(mod) give?
Any help is much appreciated. Sorry for the confusion.
 A: Example from the lme4 package:
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)

For this model coef(fm1) gives 
$Subject
    (Intercept)       Days
308    253.6637 19.6662581
309    211.0065  1.8475834
310    212.4449  5.0184067
...

This is the 'summed up' version, assuming you want to know the subject-specific intercept and subject specific slope for Day.  This is constructed by combining the fixed effects, which provide the mean, with the random effects, which are zero centred and provide the variation.  fixef(fm1) gives
(Intercept)        Days 
  251.40510    10.46729

and ranef(fm1) gives 
$Subject
    (Intercept)        Days
308   2.2585637   9.1989722
309 -40.3985802  -8.6197026
310 -38.9602496  -5.4488792 
...

Looking at subject 308 we see that their personal intercept 253.6637 is equal to the grand mean 251.40510 plus 2.2585637 and their personal slope 19.6662581 is equal to the fixed effect slope 10.46729 plus their personal slope 9.1989722.
The advantage of ranef in all this is that you can get the posterior uncertainty (or whatever it is that lme4 actually computes) over the random effects using ranef(fm1, condVar = TRUE).  What you got before were only point estimates of random variables.
