如何以非常低的方差计算非中心F分布的功率?

时间:2018-03-01 15:18:30

标签: r distribution

我的样本方差存在问题,无法计算非中心F的功率。 当我在R上运行代码时,它说:(收敛失败的' pnbeta') 你能告诉我怎么解决吗? R代码如下:

 x <- c(0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1)
 y <- c(0.016189,0.019478,0.022767,0.026056,0.029345,0.032634,0.035923,0.039212,0.042501,0.04579)
 n0 <- length(x) 
 n0
 alpha <- 0.05 
 beta <- 0.80 
 delta <- 0.2
 m <- mean(x)
 m
 sxx=sum((x-mean(x))^2)
 sxx
 sxy=sum((y-mean(y))*(x-mean(x)))
 sxy
 b1hat=sxy/sxx
 b0hat=((mean(y)-(b1hat*mean(x))))
 b0hat
 yhat= b0hat + b1hat*x
 yhat
 sigma2=sum((y-yhat)^2)/(n0-2)
 sigma2
 ncp=n0*(delta^2)*((1+mean(x))^2)/sigma2
 power=(1-pf(qf((1-alpha),2,n0-2),2,n0-2,ncp))
 ncp
 power

0 个答案:

没有答案