ci: Confidence intervals

View source: R/ci.R

ciR Documentation

Confidence intervals

Description

Given a parameter estimate and its standard error, calculate the corresponding 1-sigma, 2-sigma or 100(1-\alpha)\% confidence interval, in absolute or relative units.

Usage

ci(x, sx, oerr = 3, df = NULL, absolute = FALSE)

Arguments

x

scalar estimate

sx

scalar or vector with the standard error of x without and (optionally) with \sqrt{MSWD} overdispersion multiplier.

oerr

indicates if the confidence intervals should be reported as:

1: 1\sigma absolute uncertainties.

2: 2\sigma absolute uncertainties.

3: absolute (1-\alpha)% confidence intervals, where \alpha equales the value that is stored in settings('alpha').

4: 1\sigma relative uncertainties (\%).

5: 2\sigma relative uncertainties (\%).

6: relative (1-\alpha)% confidence intervals, where \alpha equales the value that is stored in settings('alpha').

df

(optional) number of degrees of freedom. Only used if sx is a vector.

absolute

logical. Returns absolute uncertainties even if oerr is greater than 3. Used for some internal IsoplotR functions.

Details

Several of IsoplotR's plotting functions (including isochron, weightedmean, concordia, radialplot and helioplot) return lists of parameters and their standard errors. For ‘model-1’ fits, if the data pass a Chi-square test of homogeneity, then just one estimate for the standard error is reported. This estimate can be converted to a confidence interval by multiplication with the appropriate quantile of a Normal distribution. Datasets that fail the Chi-square test are said to be ‘overdispersed’ with respect to the analytical uncertainties. The simplest way (‘model-1’) to deal with overdispersion is to inflate the standard error with a \sqrt{MSWD} premultiplier. In this case, IsoplotR returns two estimates of the standard error. To convert the second estimate to a confidence interval requires multiplication with the desired quantile of a t-distribution with the appropriate degrees of freedom.

Value

A scalar or vector of the same size as sx.

Examples

attach(examples)
fit <- isochron(PbPb,plot=FALSE,exterr=FALSE)
err <- ci(x=fit$age[1],sx=fit$age[-1],oerr=5,df=fit$df)
message('age=',signif(fit$age[1],4),'Ma, ',
        '2se=',signif(err[1],2),'%, ',
        '2se(with dispersion)=',signif(err[2],2),'%')

IsoplotR documentation built on Nov. 10, 2023, 9:08 a.m.