Chapter 3: Some Basic Probability Concepts

Introduction

This vignette of package DanielBiostatistics10th (CRAN, Github) documents the examples of Chapter 3 Some Basic Probability Concepts of Biostatistics: A Foundation for Analysis in the Health Sciences, 11th Edition by Wayne W. Daniel and Chad L. Cross.

Note to Users

Examples in this vignette require that the search path has

library(DanielBiostatistics10th)

Terms and Abbreviations

Term / Abbreviation Description Reference
Forward pipe operator ?base::pipeOp introduced in R 4.1.0
CRAN, R The Comprehensive R Archive Network https://cran.r-project.org
flextable Flexible tables ?flextable::flextable
matrix Matrices ?base::matrix
table Cross tabulation ?base::table

Example 3.4.1 - 3.4.9

Page 69-75 (10th ed), Page 61-67 (11th ed)

c(28L, 19L, 41L, 53L, 35L, 38L, 44L, 60L) |>
  matrix(ncol = 2L, dimnames = list(
    FamilyHx = c('none', 'Bipolar', 'Unipolar', 'UniBipolar'), 
    Onset = c('Early', 'Late')
  )) |> 
  as.table() |>
  as_flextable()

FamilyHx

Onset

Early

Late

Total

none

Count

28 (8.8%)

35 (11.0%)

63 (19.8%)

Mar. pct (1)

19.9% ; 44.4%

19.8% ; 55.6%

Bipolar

Count

19 (6.0%)

38 (11.9%)

57 (17.9%)

Mar. pct

13.5% ; 33.3%

21.5% ; 66.7%

Unipolar

Count

41 (12.9%)

44 (13.8%)

85 (26.7%)

Mar. pct

29.1% ; 48.2%

24.9% ; 51.8%

UniBipolar

Count

53 (16.7%)

60 (18.9%)

113 (35.5%)

Mar. pct

37.6% ; 46.9%

33.9% ; 53.1%

Total

Count

141 (44.3%)

177 (55.7%)

318 (100.0%)

(1) Columns and rows percentages

Example 3.5.1

Page 81 (10th ed), Page 72 (11th ed)

d351 = c(495L, 14L, 5L, 436L) |>
  matrix(nrow = 2L, dimnames = list(
    Alzheimer = c('No', 'Yes'), 
    Test = c('Negative', 'Positive')
  )) |>
  binTab()
d351 |>
  as_flextable()

Alzheimer

Test

Negative (-)

Positive (+)

Total

No (-)

Count

495 (52.1%)

5 (0.5%)

500 (52.6%)

Mar. pct (1)

97.2% ; 99.0%

1.1% ; 1.0%

Yes (+)

Count

14 (1.5%)

436 (45.9%)

450 (47.4%)

Mar. pct

2.8% ; 3.1%

98.9% ; 96.9%

Total

Count

509 (53.6%)

441 (46.4%)

950 (100.0%)

(1) Columns and rows percentages

d351 |>
  print(prevalence = .113, print_flextable = FALSE)
#> Sensitivity: 96.9% =436/450, 95% exact CI (94.8%, 98.3%)
#> Specificity: 99.0% =495/500, 95% exact CI (97.7%, 99.7%)
#> 
#> Positive vs. Negative Predictive Value: 92.5% vs. 99.6%, prevalence 11.3%
#> 
#> Diagnose Accuracy: 98.0% =(436+495)/950, 95% exact CI (96.9%, 98.8%)