EMbootstrap {EMSNM}R Documentation

Bootstrap Method

Description

Estimate the value of parameters several times by bootstrap method where the parameters are estimated by EM algorithm. In this way, we can observe the distribution of parameter.

Usage

EMbootstrap(X, Y, Z, samplesize, boots_samplesize, boots_expriments, classsize = 2,
            learning_rate = 0.1, regular_parameter_eta = 0.001, max_iteration = 10000, 
            max_iteration_eta = 10000, compact_flag = FALSE, C0 = 5, C1 = 2, C2 = 9)

Arguments

X

the co-variables of the mean of each subgroup

Y

the respond variable

Z

the co-variables determining subgroup

samplesize

the size of this sample.

boots_samplesize

the size of chosen sample in one step of bootstrap

boots_expriments

the steps of bootstrap

classsize

the number of subgroup types in your model assumption

learning_rate

learning rate of updating eta

regular_parameter_eta

regular value of updating eta by gradient descending method.

max_iteration

maximum steps of iteration to avoid unlimited looping.

max_iteration_eta

maximal steps of eta iteration to avoid unlimited looping.

compact_flag

if the value of eta is limited in a compact set, set it TRUE

C0

the maximum of intercept of eta.

C1

the minimum of the norm of slope of eta

C2

the maximum of the norm of slope of eta

Details

Actually, the method can be extended to other parameter estimation where the standard error of parameter can't be calculated in a simple way.

Value

alpha

alpha estimated by bootstrap method.

eta

eta estimated by bootstrap method.

sigma

sigma estimated by bootstrap method.

Author(s)

Linsui Deng

Examples

#parameter initialization
etasize <- 2
classsize <- 2
alphasize <- 3
samplesize <- 1000
  
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 EMbootstrap
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]) 

[Package EMSNM version 1.0 Index]