Hi all,
Assume I have a data set collected in a related family.
dat <- read.table(textConnection(" Id Father Mother x y
1 0 0 15 26
2 0 0 18 14
3 1 2 12 25
4 0 2 15 30
5 1 0 19 28"), header=TRUE)
xx=dat$x
yy=dat$y
I want to analyze the correlation *between x and y by accounting the
relationship among
ID, father and Mother.* The relationship among these individuals is stored
in matrix
AM. AM is a symmetric 5 by 5 matrix.
AM matrix looks like
[,1] [,2] [,3] [,4] [,5]
[1,] 0.5 0.0 0.50 0.00 0.5
[2,] 0.0 1.0 0.50 0.50 0.0
[3,] 0.5 0.5 0.50 0.25 0.5
[4,] 0.0 0.5 0.25 1.00 0.0
[5,] 0.5 0.0 0.50 0.00 1.0
How do I use this AM matrix in the calculation of correlation between
variables x and y
Cor(xx,yy)
Is it possible to do it in R?
Thanks in advance
[[alternative HTML version deleted]]