tidy.maxLik.RdThese methods return summary information about the estimated model. Both require the tibble package to be installed.
For tidy(), a tibble with columns:
The name of the estimated parameter (parameters are sequentially numbered if names missing).
The estimated parameter.
The standard error of the estimate.
The \(z\)-statistic of the estimate.
The \(p\)-value.
This is essentially the same table as summary-method prints,
just in form of a tibble (data frame).
For glance(), a one-row tibble with columns:
The degrees of freedom of the model.
The log-likelihood of the model.
Akaike's Information Criterion for the model.
The number of observations, if this is available, otherwise NA.
## Example with a single parameter
t <- rexp(100, 2)
loglik <- function(theta) log(theta) - theta*t
a <- maxLik(loglik, start=2)
tidy(a)
#> # A tibble: 1 × 5
#> term estimate std.error statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 1 2.31 0.231 10.00 1.55e-23
glance(a)
#> # A tibble: 1 × 4
#> df logLik AIC nobs
#> <int> <dbl> <dbl> <int>
#> 1 1 -16.3 34.6 100
## Example with a parameter vector
x <- rnorm(100)
loglik <- function(theta) {
dnorm(x, mean=theta[1], sd=theta[2], log=TRUE)
}
a <- maxLik(loglik, start=c(mu=0, sd=1))
tidy(a)
#> # A tibble: 2 × 5
#> term estimate std.error statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 mu -0.0775 0.0962 -0.805 4.21e- 1
#> 2 sd 0.962 0.0680 14.1 2.09e-45
glance(a)
#> # A tibble: 1 × 4
#> df logLik AIC nobs
#> <int> <dbl> <dbl> <int>
#> 1 2 -138. 280. 100