th0 <- 0.5
stopifnot(all.equal(get_cor(th0),th0/sqrt(1+th0^2)))
get_cor(c(0.5,0.2,0.5))
C <- matrix(c(1, 0.2, 0.1,
0.2, 1, -0.2,
0.1,-0.2, 1),
3, 3)
## test: round-trip (almostl results in lower triangle only)
stopifnot(all.equal(get_cor(put_cor(C)),
C[lower.tri(C)]))
Run the code above in your browser using DataLab