Calculates a particular set of summary statistics for a dataset.
Value
A named list of summary statistics containing
nThe sample size.meansThe sample means of each variable.variancesThe sample means of each variable.correlationThe sample correlation matrix.intercepts,slopes,rsquaredMatrices whose (i,j)th entries are the estimated regression coefficients in a regression ofx[, i]onx[, j]and the resulting coefficient of determination \(R^2\).
Examples
get_stats(anscombe[, c(1, 5)])
#> $n
#> [1] 11
#>
#> $means
#> x1 y1
#> 9.000000 7.500909
#>
#> $variances
#> x1 y1
#> 11.000000 4.127269
#>
#> $correlation
#> x1 y1
#> x1 1.0000000 0.8164205
#> y1 0.8164205 1.0000000
#>
#> $intercepts
#> x1 y1
#> x1 0.000000 1.332843
#> y1 3.000091 0.000000
#>
#> $slopes
#> x1 y1
#> x1 1.0000000 -0.9975311
#> y1 0.5000909 1.0000000
#>
#> $rsquared
#> [,1] [,2]
#> [1,] 1.0000000 0.6665425
#> [2,] 0.6665425 1.0000000
#>