gpt4 book ai didi

ploting power function of a sign test(标绘符号检验的幂函数)

转载 作者:bug小助手 更新时间:2023-10-24 19:45:58 26 4
gpt4 key购买 nike



I am trying to plot the power function of a sign test. The code I have is already this one:

我在试着画出符号测试的幂函数。我的代码已经是这个了:


library(BSDA)  # for SIGN.test()

M_values <- seq(-1, 1, by = 0.1)
sign_rank_test_p<-vector("numeric",length=length(M_values))
sign_test_p<-vector("numeric", length=length(M_values))
n<-1000
lower_bounds <- matrix(nrow=n,ncol=length(M_values))
upper_bounds <- matrix(nrow=n,ncol=length(M_values))
center <- matrix(nrow=n,ncol=length(M_values))
for (i in seq_along(M_values)) {
for (j in 1:n){
M <- M_values[i]
value <- rnorm(1, mean = M, sd = 1)
lower_bounds[j,i] <- value-0.01
upper_bounds[j,i] <- value+0.01
center[j,i] <- (lower_bounds[j,i] + upper_bounds[j,i]) / 2
}
sign_test_p[i]<-SIGN.test(center[,i],md=0,alternative = "greater")$p.value
sign_rank_test_p[i]<-wilcox.test(center[,i], mu = 0, alternative = "greater")$p.value
}


# Create a data frame to store the results
results_df <- data.frame(M = M_values,
sign_test_p_value = sign_test_p,
signed_rank_test_p_value = sign_rank_test_p)

This gives the p values for the sign test. We generated 1000 p-values for values of M that is between -1 and 1.

这给出了符号测试的p值。我们为介于-1和1之间的M值生成了1000个p值。


What I want now is to plot the power function for the sign test and take some conclusions about it but I dont know how to do it. Is it with pwr.r.test or power.sign.test?

我现在想要的是画出符号检验的幂函数,并得出一些结论,但我不知道怎么做。它使用的是pwr.r.test还是Power.sign.test?


更多回答

SIGN.test is not a base R function. When using functions that are not base R functions please start the scripts with a call to library(pkgname) in order to load the packages needed. (Already done, I have edited the question.)

SIGN.test不是基本R函数。当使用非基本R函数的函数时,请通过调用库(Pkgname)来启动脚本,以便加载所需的包。(已经做完了,我已经编辑了问题。)

I don't see any evidence that you know what a power function means. Perhaps if you had included some comments or explained your plan I would have come to a different conclusion. Have you tried searching for a prior answer at CrossValidated.com?

我看不出有任何证据表明你知道幂函数的含义。也许如果你有一些评论或解释你的计划,我会得出不同的结论。你试过在CrossValidated.com?上搜索先前的答案吗

优秀答案推荐
更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com