Skip to content
Prev 12895 / 20628 Next

Loglikelihood

Oh yes i have 2 random effects for 3 groups   for write this V <-Z%*% D %*% t(Z) + R
to have conformability with D
i need 6X6 matrix where       
  
       [,1]     [,2]
[1,] 597.1903 -0.97000
[2,]  -0.9700 60.05023

rappresent a blok of D       D matrix depends on Z  matrix   ( 
I use Z.sparse<- getME(mod0,"Z") # model matrix of random effect (sparse format)
Z <- as.matrix(Z.sparse)  because the lme4 built if for me only specify the formula        

the D matrix is for 2 random effects for 3 groups
a1 b1  a2 b2  a3 b3

V <-Z%*% D %*% t(Z) + R

       [,1]     [,2]     [,3]     [,4]     [,5]     [,6]
[1,] 597.1903 -0.97000  -0.9700 -0.97000  -0.9700 -0.97000
[2,]  -0.9700 60.05023  -0.9700 -0.97000  -0.9700 -0.97000
[3,]  -0.9700 -0.97000 597.1903 -0.97000  -0.9700 -0.97000
[4,]  -0.9700 -0.97000  -0.9700 60.05023  -0.9700 -0.97000
[5,]  -0.9700 -0.97000  -0.9700 -0.97000 597.1903 -0.97000
[6,]  -0.9700 -0.97000  -0.9700 -0.97000  -0.9700 60.05023