cox-stuart实现方法

 时间:2026-02-16 05:13:15

1、R语言代码

# 处理成为符号数据

  cox_test <- function(dat = customers) {

    n <- length(dat)

    c <- (n - 1)/2

    d <- rep(0, c)

    if (c %% 2 == 0) {                        # dat长度为偶数

      for (i in 1:c) {d[i] <- dat[c + i] - dat[i]}

    } else {                                  # dat长度为奇数时要去掉中间数

      dat <- dat[-(c + 1)]

      for (i in 1:c) {d[i] <- dat[c + i] - dat[i]}

    }

    d <- d[d != 0]

    binom.test(sum(d > 0), length(d), alt = 'less')

  }

  customers <- c(5, 9, 12, 18, 17, 16, 19, 20, 4, 3, 18, 16, 17, 15)

  cox_test(dat = customers)

  

  • 画风唯美的游戏推荐
  • 2016wps中怎样插入免费在线图片?
  • 上飞机前饮食注意事项
  • 随机组卷功能有哪些用途?
  • 中国移动app如何关闭新消息数字提醒
  • 热门搜索
    初一历史手抄报 绿色手抄报内容 法制伴我行手抄报 有关诚信的手抄报 有关科学的手抄报 关于普法的手抄报 清明节手抄报设计图 四年级上册手抄报 少先队员手抄报图片 手抄报版面设计图花