0% found this document useful (0 votes)
5 views4 pages

Statistical Tests in R: Examples and Analysis

The document demonstrates various statistical tests including the Pearson's correlation test, Wilcoxon sign rank test, Mann-Whitney U test, Kruskal-Wallis test, and chi-square test through examples using sample data. Datasets are created and subsets are applied. Assumptions of the tests are checked using Shapiro-Wilk normality test. Statistical tests are performed and results analyzed.

Uploaded by

Philip
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Statistical Tests in R: Examples and Analysis

The document demonstrates various statistical tests including the Pearson's correlation test, Wilcoxon sign rank test, Mann-Whitney U test, Kruskal-Wallis test, and chi-square test through examples using sample data. Datasets are created and subsets are applied. Assumptions of the tests are checked using Shapiro-Wilk normality test. Statistical tests are performed and results analyzed.

Uploaded by

Philip
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

## Pearson's example 1

#Normality test

number_of_person<-c(5,6,14,19,15,11,18,22,26)

coffee_sold<- c(10,20,30,40,30,20,40,40,50)

[Link](number_of_person)

[Link](coffee_sold)

#Statisticial Test

[Link](number_of_person,coffee_sold,method = "pearson",[Link] = 0.95)

## Wilcoxon Sign rank test


#Example 1

weight1 <-c(198,237,233,179,219,169,222,167,199,233,179,158,157,216,355,151)

weight2 <-c(196,233,231,181,217,166,219,167,200,229,181,153,151,213,255,146)

differrence <-weight1-weight2

[Link](differrence)

#statistical test

weight1 <-c(198,237,233,179,219,169,222,167,199,233,179,158,157,216,355,151)

weight2 <-c(196,233,231,181,217,166,219,167,200,229,181,153,151,213,255,146)

[Link](weight1,weight2, paired =TRUE, alternative = "[Link]",

exact = FALSE)
## Mann-Witney U test
#Example 1

results<-c(105,119,100,97,96,101,94,95,98,96,99,94,89,96,93,88,105,88)

RER <-c(replicate(9,"placebo"),replicate(9,"caffeine"))

#create a data frame

data_frame<-[Link](results,RER)

data_frame

#apply subset, to get the data "visual" and "textual" from dataframe

Placebo<-subset(data_frame,RER=="placebo")

Caffeine<-subset(data_frame,RER=="caffeine")

## Shapiro wilk Test

[Link](Placebo$results)

[Link](Caffeine$results)

## statistical test

[Link](results~RER, data = data_frame, mu=0,

alternative ="less", [Link] = 0.95, exact = FALSE)


##KRUSKAL WALLIS TEST

gains<-c(63,-261,-153,-13,965,0,-652,4724,-2,0,-86,2239,171,40,1395)

group <-c(replicate(5,"group1"),replicate(6,"group2"), replicate(4,"group3"))

#create a data frame

data_frame<-[Link](gains,group)

data_frame

#apply subset, to get the data "visual" and "textual" from dataframe

group1<-subset(data_frame,group=="group1")

group2<-subset(data_frame,group=="group2")

group3<-subset(data_frame,group=="group3")

# Shapiro wilk Test

[Link](group1$gains)

[Link](group2$gains)

[Link](group3$gains)

#Statistical Test

[Link](gains~group, data = data_frame)


#CHI-SQUARE TEST

table(School_Dataset$Gender,School_Dataset$`Drop Reason`)

table(School_Dataset$`Drop Reason`,School_Dataset$Gender)

[Link](School_Dataset$`Drop Reason`,School_Dataset$Gender)

You might also like