geneJAM | R Documentation |
This function clusters traits that share some genetic component via polygenic scores (PSs). It fits a sparse precision matrix via graphical lasso. The regularisation path is computed for the lasso penalty at a grid of values for the regularisation parameter rho. The clusters are used to specify the structure of the error covariance matrix of a GLS model and the feasible GLS estimator is used for estimating the unknown parameters in a linear regression model with a certain unknown degree of correlation between the residuals.
geneJAM( x, y, rho = NULL, nrho = ifelse(is.null(rho), 20, length(rho)), logrho = FALSE, rho.min.ratio = 0.001 )
x |
Input matrix, of dimension nobs x nvars of PGSs with nvars = nouts. Can be in sparse matrix format. |
y |
Quantitative response matrix, of dimension nobs x nouts. |
rho |
(Non-negative) regularisation parameter for lasso passed to glasso. |
nrho |
The number of rho values - default is 40. |
logrho |
Logical flag for log transformation of the rho sequence. Default is |
rho.min.ratio |
Smallest value for rho, as a fraction of rho.max, the (data derived) entry value (i.e. the smallest value for which all coefficients are zero) - default is 10e-04. |
...
An object of class "geneJAM" is returned.
call |
The call that produced this object. |
xi |
A matrix of intercepts of dimension nouts x length(rho) |
beta |
A matrix of coefficients for the PSs of dimension nouts x length(rho) |
A |
A length(rho) list of estimated adjacency matrices A of 0s and 1s, where A_ij is equal to 1 iff edges i and j are adjacent and A_ii is 0. |
P |
A length(rho) list of estimated precision matrices (matrix inverse of correlation matrices). |
Sigma |
A length(rho) list of estimated correlation matrices. |
rho |
The actual sequence of rho values used. |
PS |
Polygenic scores used. If |
logrho |
Logical flag for log transformation of the rho sequence. Default is |
nobs |
Number of observations. |
xiStderr |
Standard error of coefficients |
betaStderr |
Standard error of coefficients |
betaSD |
Standard error of the mean of coefficients |
betaSD0 |
Standard error of the mean of all coefficients |
rho.min |
Value of rho that gives minimum non-zero betaSD. |
N <- 1000 # q <- 10 # p <- 1000 # set.seed(1) # Sample 1 X0 <- matrix(rbinom(n = N*p, size = 2, prob = 0.3), nrow=N, ncol=p) B <- matrix(0, nrow = p, ncol = q) B[1, 1:2] <- 1 B[3, 3] <- 2 y0 <- X0 %*% B + matrix(rnorm(N*q), nrow = N, ncol = q) #y0 <- apply(y0, 2, scale) beta <- ps.geneJAM(X0, y0)$beta # Sample 2 X <- matrix(rbinom(n = N*p, size = 2, prob = 0.3), nrow=N, ncol=p) y <- X %*% B + matrix(rnorm(N*q), nrow = N, ncol = q) #y <- apply(y, 2, scale) #Sigma <- diag(1, q) #Sigma[1, 2] <- Sigma[2, 1] <- .8 #y <- X %*% B + MASS::mvrnorm(n = N, mu = rep(0, q), Sigma = Sigma) x <- X %*% beta #x <- MASS::mvrnorm(n = N, mu = rep(0, q), Sigma = diag(1, q)) ### pc <- geneJAM(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.