r - 为 cuzick 测试安装的软件包
问题描述
我应该为 cuzick 测试安装哪个软件包?我已经尝试过 PMCMRplus 和 install_github("raredd/rawr") 但我仍然找不到任何用于 cuzick 测试的包
解决方案
cuzick = function(x,z,test.type=c("two.sided", "upper", "lower")) {
test.type <- match.arg(test.type)
N = length(z)
n = unique(z)
ranks=rank(x)
T = sum(ranks*z)
p = (table(z)/N)
E_Z = sum(unique(z)*p)
E_T = 0.5*N*(N+1)*E_Z
Var_Z = sum(unique(z)^2*p) - E_Z^2
Var_T = N^2*(N+1)/12*Var_Z
Zscore = (T-E_T)/sqrt(Var_T)
if(test.type == "two.sided") {
pval = 2*pnorm(-abs(Zscore))
} else if(test.type == "upper") {
pval = pnorm(Zscore,lower.tail=F)
} else pval = pnorm(Zscore,lower.tail=T)
out = data.frame(Zscore,pval,test.type)
colnames(out) = c("Z","p","testType")
return(out)
}
推荐阅读
- mysql - 使用 python 代码重命名 phpmyadmin 数据库名称
- python - 从没有字符串格式的sqlite中检索文本以进行比较
- jquery - jquery - 在点击事件回调中获取 $(this) 选中单选选项的值
- angular - 为什么我不能从我的 Gorilla WebSocket 服务器读取消息,直到它被客户端关闭?
- java - 如何在基于操作系统的 java 中获取获取周期的结果?我是java的新手我正在寻找一些建议
- json - 我正在尝试在应用程序网页上滚动,但似乎无法正常工作
- exception - DNN API 控制器 - 任务已取消日志
- html - 未捕获的 ReferenceError:未定义 Swiper
- node.js - TypeError:无效的架构配置:`model` 不是数组`category` 中的有效类型
- ubuntu - 我试图为我的虚拟机添加额外的空间。我从 250GB 增加到 +750GB,但无法将其添加到 lvm