ci.balance: Experimental Function to Correct Confidence Intervals At or...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ci.balance.R

Description

Experimental function to correct confidence intervals at or near boundaries of the parameter space by 'sliding' the interval on the quantile scale.

Usage

1
2
ci.balance(x, est, confidence=0.95, alpha=1-confidence, minval, maxval,
           na.rm=TRUE)

Arguments

x

Bootstrap parameter estimates.

est

Observed value of the parameter.

confidence

Confidence level for the interval. Defaults to 0.95.

alpha

Type I error rate (size) for the interval. Defaults to 1-confidence.

minval

A numeric value specifying the lower bound of the parameter space. Leave unspecified (the default) if there is no lower bound.

maxval

A numeric value specifying the upper bound of the parameter space. Leave unspecified (the default) if there is no upper bound.

na.rm

logical. Should missing values be removed?

Details

EXPERIMENTAL FUNCTION:

This function attempts to compute a proper conf*100% confidence interval for parameters at or near the boundary of the parameter space using bootstrapped parameter estimates by 'sliding' the confidence interval on the quantile scale.

This is accomplished by attempting to place a conf *100% interval symmetrically *on the quantile scale* about the observed value. If a symmetric interval would exceed the observed data at the upper (lower) end, a one-sided interval is computed with the upper (lower) boundary fixed at the the upper (lower) boundary of the parameter space.

Value

A list containing:

ci

A 2-element vector containing the lower and upper confidence limits. The names of the elements of the vector give the actual quantile values used for the interval or one of the character strings "Upper Boundary" or "Lower Boundary".

overflow.upper, overflow.lower

The number of elements beyond those observed that would be needed to compute a symmetric (on the quantile scale) confidence interval.

n.above, n.below

The number of bootstrap values which are above (below) the observed value.

lower.n, upper.n

The index of the value used for the endpoint of the confidence interval or the character string "Upper Boundary" ("Lower Boundary").

Author(s)

Gregory R. Warnes greg@warnes.net

See Also

boot, bootstrap, Used by diseq.ci.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# These are nonsensical examples which simply exercise the
# computation. See the code to diseq.ci for a real example.
#
# FIXME: Add real example using boot or bootstrap.  

set.seed(7981357)
x <- abs(rnorm(100,1))
ci.balance(x,1, minval=0)
ci.balance(x,1)

x <- rnorm(100,1)
x <- ifelse(x>1, 1, x)
ci.balance(x,1, maxval=1)
ci.balance(x,1)

Example output

Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Loading required package: gtools
Loading required package: MASS
Loading required package: mvtnorm


NOTE: THIS PACKAGE IS NOW OBSOLETE.



  The R-Genetics project has developed an set of enhanced genetics

  packages to replace 'genetics'. Please visit the project homepage

  at http://rgenetics.org for informtion.




Attaching package: 'genetics'

The following objects are masked from 'package:base':

    %in%, as.factor, order

$ci
        2%        98% 
0.05844961 3.08604216 

$overflow.upper
[1] 0

$overflow.lower
[1] 0

$n.above
[1] 50

$n.below
[1] 50

$lower.n
[1] 2

$upper.n
[1] 98

$ci
        2%        98% 
0.05844961 3.08604216 

$overflow.upper
[1] 0

$overflow.lower
[1] 0

$n.above
[1] 50

$n.below
[1] 50

$lower.n
[1] 2

$upper.n
[1] 98

$ci
            5% Upper Boundary 
    -0.6396774      1.0000000 

$overflow.upper
[1] 25.5

$overflow.lower
[1] 0

$n.above
[1] 22

$n.below
[1] 78

$lower.n
[1] 5

$upper.n
[1] "Upper Boundary"

$ci
        5%     max(x) 
-0.6396774  1.0000000 

$overflow.upper
[1] 25.5

$overflow.lower
[1] 0

$n.above
[1] 22

$n.below
[1] 78

$lower.n
[1] 5

$upper.n
[1] "max(x)"

genetics documentation built on March 1, 2021, 9:06 a.m.