Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Bootstrap Method
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
set.seed(5610) x <- rnorm(300,10,15) bootstrap <- function(B,data){ sam = B dat = data n = length(data) mean.vector = c() for( i in 1:sam){ a = sample(dat,n,replace = T) mean.vector[i] = mean(a) } hist(mean.vector,col = 'lightblue',freq = F,border = 'white') abline(v = mean(mean.vector), col = 'red3', lty = 2, lwd = 2) cat("\n The average estimate is: ", mean(mean.vector)) cat("\n Standard error: ", sqrt(var(mean.vector))) } mean(x) bootstrap(1000,x)
[
+
]
Show input
Absolute running time: 0.61 sec, cpu time: 0.86 sec, memory peak: 34 Mb, absolute service time: 0,62 sec
edit mode
|
history
|
discussion
[1] 10.16553 The average estimate is: 10.1266 Standard error: 0.8475056