1

My question was: I'm trying to calculate the correlation between "ftd" and "ici" variables but I can't figure out how to use cortab function and I couldn't find any example in web about that.

To those who want to learn how to use cortab function, thanks to Giovanni Millo (one of the authors of plm package), I found examples. I've published the database of it and just in case I'm also putting the codes here.

http://qed.econ.queensu.ca/jae/2015-v30.4/millo/

Helix123
  • 3,502
  • 2
  • 16
  • 36
onur
  • 13
  • 3

1 Answers1

0

Here is a toy example of the cortab function in package plm:

library(plm)
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

The output matrix contains the average cross–sectional correlation coefficients within a group (diagonal) and between groups (off-diagonal).

Helix123
  • 3,502
  • 2
  • 16
  • 36