th0 <- 0.5
stopifnot(all.equal(get_cor(th0),th0/sqrt(1+th0^2)))
set.seed(101)
C <- get_cor(rnorm(21), return_val = "mat")
## test: round-trip
stopifnot(all.equal(get_cor(put_cor(C), return_val = "mat"), C))
Run the code above in your browser using DataLab