PriorGen old/new features ver 1

Basic findbeta updated

library(PriorGen)
## Loading required package: rootSolve
## Loading required package: nleqslv
findbeta(themedian = 0.5,lower.v = T,percentile = 0.999,percentile.value = 0.999)
## $parameters
## a b 
## 1 1 
## 
## $summary
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.0005798 0.2548675 0.5011664 0.5009285 0.7471612 0.9999125 
## 
## $input
##        themedian       percentile percentile.value 
##            0.500            0.999            0.999 
## 
## attr(,"class")
## [1] "PriorGen"
#findbeta(themode = 0.5,lower.v = T,percentile = 0.80,percentile.value = 0.95)
fb_per=findbeta(themean = 0.5,lower.v = T,percentile = 0.90,percentile.value = 0.95)
fb_per$parameters
##         a         b 
## 0.6658199 0.6658199
fb_per$summary
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.0000004 0.1923723 0.4975507 0.4977591 0.8030204 0.9999862
fb_per$input
##          themean       percentile percentile.value 
##             0.50             0.90             0.95
print_PriorGen(fb_per)
## [1] "The desired Beta distribution that satisfies the specified conditions is: Beta(0.67,0.67). Verification: The percentile value 0.95 corresponds to the 90th percentile"

Raw findbeta (mean/median/mode/variance/range input)

library(PriorGen)
findbeta_raw(themedian = 0.5,therange = c(0,1))
## $parameters
## a b 
## 1 1 
## 
## $summary
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.0000875 0.2528388 0.4988336 0.4990715 0.7451325 0.9994202 
## 
## $input
##                themedian scalemetric_var_or_range 
##                      0.5                      1.0 
## 
## attr(,"class")
## [1] "PriorGen"
#findbeta_raw(themode = 0.5,therange = c(0,1))
fb_raw=findbeta_raw(themean = 0.8,thevariance = 0.2)
fb_raw$parameters
##        a        b 
## 5.157879 1.289470
fb_raw$summary
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.1156  0.7171  0.8315  0.8004  0.9130  0.9997
fb_raw$input
##                  themean scalemetric_var_or_range 
##                0.8000000                0.0408861

Abstract findbeta (General statements input)

library(PriorGen)
findbeta_abstract(themean.cat = "Low",thevariance.cat = "High") 
## $parameters
##        a        b 
## 2.136044 4.984102 
## 
## $summary
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## 0.004837 0.178582 0.281257 0.301772 0.404865 0.869466 
## 
## $input
##          themean      scalemetric percentile.value 
##           0.3000           0.1075           0.9990 
## 
## attr(,"class")
## [1] "PriorGen"
#findbeta_abstract(themean.cat = "Very low",thevariance.cat = "Low") 
fb_abstract=findbeta_abstract(themean.cat =  "Low",thevariance.cat = "High")
fb_abstract$parameters
##        a        b 
## 2.136044 4.984102
fb_abstract$summary
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## 0.004837 0.178582 0.281257 0.301772 0.404865 0.869466
fb_abstract$input
##          themean      scalemetric percentile.value 
##           0.3000           0.1075           0.9990

Panel findbeta (Vector input)

library(PriorGen)
#findbeta_panel(themedian.vec = c(0.2,0.02,0.5,0.03,0.04,0.05)) 
findbeta_panel(themode.vec = c(0.2,0.02,0.5,0.03,0.04,0.05)) 
## $parameters
##         a         b 
##  4.570939 22.935768 
## 
## $summary
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.01882 0.11591 0.15828 0.16678 0.20848 0.51874 
## 
## $input
##          themode       percentile       scalevalue percentile.value 
##           0.1400           0.9999           0.4800           0.4990 
## 
## attr(,"class")
## [1] "PriorGen"
fb_panel=findbeta_panel(themean.vec = c(0.2,0.02,0.5,0.03,0.04,0.05)) 
fb_panel$parameters
##        a        b 
## 11.90200 73.11232
fb_panel$summary
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.04516 0.11378 0.13739 0.14026 0.16347 0.30894
fb_panel$input
##          themean       percentile       scalevalue percentile.value 
##        0.1400000        0.9999000        0.0355600        0.2773494

Basic findbetaqq updated (Percentiles input)

library(PriorGen)
fb_qq=findbetaqq(percentile.value1 = 0.3,percentile1 = 0.20,
                 percentile.value2 = 0.7,percentile2 = 0.97) 
