maxLik-methods: Methods for the various standard functions

Description Usage Arguments Details Examples

Description

These are methods for the maxLik related objects. See also the documentation for the corresponding generic functions

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'maxLik'
AIC(object, ..., k=2)
## S3 method for class 'maxim'
coef(object, ...)
## S3 method for class 'maxLik'
coef(object, ...)
## S3 method for class 'maxLik'
stdEr(x, eigentol=1e-12, ...)

Arguments

object

a ‘maxLik’ object (coef can also handle ‘maxim’ objects)

k

numeric, the penalty per parameter to be used; the default ‘k = 2’ is the classical AIC.

x

a ‘maxLik’ object

eigentol

The standard errors are only calculated if the ratio of the smallest and largest eigenvalue of the Hessian matrix is less than “eigentol”. Otherwise the Hessian is treated as singular.

...

other arguments for methods

Details

AIC

calculates Akaike's Information Criterion (and other information criteria).

coef

extracts the estimated parameters (model's coefficients).

stdEr

extracts standard errors (using the Hessian matrix).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## estimate mean and variance of normal random vector
set.seed(123)
x <- rnorm(50, 1, 2)

## log likelihood function.
## Note: 'param' is a vector
llf <- function( param ) {
   mu <- param[ 1 ]
   sigma <- param[ 2 ]
   return(sum(dnorm(x, mean=mu, sd=sigma, log=TRUE)))
}

## Estimate it.  Take standard normal as start values
ml <- maxLik(llf, start = c(mu=0, sigma=1) )

coef(ml)
stdEr(ml)
AIC(ml)

Example output

Loading required package: miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/
      mu    sigma 
1.068807 1.833129 
       mu     sigma 
0.2592487 0.1833165 
[1] 206.4963
attr(,"df")
[1] 2

maxLik documentation built on Nov. 25, 2020, 3 a.m.