Computes probability of the reduction parameter's marginal posterior density relative to a threshold.

fecr_probs(stanFit, threshold = 0.95, lessthan = TRUE,
           plot = TRUE, xlab, ylab, main, verbose = TRUE, ...)

Arguments

stanFit

a stanfit object from the output of fecr_stan().

threshold

numeric. The default threshold is 0.95 (95%).

lessthan

logical. If TRUE, the probability less than the threshold is computed. Otherwise greater or equal to the threshold is computed. Default is TRUE.

plot

logical. If TRUE, the posterior density of the reduction is plotted with region less than the threshold shaded.

xlab, ylab, main

strings. Arguments for plotting. Only used if plot = TRUE.

verbose

logical. If TRUE, a statement with computed probability is printed.

...

additional plotting arguments

Value

Returns a numeric value indicating the probability in percentage.

Examples

# \donttest{ ## load sample data data(epgs) ## apply individual efficacy model to the data vectors model <- fecr_stan(epgs$before, epgs$after, rawCounts = FALSE, preCF = 10, paired = TRUE, indEfficacy = TRUE)
#> #> SAMPLING FOR MODEL 'indefficacy' NOW (CHAIN 1). #> Chain 1: Gradient evaluation took 3.5e-05 seconds #> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.35 seconds. #> Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup) #> Chain 1: Iteration: 500 / 2000 [ 25%] (Warmup) #> Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup) #> Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling) #> Chain 1: Iteration: 1500 / 2000 [ 75%] (Sampling) #> Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) #> Chain 1: Elapsed Time: 1.45455 seconds (Warm-up) #> Chain 1: 0.899831 seconds (Sampling) #> Chain 1: 2.35438 seconds (Total) #> #> SAMPLING FOR MODEL 'indefficacy' NOW (CHAIN 2). #> Chain 2: Gradient evaluation took 1.6e-05 seconds #> Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.16 seconds. #> Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup) #> Chain 2: Iteration: 500 / 2000 [ 25%] (Warmup) #> Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup) #> Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling) #> Chain 2: Iteration: 1500 / 2000 [ 75%] (Sampling) #> Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) #> Chain 2: Elapsed Time: 1.64621 seconds (Warm-up) #> Chain 2: 0.917111 seconds (Sampling) #> Chain 2: 2.56332 seconds (Total) #> Model: Bayesian model without zero-inflation for paired design allowing individual efficacy #> Number of Samples: 2000 #> Warm-up samples: 1000 #> Thinning: 1 #> Number of Chains 2 #> mean sd 2.5% 50% 97.5% HPDLow95 #> FECR 0.9623 0.0566 0.8083 0.9869 1.0000 0.8438 #> meanEPG.untreated 1428.6307 747.3796 511.3575 1241.6718 3265.4171 429.1522 #> meanEPG.treated 53.6706 96.2146 0.0002 16.0360 344.9586 0.0000 #> mode HPDHigh95 #> FECR 0.9966 1.0000 #> meanEPG.untreated 899.5017 3053.2711 #> meanEPG.treated 3.6331 222.9084 #> #> NOTE: there is no evidence of non-convergence since all parameters have potential scale reduction factors (Brooks and Gelman, 1998) less than 1.1.
fecr_probs(model$stan.samples)
#> The probability that the reduction is less than 0.95 is 25.1 %.
# }