Description Usage Arguments Examples
negloglik
provides a negative log-likelihood function
of negative binomial distribution
whose mean is a sum of nonnegative terms with covariates
1 2 3 4 5 6 7 8 9 10 |
coefs |
a vector of c(beta, gamma, overdispersion), where beta is a length K vector of cell type-indepedent coefficients, gamma is a matrix of H x M dimension of cell type-specific non-negative coefficients, and overdispersion is a scalar. |
cell_type_specific_variables |
an array of n_B x H x K of cell type-independent variables. |
other_variables |
a design matrix of n_B x M of cell type-specific variables. Can be NULL. |
read_depth |
a vector of n_B sample-specific read depths. |
cellular_proportions |
a matrix of n_B x H of cellular proportions. |
counts |
A vector of n_B total read counts observed. |
use_log_scale_params |
logical. The default is FALSE, where the cell type-specific effects are parametrized on a non-log scale. Otherwise, they are parametrized on a log scale. |
verbose |
logical. If |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(CARseq)
set.seed(1234)
H = 4
n_B = 60
K = 1
M = 3
overdispersion_theta = 10
coefs = c(rep(0, K), rep(1, H*M), overdispersion_theta) # initial value
cell_type_specific_variables = array(0, dim=c(n_B, H, M))
cell_type_specific_variables[1:(n_B/3), , 1] = 1
cell_type_specific_variables[(n_B/3+1):(n_B*2/3), , 2] = 1
cell_type_specific_variables[(n_B*2/3+1):n_B, , 3] = 1
other_variables = matrix(runif(n_B * K, min = -1, max = 1), nrow=n_B, ncol=K)
read_depth = round(runif(n_B, min = 50, max = 100))
cellular_proportions = matrix(runif(n_B * H), nrow = n_B, ncol = H)
cellular_proportions = cellular_proportions / rowSums(cellular_proportions)
counts = round(runif(n_B, min = 100, max = 200))
CARseq:::negloglik(coefs, cell_type_specific_variables, other_variables, read_depth, cellular_proportions, counts)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.