Learn R Programming

distrMod (version 2.1.1)

confint-methods: Methods for function confint in Package `distrMod'

Description

Methods for function confint in package distrMod; by default uses confint and its corresponding S3-methods, but also computes (asymptotic) confidence intervals for objects of class Estimate. Computes confidence intervals for one or more parameters in a fitted model.

Usage

confint(object, method, ...)
## S3 method for class 'ANY,missing':
confint(object, method, parm, level = 0.95, \dots)
## S3 method for class 'Estimate,missing':
confint(object, method, level = 0.95)
## S3 method for class 'mle,missing':
confint(object, method, parm, level = 0.95, \dots)
## S3 method for class 'profile.mle,missing':
confint(object, method, parm, level = 0.95, \dots)

Arguments

object
in default / signature ANY case: a fitted model object, in signature Estimate case, an object of class Estimate
parm
only used in default / signature ANY case: a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.
level
the confidence level required.
method
not yet used (only as missing; later to allow for various methods
...
additional argument(s) for methods.

Value

  • signature ANY,missing:A matrix (or vector) with columns giving lower and upper confidence limits for each parameter. These will be labelled as (1-level)/2 and 1 - (1-level)/2 in % (by default 2.5% and 97.5%).
  • signature Estimate,missing:An object of class Confint

Details

confint is a generic function. Its behavior differs according to its arguments. [object Object],[object Object]

See Also

confint, confint.glm and confint.nls in package MASS, Confint-class.

Examples

Run this code
## for signature ANY examples confer stats::confint
## (empirical) Data
x <- rgamma(50, scale = 0.5, shape = 3)

## parametric family of probability measures
G <- GammaFamily(scale = 1, shape = 2)

## Maximum likelihood estimator
res <- MLEstimator(x = x, ParamFamily = G)
confint(res)

### for comparison:
require(MASS)
(res1 <- fitdistr(x, "gamma"))
## add a convenient (albeit wrong)
## S3-method for vcov:
## --- wrong as in general cov-matrix
##     will not be diagonal
## but for conf-interval this does
## not matter...
vcov.fitdistr <- function(object, ...){
     v<-diag(object$sd^2)
     rownames(v) <- colnames(v) <- names(object$estimate) 
     v}

## explicitely transforming to
## MASS parametrization:
mtrafo <- function(x){
     nms0 <- names(c(main(param(G)),nuisance(param(G))))
     nms <- c("shape","rate")
     fval0 <- c(x[2], 1/x[1])
     names(fval0) <- nms
     mat0 <- matrix( c(0, -1/x[1]^2, 1, 0), nrow = 2, ncol = 2,
                     dimnames = list(nms,nms0))                          
     list(fval = fval0, mat = mat0)}

G2 <- G
trafo(G2) <- mtrafo
res2 <- MLEstimator(x = x, ParamFamily = G2)

old<-getdistrModOption("show.details")
distrModoptions("show.details" = "minimal")
res
res1
res2
confint(res)
confint(res1)
confint(res2)
confint(res,level=0.99)
distrModoptions("show.details" = old)

Run the code above in your browser using DataLab