# [R] constraining correlations

Matthew Keller mckellercran at gmail.com
Thu Oct 11 18:55:41 CEST 2007

```Hello,

I've searched for an answer to no avail. I am wondering if anyone
knows how to constrain certain correlations to be equal. I have family
data with 2 twins per family plus up to 2 siblings. I would like to
somehow constrain all the sibling correlations (twin-sib and sib-sib)
to be the same while allowing the twin-twin correlation to be
different. Here is some simulated code:

set.seed(5)
famdata <- matrix(rnorm(400),ncol=4,dimnames=list(NULL,c("Twin1","Twin2","Sib1","Sib2")))
famdata[runif(100)<.2,3] <- NA    #20% of sib 1s are missing
famdata[runif(100)<.4,4] <- NA    #40% of sib 2s are missing
cor(famdata,use="pairwise.complete")

<R output>
Twin1      Twin2     Sib1      Sib2
Twin1  1.00000  0.12027  0.02286 -0.10578
Twin2  0.12027  1.00000  0.08118 -0.08470
Sib1    0.02286  0.08118  1.00000 -0.05064
Sib2   -0.10578 -0.08470 -0.05064  1.00000

So I want these five correlations: 0.02286 -0.10578 0.08118 -0.08470
-0.05064 to be constrained to be the same value. My actual data is
much more complicated than this, needing to constrain many different
classes of parent-offspring and spousal correlations.

Or is there some simpler alternative - e.g., transforming the
correlations to a Fisher z and doing a weighted sum?