Title: | Visualise the Results of Inferential Statistics using 'ggplot2' |
---|---|
Description: | Visualise the results of F test to compare two variances, Student's t-test, test of equal or given proportions, Pearson's chi-squared test for count data and test for association/correlation between paired samples. |
Authors: | Charalampos Bratsas [aut], Anastasia Foudouli [aut], Kleanthis Koupidis [aut, cre] |
Maintainer: | Kleanthis Koupidis <[email protected]> |
License: | GPL-2 | file LICENSE |
Version: | 0.1.3 |
Built: | 2025-02-01 02:56:10 UTC |
Source: | https://github.com/okgreece/gginference |
A data frame showing the use of seat belt and the driver status after a car accident in Greece.
accidentsData
accidentsData
A data frame with 383 observations of 2 columns:
record
factor representing the driver status
seatBelt
factor indicating whether the driver wore a seatbelt
The original data are available at Hellenic Statistical Authority
A data frame containing the number of births and deaths along with their rates from 1932 to 2016.
BirthDeath
BirthDeath
A data frame with 71 observations of 5 columns:
Year
years 1932-2016
Deaths
number of deaths
DeathsRate
number of deaths per 1000 citizen
Births
number of births
BirthRate
number of births per 1000 citizen
The original data are available at Hellenic Statistical Authority
A data frame containing samples with the number of births and deaths before and after 2000.
BirthDeath2000
BirthDeath2000
A data frame with 30 observations of 3 columns:
deaths
number of deaths
births
number of births
type
factor indicating if the number of births and deaths correspond before 2000 or after 2000
The original data are available at Hellenic Statistical Authority
A data frame giving the number of births per 1000 people in Greece from 1976 to 1989.
births
births
A data frame with 14 observations of 2 columns:
year
years from 1976 to 1989
rate
number of births per 1000 people
The original data are available at Hellenic Statistical Authority
A data frame including a sample of bio diesel and RON 95 consumption in Greece.
DieselbioRon95
DieselbioRon95
A data frame with 24 observations of 5 columns:
region
factor of Greek regions
DieselBio_consumption2006
metric tons of bio-diesel consumption in 2006
DieselBio_consumption2016
metric tons of bio-diesel consumption in 2016
RON95_consumption2006
metric tons of ron 95 consumption in 2006
RON95_consumption2016
metric tons of ron 95 consumption in 2016
The original data are available at Hellenic Statistical Authority
A data frame containing the fuel consumption in Greece.
FuelConsumption
FuelConsumption
A data frame with 50 observations of 8 columns:
Geographic.area
factor with geographic area of Greece
Regions
factor with regions of Greece
Runits
factor with regional units of Greece
RON95
metric tons of ron 95 consumption
RON98_100
metric tons of ron 98 consumption
DieselBio
metric tons of bio diesel consumption
LPG
metric tons of liquefied petroleum gas consumption
DieselC
metric tons of heating oil consumption
The original data are available at Hellenic Statistical Authority
Visualise anova F-test to determine whether group means are equal
ggaov(t, alpha=0.05, colaccept="lightsteelblue1", colreject="grey84", colstat="navyblue")
ggaov(t, alpha=0.05, colaccept="lightsteelblue1", colreject="grey84", colstat="navyblue")
t |
an object of class aov |
alpha |
alpha level for finding critical F value |
colaccept |
color for the acceptance region of the test |
colreject |
color for the area of rejection of the test |
colstat |
color of the statistic of the test line |
# 21-th day chick21 <- ChickWeight[ChickWeight$Time == 21, ] chickaov <- aov(weight ~ Diet, data = chick21) summary(chickaov) ggaov(chickaov, colaccept = "grey89", colreject = "black")
# 21-th day chick21 <- ChickWeight[ChickWeight$Time == 21, ] chickaov <- aov(weight ~ Diet, data = chick21) summary(chickaov) ggaov(chickaov, colaccept = "grey89", colreject = "black")
Visualise chi-squared contingency table tests and goodness-of-fit tests.
ggchisqtest(t, colaccept="lightsteelblue1", colreject="gray84", colstat="navyblue", alpha=0.05)
ggchisqtest(t, colaccept="lightsteelblue1", colreject="gray84", colstat="navyblue", alpha=0.05)
t |
a list result of |
colaccept |
color the acceptance area of the test |
colreject |
color for the rejection area of the test |
colstat |
color for the test statistic vline |
alpha |
default set to 0.05, choose confidence level for the plot as it is not stated in chisqtest |
## Chi-squared test for given probabilities x <- c(A = 20, B = 15, C = 25) chisq_test <- chisq.test(x) chisq_test ggchisqtest(chisq_test) x <- c(10, 86, 45, 38, 10) p <- c(0.10, 0.40, 0.20, 0.20, 0.10) chisq_test2 <- chisq.test(x, p = p) chisq_test2 ggchisqtest(chisq_test2) ## Pearson's Chi-squared test library(MASS) sex_smoke <- table(survey$Sex, survey$Smoke) chisq_test3 <- chisq.test(sex_smoke) chisq_test3 ggchisqtest(chisq_test3)
## Chi-squared test for given probabilities x <- c(A = 20, B = 15, C = 25) chisq_test <- chisq.test(x) chisq_test ggchisqtest(chisq_test) x <- c(10, 86, 45, 38, 10) p <- c(0.10, 0.40, 0.20, 0.20, 0.10) chisq_test2 <- chisq.test(x, p = p) chisq_test2 ggchisqtest(chisq_test2) ## Pearson's Chi-squared test library(MASS) sex_smoke <- table(survey$Sex, survey$Smoke) chisq_test3 <- chisq.test(sex_smoke) chisq_test3 ggchisqtest(chisq_test3)
Visualise test for association between paired samples, using Pearson's product moment correlation coefficient.
ggcortest(t, colaccept="lightskyblue1", colreject="grey94", colstat="navy")
ggcortest(t, colaccept="lightskyblue1", colreject="grey94", colstat="navy")
t |
a list result of |
colaccept |
color the acceptance area of the test |
colreject |
color for the rejection area of the test |
colstat |
color for the test statistic vline |
corr_test <- cor.test(iris$Sepal.Length, iris$Sepal.Width) corr_test ggcortest(corr_test)
corr_test <- cor.test(iris$Sepal.Length, iris$Sepal.Width) corr_test ggcortest(corr_test)
Visualise prop.test
for testing the null that the proportions
(probabilities of success) in several groups are the same, or that they
equal certain given values.
ggproptest(t, alpha=0.05,colaccept="lightsteelblue1", colreject="gray84", colstat="navyblue")
ggproptest(t, alpha=0.05,colaccept="lightsteelblue1", colreject="gray84", colstat="navyblue")
t |
a list result of |
alpha |
alpha level for ploting distribution, when prop.test is used on more than 2 samples |
colaccept |
color the acceptance area of the test |
colreject |
color for the rejection area of the test |
colstat |
color for the test statistic vline |
x <- c(5, 8, 12) y <- c(8, 9, 13) pr_test <- prop.test(x, y) pr_test ggproptest(pr_test)
x <- c(5, 8, 12) y <- c(8, 9, 13) pr_test <- prop.test(x, y) pr_test ggproptest(pr_test)
Visualise one and/or two sample t-tests on vectors of data.
ggttest(t, colaccept="lightsteelblue1", colreject="grey84", colstat="navyblue")
ggttest(t, colaccept="lightsteelblue1", colreject="grey84", colstat="navyblue")
t |
a list result of |
colaccept |
color the acceptance area of the test |
colreject |
color for the rejection area of the test |
colstat |
color for the test statistic vline |
t_test <- t.test(sleep$extra ~ sleep$group) t_test ggttest(t_test) t_test2 <- t.test(x = 1:10, y = c(7:20)) t_test2 ggttest(t_test2)
t_test <- t.test(sleep$extra ~ sleep$group) t_test ggttest(t_test) t_test2 <- t.test(x = 1:10, y = c(7:20)) t_test2 ggttest(t_test2)
Visualise F test to compare two variances
ggvartest(t, colaccept = "lightsteelblue1", colreject = "gray84", colstat = "navyblue")
ggvartest(t, colaccept = "lightsteelblue1", colreject = "gray84", colstat = "navyblue")
t |
a list result of |
colaccept |
color the acceptance area of the test, see
|
colreject |
color for the rejection area of the test |
colstat |
color for the test statistic vline |
x <- rnorm(50, mean = 0, sd = 2) y <- rnorm(30, mean = 1, sd = 1) var_test <- var.test(x, y) var_test ggvartest(var_test)
x <- rnorm(50, mean = 0, sd = 2) y <- rnorm(30, mean = 1, sd = 1) var_test <- var.test(x, y) var_test ggvartest(var_test)
A data frame that contains sample ratings of 18 laptops, by three experts.
LaptopRates
LaptopRates
A data frame with 54 observations of 3 columns:
laptop
laptop id, 1-18
expert
a character of expert1,expert2,expert3 values
rating
ratings-5 likert scale, 5 indicates a very good rate
A data frame containing a sample with the results of neuropsychological assessment before and after serious game intervention in the living lab, Thess-AHALL (Thessaloniki Active and Healthy Aging Living Lab) of Medical Physics Laboratory of Aristotle University of Thessaloniki.
LivLab
LivLab
A data frame with 10 observations of 2 columns:
before
score in a neuropsychological test before serious game intervention
after
score in a neuropsychological test after serious game intervention
<http://aha-livinglabs.com/>
A data frame with the volume of new stores by category for urban, suburban and rural areas.
m_anova
m_anova
A data frame with 54 observations of 4 columns:
Categories
integer representing three categories
UrbanAreas
coding for urban, suburban and rural areas
Month
integer representing three months
Volume
volume in cubic meters
The original data are available at Hellenic Statistical Authority
A data frame containing a sample of the number of cow, sheep and goat milk bottles sold.
MilkConsumption
MilkConsumption
A data frame with 13 observations of 3 columns:
Cow.Milk
number of cow milk bottles
Sheep.Milk
number of sheep milk bottles
Goat.Milk
number of goat milk bottles
The original data are available at Hellenic Statistical Authority
A data frame with the profits of some companies for 5 months, constructed for teaching purposes.
profits_df
profits_df
A data frame with 26 companies (rows) of 5 months (columns).
A data frame containing a sample with the answers of students.
questionnaire
questionnaire
A data frame with 50 observations of 8 columns:
gender
A factor with the student gender
writing.hand
A factor with the writing hand of the students (left, right)
fold.arm
A factor with the top hand when the students fold their arms
pulse
Integer with the pulse rate of students (beats per minute)
exercise
A factor with the frequency the students exercises (none, some,frequently)
smoke
A factor with the frequency the students smokes (heavy, regularly, occasionally, never)
height
Integer with the height of the students (in centimeters)
age
Integer with the age of the students
A data frame with 128 sample results of a repeated experiment. Success is noted with 1 and failure with 0.
randexperiment
randexperiment
A data frame with 128 observations of 1 column.
A sample data frame with female and male salaries of a company.
Salary_Gender
Salary_Gender
A data frame with 100 observations of 2 columns:
Male_sal
male salaries
Female_sal
female salaries