Extract various sigma matrices

cov_mat(obj, which = c("xy", "zy", "zw"), use_population = TRUE)

Arguments

obj

A simrel object

which

A character string to specify which covariance matrix to extract, possible values are "xy", "zy" and "zw"

use_population

A boolean whether to use compute population values or to estimate from sample

Value

A matrix of covariances with column equals to the number of response and row equals to the number of predictors

Examples

set.seed(1983) sobj <- multisimrel() cov_mat(sobj, which = "xy", use_population = TRUE)
#> [,1] [,2] [,3] [,4] [,5] #> [1,] 0.05473538 0.00000000 0.00000000 0.00000000 0.00000000 #> [2,] 0.44858369 0.00000000 0.00000000 0.00000000 0.00000000 #> [3,] 0.00000000 -0.10890699 0.00000000 0.00000000 0.10890699 #> [4,] 0.00000000 0.02184183 0.00000000 0.00000000 -0.02184183 #> [5,] 0.00000000 0.00000000 0.01324199 -0.01324199 0.00000000 #> [6,] 0.00000000 0.19497385 0.00000000 0.00000000 -0.19497385 #> [7,] 0.00000000 0.00000000 0.10910888 -0.10910888 0.00000000 #> [8,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 #> [9,] -0.47857313 0.00000000 0.00000000 0.00000000 0.00000000 #> [10,] -0.38466577 0.00000000 0.00000000 0.00000000 0.00000000 #> [11,] 0.00000000 0.00000000 -0.12235087 0.12235087 0.00000000 #> [12,] 0.35991983 0.00000000 0.00000000 0.00000000 0.00000000 #> [13,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 #> [14,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 #> [15,] 0.00000000 -0.10790869 0.00000000 0.00000000 0.10790869
cov_mat(sobj, which = "xy", use_population = FALSE)
#> [,1] [,2] [,3] [,4] [,5] #> [1,] 0.1499094276 0.0225551020 -0.021142532 -0.017642244 0.009116718 #> [2,] 0.3270660152 -0.0537449359 -0.033024128 -0.036275335 0.016893383 #> [3,] -0.0113945975 -0.0636098314 0.019111991 0.046077320 0.059385293 #> [4,] 0.0767651573 -0.0019784663 -0.029996310 -0.032876966 0.028271693 #> [5,] 0.0222361281 0.0075803695 0.022482684 -0.006324240 0.005639610 #> [6,] -0.0141878957 0.1413595087 -0.003967554 -0.064016125 -0.172939042 #> [7,] -0.0115258345 0.0227697907 0.098918022 -0.119249383 0.011651468 #> [8,] 0.0027930961 0.0021889811 -0.002523865 -0.005940305 0.003180998 #> [9,] -0.4569019775 0.0246946536 0.076264713 0.053941713 -0.019426372 #> [10,] -0.3785386131 0.0221709535 0.041538158 0.050496291 -0.023458174 #> [11,] -0.0008586489 -0.0185189080 -0.109589395 0.115398439 -0.005525881 #> [12,] 0.3642008527 -0.0188607949 -0.063248293 -0.052700939 0.009243102 #> [13,] -0.0007261248 0.0008247841 0.008077454 -0.004486281 0.002823606 #> [14,] -0.0057113104 -0.0065983306 -0.004226565 0.009044024 -0.005520259 #> [15,] -0.0482433762 -0.0719015998 0.017384308 0.049231552 0.088036807