Description Usage Arguments Examples
var.weight produces a set of weights that maximizes the total weighted variance of the distribution of different biomarkers within each subject.
1 | var.weight(X, method = c("optim", "mosek"))
|
X |
n by p maxtrix containing observations of p biomarkers of n subjects. |
method |
optim (default) using R constrOptim function from stats package for optimization, mosek using mosek function from Rmosek package for optimization |
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(MASS)
# a three biomarkers dataset generated from independent normal(0,1)
X = mvrnorm(n = 100, mu=rep(0,3), Sigma=diag(3), tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
# compute maximum variance weights using constrOptim for optimization
var.weight(X)
## Not run:
# need mosek installed
# compute maximum variance weights using mosek for optimization
library(Rmosek)
var.weight(X,'mosek')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.