CInp                 package:BSagri                 R Documentation

_C_o_n_s_t_r_u_c_t _l_o_c_a_l _c_o_n_f_i_d_e_n_c_e _i_n_t_e_r_v_a_l_s _f_r_o_m _j_o_i_n_t _e_m_p_i_r_i_c_a_l _d_i_s_t_r_i_b_u_t_i_o_n.

_D_e_s_c_r_i_p_t_i_o_n:

     Construct local confidence intervals for each parameter from the
     empirical joint distribution of  a parameter vector of length P.

_U_s_a_g_e:

     CInp(x, ...)

     ## Default S3 method:
     CInp(x, conf.level = 0.95,
      alternative = "two.sided", ...)

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

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

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

_A_r_g_u_m_e_n_t_s:

       x: an N-times-P matrix, or an object of class 'CCRatio',
          'CCDiff', 'bugs', as can be obtained by calling the functions
          'CCRatio', 'CCDiff', or 'openbugs' in package 'R2WinBUGS' 

conf.level: a single numeric value between 0.5 and 1, specifying the
          local confidence level for each of the P parameters 

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 

     ...: currently not used 

_D_e_t_a_i_l_s:

     Construct simple confidence intervals based on order statistics
     applied to the marginal empirical distributions in 'x'.

_V_a_l_u_e:

     An object of class "CInp", 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 each confidence interval, i.e.
          conf.level*N

      N : the number of values used to construct each confidence
          interval

conf.level : a single numeric value, the nominal confidence level, as
          input

alternative : a single character string, as input

_S_e_e _A_l_s_o:

     The function internally used is 'quantile' with its default
     settings.  See 'SCSnp' for simultaneous sets.

_E_x_a_m_p_l_e_s:

     # Assume a 100 times 4 matrix of 4 mutually independent
     # normal variables:

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

     lcits<-CInp(x=X, conf.level=0.95, alternative="two.sided")
     lcits

     ci1<-lcits$conf.int[1,]
     length( which(X[,1]>=ci1[1] & X[,1]<=ci1[2] ) )

     ci2<-lcits$conf.int[2,]
     length( which(X[,2]>=ci2[1] & X[,2]<=ci2[2] ) )

