entropy.weight: Maximum entropy weights

Description Usage Arguments Examples

View source: R/entropy.weight.R

Description

entropy.weight produces a set of weights that maximizes the total weighted entropy of the distribution of different biomarkers within each subject, values of biomarkers can be either continuous or categorical.

Usage

1

Arguments

X

n by p maxtrix containing observations of p biomarkers of n subjects.

h

bandwidth for kernel density estimation. if data is categorical, set to 'na'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(MASS)
# a three biomarkers dataset generated from independent normal(0,1)
set.seed(1)
X = mvrnorm(n = 100, mu=rep(0,3), Sigma=diag(3), tol = 1e-6, empirical = FALSE, EISPACK = FALSE)
entropy.weight(X, h=1)
###
# a three categorical biomarkers dataset
set.seed(1)
tmp=mvrnorm(n=10,mu=c(0,0,0),Sigma = diag(3))
dat=t(apply(tmp, 1, function(x) cut(x,c(-Inf,-0.5,0.5,Inf),labels=1:3)))
entropy.weight(dat,h='na')

Example output

[1] 0.3518879 0.3436133 0.3044988
[1] 0.4080125 0.1840237 0.4079638

mdw documentation built on July 1, 2020, 10:27 p.m.

Related to entropy.weight in mdw...