CASE.Rd
Perform Multi-trait Fine-mapping
CASE(
Z = NULL,
R,
hatB = NULL,
hatS = NULL,
N,
V = NULL,
cs = TRUE,
verbose = TRUE,
...
)
M * C matrix of z scores.
M * M matrix of LD.
M * C matrix of the estimated effects. Alternative summary data (together with hatS) to be provided instead of Z.
M * C matrix of standard errors of the estimated effects. Alternative summary data (together with hatB) to be provided instead of Z.
either C vector of the sample size, or C * C matrix of the sample size (diagonal) and ovelaps (off-diagonal). If provided with a vector, CASE assumes that each pair of traits overlaps with their minimal sample size.
(optional) C * C covariance (correlation) matrix for the noise between traits. If not provided, the default is an identity matrix representing no correlations of the error.
(optional) logical, whether to get credible sets. Default = TRUE.
(optional) logical, whether to print logging information. Default = TRUE.
additional arguments.
A "CASE"
object with the following elements:
L-vector, the prior probabilities of sharing patterns.
L-list of C * C matrix, the prior covariances of sharing patterns.
C * C matrix, the sample-adjusted phenotypical variance.
M * C matrix, posterior probability of having eQTL effects per SNP per cell type.
M * C matrix, average posterior estimates of eQTL effects per SNP per cell type.
TBD
TBD
## A single-trait example.
set.seed(3)
N = 500
M = 1000
X = matrix(sample(0:2, size = N * M, replace = TRUE), N, M)
B = rep(0, M)
B[1:4] = runif(4, 1, 2)
e = rnorm(N)
Y = X %*% B + e
X = scale(X)
Y = scale(Y)
R = cor(X)
Z = hatB = hatS = rep(0, M)
hatB <- as.vector(t(X) %*% Y / (N - 1))
hatS <- sqrt((sum(Y^2) / (N - 1) - hatB^2 ) / (N - 1))
Z <- hatB / hatS
fit <- CASE(Z = Z, R = R, N = N)
#> Start Prior fitting.
#> Initialize with patterns: 1 0
#> Start Posterior Analysis.
#> Start getting credible sets.
# print(fit$sets)
## A multi-trait example.
set.seed(3)
N = 500
M = 1000
C = 3
X = matrix(sample(0:2, size = N * M, replace = TRUE), N, M)
B = matrix(0, M, C)
B[1, ] = runif(C, 1, 2)
B[2, 1] = runif(1, 2, 3)
e = matrix(rnorm(N * C), N, C)
Y = X %*% B + e
X = scale(X)
Y = scale(Y)
R = cor(X)
Z = hatB = hatS = matrix(0, M, C)
for (c in 1:C){
hatB[, c] <- t(X) %*% Y[, c] / (N - 1)
hatS[, c] <- sqrt((sum(Y[, c]^2) / (N - 1) - hatB[, c]^2 ) / (N - 1))
Z[, c] <- hatB[, c] / hatS[, c]
}
fit <- CASE(Z = Z, R = R, N = N)
#> Start Prior fitting.
#> Initialize with patterns: 111 100 010 001 000
#> Start Posterior Analysis.
#> Start getting credible sets.
# print(fit$sets)