【发布时间】:2018-07-14 00:08:34
【问题描述】:
我想知道为什么我找不到x 的另一个现有值,其f(x) 等于f(.6)?
也就是说,我想知道如何找到下图中红色X所指示的点的x值?
这是我尝试过但没有成功的方法:
source("https://raw.githubusercontent.com/rnorouzian/i/master/ii.r") # source the function
f <- function(x, n.pred = 5, N = 100, conf.level = .95){
ci <- R2.ci(R2 = x, n.pred = n.pred, N = N, conf.level = conf.level) # The objective function
ci$upper - ci$lower
}
curve(f, panel.f = abline(v = .6, h = f(.6), col = 2, lty = c(2, 1))) # curve the function
uniroot(function(x) f(.6) - f(x), c(0, 1))[[1]] # find the requested 'x' value
`Error: f() values at end points not of opposite sign`
【问题讨论】:
-
你在找this?
-
我无法运行您的代码。这就是为什么我指示你这样做
-
uniroot 只返回一个根。并且您需要在与该功能的交叉点的两侧。与其使用
c(0,1)作为范围,不如使用c(0,.5)和c(.5,1)运行它 -
Error in peta2F(peta, df1, df2) : could not find function "peta2F" -
很抱歉仍然遇到同样的错误
标签: r function math optimization linear-algebra