How do I extract the Correlation of fixed effects part of the lmer output

后端 未结 3 1550
感情败类
感情败类 2021-01-03 04:23

When you have a multilevel model with lots of factors and interactions the size of the correlation of fixed effects matrix can become quite big and unclear.

I can us

相关标签:
3条回答
  • 2021-01-03 05:01

    Using the S4 method listing function we can return the function which is dispatched when print is called on an object of class "mer":

    selectMethod( print , "mer" )
    

    Looking at the source code that is returned we can find the lines applicable to you:

    if (correlation) {
                corF <- so@vcov@factors$correlation
    

    so is defined as the summary of your object, so in your case you should just need to extract:

    so <- summary(mod)
    so@vcov@factors$correlation
    
    0 讨论(0)
  • 2021-01-03 05:02

    How about using the built-in

    cov2cor(vcov(mod))
    

    ?

    0 讨论(0)
  • 2021-01-03 05:03

    I don't know direct method. But this is workaround.

     diag(diag(1/sqrt(vcov(mod)))) %*% vcov(mod) %*% diag(diag(1/sqrt(vcov(mod))))
    
    0 讨论(0)
提交回复
热议问题