A sample dataset adapted from the AppliedPredictive Modeling R package with additional simulated variables, noise and missingness added. The original dataset Craig-Schapiro et al. (2011) describes a clinical study of 333 patients where laboratory measurements are used to predict which subjects are most likely to develop cognitive impairment, such as Alzheimer's disease.
Format
SampleData
A data frame with 333 rows and 131 columns:
- Diagnosis
Control or impaired
- age
Age in years
- sex
Coded 0 = Female, 1 = Male, left uncoded until
RevalueData()is applied- Genotype
APOE genotype, one of E2E2, E2E3, E2E4, E3E3, E3E4, E4E4
- ...
127 further columns, almost all continuous protein and biomarker measurements
Details
This is deliberately a raw extract rather than a tidy one, because that is
what the package is for. It arrives with no variable labels, sex stored as
bare 0/1, and missingness scattered through 13 of the biomarker columns (up
to 30% in some), so the examples throughout the package can show what each
function does to real, untidied data.
It is paired with SampleVariableTypes, the codebook that describes it.
Passing the two to RevalueData() is the first step of nearly every
example in this package.
See also
SampleVariableTypes for the companion codebook, and SimulatedPhenotypeData for the clustering examples.
Examples
data(SampleData)
# 333 participants, 131 columns, two diagnosis groups.
dim(SampleData)
#> [1] 333 131
table(SampleData$Diagnosis)
#>
#> Control Impaired
#> 242 91
# The first columns are demographics; the rest are biomarkers.
names(SampleData)[1:10]
#> [1] "Diagnosis" "age"
#> [3] "sex" "Genotype"
#> [5] "ACE_CD143_Angiotensin_Converti" "ACTH_Adrenocorticotropic_Hormon"
#> [7] "AXL" "Adiponectin"
#> [9] "Alpha_1_Antichymotrypsin" "Alpha_1_Antitrypsin"
# As shipped, it is unlabelled and `sex` is still a bare numeric code.
str(SampleData[, c("Diagnosis", "age", "sex", "Genotype", "AXL")])
#> 'data.frame': 333 obs. of 5 variables:
#> $ Diagnosis: chr "Control" "Control" "Control" "Control" ...
#> $ age : num 52 61 77 97 73 87 82 56 69 89 ...
#> $ sex : int 0 0 1 0 0 1 1 1 0 0 ...
#> $ Genotype : chr "E3E3" "E3E4" "E3E4" "E3E4" ...
#> $ AXL : num 1.098 0.683 -0.145 0.683 0.191 ...
sjlabelled::get_label(SampleData$age)
#> NULL
# \donttest{
data(SampleVariableTypes)
# The codebook turns it into the labelled frame the other examples use.
Labelled <- RevalueData(SampleData, SampleVariableTypes)$RevaluedData
htmltools::browsable(htmltools::HTML(as.character(
FreezeTableHeader(
utils::head(
Labelled[, c("Diagnosis", "age", "sex", "Genotype", "AXL", "tau", "p_tau")],
8
),
full_width = TRUE
)
)))
Diagnosis
age
sex
Genotype
AXL
tau
p_tau
Control
52
Female
E3E3
1.0983867
6.297754
4.348108
Control
61
Female
E3E4
0.6832816
NA
4.859967
Control
77
Male
E3E4
-0.1452763
6.270988
4.400247
Control
97
Female
E3E4
0.6832816
6.152733
4.494886
Control
73
Female
E3E3
0.1908902
NA
4.524589
Impaired
87
Male
E4E4
-0.2223611
5.361292
3.465736
Control
82
Male
E2E3
0.5298221
5.740789
3.747667
Control
56
Male
E2E3
-0.3266799
NA
3.200630
# Missingness is real and uneven, which is what makes it useful for
# demonstrating the QC functions.
missing_by_var <- sort(colMeans(is.na(SampleData)), decreasing = TRUE)
round(utils::head(missing_by_var[missing_by_var > 0], 10), 3)
#> Angiotensinogen BMP_6
#> 0.3 0.3
#> ENA_78 Fetuin_A
#> 0.3 0.3
#> IL_6 NT_proBNP
#> 0.3 0.3
#> NrCAM Pulmonary_and_Activation_Regulat
#> 0.3 0.3
#> TTR_prealbumin Tamm_Horsfall_Protein_THP
#> 0.3 0.3
# A descriptive overview of a handful of the biomarkers.
htmltools::browsable(htmltools::HTML(as.character(
CreateSummaryTable(
data = Labelled,
variables = c("AXL", "Adiponectin", "Ferritin", "tau", "p_tau"),
ScrollBoxHeight = "260px"
)
)))
Descriptive Summary Table. IQR, Skewness, and Kurtosis are highlighted in yellow if they are indicative of a non-normal distribution. Pct.Valid is highlighted in red if over 30% of data is missing
Variable
label
Mean
Std.Dev
Median
IQR
Min
Max
Skewness
Kurtosis
N.Valid
Pct.Valid
1
AXL
AXL receptor tyrosine kinase
0.30
0.45
0.28
0.62
-0.92
1.52
0.01
-0.24
333
100
2
Adiponectin
Adiponectin
-5.22
0.67
-5.22
0.86
-7.06
-3.47
0.14
-0.21
333
100
3
Ferritin
Ferritin
2.75
0.78
2.73
1.01
0.61
4.93
0.02
0.03
333
100
4
tau
Tau protein
5.74
0.56
5.74
0.8
4.60
7.17
0.22
-0.52
233
69.97
5
p_tau
Phosphorylated tau protein
4.04
0.46
4.04
0.63
2.96
5.47
0.28
-0.11
333
100
# }
