Skip to contents

This function generates a list of objects of class PointEstimator, IntervalEstimators, and PValues to use in examples of the analyze function.

Usage

get_example_statistics(
  point_estimators = TRUE,
  interval_estimators = TRUE,
  p_values = TRUE
)

Arguments

point_estimators

logical indicating whether point estimators should be included in output list

interval_estimators

logical indicating whether interval estimators should be included in output list

p_values

logical indicating whether p-values should be included in output list

Value

a list of PointEstimators, IntervalEstimators and PValue.

Examples

set.seed(123)
dat <- data.frame(
  endpoint = c(rnorm(28, 0.3)),
  stage = rep(1, 28)
)
analyze(data = dat,
        statistics = list(),
        data_distribution = Normal(FALSE),
        design = get_example_design(),
        sigma = 1)
#> Design:                               TwoStageDesign<n1=28;0.8<=x1<=2.3:n2=9-40>
#> Data Distribution:                                          Normal<single-armed>
#> Observed number of stages:                                                     1
#> Observed n1 (total)                                                           28
#> Z1                                                                           1.3
#> Interim decision:                                       continue to second stage
#> Calculated n2(Z1) (per group)                                           32.21129
#> Calculated c2(Z1)                                                           1.71
#> 

# The results suggest recruiting 32 patients for the second stage
dat <- rbind(
  dat,
  data.frame(
    endpoint = rnorm(32, mean = 0.3),
    stage = rep(2, 32)))
analyze(data = dat,
        statistics = get_example_statistics(),
        data_distribution = Normal(FALSE),
        design = get_example_design(),
        sigma = 1)
#> Design:                               TwoStageDesign<n1=28;0.8<=x1<=2.3:n2=9-40>
#> Data Distribution:                                          Normal<single-armed>
#> Observed number of stages:                                                     2
#> Observed n1 (total)                                                           28
#> Z1                                                                           1.3
#> Interim decision:                                       continue to second stage
#> Calculated n2(Z1) (per group)                                           32.21129
#> Calculated c2(Z1)                                                           1.71
#> Observed n2 (in total)                                                        32
#> Z2                                                                          2.66
#> Final test decision:                                                 reject null
#> 
#> Stage 2 results:
#>  Sample mean:                                                          0.3656173
#>  Pseudo Rao-Blackwellized:                                             0.3135628
#>  Median unbiased (LR test ordering):                                   0.3420742
#>  Bias reduced MLE (iterations=1):                                       0.357214
#>  SWCF ordering CI:                                       [0.04664821, 0.6142449]
#>  LR test ordering CI:                                    [0.08992822, 0.6106096]
#>  SWCF ordering p-value:                                               0.01321363
#>  LR test ordering p-value:                                           0.003551316
#>