26 lines
411 B
R
26 lines
411 B
R
#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='')
|
|
hist(bootstrappedData,prob=T,main='')
|
|
|
|
|
|
|
|
|
|
|