Calculate Tetrachoric Correlations
tetracorr.Rd
This function calculates the tetrachoric correlations between pairs of variables in a given data frame. It returns a list containing a data frame with the tetrachoric correlation coefficients, and the sum of the tetrachoric correlations if the input variable was in p-value form.
Arguments
- data
data frame with "markname" and study names as column names.
- varlist
character vector of study names to include in the meta-analysis.
Value
list containing a data frame with tetrachoric correlation coefficients, and the sum of the tetrachoric correlations if the input variable was in p-value form.
Examples
data(snp_example)
head(snp_example)
#> markname trt1 trt2 trt3
#> 1 c01b000015585s 0.35580 0.7356 0.6920
#> 2 c01b000015644s 0.58850 0.4539 0.7164
#> 3 c01b000015647s 0.18840 0.3029 0.2111
#> 4 c01b000015717s 0.99820 0.2474 0.2029
#> 5 c01b000015721s 0.74750 0.2206 0.1954
#> 6 c01b000016805s 0.08051 0.1532 0.7910
varlist <- c("trt1","trt2","trt3")
tetracorr(snp_example, varlist)
#> $sigma
#> # A tibble: 3 × 4
#> row trt1 trt2 trt3
#> <chr> <dbl> <dbl> <dbl>
#> 1 trt1 1 0.215 -0.215
#> 2 trt2 0.215 1 0.127
#> 3 trt3 -0.215 0.127 1
#>
#> $sum_sigma
#> [1] 3.253552
#>