Skip to contents

[Maturing]

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 maxlogL
summary(object, ...)

Arguments

object

an object of maxlogL class which summary is desired.

...

additional arguments affecting the summary produced.

Value

A list with information that summarize results of a maxlogL class object.

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.054:  1.00000
#>   1:     32472.304:  2.00000
#>   2:     32237.730:  1.91816
#>   3:     32095.354:  1.75915
#>   4:     32086.023:  1.79369
#>   5:     32085.860:  1.78977
#>   6:     32085.860:  1.78965
#>   7:     32085.860:  1.78965
summary(theta_1)
#> _______________________________________________________________
#> Optimization routine: nlminb 
#> Standard Error calculation: Hessian from optim 
#> _______________________________________________________________
#>        AIC      BIC
#>   64171.72 64171.72
#> _______________________________________________________________
#>    Estimate  Std. Error Z value Pr(>|z|)    
#> sd   5.98734    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
#>   340.9752 340.9752
#> _______________________________________________________________
#>      Estimate  Std. Error Z value Pr(>|z|)    
#> prob   0.30400    0.01455    20.9   <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
#>   342.8112 342.8112
#> _______________________________________________________________
#>      Estimate  Std. Error Z value Pr(>|z|)    
#> prob   0.28400    0.01426   19.92   <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
#>   5088.325 5107.956
#> _______________________________________________________________
#> Fixed effects for mean
#> ---------------------------------------------------------------
#>              Estimate Std. Error Z value  Pr(>|z|)    
#> (Intercept) -1.986626   0.113379 -17.522 < 2.2e-16 ***
#> x            2.990814   0.030319  98.645 < 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.997183   0.022537  44.247 < 2.2e-16 ***
#> x           0.309071   0.007004  44.127 < 2.2e-16 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> _______________________________________________________________
#> Note: p-values valid under asymptotic normality of estimators 
#> ---


#--------------------------------------------------------------------------------