Logll: Likelihood Estimation.

Description Usage Arguments Value Examples

View source: R/em_mcem_logll.R

Description

Likelihood Estimation.

Usage

1
Logll(tl, freq, theta)

Arguments

tl

Lower end of the intervals.

freq

Frequency on each interval.

theta

The arguments including mu and sigma.

Value

Return the result of the log likelihood for the mean (mu) and sigma (standard deviation) estimates.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 library(stats)

 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))
 
 
 tl <- simdataaaa$simul_data[,1,1]
 freq <- simdataaaa$simul_data[,3,1]
 res <- stats::optim(c((67/2),(1/2)),fn=Logll,tl=tl,freq=freq,
 method="L-BFGS-B",lower=c(0.02,0.2),upper=c(180,2))
 
 estimate<- res$par
 mu_estimate<- base::round(res$par[1]/res$par[2],4)
 sigma_estimate<- base::round(1/res$par[2],4) 
 sigma_squared_estimate = sigma_estimate^2
 
 mu_estimate
 sigma_squared_estimate

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