| Title: | Data Bank for Statistical Analysis and Visualization |
|---|---|
| Description: | Contains data organized by topics: categorical data, regression model, means comparisons, independent and repeated measures ANOVA, mixed ANOVA and ANCOVA. The package code is under GPL-2; the data sets are covered by the terms in the 'LICENSE.note' file (the author's data sets under CC0 1.0, and the 'heartdisease' data under CC BY 4.0, see the 'heartdisease' help page). |
| Authors: | Alboukadel Kassambara [aut, cre] |
| Maintainer: | Alboukadel Kassambara <[email protected]> |
| License: | GPL-2 |
| Version: | 0.2.0 |
| Built: | 2026-07-23 15:48:31 UTC |
| Source: | https://github.com/cran/datarium |
This dataset contains the number of monthly air passengers from 1949 to 1960. It is taken from the R datasets package and formatted into long data frame format.
data("AirPassengersDf")data("AirPassengersDf")
A data frame with 144 rows and 2 columns.
the month of the observation, as a Date (the first day
of each month from January 1949 to December 1960).
the monthly total of international airline passengers.
The AirPassengers time series in base R (the classic Box and
Jenkins airline data), reshaped into a long data frame.
Box, G. E. P., Jenkins, G. M. and Reinsel, G. C. (1976) Time Series Analysis, Forecasting and Control. San Francisco: Holden-Day.
data("AirPassengersDf") head(AirPassengersDf) # Monthly international airline passengers over time plot(Passengers ~ Month, data = AirPassengersDf, type = "l")data("AirPassengersDf") head(AirPassengersDf) # Monthly international airline passengers over time plot(Passengers ~ Month, data = AirPassengersDf, type = "l")
Paired nominal data providing the smoking status 62 individuals before and after emotive video communications showing the danger of smoking. This a demo dataset for McNemar test.
It is the data set used in the Datanovia tutorial “McNemar's Test in R: Compare Paired Proportions (Before/After)” (https://www.datanovia.com/learn/biostatistics/categorical/mcnemar-test-in-r).
data("antismoking")data("antismoking")
A data frame with 62 rows and 3 columns (stored as a tibble).
participant identifier (1 to 62).
the smoking status before the communication, "non.smoker" or "smoker".
the smoking status after the communication, "non.smoker" or "smoker".
A simulated dataset for teaching McNemar's test.
Datanovia tutorial: McNemar's Test in R: Compare Paired Proportions (Before/After).
data(antismoking) xtabs(~before + after, data = antismoking) # McNemar test of the change in smoking status mcnemar.test(table(antismoking$before, antismoking$after))data(antismoking) xtabs(~before + after, data = antismoking) # McNemar test of the change in smoking status mcnemar.test(table(antismoking$before, antismoking$after))
The data provide the anxiety score, measured at three time points, of three groups of individuals practicing physical exercises at different levels (grp1: basal, grp2: moderate and grp3: high)
Two-way mixed ANOVA can be used to evaluate if there is interaction between group and time in explaining the anxiety score.
It is the data set used in the Datanovia tutorial “Mixed ANOVA in R: One Between- and One Within-Subjects Factor” (https://www.datanovia.com/learn/biostatistics/anova/mixed-anova-in-r).
data("anxiety")data("anxiety")
A data frame with 45 rows and 5 columns (stored as a tibble).
participant identifier (1 to 45).
the physical exercise level, "grp1" (basal), "grp2" (moderate) or "grp3" (high); a between-subjects factor.
the anxiety score at the first time point.
the anxiety score at the second time point.
the anxiety score at the third time point.
The anxiety score is a simulated measure on an arbitrary scale with no real-world units.
A simulated dataset created for teaching two-way mixed ANOVA.
Datanovia tutorial: Mixed ANOVA in R: One Between- and One Within-Subjects Factor.
data(anxiety) head(anxiety) # Two-way mixed ANOVA: group (between) x time (within) anxiety_long <- reshape(anxiety, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ group * factor(time) + Error(factor(id)/factor(time)), data = anxiety_long))data(anxiety) head(anxiety) # Two-way mixed ANOVA: group (between) x time (within) anxiety_long <- reshape(anxiety, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ group * factor(time) + Error(factor(id)/factor(time)), data = anxiety_long))
The data correspond to an experiment in which a treatment for depression is studied. Two groups of patients - control ("ctr") and treatment ("treated") - have been followed at four different time points: t0 (pre-test) and three post-test follow-up measurements (t1, t2, t3). The dependent variable is a depression score.
Repeated measures ANOVA can be performed in order to determine the effect of the treatment and the effect of time on the depression score.
For a worked tutorial on this analysis, see the Datanovia lesson “Mixed ANOVA in R: One Between- and One Within-Subjects Factor” (https://www.datanovia.com/learn/biostatistics/anova/mixed-anova-in-r).
data("depression")data("depression")
A data frame with 24 rows and 6 columns (stored as a tibble).
participant identifier (1 to 24).
the treatment group, "ctr" (control) or "treated".
the depression score at pre-test.
the depression score at the first post-test follow-up.
the depression score at the second post-test follow-up.
the depression score at the third post-test follow-up.
The depression score is a simulated measure on an arbitrary scale with no real-world units.
A simulated dataset created for teaching two-way mixed ANOVA.
Datanovia tutorial: Mixed ANOVA in R: One Between- and One Within-Subjects Factor.
data(depression) head(depression) # Two-way mixed ANOVA: treatment (between) x time (within) depression_long <- reshape(depression, varying = c("t0", "t1", "t2", "t3"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ treatment * factor(time) + Error(factor(id)/factor(time)), data = depression_long))data(depression) head(depression) # Two-way mixed ANOVA: treatment (between) x time (within) depression_long <- reshape(depression, varying = c("t0", "t1", "t2", "t3"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ treatment * factor(time) + Error(factor(id)/factor(time)), data = depression_long))
Contains the weights by sex (M for male; F for female). The question is whether the average women's weight differs from the average men's weight?
A two-samples independent t-test can be performed to answer to this question.
It is the data set used in the Datanovia tutorial “T-Test in R: One-Sample, Independent (Student & Welch) & Paired” (https://www.datanovia.com/learn/biostatistics/two-groups/t-test-in-r).
data("genderweight")data("genderweight")
A data frame with 40 rows and 3 columns (stored as a tibble).
participant identifier (1 to 40).
the participant's sex, "F" (female) or "M" (male).
the participant's body weight.
A simulated dataset for teaching the two-samples (independent) t-test.
Datanovia tutorial: T-Test in R: One-Sample, Independent (Student & Welch) & Paired.
data(genderweight) head(genderweight) # Two-samples independent t-test: do mean weights differ by sex? t.test(weight ~ group, data = genderweight)data(genderweight) head(genderweight) # Two-samples independent t-test: do mean weights differ by sex? t.test(weight ~ group, data = genderweight)
A pharmaceutical company tested three treatments for migraine headache sufferers. 72 participants were enrolled in the experiments. The aim is to examine the potential of new class of treatments in lowering the pain score associated with the migraine headache episode.
The participants include 36 males and 36 females. Males and females were further (equally) subdivided into whether they were at low or high risk of migraine headache.
This data set is suited for three way Anova test.
It is the data set used in the Datanovia tutorial “Three-Way ANOVA in R: Three Factors and Their Interaction” (https://www.datanovia.com/learn/biostatistics/anova/three-way-anova-in-r).
data("headache")data("headache")
A data frame with 72 rows and 5 columns (stored as a tibble).
participant identifier (1 to 72).
the participant's gender, "male" or "female".
the participant's migraine risk, "high" or "low".
the treatment received, "X", "Y" or "Z".
a simulated migraine pain score (an arbitrary scale with no real-world units).
A simulated dataset for teaching three-way ANOVA.
heartattack, the companion three-way ANOVA data set.
Datanovia tutorial:
Three-Way ANOVA in R: Three Factors and Their Interaction.
data(headache) head(headache) # Three-way ANOVA of the pain score summary(aov(pain_score ~ gender * risk * treatment, data = headache))data(headache) head(headache) # Three-way ANOVA of the pain score summary(aov(pain_score ~ gender * risk * treatment, data = headache))
Measures of cholesterol concentration in 72 participants treated with three different drugs. The aim is to examine the potential of new class of drugs in lowering the cholesterol concentration and consequently reducing heart attack.
The participants include 36 males and 36 females. Males and females were further (equally) subdivided into whether they were at low or high risk of heart attack.
This data set is suited for three way Anova test.
For a worked tutorial on this analysis, see the Datanovia lesson “Three-Way ANOVA in R: Three Factors and Their Interaction” (https://www.datanovia.com/learn/biostatistics/anova/three-way-anova-in-r).
data("heartattack")data("heartattack")
A data frame with 72 rows and 5 columns (stored as a tibble).
the participant's gender, "male" or "female".
the participant's heart attack risk, "high" or "low".
the drug received, "A", "B" or "C".
the blood cholesterol concentration.
participant identifier (1 to 72).
A simulated dataset for teaching three-way ANOVA.
headache, the companion three-way ANOVA data set.
Datanovia tutorial:
Three-Way ANOVA in R: Three Factors and Their Interaction.
data(heartattack) head(heartattack) # Three-way ANOVA of the cholesterol concentration summary(aov(cholesterol ~ gender * risk * drug, data = heartattack))data(heartattack) head(heartattack) # Three-way ANOVA of the cholesterol concentration summary(aov(cholesterol ~ gender * risk * drug, data = heartattack))
A real, deliberately messy clinical dataset: 920 patients assessed
for coronary artery disease at four institutions (Cleveland, Hungary,
Switzerland and the Long Beach VA). Unlike the simulated teaching sets in
datarium, it ships close to raw — integer-coded categorical variables,
substantial and uneven missingness across sites, and a multi-level outcome —
so it can be used to teach the "clean the data before you analyse it" step
ahead of logistic regression, chi-square tests and group comparisons. The
values are the original UCI codes and are not relabelled; see the
data-raw/heartdisease/heart-disease.names codebook.
For a worked tutorial on this analysis, see the Datanovia lesson “Logistic Regression in R: Model a Binary Outcome” (https://www.datanovia.com/learn/biostatistics/regression/logistic-regression-in-r).
data("heartdisease")data("heartdisease")
A data frame with 920 rows and 15 columns. The missing marker
"?" in the source has been converted to NA; missingness is heavy
and very uneven across sites (see colSums(is.na(heartdisease))).
age, in years.
sex, integer-coded: 1 = male, 0 = female.
chest pain type: 1 = typical angina, 2 = atypical
angina, 3 = non-anginal pain, 4 = asymptomatic.
resting blood pressure (mm Hg on admission to hospital).
serum cholesterol (mg/dl). Note: 172 patients are recorded with
0 — all 123 of the Switzerland site's patients and a further 49 at
the Long Beach VA site — where 0 means "not measured" rather than a
true value: a real missing-data trap to handle before analysis.
fasting blood sugar > 120 mg/dl: 1 = true, 0 = false.
resting electrocardiographic results: 0 = normal,
1 = ST-T wave abnormality, 2 = probable or definite left
ventricular hypertrophy (Estes' criteria).
maximum heart rate achieved.
exercise-induced angina: 1 = yes, 0 = no.
ST depression induced by exercise relative to rest.
slope of the peak exercise ST segment: 1 = upsloping,
2 = flat, 3 = downsloping.
number of major vessels (0–3) coloured by fluoroscopy.
thallium stress-test result: 3 = normal, 6 = fixed
defect, 7 = reversible defect.
diagnosis of heart disease (angiographic disease status):
0 = < 50% diameter narrowing (no disease); 1–4 =
> 50% narrowing (disease present). It is commonly binarised to absence
(0) vs presence (> 0).
the collecting site, a factor with levels "cleveland",
"hungarian", "switzerland" and "va".
Heart Disease, UCI Machine Learning Repository
(doi:10.24432/C52P4X). Real patient data collected by the Hungarian
Institute of Cardiology, Budapest; University Hospital, Zurich; University
Hospital, Basel; and the V.A. Medical Center, Long Beach, and shared by the
Cleveland Clinic Foundation. This dataset combines the four
processed.<site>.data files (the 14 commonly-used attributes of the
original 76), converting the "?" marker to NA and keeping the raw
values otherwise unchanged; the source files and codebook are in
data-raw/heartdisease/. Distributed under the Creative Commons
Attribution 4.0 International (CC BY 4.0) licence; when using the data please
cite Janosi et al. (1989) (see references).
Janosi, A., Steinbrunn, W., Pfisterer, M., & Detrano, R. (1989). Heart Disease [Dataset]. UCI Machine Learning Repository. doi:10.24432/C52P4X.
Detrano, R., Janosi, A., Steinbrunn, W., Pfisterer, M., Schmid, J. J., Sandhu, S., Guppy, K. H., Lee, S., & Froelicher, V. (1989). International application of a new probability algorithm for the diagnosis of coronary artery disease. The American Journal of Cardiology, 64(5), 304–310.
Datanovia tutorial: Logistic Regression in R: Model a Binary Outcome.
data("heartdisease") # Real data is messy: missingness is heavy and very uneven across sites colSums(is.na(heartdisease)) table(heartdisease$dataset) # The Cleveland site is the most complete; use it for a first model cleveland <- subset(heartdisease, dataset == "cleveland") # Binarise the 0-4 angiographic outcome into disease present/absent cleveland$disease <- as.integer(cleveland$num > 0) # Logistic regression of disease on age, sex and maximum heart rate fit <- glm(disease ~ age + sex + thalach, family = binomial, data = cleveland) summary(fit) # Chi-square test: is disease associated with sex (all sites)? heartdisease$disease <- as.integer(heartdisease$num > 0) chisq.test(table(heartdisease$sex, heartdisease$disease))data("heartdisease") # Real data is messy: missingness is heavy and very uneven across sites colSums(is.na(heartdisease)) table(heartdisease$dataset) # The Cleveland site is the most complete; use it for a first model cleveland <- subset(heartdisease, dataset == "cleveland") # Binarise the 0-4 angiographic outcome into disease present/absent cleveland$disease <- as.integer(cleveland$num > 0) # Logistic regression of disease on age, sex and maximum heart rate fit <- glm(disease ~ age + sex + thalach, family = binomial, data = cleveland) summary(fit) # Chi-square test: is disease associated with sex (all sites)? heartdisease$disease <- as.integer(heartdisease$num > 0) chisq.test(table(heartdisease$sex, heartdisease$disease))
A data frame containing the frequency of execution of 13 house tasks in the couple.
It is the data set used in the Datanovia tutorial “Chi-Square Test of Independence in R: Are Two Variables Associated?” (https://www.datanovia.com/learn/biostatistics/categorical/chi-square-test-of-independence-in-r).
data("housetasks.raw")data("housetasks.raw")
A data frame with 1744 rows and 2 columns (stored as a tibble). Each row is one recorded performance of a household task, recovered from the original contingency table.
the household task, one of 13 categories: "Laundry", "Main_meal", "Dinner", "Breakfeast", "Tidying", "Dishes", "Shopping", "Official", "Driving", "Finances", "Insurance", "Repairs" and "Holidays". ("Breakfeast" is a misspelling of "Breakfast" carried over from the source data.)
who performs the task: "Partner1", "Alternating", "Parter2" or "Jointly". The two partner categories were relabeled from the source data's "Wife" and "Husband"; "Parter2" is a misspelling of "Partner2" retained as-is in the stored data.
Derived from the housetasks data set in the factoextra
package, with its "Wife" and "Husband" columns relabeled "Partner1" and
"Partner2", expanded to one row per recorded case.
Datanovia tutorial: Chi-Square Test of Independence in R: Are Two Variables Associated?.
data(housetasks.raw) table(housetasks.raw) # Chi-square test of association between task and who performs it chisq.test(table(housetasks.raw$tasks, housetasks.raw$status))data(housetasks.raw) table(housetasks.raw) # Chi-square test of association between task and who performs it chisq.test(table(housetasks.raw$tasks, housetasks.raw$status))
A simulated dataset giving the number of infections recorded for 100 patients over a one-year follow-up in a placebo-controlled study. It is designed for teaching Poisson regression of a count outcome on a treatment group and a continuous covariate.
data("infections")data("infections")
A data frame with 100 rows and 4 columns.
patient identifier (1 to 100).
the treatment group, "placebo" or "treated".
the patient's age, in years.
the number of infections recorded during the one-year follow-up (a count outcome).
A simulated dataset created for teaching Poisson regression. The counts
were generated as count ~ Poisson(mu) with
log(mu) = 1.6 - 0.8 * (treatment == "treated") + 0.25 * ((age - 40) / 10)
(see data-raw/infections.R), so the treated group has a lower infection
rate.
data(infections) head(infections) # Poisson regression of the infection count on treatment and age fit <- glm(count ~ treatment + age, family = poisson, data = infections) summary(fit)data(infections) head(infections) # Poisson regression of the infection count on treatment and age fit <- glm(count ~ treatment + age, family = poisson, data = infections) summary(fit)
Contains the job satisfaction score organized by gender and education level.
It is the data set used in the Datanovia tutorial “Two-Way ANOVA in R: Two Factors and Their Interaction” (https://www.datanovia.com/learn/biostatistics/anova/two-way-anova-in-r).
data("jobsatisfaction")data("jobsatisfaction")
A data frame with 58 rows and 4 columns (stored as a tibble).
participant identifier (1 to 58).
the participant's gender, "male" or "female".
the participant's education level, "school", "college" or "university".
a simulated job satisfaction score (an arbitrary scale with no real-world units).
A simulated dataset for teaching two-way ANOVA.
Datanovia tutorial: Two-Way ANOVA in R: Two Factors and Their Interaction.
data(jobsatisfaction) head(jobsatisfaction) # Two-way ANOVA of satisfaction by gender and education level summary(aov(score ~ gender * education_level, data = jobsatisfaction))data(jobsatisfaction) head(jobsatisfaction) # Two-way ANOVA of satisfaction by gender and education level summary(aov(score ~ gender * education_level, data = jobsatisfaction))
A data frame containing the impact of three advertising medias (youtube, facebook and newspaper) on sales. Data are the advertising budget in thousands of dollars along with the sales (in thousands of units). The advertising experiment has been repeated 200 times. This is a simulated data.
It is the data set used in the Datanovia tutorial “Multiple Linear Regression in R: Several Predictors” (https://www.datanovia.com/learn/biostatistics/regression/multiple-linear-regression-in-r).
data("marketing")data("marketing")
A data frame with 200 rows and 4 columns.
the advertising budget spent on YouTube, in thousands of dollars.
the advertising budget spent on Facebook, in thousands of dollars.
the advertising budget spent on newspaper, in thousands of dollars.
the sales generated, in thousands of units.
A simulated dataset for teaching multiple linear regression.
Datanovia tutorial: Multiple Linear Regression in R: Several Predictors.
data(marketing) res.lm <- lm(sales ~ youtube*facebook, data = marketing) summary(res.lm)data(marketing) res.lm <- lm(sales ~ youtube*facebook, data = marketing) summary(res.lm)
Contains the weight of 10 mice. The question is whether the average weight of the mice differs from 25g.
A one sample t-test can be performed to answer to this question.
It is the data set used in the Datanovia tutorial “T-Test in R: One-Sample, Independent (Student & Welch) & Paired” (https://www.datanovia.com/learn/biostatistics/two-groups/t-test-in-r).
data("mice")data("mice")
A data frame with 10 rows and 2 columns (stored as a tibble).
mouse identifier, "M_1" to "M_10".
the mouse weight, in grams.
A simulated dataset for teaching the one-sample t-test.
mice2, the paired-samples companion data set.
Datanovia tutorial:
T-Test in R: One-Sample, Independent (Student & Welch) & Paired.
data(mice) head(mice) # One-sample t-test: does the mean weight differ from 25 g? t.test(mice$weight, mu = 25)data(mice) head(mice) # One-sample t-test: does the mean weight differ from 25 g? t.test(mice$weight, mu = 25)
contains the weight of 10 mice before and after the treatment.
A paired-samples t-test can be performed to answer to this question.
It is the data set used in the Datanovia tutorial “T-Test in R: One-Sample, Independent (Student & Welch) & Paired” (https://www.datanovia.com/learn/biostatistics/two-groups/t-test-in-r).
data("mice2")data("mice2")
A data frame with 10 rows and 3 columns.
mouse identifier (1 to 10).
the mouse weight before the treatment.
the mouse weight after the treatment.
A simulated dataset for teaching the paired-samples t-test.
mice, the one-sample companion data set.
Datanovia tutorial:
T-Test in R: One-Sample, Independent (Student & Welch) & Paired.
data(mice2) head(mice2) # Paired-samples t-test: did the treatment change the weight? t.test(mice2$before, mice2$after, paired = TRUE)data(mice2) head(mice2) # Paired-samples t-test: did the treatment change the weight? t.test(mice2$before, mice2$after, paired = TRUE)
Contains the performance score measures of participants at two time points. The aim of this study is to evaluate the effect of gender and stress on performance score. The three-way mixed ANOVA test can be used to investigate this question.
The data include two between-subjects factors (gender and stress) and one within-subject factor (time, repeated measures).
It is the data set used in the Datanovia tutorial “Mixed ANOVA in R: One Between- and One Within-Subjects Factor” (https://www.datanovia.com/learn/biostatistics/anova/mixed-anova-in-r).
data("performance")data("performance")
A data frame with 60 rows and 5 columns (stored as a tibble).
participant identifier (1 to 60).
the participant's gender, "male" or "female".
the stress level, "low", "moderate" or "high".
a simulated performance score at the first time point (an arbitrary scale with no real-world units).
the performance score at the second time point (same scale as t1).
A simulated dataset for teaching three-way mixed ANOVA.
Datanovia tutorial: Mixed ANOVA in R: One Between- and One Within-Subjects Factor.
data(performance) head(performance) # Three-way mixed ANOVA: gender and stress (between) x time (within) perf_long <- reshape(performance, varying = c("t1", "t2"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ gender * stress * factor(time) + Error(factor(id)/factor(time)), data = perf_long))data(performance) head(performance) # Three-way mixed ANOVA: gender and stress (between) x time (within) perf_long <- reshape(performance, varying = c("t1", "t2"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ gender * stress * factor(time) + Error(factor(id)/factor(time)), data = perf_long))
Contains the type of properties and the buyer types. Buyer categories are: "single male", "single female", "married couple" and "family".
The type of property these buyers purchased were sorted into four categories: "flat", "bungalow" (i.e., a one-storey home), "detached house" and "terrace" (i.e., a block of adjoining houses).
Chi-square test of independence can be used to assess the association between the type of buyer who purchases a property and the type of property that is purchased.
For a worked tutorial on this analysis, see the Datanovia lesson “Chi-Square Test of Independence in R: Are Two Variables Associated?” (https://www.datanovia.com/learn/biostatistics/categorical/chi-square-test-of-independence-in-r).
data("properties")data("properties")
A data frame with 333 rows and 2 columns (stored as a tibble).
the type of property purchased: "flat", "bungalow", "detached house" or "terrace".
the type of buyer: "single male", "single female", "married couple" or "family".
A simulated dataset for teaching the chi-square test of independence.
Datanovia tutorial: Chi-Square Test of Independence in R: Are Two Variables Associated?.
data("properties") head(properties) # Chi-square test of independence between buyer type and property type chisq.test(table(properties$property_type, properties$buyer_type))data("properties") head(properties) # Chi-square test of independence between buyer type and property type chisq.test(table(properties$property_type, properties$buyer_type))
Presents the frequencies of individuals at high risk of renal calculi according to age and gender. This a demo dataset for Cochran-Armitage trend test for investigating whether there is a linear trend between the proportion of individual with renal stone and ages.
It is the data set used in the Datanovia tutorial “Cochran-Armitage Trend Test in R: Test a Trend in Proportions” (https://www.datanovia.com/learn/biostatistics/categorical/cochran-armitage-trend-test-in-r).
data("renalstone")data("renalstone")
A data frame with 3513 rows and 3 columns (stored as a tibble).
the individual's gender, "male" or "female".
whether the individual has a renal stone, "yes" or "no".
the age group, an ordered factor: "30-39" < "40-49" < "50-59".
Frequencies reported by Hazra and Gogtay (2016), expanded to one row per individual.
Hazra, Avijit, and Nithya Jaideep Gogtay. 2016. "Biostatistics Series Module 4: Comparing Groups - Categorical Variables." In Indian Journal of Dermatology.
Datanovia tutorial: Cochran-Armitage Trend Test in R: Test a Trend in Proportions.
data(renalstone) xtabs(~stone+age+gender, data = renalstone)data(renalstone) xtabs(~stone+age+gender, data = renalstone)
The dataset contains 10 individuals' self-esteem score on three time points during a specific diet to determine whether their self-esteem improved.
One-way repeated measures ANOVA can be performed in order to determine the effect of time on the self-esteem score.
It is the data set used in the Datanovia tutorial “Repeated Measures ANOVA in R: Compare Means Across Time” (https://www.datanovia.com/learn/biostatistics/anova/repeated-measures-anova-in-r).
data("selfesteem")data("selfesteem")
A data frame with 10 rows and 4 columns (stored as a tibble).
participant identifier (1 to 10).
the self-esteem score at the first time point.
the self-esteem score at the second time point.
the self-esteem score at the third time point.
The self-esteem score is a simulated measure on an arbitrary scale with no real-world units.
A simulated dataset created for teaching one-way repeated measures ANOVA.
selfesteem2, the two-way (treatment x time) companion data set.
Datanovia tutorial:
Repeated Measures ANOVA in R: Compare Means Across Time.
data(selfesteem) head(selfesteem) # One-way repeated measures ANOVA of the self-esteem score over time selfesteem_long <- reshape(selfesteem, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ factor(time) + Error(factor(id)/factor(time)), data = selfesteem_long))data(selfesteem) head(selfesteem) # One-way repeated measures ANOVA of the self-esteem score over time selfesteem_long <- reshape(selfesteem, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", direction = "long") summary(aov(score ~ factor(time) + Error(factor(id)/factor(time)), data = selfesteem_long))
Data are the self esteem score of 12 individuals enrolled in 2 successive short-term trials (4 weeks) - control (placebo) and special diet trials.
The self esteem score was recorded at three time points: at the beginning (t1), midway (t2) and at the end (t3) of the trials.
The same 12 participants are enrolled in the two different trials with enough time between trials.
Two-way repeated measures ANOVA can be performed in order to determine whether there is interaction between time and treatment on the self esteem score.
For a worked tutorial on this analysis, see the Datanovia lesson “Repeated Measures ANOVA in R: Compare Means Across Time” (https://www.datanovia.com/learn/biostatistics/anova/repeated-measures-anova-in-r).
data("selfesteem2")data("selfesteem2")
A data frame with 24 rows and 5 columns (stored as a tibble).
participant identifier (1 to 12); each participant takes part in both trials.
the trial, "ctr" (control/placebo) or "Diet".
the self esteem score at the beginning of the trial.
the self esteem score midway through the trial.
the self esteem score at the end of the trial.
The self esteem score is a simulated measure on an arbitrary scale with no real-world units.
A simulated dataset created for teaching two-way repeated measures ANOVA.
selfesteem, the one-way companion data set.
Datanovia tutorial:
Repeated Measures ANOVA in R: Compare Means Across Time.
data(selfesteem2) head(selfesteem2) # Two-way repeated measures ANOVA (treatment x time), both within-subjects selfesteem2_long <- reshape(selfesteem2, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", idvar = c("id", "treatment"), direction = "long") summary(aov(score ~ treatment * factor(time) + Error(factor(id)/(treatment * factor(time))), data = selfesteem2_long))data(selfesteem2) head(selfesteem2) # Two-way repeated measures ANOVA (treatment x time), both within-subjects selfesteem2_long <- reshape(selfesteem2, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", idvar = c("id", "treatment"), direction = "long") summary(aov(score ~ treatment * factor(time) + Error(factor(id)/(treatment * factor(time))), data = selfesteem2_long))
Researchers want to evaluate the effect of a new "treatment" and "exercise" on the stress score reduction after adjusting for "age".
Two-way ANCOVA can be performed in order to determine whether there is interaction between exercise and treatment on the stress score.
It is the data set used in the Datanovia tutorial “ANCOVA in R: Compare Group Means Adjusted for a Covariate” (https://www.datanovia.com/learn/biostatistics/anova/ancova-in-r).
data("stress")data("stress")
A data frame with 60 rows and 5 columns (stored as a tibble).
participant identifier (1 to 60).
the stress score; a simulated measure on an arbitrary scale with no real-world units.
whether the participant received the treatment, "yes" or "no".
the exercise level, "low", "moderate" or "high".
the participant's age, in years.
A simulated dataset created for teaching two-way ANCOVA.
Datanovia tutorial: ANCOVA in R: Compare Group Means Adjusted for a Covariate.
data(stress) head(stress) # Two-way ANCOVA of the stress score, adjusting for age summary(aov(score ~ age + treatment * exercise, data = stress))data(stress) head(stress) # Two-way ANCOVA of the stress score, adjusting for age summary(aov(score ~ age + treatment * exercise, data = stress))
Repeated measures nominal designs where 73 subjects are asked to perform 3 tasks. The outcome of each task is a dichotomous value, success or failure. Each row correspond to a participant (called "block" in the jargon). This a demo dataset for Cochran's Q test.
It is the data set used in the Datanovia tutorial “Cochran's Q Test in R: Compare Three or More Paired Proportions” (https://www.datanovia.com/learn/biostatistics/categorical/cochran-q-test-in-r).
data("taskachievment")data("taskachievment")
A data frame with 73 rows and 4 columns (stored as a tibble).
participant identifier (1 to 73).
the outcome of task 1: 0 (failure) or 1 (success).
the outcome of task 2: 0 (failure) or 1 (success).
the outcome of task 3: 0 (failure) or 1 (success).
A simulated dataset for teaching Cochran's Q test.
Datanovia tutorial: Cochran's Q Test in R: Compare Three or More Paired Proportions.
data(taskachievment) head(taskachievment) # Proportion of success for each task colMeans(taskachievment[, c("Task1", "Task2", "Task3")])data(taskachievment) head(taskachievment) # Proportion of success for each task colMeans(taskachievment[, c("Task1", "Task2", "Task3")])
Survival of passengers on the Titanic. This data set provides information on the fate of passengers on the fatal maiden voyage of the ocean liner "Titanic". Columns are economic status (Class), Sex, Age and Survived.
It is the data set used in the Datanovia tutorial “Descriptive Statistics for Categorical Data in R: Contingency Tables” (https://www.datanovia.com/learn/biostatistics/categorical/categorical-descriptive-statistics-in-r).
data("titanic.raw")data("titanic.raw")
A data frame with 2201 rows and 4 columns.
the passenger's economic status, "1st", "2nd", "3rd" or "Crew".
the passenger's sex, "Male" or "Female".
the age category, "Child" or "Adult".
whether the passenger survived, "No" or "Yes".
Derived from the Titanic data set in base R, expanded to one
row per passenger.
Datanovia tutorial: Descriptive Statistics for Categorical Data in R: Contingency Tables.
data(titanic.raw) with(titanic.raw, table(Class, Survived))data(titanic.raw) with(titanic.raw, table(Class, Survived))
A researcher wanted to assess the effects of Diet and Exercises on weight loss in 12 sedentary males.
The participants were enrolled in four trials: (1) no diet and no exercises; (2) diet only; (3) exercises only; and (4) diet and exercises combined.
Each participant performed all four trials. The order of the trials was counterbalanced and sufficient time was allowed between trials to allow any effects of previous trials to have dissipated (i.e., a "wash out" period).
Each trial lasted nine weeks and the weight loss score was measured at the beginning of each trial (t1), at the midpoint of each trial (t2) and at the end of each trial (t3).
Three-way repeated measures ANOVA can be performed in order to determine whether there is interaction between diet, exercises and time on the weight loss score.
For a worked tutorial on this analysis, see the Datanovia lesson “Repeated Measures ANOVA in R: Compare Means Across Time” (https://www.datanovia.com/learn/biostatistics/anova/repeated-measures-anova-in-r).
data("weightloss")data("weightloss")
A data frame with 48 rows and 6 columns (stored as a tibble).
participant identifier (1 to 12); each participant performs all four diet/exercises trials.
whether the trial included a diet, "no" or "yes".
whether the trial included exercises, "no" or "yes".
the weight loss score at the beginning of the trial.
the weight loss score at the midpoint of the trial.
the weight loss score at the end of the trial.
The weight loss score is a simulated measure on an arbitrary scale with no real-world units.
A simulated dataset created for teaching three-way repeated measures ANOVA.
Datanovia tutorial: Repeated Measures ANOVA in R: Compare Means Across Time.
data(weightloss) head(weightloss) # Three-way repeated measures ANOVA (diet x exercises x time), all within weightloss_long <- reshape(weightloss, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", idvar = c("id", "diet", "exercises"), direction = "long") summary(aov(score ~ diet * exercises * factor(time) + Error(factor(id)/(diet * exercises * factor(time))), data = weightloss_long))data(weightloss) head(weightloss) # Three-way repeated measures ANOVA (diet x exercises x time), all within weightloss_long <- reshape(weightloss, varying = c("t1", "t2", "t3"), v.names = "score", timevar = "time", idvar = c("id", "diet", "exercises"), direction = "long") summary(aov(score ~ diet * exercises * factor(time) + Error(factor(id)/(diet * exercises * factor(time))), data = weightloss_long))