Displays maximum likelihood estimates computed with maxlogL
with
its standard errors, AIC and BIC.
This is a summary
method for maxlogL
object.
Usage
# S3 method for class 'maxlogL'
summary(object, ...)
Arguments
- object
an object of
maxlogL
class which summary is desired.- ...
additional arguments affecting the summary produced.
Details
This summary
method computes and displays AIC, BIC,
estimates and standard errors from a estimated model stored i a maxlogL
class object. It also displays and computes Z-score and p values of significance
test of parameters.
Author
Jaime Mosquera Gutiérrez, jmosquerag@unal.edu.co
Examples
library(EstimationTools)
#--------------------------------------------------------------------------------
### First example: One known parameter
x <- rnorm(n = 10000, mean = 160, sd = 6)
theta_1 <- maxlogL(x = x, dist = 'dnorm', control = list(trace = 1),
link = list(over = "sd", fun = "log_link"),
fixed = list(mean = 160))
#> 0: 43447.898: 1.00000
#> 1: 32472.418: 2.00000
#> 2: 32237.883: 1.91817
#> 3: 32095.525: 1.75917
#> 4: 32086.197: 1.79371
#> 5: 32086.034: 1.78979
#> 6: 32086.034: 1.78966
#> 7: 32086.034: 1.78966
summary(theta_1)
#> _______________________________________________________________
#> Optimization routine: nlminb
#> Standard Error calculation: Hessian from optim
#> _______________________________________________________________
#> AIC BIC
#> 64172.07 64172.07
#> _______________________________________________________________
#> Estimate Std. Error Z value Pr(>|z|)
#> sd 5.98745 0.04234 141.4 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> _______________________________________________________________
#> Note: p-values valid under asymptotic normality of estimators
#> ---
#--------------------------------------------------------------------------------
# Second example: Binomial probability parameter estimation with variable
# creation
N <- rbinom(n = 100, size = 10, prob = 0.3)
phat <- maxlogL(x = N, dist = 'dbinom', fixed = list(size = 10),
link = list(over = "prob", fun = "logit_link"))
## Standard error calculation method
print(phat$outputs$StdE_Method)
#> [1] "Hessian from optim"
## 'summary' method
summary(phat)
#> _______________________________________________________________
#> Optimization routine: nlminb
#> Standard Error calculation: Hessian from optim
#> _______________________________________________________________
#> AIC BIC
#> 342.3235 342.3235
#> _______________________________________________________________
#> Estimate Std. Error Z value Pr(>|z|)
#> prob 0.30000 0.01449 20.7 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> _______________________________________________________________
#> Note: p-values valid under asymptotic normality of estimators
#> ---
#--------------------------------------------------------------------------------
# Third example: Binomial probability parameter estimation with no variable
# creation
N <- rbinom(n = 100, size = 10, prob = 0.3)
summary(maxlogL(x = N, dist = 'dbinom', fixed = list(size = 10),
link = list(over = "prob", fun = "logit_link")))
#> _______________________________________________________________
#> Optimization routine: nlminb
#> Standard Error calculation: Hessian from optim
#> _______________________________________________________________
#> AIC BIC
#> 344.8635 344.8635
#> _______________________________________________________________
#> Estimate Std. Error Z value Pr(>|z|)
#> prob 0.29100 0.01436 20.26 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> _______________________________________________________________
#> Note: p-values valid under asymptotic normality of estimators
#> ---
#--------------------------------------------------------------------------------
# Fourth example: Estimation in a regression model with simulated normal data
n <- 1000
x <- runif(n = n, -5, 6)
y <- rnorm(n = n, mean = -2 + 3 * x, sd = exp(1 + 0.3* x))
norm_data <- data.frame(y = y, x = x)
formulas <- list(sd.fo = ~ x, mean.fo = ~ x)
norm_mod <- maxlogLreg(formulas, y_dist = y ~ dnorm, data = norm_data,
link = list(over = "sd", fun = "log_link"))
## 'summary' method
summary(norm_mod)
#> _______________________________________________________________
#> Optimization routine: nlminb
#> Standard Error calculation: Hessian from optim
#> _______________________________________________________________
#> AIC BIC
#> 5079.184 5098.815
#> _______________________________________________________________
#> Fixed effects for mean
#> ---------------------------------------------------------------
#> Estimate Std. Error Z value Pr(>|z|)
#> (Intercept) -2.006974 0.113332 -17.709 < 2.2e-16 ***
#> x 2.999269 0.030313 98.942 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> _______________________________________________________________
#> Fixed effects for log(sd)
#> ---------------------------------------------------------------
#> Estimate Std. Error Z value Pr(>|z|)
#> (Intercept) 0.9970244 0.0225218 44.269 < 2.2e-16 ***
#> x 0.3104011 0.0069774 44.487 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> _______________________________________________________________
#> Note: p-values valid under asymptotic normality of estimators
#> ---
#--------------------------------------------------------------------------------