Skip to content

Instantly share code, notes, and snippets.

@hanowell
Last active June 9, 2023 21:27
Show Gist options
  • Save hanowell/de4e20603a8c2c4b184710b872c88b23 to your computer and use it in GitHub Desktop.
Save hanowell/de4e20603a8c2c4b184710b872c88b23 to your computer and use it in GitHub Desktop.
sample_list <- list(rnorm(1000, 0, 1))
mean_vec <- c(mean(sample_list[[1]]))
sd_vec <- c(sd(sample_list[[1]]))
chains <- tibble::tibble(chain = rep,
mean_value = NA,
sd_value = NA)
for (i in 2:100000) {
sample_list[[i]] <- rnorm(1000, mean_vec[i - 1], sd_vec[i - 1])
mean_vec[i] <- mean(sample_list[[i]])
sd_vec[i] <- sd(sample_list[[i]])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment