I am fitting some distribution with the method Maximizing the Likelihood. The method implemented in R "maxLogL" is an amazing tools that works great. Documentation:
AIC and BIC are printed with the summary function but I want to keep those values in variables. Here a code that you can easily reproduce:
library(EstimationTools)
set.seed(10)
z <- rnorm(n = 1000, mean = 0.1, sd = 1)
fit1 <- maxlogL(x = z, dist = 'dnorm', start=c(0, 2), lower = 0, upper = 2)
a <-summary(fit1)
which prints the following:
Optimization routine: nlminb
Standard Error calculation: Hessian from optim
AIC BIC
2824.494 2820.494
Estimate Std. Error
mean 0.011375 0.0313
sd 0.991346 0.0222
My question is:
Thanks
PD: I particularly want to use the maxLogL function.
I apologize because I have not seen this post before. Since some previous versions, we enabled some generic methods, including those you mentioned. Recently we have released version 2.0.0. Let's take the example before:
library(EstimationTools)
set.seed(10)
z <- rnorm(n = 1000, mean = 0.1, sd = 1)
fit1 <- maxlogL(x = z, dist = 'dnorm', start=c(0, 2), lower = 0, upper = 2)
summary(fit1)
_______________________________________________________________
Optimization routine: nlminb
Standard Error calculation: Hessian from optim
_______________________________________________________________
AIC BIC
2824.494 2834.309
_______________________________________________________________
Estimate Std. Error Z value Pr(>|z|)
mean 0.11137 0.03135 3.553 0.000381 ***
sd 0.99135 0.02217 44.722 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
_______________________________________________________________
For keeping AIC, BIC and Log-likelihood in a variable, just invoke the generic functions:
myAIC <- AIC(fit1)
myBIC <- BIC(fit1)
mylogL <- logLik(fit1)
Then, you can print any of them
>myAIC
[1] 2824.494
> myBIC
[1] 2834.309
> mylogL
'log Lik.' -1410.247 (df=2)
Hope this could be useful. Thanks on your interest in EstimationTools
.
Best wishes.