Number of parameters in mixed model How can I tell how many parameters will be estimated for random effects in mixed models? Here is the example from the lme function in nlme:
library(nlme)
fm1 <- lme(fixed = distance ~ age, random = ~ 1 | Subject, data = Orthodont, method = "ML", control=lmeControl(opt = "optim")) 
fm2 <- lme(fixed = distance ~ age + Sex, random = ~ 1 | Subject, data = Orthodont, method = "ML", control=lmeControl(opt = "optim")) 
fm3 <- lme(fixed = distance ~ age, random = ~ age | Subject, data = Orthodont, method = "ML", control=lmeControl(opt = "optim")) 
fm4 <- lme(fixed = distance ~ age + Sex, random = ~ age | Subject, data = Orthodont, method = "ML", control=lmeControl(opt = "optim")) 
fm5 <- lme(fixed = distance ~ age + Sex, random = ~ age + Sex | Subject, data = Orthodont, method = "ML", control=lmeControl(opt = "optim"))

library(AICcmodavg)
aictab(list(fm1,fm2,fm3,fm4,fm5), c("fm1","fm2","fm3","fm4","fm5"))

Can someone help me understand why K is what it is for fm1-fm5?
     K   AICc Delta_AICc AICcWt Cum.Wt      LL
fm2  5 445.44       0.00   0.72   0.72 -217.43
fm4  7 447.96       2.51   0.21   0.93 -216.42
fm1  4 451.78       6.33   0.03   0.96 -221.69
fm3  6 452.04       6.60   0.03   0.99 -219.61
fm5 10 453.44       7.99   0.01   1.00 -215.58

In particular, why does fm5 have 3 more parameters than fm4?
 A: *

*fm1


fixed = distance ~ age, random = ~ 1 | Subject
K = 4: the coefficients for intercept, and age; variances for random intercept, and error term.


*

*fm2


fixed = distance ~ age + Sex, random = ~ 1 | Subject
K = 5: the coefficients for intercept, age, and Sex; variances for random intercept, and error term.


*

*fm3


fixed = distance ~ age, random = ~ age | Subject
K = 6: the coefficients for intercept, and age; variances for random intercept, age, and error term; covariance between random effects of intercept and age.


*

*fm4


fixed = distance ~ age + Sex, random = ~ age | Subject
K = 7: the coefficients for intercept, age, and Sex; variances for random intercept, age, and error term; covariance between random effects of intercept and age.


*

*fm5


fixed = distance ~ age + Sex, random = ~ age + Sex | Subject
K = 10: the coefficients for intercept, age, and Sex; variances for random intercept, age, Sex, and error term; covariances between random effects of intercept and age, intercept and Sex, and age and Sex.
