EMSNM-package {EMSNM} | R Documentation |
EM Algorithm for Sigmoid Normal Model
Description
It provides a method based on EM algorithm to estimate the parameter of a mixture model, Sigmoid-Normal Model, where the samples come from several normal distributions (also call them subgroups) whose mean is determined by co-variable Z and coefficient alpha while the variance are homogeneous. Meanwhile, the subgroup each item belongs to is determined by co-variables X and coefficient eta through Sigmoid link function which is the extension of Logistic Link function. It uses bootstrap to estimate the standard error of parameters. When sample is indeed separable, removing estimation with abnormal sigma, the estimation of alpha is quite well. I used this method to explore the subgroup structure of HIV patients and it can be used in other domains where exists subgroup structure.
Details
The DESCRIPTION file:
Package: | EMSNM |
Type: | Package |
Title: | EM Algorithm for Sigmoid Normal Model |
Version: | 1.0 |
Date: | 2019-04-19 |
Author: | Linsui Deng <denglinsui@gmail.com> |
Maintainer: | Linsui Deng <denglinsui@gmail.com> |
Description: | It provides a method based on EM algorithm to estimate the parameter of a mixture model, Sigmoid-Normal Model, where the samples come from several normal distributions (also call them subgroups) whose mean is determined by co-variable Z and coefficient alpha while the variance are homogeneous. Meanwhile, the subgroup each item belongs to is determined by co-variables X and coefficient eta through Sigmoid link function which is the extension of Logistic Link function. It uses bootstrap to estimate the standard error of parameters. When sample is indeed separable, removing estimation with abnormal sigma, the estimation of alpha is quite well. I used this method to explore the subgroup structure of HIV patients and it can be used in other domains where exists subgroup structure. |
License: | GPL(>=2) |
Index of help topics:
Ccompute Ccompute EMSNM-package EM Algorithm for Sigmoid Normal Model EM_parameter_sd Bootstrap Parameter Inference EM_result_sort Sort Parameter EMalgorithm Parameter Estimation EMbootstrap Bootstrap Method EMsimulation Simulation For Estimation Ggenerate Subgroup Determination Wgenerate Sigmoid Logistic Data Generation fnorm Density Value softmax Softmax Value standard Data Standardlization update_eta Updata Eta update_gamma Updata Alpha and Sigma weight_matrix Weighted Inner Product
The EMalgorithm is used to estimate the parameters, EMbootstrap is used to estimate the parameters with bootstrap method. In EMsimulation we can simulate the situation with given parameters, so parameter estimation can be verified.
Author(s)
Linsui Deng <denglinsui@gmail.com>
Maintainer: Linsui Deng <denglinsui@gmail.com>
Examples
#parameter initialization
etasize <- 2
classsize <- 2
alphasize <- 3
samplesize <- 100
expriments <- 30
etatest <- matrix(c(1,1,
0,0),etasize,classsize)
alphatest <- matrix(c(1,0,2,
4,3,5),alphasize,classsize)
sigmatest <- 0.5
#test of EMsimulation
EMsimulation_result <- EMsimulation(eta=etatest,alpha=alphatest,sigma=sigmatest,
samplesize=samplesize,expriments=expriments,
compact_flag=TRUE,C0=5,C1=0.5,C2=5)
index <- which(EMsimulation_result$sigma<0.8)
EMsimulation_result_sort <- EM_result_sort(EMsimulation_result$alpha[index,,],
EMsimulation_result$eta[index,,])
EM_parameter <- EM_parameter_sd(EMsimulation_result_sort$alpha,
EMsimulation_result_sort$eta,
EMsimulation_result$sigma[index])
#test of EMbootstrap
samplesize <- 1000
X <- matrix(c(matrix(1,samplesize),
rnorm(samplesize*(etasize-1))+1),samplesize,etasize)
Z <- matrix(c(matrix(1,samplesize),rbinom(prob=1/2,size=1,n=samplesize),
rnorm(samplesize*(alphasize-2))+1),samplesize,alphasize)
Wtest <- Wgenerate(alpha=alphatest,eta=etatest,sigma=sigmatest,X=X,Z=Z)
boots_samplesize <- 100
boots_expriments <- 30
samplesize <- dim(Wtest$X)[1]
EMbootstrap_theta <- EMbootstrap(Wtest$X,Wtest$Y,Wtest$Z,samplesize,
boots_samplesize,boots_expriments,
classsize=2,compact_flag=TRUE,C0=5,C1=0.2,C2=5)
index <- which(EMbootstrap_theta$sigma<0.8)
EMsimulation_result_sort <- EM_result_sort(EMbootstrap_theta$alpha[index,,],
EMbootstrap_theta$eta[index,,])
EM_parameter <- EM_parameter_sd(EMsimulation_result_sort$alpha,
EMsimulation_result_sort$eta,
EMbootstrap_theta$sigma[index])