lik.ci: Likelihood Confidence Intervals for Scalar Parameter

Description Usage Arguments Value Note Author(s) References Examples

Description

A simple function for computing confidence intervals from the values of a likelihood function for a scalar parameter. It prints the maximum likelihood estimate (MLE) and its standard error, and confidence intervals based on normal approximation to the distribution of the MLE and on the chi-squared approximation to the distribution of the likelihood ratio statistic.

Usage

1
lik.ci(psi, logL, conf = c(0.975, 0.025))

Arguments

psi

Vector containing parameter values, the range of which contains the MLE

logL

Vector containing corresponding log likelihood values

conf

Vector containing levels for which confidence interval limits needed

Value

See above

Note

This uses the spline functions in library(modreg).

Author(s)

Anthony Davison (Anthony.Davison@epfl.ch)

References

Davison, A. C. (2003) Statistical Models. Cambridge University Press. Sections 4.4.2, 4.5.1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# likelihood analysis for mean of truncated Poisson data
y <- c(1:6)
n <- c(1486,694,195,37,10,1)
logL <- function(x, y, n.obs)      # x is theta
{  f <- dpois(y,x)/(1-dpois(0,x))  # dpois is Poisson PDF
   sum(n*log(f))  }                # log likelihood
theta <- seq(from=0.8, to=1, length=200)
L <- rep(NA, 200)
for (i in 1:200) L[i] <- logL(theta[i], y, n)
plot(theta, L, type="l", ylab="Log likelihood")
lik.ci(theta, L)

SMPracticals documentation built on May 2, 2019, 11:12 a.m.