Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way to print a certain part of the summary of a model?

I wish to print a part of my summary when reviewing my model (more to save space and for a clearer output), if there anyway to do this? All want is the variance table as circled below

enter image description here

model used;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

pupils_test_model = lmer(IQ ~ ses + (1 | Class), 
                    data = pupils) 

>Solution :

If all you want is to get those lines, you could just use capture.output and then select the relevant lines.

temp = capture.output(summary(model))
Start = grep("Random effects", temp)
End   = grep("Number of obs", temp)
print(unname(temp[Start:End]))

[1] "Random effects:"                                  
[2] " Groups       Name        Variance Std.Dev. Corr "
[3] " Petal.Length (Intercept) 2.16667  1.4720        "
[4] "              Petal.Width 0.62156  0.7884   -0.91"
[5] " Residual                 0.08241  0.2871        "
[6] "Number of obs: 150, groups:  Petal.Length, 43"  
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading