首页 > 其他分享 >bootstrapping

bootstrapping

时间:2024-05-30 09:23:48浏览次数:19  
标签:置信区间 bootstrapping 代码 这部分 估计 随机抽样

在这段R Markdown代码中,代表bootstrapping思想的代码片段是以下几段:

  1. 这部分代码使用bootstrapping方法来估计活性(Active)和抑制(Repressed)状态下ave列的中位数:
active_med <- c()
repress_med <- c()
for (rep in 1:100) {
  active_sample <- sample(active_rep$ave, size = length(active_rep), replace = T)
  repress_sample <- sample(repress_rep$ave,size = length(repress_rep),replace = T)
  active_med <- c(c(active_med),median(active_sample))
  repress_med <- c(c(repress_med),median(repress_sample))
}
  1. 这部分代码通过多次随机抽样来估计result1的数量的分布,并计算其均值和标准差:
num_count <- c()
for (rep in 1:1000) {
  sample_num <- sample(result,276,replace = T)
  num_count <- c(length(sample_num[sample_num==1]),c(num_count))
}
  1. 这部分代码使用一个双层循环来为movie数据集中的每个电影计算95%置信区间的上下界,这也是bootstrapping方法的应用:
min_list <- c()
max_list <- c()
for (i in 1:length(movie$students)){
  size0 <- 267 - movie$students[i]
  size1 <- movie$students[i]
  sample0 <- rep(0, size0)
  sample1 <- rep(1, size1)
  result <- c(sample0, sample1)
  num_count <- c()
  for (rep in 1:1000) {
    sample_num <- sample(result,276,replace = T)
    num_count <- c(length(sample_num[sample_num==1]),c(num_count))
  }
  quan <- quantile(num_count,probs = c(0.025,0.975))
  result <- as.matrix(quan)
  min_list <- c(c(min_list),result[1])
  max_list <- c(c(max_list),result[2])
}

Bootstrapping是一种统计方法,它通过从数据集中进行多次随机抽样(有放回),来估计统计量的分布。在上述代码中,这种方法被用来估计中位数、数量的分布以及构建置信区间。

标签:置信区间,bootstrapping,代码,这部分,估计,随机抽样
From: https://www.cnblogs.com/chen-heybro/p/18221610

相关文章

  • ANNOVA test (one-way test and two-way test and bootstrapping)
    对于ANNOVA的理解什么情况下可以使用annova:Morethan2populations对于多种不同药物对于某种疾病的效果的研究;比较不同国家指标的研究Morethan1predictivevariable(factor)锻炼和饮食对于健康的影响;effectofgeneticbackgroundanddrugsonstresslevels如果是......
  • offline RL | Pessimistic Bootstrapping (PBRL):在 Q 更新中惩罚 uncertainty,拉低 OOD
    论文题目:PessimisticBootstrappingforUncertainty-DrivenOfflineReinforcementLearning,ICLR2022,6688spotlight。pdf版本:https://arxiv.org/abs/2202.11566html版本:https://ar5iv.labs.arxiv.org/html/2202.11566openreview:https://openreview.net/forum?id=Y4c......
  • 什么是全同态加密(FHE)中的自举(Bootstrapping)?
    PrimiHub一款由密码学专家团队打造的开源隐私计算平台,专注于分享数据安全、密码学、联邦学习、同态加密等隐私计算领域的技术和内容。全同态加密(FullyHomomorphicEncryption,FHE)中经常提到的一个术语是“自举”(Bootstrapping)。任何读过FHE初级材料的人都知道,自举是FHE方案中最......
  • TLS Bootstrapping原理
    1.1 Kubelet启动过程TLSBootStrapping官方文档:https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet-tls-bootstrapping/#initialization-p......
  • MIT6.828 Lab 1: C, Assembly, Tools, and Bootstrapping
    前置准备实现机器为VMWare的虚拟机,操作系统为Debian-11(无桌面版本),内核版本为5.10.0,指令集为AMD64(i79700K),编译器为GCC-10QEMU虚拟化支持理论上只需要qemu提......