SCSnp {BSagri} | R Documentation |
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
## Default S3 method:
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 |
conf.level |
a single numeric value between 0.5 and 1, the simultaneous confidence level |
alternative |
a single character string, one of |
whichp |
a single character string, naming an element of the |
... |
further arguments, currently not used |
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.
Value
An object of class "SCSnp", a list with elements
conf.int |
a P-times-2 matrix containing the lower and upper confidence limits |
estimate |
a numeric vector of length P, containing the medians of the P marginal empirical distributions |
x |
the input object |
k |
the number of values outside the SCS, i.e. conf.level*N |
N |
the number of values used to construct the confidence set |
conf.level |
a single numeric value, the nominal confidence level, as input |
alternative |
a single character string, as input |
Author(s)
Frank Schaarschmidt, adapting an earliere version of Gemechis D. Djira
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 simple percentile intervals on each of P marginal distributions
Examples
# 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)