'What is code to visualize vcov() matrix for a multivariate multiple regression fit?

I'd like to print/visualize the vcov() matrix, but it's not turning out quite right. I suspect it's because I've got two dependent variables, because all is fine when I do the same with a fit containing only one dependent variable. Where am I going wrong? Here is some data:

training_set_NORM <- data.frame(MD_EARN_WNE_P10 = c(.3094,.2901,.3401,.1311,.2022,.1301,.0872,.1412,.1184,.1296), ADM_RATE = c(.8177,.8189,.7979,.7734,.5744,.5273,.3197,.4319,.5107,.8827), UGDS = c(.1026,.4263,.3231,.024,.0116,.0886,.0281,.0141,.0276,.0721), SAT_AVG = c(.7097,.639,.6865,.4012,.4134,.4231,.3707,.5231,.4853,.5012), TUITIONFEE_OUT = c(.3776,.4907,.5054,.4428,.3325,.3199,.3833,.4315,.3221,.4132), AVGFACSAL = c(.361,.3951,.4204,.1525,.1908,.2242,.1797,.1068,.2517,.2845), PFTFAC = c(.6127,.7398,.8642,.4628,.4176,.6636,.42,1,.6779,1), RET_FT4_POOLED = c(.8077,.8615,.9,.5043,.5902,.7204,.5879,.7183,.7134,.7182), INEXPFTE = c(.0462,.0577,.0476,.0263,.0314,.0329,.0389,.0382,.0737,.0364), C100_4_POOLED = c(.2421,.5332,.5318,.1136,.3775,.1823,.1934,.3783,.3122,.2001), GRAD_DEBT_MDN = c(.537,.586,.538,.583,.704,.568,.674,.704,.608,.561), COSTT4_A = c(.2136,.2993,.324,.3632,.3994,.1429,.181,.389,.2255,.1699), X40.year.NPV = c(.3005,.2631,.3126,.1084,.1789,.1221,.0835,.1278,.1057,.1257)

And I'm working with this model:

lm_joined1 <- lm(cbind(MD_EARN_WNE_P10, X40.year.NPV) ~ ADM_RATE + UGDS + SAT_AVG + TUITIONFEE_OUT + AVGFACSAL + PFTFAC + RET_FT4_POOLED + INEXPFTE + C100_4_POOLED, data = training_set_NORM)

I want to check covariance, so I use vcov(lm_joined1), which yields a rather large output. So I want to visualize the matrix. Here's my attempt:

cor_matrix3 = vcov(lm_joined1, method='pearson',use='complete.obs')
head(cor_matrix3)
ggcorrplot(cor_matrix3, method = c("square"), type = c("full"), 
           ggtheme = ggplot2::theme_minimal, 
           title = "Correlation Matrix: Select Variables", show.legend = TRUE, 
           legend.title = "Corr", show.diag = FALSE, outline.color = "gray", 
           hc.order = TRUE, lab = TRUE, lab_col = "black", 
           lab_size = 2, tl.cex = 10, tl.col = "black", tl.srt = 45, digits = 2) + 
  theme(
   legend.key.width = unit(.6, "cm"),   #to resize legend
   legend.key.height = unit(1.4, "cm"),
  )

This does print a matrix with all variables, but every single box is zero:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source