2022-04-27 12:37:59 +02:00
|
|
|
#Bootstrap
|
|
|
|
|
|
|
|
load("Hamulce.RData")
|
|
|
|
attach(Hamulce)
|
|
|
|
|
|
|
|
|
|
|
|
ourBoot <- function(data, outSize, sampleSize) {
|
|
|
|
output <- c()
|
|
|
|
for (i in 1:outSize) {
|
|
|
|
sampleElements <- sample(data, sampleSize, replace=TRUE)
|
|
|
|
output <- append(output, mean(sampleElements))
|
|
|
|
}
|
|
|
|
return(output)
|
|
|
|
}
|
|
|
|
|
|
|
|
bootstrappedData <- ourBoot(Wynik, 200, 50)
|
|
|
|
|
|
|
|
par(mfrow=c(1,2))
|
|
|
|
hist(Wynik,prob=T,main='')
|
2022-05-08 23:55:40 +02:00
|
|
|
hist(bootstrappedData,prob=T,main='')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|