Displaying 3 results from an estimated 3 matches for "mlogl_out".
Did you mean:
log_out
2008 May 22
1
Computing Maximum Loglikelihood With "nlm" Problem
...is:
__BEGIN__
vsamples<- c(103.9, 88.5, 242.9, 206.6, 175.7, 164.4)
mlogl <- function(alpha, x) {
if (length(alpha) > 1) stop("alpha must be scalar")
if (alpha <= 0) stop("alpha must be positive")
return(- sum(dgamma(x, shape = alpha, log = TRUE)))
}
mlogl_out <- nlm(mlogl, mean(vsamples),vsamples=vsamples)
print(mlogl_out)
__END__
However, it gives the following error:
Error in f(x, ...) :
unused argument(s) (vsamples = c(103.9, 88.5, 242.9, 206.6, 175.7, 164.4))
Calls: nlm -> <Anonymous> -> f
Execution halted
What's wrong in m...
2008 May 23
2
About Passing Arguments to Function
...2.8)
mlogl_k <- function( k_func, x_func, theta_func, samp) {
tot_mll <- 0
for (comp in 1:k_func) {
curr_mll <- (- sum(dgamma(samp, shape = x_func,
scale=theta_func, log = TRUE)))
tot_mll <- tot_mll + curr_mll
}
tot_mll
}
# Calling the function above
mlogl_out <- nlm(mlogl_k, mean(vsamples), k_func =2, x_func = 1,
theta_func = 1, samp=vsamples)
__END__
I thought under NLM, I already assign
the parameter correctly.
However it gives me the following error.
Error in f(x, ...) : unused argument(s) (14.3166666666667)
Calls: nlm -> <Anonymous> -...
2008 May 23
0
Est. Component Size with AIC/BIC under Gamma Distribution
...aic
}
mlogl_process <- function(smpl,error,start ) {
# EM algorithm to estimate max loglikelihood
thetalast <- 0
thetacurrent <- start
theta <- start
difference <- start
thetaprocess <- start
best <- 0
while (difference > error) {
mlogl_out <- nlm(mlogl, mean(smpl), theta_func=thetacurrent, samp=smpl)
theta <- mlogl_out$estimate
thetalast <- thetacurrent
thetacurrent <- theta
difference <- abs(thetalast - thetacurrent)
# E-STEP
new_maxlogl <- nlm(mlogl, mean(smpl), t...