`R/cov_udi.R`

`cov_udi.Rd`

Compute a list of covariance matrices corresponding to the "Unassociated", "Directly associated" and "Indirectly associated" models

`cov_udi(data, model = udi_model_matrix(n_conditions(data)))`

- data
a mash data object, eg as created by

`mash_set_data`

- model
a model matrix with R columns, where R is the number of conditions in the data; each row should be a vector of length R with elements "U","D" and "I" indicating whether each effect is Unassociated, Directly associated or Indirectly associated

a named list of covariance matrices

If model is specified then this returns the covariance matrices for those models. The default creates all possible models. For a desription of the "Unassociated", "Directly associated" and "Indirectly associated" models see Stephens M (2013), A unified framework for Association Analysis with Multiple Related Phenotypes, PloS ONE.

```
data = mash_set_data(Bhat = cbind(c(1,2),c(3,4)), Shat = cbind(c(1,1),c(1,1)))
cov_udi(data)
#> $cov_udi_DU
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 0
#>
#> $cov_udi_UD
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#>
#> $cov_udi_DD
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
#> $cov_udi_ID
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#>
#> $cov_udi_DI
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 0
#>
cov_udi(data,c('I','D'))
#> $cov_udi_ID
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 0 1
#>
```