Search
 
SCRIPT & CODE EXAMPLE
 

R

how to bootstrap in r

# Import libaries
library(boot)

# Create sample dataframe
set.seed(1)
x <- rnorm(1000, sd=10)
y <- rnorm(1000, sd=1)
df <- data.frame(x,y)

# Create function to pass to boot()
calc_mean = function(data, index){
  mean_x <- mean(df$x[index]) 
  return(mean_x)
}

boot(df$x, calc_mean, R=1000)
Comment

how to bootstrap in r

library(boot)

boot_returns <- function(data, indices){
  d <- data[indices]
  Return.calculate(d, method="log")
}

bret <- boot(end_eq, boot_returns, R=1000)

dim(bret$t)
bretMeans <- colMeans(bret$t, na.rm = TRUE)
Comment

PREVIOUS NEXT
Code Example
R :: r tibble select rows containing string 
R :: r select rows 
R :: read xlsx in r 
R :: if in r 
R :: how to make the minutes zero in r 
R :: r ggplot hide one legend group from multiple legends 
R :: R check object dimensions 
R :: rstudio 
R :: r change column value conditionally 
R :: eleminating a char in of a list in r 
R :: R change column to row names 
R :: Edit axis labels R 
R :: geom_jitter transparency 
R :: save link tweet in new column in R 
R :: timestamp conversion from excel R 
R :: print in r 
Rust :: rust get command line arguments 
Rust :: convert string to i32 rust 
Rust :: linking with `link.exe` failed: exit code: 1189 
Rust :: rust string to f64 
Rust :: enum rust 
Rust :: pause rust 
Rust :: armanriazi•rust•static•vs•cons 
Rust :: armanriazi•rust•error•[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable 
Rust :: rust iterate over split 
Rust :: minimum and maximum numbers for various integer types 
Rust :: armanriazi•rust•error•E0277•the trait bound `` is not satisfied 
Lua :: wait function lua 
Lua :: if part is touched 
Lua :: lua array is empty 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =