Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Visualise the Results of Inferential Statistics using 'ggplot2'

License

NotificationsYou must be signed in to change notification settings

okgreece/gginference

Repository files navigation

R-CMD-checkCRAN_Status_BadgeProject Status: Active – The project has reached a stable, usable state and is being actively developed.LicenceDOI

Overview

Visualise the results of F test to compare two variances, Student’st-test, test of equal or given proportions, Pearson’s chi-squared testfor count data and test for association/correlation between pairedsamples.

Installation

# CRAN installation:install.packages("gginference")# Or the development version from GitHub:# install.packages("devtools")devtools::install_github("okgreece/gginference")

Usage

One sample

One sample t-test with normal population and σ2 unknown

The rejection regions for one sample t-test with normal population andσ2 unknown are calculated usingggttest function. Thefollowing table shows the rejection regions which is calculated withgginference depending the specified parameters int.test.

H0H1Rejection Region ofgginferenceParameters oft.test
μ = μ0μ < μ0R = {z <  − za}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “less”
μ > μ0R = {z > za}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “greater”
μ ≠ μ0R = {|z| > za/2}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “two.sided”

where

One sample t-test with normal population and n < 30 and σ2 unknown

ggttest is also used to calculate rejection region for one samplet-test with normal population and n < 30 and σ2 unknown.

H0H1Rejection Region ofgginferenceParameters oft.test
μ = μ0μ < μ0R = {t <  − tn − 1, a}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “less”
μ > μ0R = {t > tn − 1, a}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “greater”
μ ≠ μ0R = {|t| > tn − 1, a/2}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “two.sided”

where

Two samples

Two independent samples t-test with normal populations and σ12 = σ22 unknown

Next table shows the rejection regions of two independent samples t-testwith normal populations and σ1222.ggttest is also used to visualize thistest.

H0H1Rejection Region ofgginferenceParameters oft.test
μ1 − μ2 = d0μ1 − μ2 < d0R = {t <  − tn1 + n2 − 2, a}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = TRUE,
  • alternative = “less”
μ1 − μ2 > d0R = {t > tn1 + n2 − 2, a}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = TRUE,
  • alternative = “greater”
μ1 − μ2 ≠ d0R = {|t| > tn1 + n2 − 2, a/2}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = TRUE,
  • alternative = “two.sided”

where

Two independent samples t-test with normal populations and σ12 σ22

ggttest is used to visualize two independent samples t-test withnormal populations and σ12 σ22. The followingtable shows the rejection regions of this test.

H0H1Rejection Region ofgginferenceParameters oft.test
μ1 − μ2 = d0μ1 − μ2 < d0R = {t <  − tν, a}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “less”
μ1 − μ2 > d0R = {t > tν, a}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “greater”
μ1 − μ2 ≠ d0R = {|t| > tν, a/2}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “two.sided”

where

and ν degrees of freedom with

Paired samples with normal population

ggttest is used also to visualize the results of the paired sampleStudent’s t-test. Next table shows th rejection region of this test.

H0H1Rejection Region ofgginferenceParameters oft.test
μ1 − μ2 = d0μ1 − μ2 < d0R = {t <  − tn − 1, a}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “less”
μ1 − μ2 > d0R = {t > tn − 1, a}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “greater”
μ1 − μ2 ≠ d0R = {|t| > tn − 1, a/2}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “two.sided”

where

Proportion test

One-proportion z-test

ggproptest() is used to visualize one-proportion z-test. The rejectionregions are shown below.

H0H1Rejection Region ofgginferenceParameters ofprop.test()
p = p0p < p0R = {z <  − za}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “less”
p > p0R = {z > za}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “greater”
p ≠ p0R = {|z| > za/2}
  • x = vector of sample data,
  • mu =μ0,
  • alternative = “two.sided”

where

Two-proportion z-test

The results of two-proportion z-test are visualized usingggproptest()and next table shows the rejection regions.

H0H1Rejection Region ofgginferenceParameters ofprop.test()
p1 − p2 = d0p1 − p2 < d0R = {z <  − za}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “less”
p1 − p2 > d0R = {z > za}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “greater”
p1 − p2 ≠ d0R = {|z| > za/2}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • paired = FALSE,
  • var.equal = FALSE,
  • alternative = “two.sided”

where

Two-sample F test for equality of variances

ggvartest is used to visualize the results of the paired sampleStudent’s t-test. The rejection region that is used in this test isshown below.

H0H1Rejection Region ofgginferenceParameters ofvar.test
σ12 / σ22 = 1σ12 / σ22 < 1R = {F > Fn1 − 1, n2 − 1, 1 − a}
  • x = vector of sample 1 data,
  • y = vector of sample 2 data,
  • ratio = 1
  • alternative = “less”
σ12 / σ22 > 1R = {F > Fn1 − 1, n2 − 1, a}
  • x = vector of sample data,
  • mu =μ0,
  • ratio = 1
  • alternative = “greater”
σ12 / σ22 1R = {F > Fn1 − 1, n2 − 1, a/2}
  • x = vector of sample data,
  • mu =μ0,
  • ratio = 1
  • alternative = “two.sided”

where

Test for Correlation Between Paired Samples

ggcortest is usesd to visualize the results of test for correlationbetween paired samples. The following table shows the rejection regionof this test.

H0H1Rejection Region ofgginferenceParameters ofcor.test
𝜚 = 0𝜚 ≠ 0R = {|t| > tn − 2, a/2}
  • x = vector of sample 1 data
  • y = vector of sample 2 data,
  • alternative = “two.sided”

where

Chi-squared Test of Independence

The results of Pearson’s chi-squared test for count data are visulizedusingggchisqtest. Next table shows the rejection region of this test.

H0H1Rejection Region ofgginferenceParameters ofchisq.test
Two variables are independentTwo variables are not independentR = {X2 > χa/22}
  • x = 2-dimensional contingency table

where

ANOVA F-test

ggaov is used to visualize the results of ANOVA F-test. Table belowshows rejection region of Anova F-stest.

H0H1Rejection Region ofgginferenceParameters ofaov
H0 : μ1 = μ2=... = μkNot all three population means are equalR = {F > Fk − 1, n − k, a}
  • formula = formula specifying the model
  • data = data frame with the variables specified in the formula

where

Getting help

If you encounter a bug, please feel free to open anissue with a minimalreproducible example.

About

Visualise the Results of Inferential Statistics using 'ggplot2'

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp