sampleCovEst() computes the sample covariance matrix. This function is a simple wrapper around covar().

sampleCovEst(dat)

Arguments

dat

A numeric data.frame, matrix, or similar object.

Value

A matrix corresponding to the estimate of the covariance matrix.

Examples

sampleCovEst(dat = mtcars)
#>              mpg         cyl        disp          hp         drat          wt
#> mpg    36.324103  -9.1723790  -633.09721 -320.732056   2.19506351  -5.1166847
#> cyl    -9.172379   3.1895161   199.66028  101.931452  -0.66836694   1.3673710
#> disp -633.097208 199.6602823 15360.79983 6721.158669 -47.06401915 107.6842040
#> hp   -320.732056 101.9314516  6721.15867 4700.866935 -16.45110887  44.1926613
#> drat    2.195064  -0.6683669   -47.06402  -16.451109   0.28588135  -0.3727207
#> wt     -5.116685   1.3673710   107.68420   44.192661  -0.37272073   0.9573790
#> qsec    4.509149  -1.8868548   -96.05168  -86.770081   0.08714073  -0.3054816
#> vs      2.017137  -0.7298387   -44.37762  -24.987903   0.11864919  -0.2736613
#> am      1.803931  -0.4657258   -36.56401   -8.320565   0.19015121  -0.3381048
#> gear    2.135685  -0.6491935   -50.80262   -6.358871   0.27598790  -0.4210806
#> carb   -5.363105   1.5201613    79.06875   83.036290  -0.07840726   0.6757903
#>              qsec           vs           am        gear        carb
#> mpg    4.50914919   2.01713710   1.80393145   2.1356855 -5.36310484
#> cyl   -1.88685484  -0.72983871  -0.46572581  -0.6491935  1.52016129
#> disp -96.05168145 -44.37762097 -36.56401210 -50.8026210 79.06875000
#> hp   -86.77008065 -24.98790323  -8.32056452  -6.3588710 83.03629032
#> drat   0.08714073   0.11864919   0.19015121   0.2759879 -0.07840726
#> wt    -0.30548161  -0.27366129  -0.33810484  -0.4210806  0.67579032
#> qsec   3.19316613   0.67056452  -0.20495968  -0.2804032 -1.89411290
#> vs     0.67056452   0.25403226   0.04233871   0.0766129 -0.46370968
#> am    -0.20495968   0.04233871   0.24899194   0.2923387  0.04637097
#> gear  -0.28040323   0.07661290   0.29233871   0.5443548  0.32661290
#> carb  -1.89411290  -0.46370968   0.04637097   0.3266129  2.60887097