From 68c8eb5e04b46bc31b13c249c60c3c3f65d793f2 Mon Sep 17 00:00:00 2001 From: Jakub Adamski Date: Tue, 10 May 2022 17:26:35 +0200 Subject: [PATCH] code cleanup --- Projekt_1/Bootstrapping.R | 11 ++++++----- Projekt_1/T-student-multiple-paired.R | 4 +--- Projekt_1/T-student-single.R | 2 -- Projekt_1/T-studnet-multiple.R | 2 -- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Projekt_1/Bootstrapping.R b/Projekt_1/Bootstrapping.R index 1f7983f..ebdd0aa 100644 --- a/Projekt_1/Bootstrapping.R +++ b/Projekt_1/Bootstrapping.R @@ -16,10 +16,11 @@ ourBoot <- function(data, outSize, sampleSize) { bootstrappedData <- ourBoot(Wynik, 200, 50) par(mfrow=c(1,2)) -hist(Wynik,prob=T,main='') -hist(bootstrappedData,prob=T,main='') - - - +hist(Wynik,prob=T,main='normal') +hist(bootstrappedData,prob=T,main='bootstrapped') + +par(mfrow=c(1,2)) +boxplot(Wynik,prob=T,main='normal') +boxplot(bootstrappedData,prob=T,main='bootstrapped') diff --git a/Projekt_1/T-student-multiple-paired.R b/Projekt_1/T-student-multiple-paired.R index fa1d844..faea955 100644 --- a/Projekt_1/T-student-multiple-paired.R +++ b/Projekt_1/T-student-multiple-paired.R @@ -17,7 +17,7 @@ t.test_multiple_paried <- function(x, m0=0, alternative = "two.sided") { pt(q=statistic, df=length(x)-1, lower.tail = FALSE) } - value <- list(mean = M, m0 = m0, statistic = statistic, p.value = p, alternative = alternative) + value <- list(mean = M, m0 = m0, df=length(x)-1, statistic = statistic, p.value = p, alternative = alternative) return(value) } @@ -30,14 +30,12 @@ mean(Po-Przed) #t.test(Po-Przed,mu=0,alternative='less') size <- length(Cisnienie) -#jest git #dane zwykłe # funkcja wbudowana t.test(Cisnienie$Po-Cisnienie$Przed,mu=0,alternative='less') #nasza funkcja t.test_multiple_paried(Cisnienie$Po-Cisnienie$Przed,m0=0,alternative='less') -# jest różnica w p-wartości!!! #dane zbootstrpowane bootstrappedData_Cisnienie <- ourBoot(Cisnienie$Po-Cisnienie$Przed, 200, size) # funkcja wbudowana diff --git a/Projekt_1/T-student-single.R b/Projekt_1/T-student-single.R index d999b3a..5afcf65 100644 --- a/Projekt_1/T-student-single.R +++ b/Projekt_1/T-student-single.R @@ -22,14 +22,12 @@ size_Hamulce <- length(Hamulce$Wynik) bootstrappedData_Wynik <- ourBoot(Hamulce$Wynik, 200, size_Hamulce) -# p-wartość jest inna # funkcja wbudowana t.test(bootstrappedData_Wynik,mu=18.6,alternative='less') # nasza funkcja t.test_single(bootstrappedData_Wynik, m=18.6, alternative='less') -#jest git # funkcja wbudowana t.test(Wynik,mu=18.6,alternative='less') # nasza funkcja diff --git a/Projekt_1/T-studnet-multiple.R b/Projekt_1/T-studnet-multiple.R index bc5e5e0..4c72095 100644 --- a/Projekt_1/T-studnet-multiple.R +++ b/Projekt_1/T-studnet-multiple.R @@ -1,5 +1,3 @@ - -#jest git t.test_multiple <- function(x, y, m0=0, alternative = "two.sided") { M1 <- mean(x) M2 <- mean(y)