Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 要安装用于cuzick测试的软件包_R_Install.packages - Fatal编程技术网

R 要安装用于cuzick测试的软件包

R 要安装用于cuzick测试的软件包,r,install.packages,R,Install.packages,我应该为cuzick测试安装哪个软件包?我已经尝试了PMCMRplus,并安装了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)

我应该为cuzick测试安装哪个软件包?我已经尝试了PMCMRplus,并安装了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)
}

test.type请解释您的代码。仅代码的答案并不完全有用!