R/verifying_priorQ.R

#######################################################
#This function checks whether the prior distribution  #
#for Q is valid.                                      #
#######################################################

verifying_prior_Q<-function(ind,a,b)
  {
  if(ind==1)
    {
    if(!exists("a")){stop("missing lower limit of the uniform prior distribution of Q.")}
    if(!exists("b")){stop("missing upper limit of the uniform prior distribution of Q.")}
    if(a<0) {stop("the lower limit of the uniform prior distribution of Q must be greater than 0.")}
    if(a>=b) {stop(" the lower limit of the uniform prior distribution of Q must be lower than the upper limit.")}
    }

  if(ind==2)
    {
    if(!exists("a")){stop("missing shape parameter of the gamma prior distribution of Q.")}
    if(!exists("b")){stop("missing scale paramter  of the gamma prior distribution of Q.")}
    if(a<=0) {stop("the shape parameter in the gamma prior distribution of Q must be greater than 0.")}
    if(b<=0) {stop("the scale parameter in the gamma prior distribution of Q must be greater than 0.")}
    }

  if(ind==3)
    {
    if(!exists("a")){stop("missing scale parameter of the exponential prior distribution of Q.")}
    if(a<=0) {stop("the scale parameter in the exponential prior distribution of Q must be greater than 0.")}
    }

  if(ind==4)
    {
    if(!exists("a")){stop("missing mean parameter of the normal prior distribution of Q.")}
    if(!exists("b")){stop("missing standard deviation paramter  of the normal prior distribution of Q.")}
    if(b<=0) {stop("the sigma parameter in the normal prior distribution of Q must be greater than 0.")}
    }

  if(ind==5)
    {
    if(!exists("a")){stop("missing d.f parameter of the t prior distribution of Q.")}
    if(a<=0) {stop("the d.f. in the t prior distribution of Q must be greater than 0.")}
    }

  if(ind==6)
    {
    if(!exists("a")){stop("missing shape parameter of the weibull prior distribution of Q.")}
    if(!exists("b")){stop("missing scale paramter  of the weibull prior distribution of Q.")}
    if(a<=0) {stop("the shape parameter in the weibull prior distribution of Q must be greater than 0.")}
    if(b<=0) {stop("the scale parameter in the weibull prior distribution of Q must be greater than 0.")}
    }

  if(ind==7)
    {
    if(!exists("a")){stop("missing d.f. of the F prior distribution of Q.")}
    if(!exists("b")){stop("missing d.f. of the F prior distribution of Q.")}
    if(a<=0) {stop("the d.f. of the F prior distribution of Q must be greater than 0.")}
    if(b<=0) {stop("the d.f. of the F prior distribution of Q must be greater than 0.")}
    }

  if(ind==8)
    {
    if(!exists("a")){stop("missing d.f parameter of the chi-squared prior distribution of Q.")}
    if(a<=0) {stop("the d.f. in the chi-squared prior distribution of Q must be greater than 0.")}
    }

  if(ind==9)
    {
    if(!exists("a")){stop("missing location parameter of the cauchy prior distribution of Q.")}
    if(!exists("b")){stop("missing scale paramter  of the cauchy prior distribution of Q.")}
    if(b<=0) {stop("the scale parameter in the cauchy prior distribution of Q must be greater than 0.")}
    }


  if(ind==10)
    {
    if(!exists("a")){stop("missing mean parameter of the log-normal prior distribution of Q.")}
    if(!exists("b")){stop("missing standard deviation paramter  of the log-normal prior distribution of Q.")}
    if(b<=0) {stop("the standard parameter in the log-normal prior distribution of Q must be greater than 0.")}
    }

  }



 
  
   
  
  

Try the B2Z package in your browser

Any scripts or data that you put into this service are public.

B2Z documentation built on May 2, 2019, 6:33 a.m.