Articles

Affichage des articles du novembre, 2021

Example of bootstrap to estimate se of a set of data... just for fun

Image
N <- 1000 A <- rnorm(N) sd(A)/sqrt(N) # Vraie valeur:  1/sqrt(N) t <- NULL for (rep in rep(c(100, 200, 300, 400, 500, 1000), 10)) {   print(rep)   s <- NULL   for (i in 1:10000) {     tirage <- sample(A, size=rep, replace = TRUE)     s <- c(s, mean(tirage))   }      t <- c(t, sd(s)) } dta <- data.frame(group=rep(c(100, 200, 300, 400, 500, 1000), 10),                    mean=t) boxplot(mean ~ group, data=dta, las=1, ylab="SE", xlab="Number of bootstraps", ylim=c(0, 0.15)) segments(x0=1, x1=7, y0=1/sqrt(N), y1=1/sqrt(N), col="red", lty=3, lwd=2) In red, the true SE. The SE estimation by bootstrap is upper biased.

Get versions of R, Rstudio, shiny or packages

  The version of Rstudio can be obtained using: RStudio.Version() The running version of R is obtained by: R.version In terminal, the installed R version is obtained by: √ ~ % R --version  R version 4.3.2 (2023-10-31) -- "Eye Holes" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under the terms of the GNU General Public License versions 2 or 3. For more information about these matters see https://www.gnu.org/licenses/. To get a package version: packageVersion(_Package name_) Other information can be found here: .libPaths() sessionInfo() For Shiny: Whitin R: system('shiny-server --version', intern = TRUE) In terminal: shiny-server --version