bss.dt.bs: Bayesian sample size in a decision-theoretic approach under...

Description Usage Arguments Value Author(s) References Examples

View source: R/RCodes.R

Description

A function to obtain the optimal Bayesian sample size via a decision-theoretic approach for estimating the mean of the Birbaum-Saunders distribution.

Usage

 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
bss.dt.bs(
  loss = "L1",
  a1 = 8,
  b1 = 50,
  a2 = 8,
  b2 = 50,
  cost = 0.01,
  rho = 0.05,
  gam = 1,
  l = 1,
  nmin = 2,
  nmax = 2000,
  nlag = 200,
  nrep = 6L,
  lrep = 100,
  npost = 500,
  nburn = 500,
  thin = 20L,
  scale = 1L,
  plots = TRUE,
  prints = TRUE,
  save.plot = FALSE,
  diagnostic = FALSE,
  mc.preschedule = FALSE,
  ...
)

Arguments

loss

L1 (Absolute loss), L2 (Quadratic loss), L3 (Weighted loss) and L4 (Half loss) representing the loss function used. The default is absolute loss function.

a1

hyperparameter of the prior distribution for beta. The default is 3.

b1

hyperparameter of the prior distribution for beta. The default is 2.

a2

hyperparameter of the prior distribution for shape^2. The default is 3.

b2

hyperparameter of the prior distribution for shape^2. The default is 2.

cost

a positive real number representing the cost of colect one observation. The default is 0.010.

rho

a number in (0, 1). The probability of the credible interval is 1-rho. Only for loss function L3. The default is 0.95.

gam

a positive real number connected with the credible interval when using loss function L4. The default is 0.5.

l

xxx

nmin

a positive integer representing the minimum number for compute the Bayes risk. Default is 2.

nmax

a positive integer representing the maximum number for compute the Bayes risk. Default is 100.

nlag

a positive integer representing the lag in the n's used to compute the Bayes risk. Default is 10.

nrep

a positive integer representing the number of samples taken for each n.

lrep

a positive integer representing the number of samples taken for S_n. Default is 100.

npost

a positive integer representing the number of values to draw from the posterior distribution of the mean. Default is 100.

nburn

a positive constant for the sampling method.

thin

a positive constant for the sampling method.

scale

a positive constant for the sampling method.

plots

Boolean. If TRUE (default) it plot the estimated Bayes risks and the fitted curve.

prints

Boolean. If FALSE (default) the output is a list.

save.plot

Boolean. If TRUE, the plot is saved to an external file. The default is FALSE.

diagnostic

xxx.

mc.preschedule

xxx

...

Currently ignored.

Value

An integer representing the optimal sample size.

Author(s)

Eliardo G. Costa eliardocosta@ccet.ufrn.br and Manoel Santos-Neto manoel.ferreira@ufcg.edu.br

References

Costa, E.G., Paulino, C.D., and Singer, J. M. (2019). Sample size determination to evaluate ballast water standards: a decision-theoretic approach. Tech. rept. University of Sao Paulo.

Examples

1
2
 
#bss.dt.bs(loss="L1", plot=TRUE, lrep=10, npost=10)

santosneto/sampleBS documentation built on May 26, 2021, 2:45 a.m.