📜  过程控制数据集 CSV 文件 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:18.197000             🧑  作者: Mango

代码示例1
##***part020e;
sink()

# Look at how many years are needed to detect a -5% trend/year with 80% power?
sink("monitor-example1-R-030.txt", split=TRUE)
##***part030b;
poweryears.stroup <- ddply(data.frame(Nyears=4:10), "Nyears", 
   function(x, Ivalue, Trend, Process.SD, Sampling.SD, alpha=0.05){
   # run the simulations
   myres <- slr.power.stroup(Ivalue=Ivalue, Trend=Trend, Xvalues=rep(0:x$Nyears,2), 
                 Process.SD=Process.SD, Sampling.SD=Sampling.SD, alpha=alpha)

   return(myres)
}, Ivalue=Ivalue, Trend=Trend, Process.SD=0, Sampling.SD=Sampling.SD, alpha=0.05)

poweryears.stroup[,c("Nyears","power")]