Description Usage Arguments Value References Examples

This function solves the optimization problem

*min -tr(SX) + λ * p(X),*

*s.t. O ≼ X ≼ I, X ≥ 0, and tr(X) = 1,*

where *O ≼ X ≼ I* means all eigenvalues of *X* are
between 0 and 1, *X ≥ 0* means all elements of *X* are nonnegative,
and *p(X)* is a penalty function defined in the article
(see the **References** section).

1 2 3 4 5 6 7 8 9 10 | ```
pca_pen(
S,
gr,
lambda,
w = 1.5,
alpha = 0.01,
maxit = 1000,
eps = 1e-04,
verbose = 0
)
``` |

`S` |
The sample correlation matrix of gene expression. |

`gr` |
Indices of genes that are treated as markers in the prior information. |

`lambda` |
Tuning parameter to control the sparsity of eigenvectors. |

`w` |
Tuning parameter to control the weight on prior information.
Larger |

`alpha` |
Step size of the optimization algorithm. |

`maxit` |
Maximum number of iterations. |

`eps` |
Tolerance parameter for convergence. |

`verbose` |
Level of verbosity. |

A list containing the following components:

- projection
The estimated projection matrix.

- evecs
The estimated eigenvectors.

- niter
Number of iterations used in the optimization process.

- err_v
The optimization error in each iteration.

Qiu, Y., Wang, J., Lei, J., & Roeder, K. (2020). Identification of cell-type-specific marker genes from co-expression patterns in tissue samples.

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 | ```
set.seed(123)
n = 200 # Sample size
p = 500 # Number of genes
s = 50 # Number of true signals
# The first s genes are true markers, and others are noise
Sigma = matrix(0, p, p)
Sigma[1:s, 1:s] = 0.9
diag(Sigma) = 1
# Simulate data from the covariance matrix
x = matrix(rnorm(n * p), n) %*% chol(Sigma)
# Sample correlation matrix
S = cor(x)
# Indices of prior marker genes
# Note that we have omitted 10 true markers, and included 10 false markers
gr = c(1:(s - 10), (s + 11):(s + 20))
# Run the algorithm
res = pca_pen(S, gr, lambda = 0.1, verbose = 1)
# See if we can recover the true correlation structure
image(res$projection, asp = 1)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.