Computes the cross–sectional correlation matrix
cortab(x, grouping, groupnames = NULL, value = "statistic", ...)
Arguments
- x
an object of class pseries
- grouping
grouping variable,
- groupnames
a character vector of group names,
- value
to complete,
- ...
further arguments.
Value
A matrix with average correlation coefficients within a group
(diagonal) and between groups (off-diagonal).
Examples
data("Grunfeld", package = "plm")
pGrunfeld <- pdata.frame(Grunfeld)
grp <- c(rep(1, 100), rep(2, 50), rep(3, 50)) # make 3 groups
cortab(pGrunfeld$value, grouping = grp, groupnames = c("A", "B", "C"))
#> A B C
#> A 0.5562310 NA NA
#> B 0.5431652 0.5406152 NA
#> C 0.3799585 0.2999645 -0.1665637