parfm: R/ci.parfm.R

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
################################################################################
#  Confidence intervals of regression parameters' estimates                    #
################################################################################
#                                                                              #
#  Computes confidence intervals of regression parameters' estimates           #
#  for objects of class 'parfm'                                                #
#                                                                              #
#  Its parameters are                                                          #
#   - x         : the fitted model, object of class 'parfm'                    #
#   - level     : the coverage probability of the interval                     #
#   - digits    : number of significant digits                                 #
#                                                                              #
#                                                                              #
#   Date: January, 16, 2012                                                    #
#   Last modification on: February, 29, 2012                                  #
################################################################################

ci.parfm <- function(x,
                     level=.05,
                     digits=3) {
  beta <- which (!is.na(x[, "p-val"]))
  
  q <- qnorm(1 - level / 2)
  
  res <- exp(x[beta, "ESTIMATE"] + outer(x[beta, "SE"], c(-1, 1) * q))

  colnames(res) <- c("low", "up")
  rownames(res) <- names(beta)
  
  return(round(res, digits))
}
  

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.