Last data update: 2014.03.03

R: A function that returns the shape parameters of the beta...
beta.parameterR Documentation

A function that returns the shape parameters of the beta distribution

Description

When provided the minimum and maximum values corresponding to the prior information on a parameter (within [0, 1]), the function returns the shape parameters of the beta distribution, namely alpha and beta, that covers this range.

Usage

beta.parameter(low, up) 

Arguments

low

numeric argument. Lower bound of the range

up

numeric argument. Upper bound of the range

Details

The low argument must always be less than the up argument. Also, both low and up arguments must remain within [0, 1].

Value

It returns a list object consisting of the shape parameters alpha and beta of the Beta distribution such that

alpha/(alpha + beta) = (low + up)/2

and

(alpha*beta)/( (alpha + beta)^2 (alpha + beta + 1)) = (up - low)/4

The function has been built such that the particular case where low = up = 1 will return alpha = beta = 1.

Examples

  

## Not run: beta.parameter(-1, 0.5) #Returns error!
## Not run: beta.parameter(0, 0) #Not allowed.  Returns error!
## Not run: beta.parameter(0.75, 0.25) #Returns error!

beta.parameter(0, 1)
beta.parameter(0.5, 1) 
beta.parameter(0.1, 0.7)            

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(HSROC)
Loading required package: lattice
Loading required package: coda
Loading required package: MASS
Loading required package: MCMCpack
##
## Markov Chain Monte Carlo Package (MCMCpack)
## Copyright (C) 2003-2016 Andrew D. Martin, Kevin M. Quinn, and Jong Hee Park
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0350646 and SES-0350613)
##
##
## Hierarchical Summary Receiver Operating Characteristic package (HSROC)
## Copyright (C) 2010-2016 Ian Schiller and Nandini Dendukuri 
##
## Development of HSROC package was supported by grants from the 
## Canadian Institutes of Health Research (MOP #89857) 
## and the Fonds de la Recherche en Sant<U+00E9> Qu<U+00E9>bec. 
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HSROC/beta.parameter.Rd_%03d_medium.png", width=480, height=480)
> ### Name: beta.parameter
> ### Title: A function that returns the shape parameters of the beta
> ###   distribution
> ### Aliases: beta.parameter
> ### Keywords: methods
> 
> ### ** Examples
> 
>   
> 
> ## Not run: beta.parameter(-1, 0.5) #Returns error!
> ## Not run: beta.parameter(0, 0) #Not allowed.  Returns error!
> ## Not run: beta.parameter(0.75, 0.25) #Returns error!
> 
> beta.parameter(0, 1)
      1
alpha 1
beta  1
> beta.parameter(0.5, 1) 
         1
alpha 8.25
beta  2.75
> beta.parameter(0.1, 0.7)            
             1
alpha 3.866667
beta  5.800000
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>