给定d维输入u,我试图找到满足R中以下等式的x(也为d维)。
u = 0.5* CDF(x,mean1,sigma1) + 0.5*CDF(x,mean2,sigma2)
。在这里,mean1,mean2,sigma1,sigma2是适当尺寸的已知量。
如果我知道x,并且想找到u,我会使用mvtnorm package
0.5* pmvnorm(c(0,0),mean=c(0,0),sigma = matrix(c(1,0,0,1),ncol=2) ) + 0.5* pmvnorm(c(0,0),mean=c(0,0),sigma = matrix(c(1,0,0,1),ncol=2) )
[1] 0.25
attr(,"error")
[1] 1e-15
attr(,"msg")
[1] "Normal Completion"
这里x =(0,0)是输入,而u = 0.25是输出
我正在尝试完成相反的过程,即知道u和找到x。我尝试使用multiroot
包中的rootsolve
函数,但无法理解为什么它不起作用。
> junk_fun <- function(x,y) ( 0.25 - 0.5*pmvnorm( c(x,y) ,mean = c(0,0),sigma = matrix(c(1,0,0,1),ncol=2))+ 0.5*pmvnorm( c(x,y) ,mean = c(1,0),sigma = matrix(c(1,0,0,1),ncol=2)) )
multiroot(junk_fun, start = c(0,0))
显示回溯
Rerun with Debug Error in checkmvArgs(lower = lower, upper = upper, mean = mean, corr = corr, : argument "y" is missing, with no default
请帮助我。在此先感谢!