Description Usage Arguments Value Author(s) References See Also Examples
Determines effective sample size of a parametric prior distribution in Bayesian conjugate models (beta-binomial, gamma-exponential, gamma-Poisson, dirichlet-multinomial, normal-normal, inverse-chi-squared-normal, inverse-gamma-normal), Bayesian linear and logistic regression models, Bayesian continual reassessment method (CRM), and Bayesian time to event model.
1 2 3 4 5 |
model |
Model specifications. Options are: 'betaBin' for beta-binomial model; 'gammaEx' for gamma-exponential model; 'gammaPois' for gamma-Poisson model; 'dirMult' for dirichlet-multinomial model; 'normNorm' for normal-normal model; 'invChisqNorm' for scaled-inverse-chi-squared-normal model; or 'invGammaNorm' for inverse-gamma-normal models. For non-conjugate models, options are: 'linreg' for linear regression model; and 'logistic' for logistic regression models. In addition, the continual reassessment method (CRM) can be specified as: model = 'crm', or as 'tite.crm' for the time-to-event CRM (TITE CRM). Finally, time to event models can be specified as model = 'surv' |
label |
Optional labeling for hyperparameters. Please see examples for sample usage. |
prior |
Prior distribution specification specified as a list. Options are 'beta', 'gamma', 'dirichlet', 'norm' (for normal prior), 'scaled-inverse-chisquared', and 'inverse-gamma'. |
m |
A positive integer specified as an maximum value in which ESS is searched. |
nsim |
Number of simulations for numerical approximation (specified only for model = 'linreg' or model = 'logistic'). |
ncov |
(Required for linear or logistic regression model) Number of covariates |
svec1 |
(Required for linear or logistic regression model) Specification of first subvector for calculating ESS |
svec2 |
(Required for linear or logistic regression model) Specification of second subvector for calculating ESS |
PI |
(Required for CRM) A vector of the true toxicity probabilites associated with the doses. |
betaSD |
(Required for CRM) Standard deviation of the normal prior of the model parameter. |
target |
(Required for CRM) The target dose limiting toxicity (DLT) rate. |
obswin |
(Further required for TITE (time-to-event) CRM) The observation window with respect to which the maximum tolerated dose (MTD) is defined. Default is obswin=30. |
rate |
(Further required for TITE (time-to-event) CRM) Patient arrival rate: Expected number of arrivals per observation window. Example: obswin=6 and rate=3 means expecting 3 patients arrive in 6 time units. Default is rate=2. |
accrual |
(Further required for TITE (time-to-event) CRM) Patient accrual scheme. Default is accrual="poisson". Alternatively use accrual="fixed" whereby inter-patient arrival is fixed. |
shapeParam |
(Required for time to event model) Shape parameter of the inverse gamma prior |
scaleParam |
(Required for time to event model) Scale parameter of the inverse gamma prior |
fast |
Accelerate ESS computation for linear or logistic regression models with C++ code? Default is fast=TRUE. |
ESS |
Returns ESS |
ESSsubvec1 |
(For linear or logistic regression model) ESS for the first sub-vector |
ESSsubvec2 |
(For linear or logistic regression model) ESS for the second sub-vector |
Jaejoon Song <jjsong2@mdanderson.org>, Satoshi Morita <smorita@kuhp.kyoto-u.ac.jp>, J. Jack Lee <jjlee@mdanderson.org>
Morita, S., Thall, P. F., and Muller, P. (2008). Determining the effective sample size of a parametric prior. Biometrics, 64, 595-602.
Morita, S., Thall, P. F., and Muller, P. (2010). Evaluating the impact of prior assumptions in Bayesian biostatistics. Stat Biosci, 2, 1-17.
O'Quigley J., Pepe M., Fisher, L. (1990).Continual reassessment method: A practical design for phase I clinical trials in cancer. Biometrics, 46, 33-48.
Thall, P. F., Wooten, L. H., Tannir, N. M. (2005). Monitoring event times in early phase clinical trials: some practical issues. Clinical Trials, 2, 467-478.
https://biostatistics.mdanderson.org/SoftwareDownload/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | library(BayesESS)
# Calculating ESS for a beta-binomial model with
# beta(1,2) prior
ess(model='betaBin',prior=c('beta',1,2))
# Calculating ESS for a gamma-exponential model with
# gamma(2,4) prior
ess(model='gammaEx',prior=c('gamma',2,4))
# Calculating ESS for a gamma-Poisson model with
# gamma(2,4) prior
ess(model='gammaPois',prior=c('gamma',2,4))
# Calculating ESS for a dirichlet-multinomial model with
# dirichlet(10,15,20) prior
ess(model='dirMult',prior=c('dirichlet',10,15,20))
# Calculating ESS for a scaled-inverse-chi-squared-normal model
# when mean is known and variance is unknown
# with scaled-inverse-chi-squared(nu_0=10,sigma^2_0=1) prior for variance
# ESS for such model can be found analytically
ess(model='invChisqNorm',prior=c(10,1))
# Calculating ESS for a normal-normal model
# when mean is unknown and variance is known
# with normal(mu_0=10,sigma^2=1,n_0=30) prior (i.e. known variance is sigma^2=1)
# ESS for such model can be found analytically (ESS = n_0)
ess(model='normNorm',prior=c('norm',10,1,30))
# Calculating ESS for a scaled-inverse-chi-squared-normal model
# when mean and variance are both unknown
# with scaled-inverse-chi-squared(nu_0=10,sigma^2_0=1) prior for variance
# and normal(mu_0=1,sigma^2/phi=sigma^2/30) prior for mean
# Smaller nsim = 1000 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
## Not run:
ess(model='invChisqNorm',prior=c(10,1,1,30),m=20,nsim=1000)
## End(Not run)
# Calculating ESS for a inverse-gamma-normal model
# when mean is known and variance is unknown
# with inverse-gamma(alpha=5,beta=5) prior
# Note: the inverse-gamma(nu_0/2,nu_0*sigma^2_0/2) prior is
# equivalent to scaled-inverse-chi-squared(nu_0,sigma^2_0)
# ESS for such model can be found analytically
ess(model='invGammaNorm',prior=c(5,5))
# Calculating ESS for a inverse-gamma-normal model
# when mean and variance are both unknown
# with inverse-gamma(alpha=5,beta=5) prior
# and normal(mu_0=1,sigma^2/phi=sigma^2/30) prior for mean
# Note: the inverse-gamma(nu_0/2,nu_0*sigma^2_0/2) prior is
# equivalent to scaled-inverse-chi-squared(nu_0,sigma^2_0)
# Smaller nsim = 1000 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
## Not run:
ess(model='invGammaNorm',prior=c(5,5,1,30),m=20,nsim=1000)
## End(Not run)
# Calculating ESS for a linear regression model with
# three covariates, with priors specified as
# beta0 ~ N(0,1); beta1 ~ N(0,.1); beta2 ~ N(0,.2); beta3 ~ N(0,.3); tau ~ Gamma(1,1);
# Smaller nsim = 50 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
# The value of nsim as low as 1,000 may be used to reduce runtime.
## Not run:
ess(model='linreg',label=c('beta0','beta1','beta2','beta3','tau'),
prior=list(c('norm',0,1),c('norm',0,.1),c('norm',0,.2),c('norm',0,.3),c('gamma',1,1)),
ncov=3,m=50,nsim=50,svec1=c(0,1,1,1,0),svec2=c(0,0,0,0,1))
## End(Not run)
# Calculating ESS for a linear regression model with
# two covariates, with priors specified as
# beta0 ~ N(0,1); beta1 ~ N(0,.1); beta2 ~ N(0,.2); tau ~ Gamma(1,1);
# Smaller nsim = 50 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
# The value of nsim as low as 1,000 may be used to reduce runtime.
## Not run:
ess(model='linreg',label=c('beta0','beta1','beta2','tau'),
prior=list(c('norm',0,1),c('norm',0,.1),c('norm',0,.2),c('gamma',1,1)),
ncov=2,m=50,nsim=50,svec1=c(0,1,1,0),svec2=c(0,0,0,1))
## End(Not run)
# Calculating ESS for a logistic regression model with
# three covariates, with priors specified as
# beta0 ~ N(0,1); beta1 ~ N(0,1); beta2 ~ N(0,1); beta3 ~ N(0,1)
# Smaller nsim = 50 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
# The value of nsim as low as 1,000 may be used to reduce runtime.
## Not run:
ess(model='logistic',label=c('beta0','beta1','beta2','beta3'),
prior=list(c('norm',0,1),c('norm',0,1),c('norm',0,1),c('norm',0,1)),
ncov=3,m=50,nsim=50,svec1=c(1,0,0,0),svec2=c(0,1,1,1))
## End(Not run)
# Calculating ESS for a continual reassessment method (CRM)
# with true toxicity probabilites PI=c(.02,.06,.10,.18,.30)
# prior is specified as N(0,2.5) with target DLT = 0.2
# Smaller nsim = 50 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
# The value of nsim as low as 1,000 may be used to reduce runtime.
## Not run:
ess(model='crm',prior=c(.02,.06,.10,.18,.30),
m=7,nsim=50,
PI=c(.02,.06,.10,.18,.30),
betaSD=sqrt(2.5),target=0.2)
## End(Not run)
# Calculating ESS for a TITE CRM
# with true toxicity probabilites PI=c(.02,.06,.10,.18,.30)
# prior is specified as N(0,1.5) with target DLT = 0.2
# Smaller nsim = 50 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
# The value of nsim as low as 1,000 may be used to reduce runtime.
## Not run:
ess(model='tite.crm',prior=c(.02,.06,.10,.18,.30),
m=7,nsim=50,
PI=c(.02,.06,.10,.18,.30),
betaSD=sqrt(1.5),target=0.2,obswin=30,rate=2,
accrual="poisson")
## End(Not run)
# Calculating ESS for a time to event model
# prior is specified as inverse-gamma(5.348,30.161)
# Smaller nsim = 50 is specified for illustration purposes
# The user can use nsim = 10,000 to carry out the most accurate ESS computations.
# The value of nsim as low as 1,000 may be used to reduce runtime.
## Not run:
ess(model='surv',shapeParam=5.348,scaleParam=30.161,m=7,nsim=50)
## End(Not run)
|
Loading required package: MCMCpack
Loading required package: coda
Loading required package: MASS
##
## Markov Chain Monte Carlo Package (MCMCpack)
## Copyright (C) 2003-2021 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)
##
Loading required package: LaplacesDemon
Attaching package: ‘LaplacesDemon’
The following objects are masked from ‘package:MCMCpack’:
BayesFactor, ddirichlet, dinvgamma, rdirichlet, rinvgamma
ESS was calculated for a beta-binomial model
ESS for the beta(alpha,beta) prior is: 3
[1] 3
ESS was calculated for a gamma-exponential model
ESS for the gamma(alpha,beta) prior is: 4
[1] 4
ESS was calculated for a gamma-poisson model
ESS for the gamma(alpha,beta) prior is: 4
[1] 4
ESS was calculated for a dirichlet-multinomial model
ESS for the dirichlet(alpha1,alpha2,alpha3) prior is: 45
[1] 45
ESS was calculated for a scaled inverse-chi-squared-normal model (with known mean and unknown variance)
ESS for the scaled-inv-chi-squared(10,1) prior for variance is: 10
[1] 10
ESS was calculated for a normal-normal model
ESS for the normal(mu_0,sigma^2/n_0) prior is: 30
[1] 30
ESS was calculated for a scaled inverse-chi-squared-normal model (with unknown mean and unknown variance)
ESS_sigmasq: ESS for the scaled-inv-chi-squared(10,1) prior for variance is 9.14
ESS_mu: ESS for the normal prior for mean is 18.06
$ESS_sigmasq
[1] 9.14
$ESS_mu
[1] 18.06
ESS was calculated for a inverse-gamma-normal model (with known mean and unknown variance)
ESS for the inv-gamma(5,5) prior for variance is: 10
[1] 10
ESS was calculated for a inverse-gamma-normal model (with unknown mean and unknown variance)
ESS_sigmasq: ESS for the inv-gamma(5,5) prior for variance is 9.92
ESS_mu: ESS for the normal prior for mean is 18.06
$ESS_sigmasq
[1] 9.92
$ESS_mu
[1] 18.06
ESS was calculated for a linear regression model
ESSsubvector1: ESS for the first sub-vector (beta1,beta2,beta3)
ESSsubvector1: ESS for the second sub-vector (tau)
$ESSsubvec1
[1] 17.8629
$ESSsubvec2
[1] 1.9998
ESS was calculated for a linear regression model
ESSsubvector1: ESS for the first sub-vector (beta1,beta2)
ESSsubvector1: ESS for the second sub-vector (tau)
$ESSsubvec1
[1] 23.53994
$ESSsubvec2
[1] 1.9998
ESS was calculated for a logistic regression model
ESSsubvector1: ESS for the first sub-vector (beta0)
ESSsubvector1: ESS for the second sub-vector (beta1,beta2,beta3)
$ESSsubvec1
[1] 3.9996
$ESSsubvec2
[1] 12.70702
ESS was calculated for a CRM model
ESS for the N(0,2.5) beta prior is: 0.7142857143
[1] 0.7142857
ESS was calculated for a TITE CRM model
ESS for the N(0,1.5) beta prior is: 1.4285714286
[1] 1.428571
ESS was calculated for a time to event model
ESS for the inverse-gamma (alpha,beta) prior is: 3.94
[1] 3.938776
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.