Learn R Programming

BSagri (version 0.1-6)

SCSnp: Simultaneous confidence sets from empirical joint distribution.

Description

Calcualte simultaneous confidence sets according to Besag et al. (1995) from a empirical joint distribution of a parameter vector. Joint empirical distributions might be obtained from WinBUGS or OpenBUGS calls.

Usage

SCSnp(x,...)

## S3 method for class 'default':
SCSnp(x, conf.level = 0.95,
 alternative = "two.sided", ...)

## S3 method for class 'bugs':
SCSnp(x, conf.level = 0.95,
 alternative = "two.sided", whichp = NULL, ...)

## S3 method for class 'CCRatio':
SCSnp(x, ...)

## S3 method for class 'CCDiff':
SCSnp(x, ...)

Arguments

x
a matrix N-times-P matrix or an object of class CCRatio or CCDiff
conf.level
a single numeric value between 0.5 and 1, the simultaneous confidence level
alternative
a single character string, one of "two.sided", "less", "greater", for two-sided, upper and lower limits
whichp
a single character string, naming an element of the sims.list if x is a bugs object, ignored otherwise
...
further arguments, currently not used

Value

  • An object of class "SCSnp", a list with elements
  • conf.inta P-times-2 matrix containing the lower and upper confidence limits
  • estimatea numeric vector of length P, containing the medians of the P marginal empirical distributions
  • xthe input object
  • kthe number of values outside the SCS, i.e. conf.level*N
  • Nthe number of values used to construct the confidence set
  • conf.levela single numeric value, the nominal confidence level, as input
  • alternativea single character string, as input

concept

confidence set

Details

Let P be the number of parameters in the parameter vector and N be the total number of values obtained for the empirical joint distribution of the parameter vector, e.g. as can be obtaine e.g., from Gibbs sampling.

References

Besag J, Green P, Higdon D, Mengersen K (1995): Bayesian Computation and Stochastic Systems. Statistical Science 10 (1), 3-66.

See Also

CInp for a wrapper to quantile to compute elementwise intervals

Examples

Run this code
# Assume a 1000 times 4 matrix of 4 mutually independent
# normal variables:

X<-cbind(rnorm(1000), rnorm(1000), rnorm(1000), rnorm(1000))

SCSts<-SCSnp(x=X, conf.level=0.9, alternative="two.sided")
SCSts

SCS<-SCSts$conf.int

in1<-X[,1]>=SCS[1,1] & X[,1]<=SCS[1,2] 

in2<-X[,2]>=SCS[2,1] & X[,2]<=SCS[2,2] 

in3<-X[,3]>=SCS[3,1] & X[,3]<=SCS[3,2] 

in4<-X[,4]>=SCS[4,1] & X[,4]<=SCS[4,2] 

sum(in1*in2*in3*in4)

Run the code above in your browser using DataLab