Description Usage Arguments Value About type About solver Examples
fit_ppl
returns estimates of HRs and their p-values given a known variance component (tau).
1 2 |
X |
A matrix of the preidctors. Can be quantitative or binary values. Categorical variables need to be converted to dummy variables. Each row is a sample, and the predictors are columns. |
outcome |
A matrix contains time (first column) and status (second column). The status is a binary variable (1 for failure / 0 for censored). |
corr |
A relatedness matrix. Can be a matrix or a 'dgCMatrix' class in the Matrix package. Must be symmetric positive definite or symmetric positive semidefinite. |
type |
A string indicating the sparsity structure of the relatedness matrix. Should be 'bd' (block diagonal), 'sparse', or 'dense'. See details. |
tau |
A positive scalar. A variance component given by the user. Default is 0.5. |
FID |
An optional string vector of family ID. If provided, the data will be reordered according to the family ID. |
eps |
An optional positive value indicating the tolerance in the optimization algorithm. Default is 1e-6. |
order |
An optional integer value starting from 0. Only valid when dense=FALSE. It specifies the order of approximation used in the inexact newton method. Default is 1. |
solver |
An optional bianry value that can be either 1 (Cholesky Decomposition using RcppEigen), 2 (PCG) or 3 (Cholesky Decomposition using Matrix). Default is NULL, which lets the function select a solver. See details. |
spd |
An optional logical value indicating whether the relatedness matrix is symmetric positive definite. Default is TRUE. |
verbose |
An optional logical value indicating whether to print additional messages. Default is TRUE. |
beta: The estimated coefficient for each predictor in X.
HR: The estimated HR for each predictor in X.
sd_beta: The estimated standard error of beta.
p: The p-value.
iter: The number of iterations until convergence.
ppl: The PPL when the convergence is reached.
type
'bd' is used for a block-diagonal relatedness matrix, or a sparse matrix the inverse of which is also sparse. 'sparse' is used for a general sparse relatedness matrix the inverse of which is not sparse.
solver
When solver=1,3
/solver=2
, Cholesky decompositon/PCG is used to solve the linear system. When solver=3
, the solve function in the Matrix package is used, and when solver=1
, it uses RcppEigen:LDLT to solve linear systems.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | library(Matrix)
library(MASS)
library(coxmeg)
## simulate a block-diagonal relatedness matrix
tau_var <- 0.2
n_f <- 100
mat_list <- list()
size <- rep(10,n_f)
offd <- 0.5
for(i in 1:n_f)
{
mat_list[[i]] <- matrix(offd,size[i],size[i])
diag(mat_list[[i]]) <- 1
}
sigma <- as.matrix(bdiag(mat_list))
n <- nrow(sigma)
## simulate random effexts and outcomes
x <- mvrnorm(1, rep(0,n), tau_var*sigma)
myrates <- exp(x-1)
y <- rexp(n, rate = myrates)
cen <- rexp(n, rate = 0.02 )
ycen <- pmin(y, cen)
outcome <- cbind(ycen,as.numeric(y <= cen))
## fit the ppl
re = fit_ppl(x,outcome,sigma,type='bd',tau=0.5,order=1)
re
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.