EM: Maximization step of the EM algorithm

Description Usage Arguments Value Examples

Description

Maximization step of the EM algorithm

Usage

1
em(bl, bu, freq, theta_init, maxit = 1000, tol1 = 0.001, tol2 = 1e-04)

Arguments

bl

Lower bound of the intervals, values in vector, starting from -inf.

bu

Upper bound of the intervals, values in vector, ending with +inf.

freq

Frequency over the intervals, values in vector.

theta_init

The initial values of the parameters, for mu and sigma. Vector with two values.

maxit

The maximum number of iteration of the EM algorithm.

tol1

A number, the stopping criteria for updating mu.

tol2

A number, the stopping criteria for updating sigma.

Value

This is the maximization step of the EM algorithm (M-step) that has defined it using the function E-Step for mean estimate and variance estimate. Return a list has as arguments "mu_estimate" for the average and "sigma_estimate" for the variance.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 library(em.univ)


 output2 <- base::list()
 simdataaaa <- em.univ::univ_simul(ncol_matrix=1,
                       n=50,
                       nclass = 10,
                       mean = 68,
                       sd = 1.80,
                       fr_breaks=c(62,64,66,68,70,72,74,76,78))

 output2 <- em.univ::em(bl=simdataaaa$simul_data[,1,1],
               bu=simdataaaa$simul_data[,2,1],
               freq=simdataaaa$simul_data[,3,1],
               theta_init=c(67,2),
               maxit = 1000,
               tol1=1e-3,
               tol2=1e-4)
 output2

JoaoPedro2536/univ.em documentation built on Dec. 18, 2021, 1:38 a.m.