marg2con | R Documentation |
Returns conditional estimates based on marginal estimates (such as public GWAS summary statistics) and a correlation matrix. Allows post-hoc adjustments for covariates without access to the original data. Among other things, this is useful for fine-mapping and for decorrelating variants to prevent double-counting in polygenic risk scores.
marg2con(
marginal_coefs,
X = NULL,
covX = NULL,
corX = NULL,
MAF = NULL,
N = NULL,
marginal_se = NULL,
estimate_se = FALSE,
y = NULL,
varY = NULL,
ridge = FALSE,
lambda = 0,
binary = FALSE,
caseprop = 0.25
)
marginal_coefs |
A numeric vector of k marginal coefficient estimates from linear or logistic regression models. |
X |
An n*k matrix of predictors, with k equal to the length of marginal_coefs. Is not necessary when covX or corX and MAF are provided. |
covX |
A k*k covariance matrix. |
corX |
A k*k correlation matrix. |
MAF |
A numeric vector of k minor allele frequencies. |
N |
A single constant representing the sample size of the GWAS from which the marginal estimates were derived. |
marginal_se |
A numeric vector of k marginal standard error estimates from linear or logistic regression models. |
estimate_se |
If TRUE and if marginal_se is not NULL, returns conditional standard error estimates. |
y |
A continuous or binary response vector. If provided together with X, standard OLS is fit to obtain the estimates. |
varY |
The variance of the response vector. Is estimated if not provided. |
ridge |
If TRUE, applies a ridge penalty. |
lambda |
The parameter controlling the degree of (ridge) regularization. |
binary |
If TRUE, assumes that marginal_coefs are log odds ratios and that the standard errors should be estimated based on a different variance approximation for the response vector. |
caseprop |
The proportion of the response vector that represents 'cases', i.e. the proportion of the binary-valued vector that is equal to 1. |
A data.frame of conditional regression estimates, including standard errors and p-values depending on the input arguments.
marg_coefs <- rbind(summary(lm(Sepal.Length~Petal.Width, iris))$coef[2,1:2],
summary(lm(Sepal.Length~Petal.Length, iris))$coef[2,1:2],
summary(lm(Sepal.Length~Sepal.Width, iris))$coef[2,1:2])
covX <- cov(iris[c('Petal.Width','Petal.Length','Sepal.Width')])
N <- nrow(iris)
marg2con(marginal_coefs = marg_coefs[,1],
covX = covX,
N = N,
marginal_se = marg_coefs[,2],
estimate_se = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.