fb_qq$parameters
##        a        b 
## 4.754100 6.398365
fb_qq$summary
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.06502 0.32446 0.42170 0.42666 0.52329 0.89435
fb_qq$input
## percentile.value1       percentile1 percentile.value2       percentile2 
##              0.30              0.20              0.70              0.97

Basic findbetamupsi updated (Hierarchical input + choice of root function)

library(PriorGen)
fb_mupsi_RS=findbetamupsi(themean=0.20, percentile=0.99, lower.v=TRUE,
              percentile.value=0.30, psi.percentile=0.90,
              percentile.median=0.60, percentile95value=0.80,root.method="multiroot")
fb_mupsi_RS$parameters
## NULL
fb_mupsi_RS$summary
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## 0.000000 0.008379 0.085610 0.203784 0.320677 0.999995
fb_mupsi_RS$input
##           themean        percentile  percentile.value    psi.percentile 
##              0.20              0.99              0.30              0.90 
## percentile.median percentile95value 
##              0.60              0.80
fb_mupsi_NL=findbetamupsi(themean=0.20, percentile=0.99, lower.v=TRUE,
              percentile.value=0.30, psi.percentile=0.90,
              percentile.median=0.60, percentile95value=0.80,root.method="nleqslv")
fb_mupsi_RS$parameters
## NULL
fb_mupsi_NL$parameters
## NULL
# Results are similar

Raw findbetamupsi updated (Hierarchical input)

library(PriorGen)
fb_mupsi_raw=findbetamupsi_raw(themean=0.20,thevariance = 0.05, thepsi=0.15)
fb_mupsi_raw$parameters
## NULL
fb_mupsi_raw$summary
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.0000000 0.0000000 0.0000103 0.1935946 0.1337335 1.0000000
fb_mupsi_raw$input
##          themean     thevariances       percentile percentile.value 
##        0.2000000        0.0500000        0.9999000        0.3645263 
##           thepsi 
##        0.1500000

Abstract findbetamupsi updated (Hierarchical input)

library(PriorGen)
fb_mupsi_abstract=findbetamupsi_abstract(themean="Average",thevariance = "Very high", 
                                         psi.percentile=0.90,percentile.median=0.999,
                                         percentile95value=0.9999)
fb_mupsi_abstract$parameters
## NULL
fb_mupsi_abstract$summary
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.00000 0.05677 0.64303 0.54865 0.99077 1.00000
fb_mupsi_abstract$input
##           themean        percentile  percentile.value    psi.percentile 
##         0.5500000         0.9999000         0.9974181         0.9000000 
## percentile.median percentile95value 
##         0.9990000         0.9999000

Panel findbetamupsi updated (Hierarchical input)

library(PriorGen)
fb_mupsi_panel=findbetamupsi_panel(themean=c(0.1,0.5,0.6,0.3,0.05,0.01,0.3), 
                                   psi.percentile=0.90, percentile.median=0.50,
                                   percentile95value=0.60)
fb_mupsi_panel$parameters
## NULL
fb_mupsi_panel$summary
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.0000001 0.1293974 0.2387243 0.2681315 0.3763673 0.9607058
fb_mupsi_panel$input
##           themean        percentile  percentile.value    psi.percentile 
##         0.2657143         0.9999000         0.4656722         0.9000000 
## percentile.median percentile95value 
##         0.5000000         0.6000000

Plot for findbeta

library(PriorGen)
fb_pr=findbeta(themean = 0.5,lower.v = T,percentile = 0.999,percentile.value = 0.999) 
plot(fb_pr,main="Elicited beta prior \n(Percentile)",ylab = "Density",lwd=3,type="l",xlab="")

# Plot for finbeta_raw

library(PriorGen)
fb_raw=findbeta_raw(themean = 0.5,thevariance = 0.5) 
plot(fb_raw,main="Elicited beta prior \n(Raw)",ylab = "Density",lwd=3,type="l",xlab="")

# Plot for findbeta_abstract

library(PriorGen)
fb_abstract=findbeta_abstract(themean.cat = "Low",thevariance.cat = "High") 
plot(fb_abstract,main="Elicited beta prior \n(Abstract)",ylab = "Density",lwd=3,type="l",xlab="")

Plot for findbeta_panel

library(PriorGen)
fb_panel1=findbeta_panel(themean.vec = c(0.2,0.02,0.5,0.03,0.04,0.05)) 
fb_panel2=findbeta_panel(themean.vec = c(0.2,0.02,0.5,0.4,0.04,0.05)) 
plot(fb_panel1,main="Elicited beta prior  \n(Panel)",ylab = "Density",lwd=3,type="l",xlab="")
lines(fb_panel2,lwd=3,type="l",lty=2)
legend("topright",c("Panel 1", "Panel 2"),lty = c(1,2),lwd=3)

Plot for findbetaqq

library(PriorGen)

fb_qq=findbetaqq(percentile.value1 = 0.3,percentile1 = 0.20,
percentile.value2 = 0.7,percentile2 = 0.97) 

plot(fb_qq,main="Elicited beta prior \n(Percentiles method)",ylab = "Density",lwd=3,type="l",xlab="")

Plots for finbetamupsi

library(PriorGen)
fb_mupsi=findbetamupsi(themean=0.20, percentile=0.99, lower.v=TRUE,
              percentile.value=0.30, psi.percentile=0.90,
              percentile.median=0.50, percentile95value=0.60)
#par(mfrow=c(1,3))
#plot(density(fb_mupsi$param_upper$at),lwd=3,main="Density plot for samples of a=mu*psi") # 
#plot(density(fb_mupsi$param_upper$bt),lwd=3,main="Density plot for samples of b=mu*(1-psi)") # 
plot(fb_mupsi,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",xlab="")
fb_mupsi1=findbetamupsi(themean=0.30, percentile=0.8, lower.v=TRUE,
              percentile.value=0.30, psi.percentile=0.90,
              percentile.median=0.70, percentile95value=0.80)
lines(fb_mupsi1,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",lty=2,col="gray")
legend("topright",c("Basic","Basic1"),col=c("black","gray"),lty=1:2,lwd=3)

Plots for findbetamupsi_raw

library(PriorGen)
fb_mupsi_raw=findbetamupsi_raw(themean=0.20, thevariance = 0.1, thepsi=0.15)
#par(mfrow=c(1,3))
#plot(density(fb_mupsi_abstract$param_upper$at),lwd=3,main="Density plot for samples of a=mu*psi") # 
#plot(density(fb_mupsi_abstract$param_upper$bt),lwd=3,main="Density plot for samples of b=mu*(1-psi)") # 
plot(fb_mupsi_raw,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",xlab="")
fb_mupsi_raw1=findbetamupsi_raw(themean=0.30, thevariance = 0.15, thepsi=0.15)
lines(fb_mupsi_raw1,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",lty=2,col="gray")
legend("topright",c("Raw","Raw1"),col=c("black","gray"),lty=1:2,lwd=3)

Plots for findbetamupsi_abstract

library(PriorGen)
fb_mupsi_abstract=findbetamupsi_abstract(themean="Low", thevariance = "High", 
psi.percentile=0.90, percentile.median=0.95, percentile95value=0.98)
#par(mfrow=c(1,3))
#plot(density(fb_mupsi_abstract$param_upper$at),lwd=3,main="Density plot for samples of a=mu*psi") # 
#plot(density(fb_mupsi_abstract$param_upper$bt),lwd=3,main="Density plot for samples of b=mu*(1-psi)") # 
plot(fb_mupsi_abstract,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",xlab="")
fb_mupsi_abstract1=findbetamupsi_abstract(themean="Very low", thevariance = "Average",
                                          psi.percentile=0.90,percentile.median=0.95, 
                                          percentile95value=0.98)
lines(fb_mupsi_abstract1,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",lty=2,col="gray")
legend("topright",c("Abstract","Abstract1"),col=c("black","gray"),lty=1:2,lwd=3)

Plots for findbetamupsi_panel

library(PriorGen)
fb_mupsi_panel=findbetamupsi_panel(themean=c(0.1,0.5,0.05,0.01,0.4,0.2), psi.percentile=0.90,
                                   percentile.median=0.50, percentile95value=0.60)
#par(mfrow=c(1,3))
#plot(density(fb_mupsi_panel$param_upper$at),lwd=3,main="Density plot for samples of a=mu*psi") # 
#plot(density(fb_mupsi_panel$param_upper$bt),lwd=3,main="Density plot for samples of b=mu*(1-psi)") # 
plot(fb_mupsi_panel,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",xlab="")
fb_mupsi_panel1=findbetamupsi_panel(themean=c(0.1,0.5,0.05,0.01,0.6,0.65), psi.percentile=0.90,
              percentile.median=0.80, percentile95value=0.90)
lines(fb_mupsi_panel1,main="Elicited beta prior \n(Hierarchical top level)",
              ylab = "Density",lwd=3,type="l",lty=2,col="gray")
legend("topright",c("Panel","Panel1"),col=c("black","gray"),lty=1:2,lwd=3)