简体   繁体   English

如何反转具有多个输入的 function 的估计值,但仅反转单个输入的 function

[英]How to invert the estimate of a function with multiple inputs, but only invert the function for a single input

I am trying to invert a function like one would invert an empirical cdf.我正在尝试反转 function,就像反转经验 cdf 一样。 If I wanted to invert an empirical cdf, I would write something like,如果我想反转经验 cdf,我会写类似的东西,

tau = 0.8
y=rnorm(1000,1)
[f,x]=ecdf(y)
q = interp1(f,x,tau,'next');

Instead, suppose that I have defined a function with multiple inputs, where all but the last input is based upon data.相反,假设我定义了一个具有多个输入的 function,其中除最后一个输入外的所有输入都基于数据。 For example,例如,

example_data= example_data_missingdatacdf(x1,x2,x3,scalar_delta)

I want to find the smallest value of delta such that我想找到 delta 的最小值,这样

example_data_missingdatacdf(x1,x2,x3,scalar_delta)>= tau

What can I do?我能做什么? Thanks for any help in advance.感谢您提前提供帮助。

You would find the value of scalar_delta for which example_data_missingdatacdf(x1,x2,x3,scalar_delta) - tau = 0 .您会找到example_data_missingdatacdf(x1,x2,x3,scalar_delta) - tau = 0scalar_delta值。 Assuming the function is monotonously increasing, this is the smallest value that satisfies your requirement.假设function单调递增,这是满足你要求的最小值。

There are standard numerical techniques to find the zero crossing of a function. MATLAB implements such a technique in fzero .有标准的数值技术可以找到 function 的过零点。MATLAB 在fzero中实现了这种技术。

This is how you'd use it:这就是您使用它的方式:

fun = @(d) example_data_missingdatacdf(x1,x2,x3,d) - tau;
scalar_delta = fzero(fun, 0);

The 0 is the start point for the algorithm, your best guess. 0 是算法的起点,您最好的猜测。 Given that the function is monotonic, it is not important to have a good guess, you will always find the only zero.鉴于 function 是单调的,猜得好并不重要,你总会找到唯一的零。 But a good guess will make the algorithm converge faster.但是一个好的猜测会让算法收敛得更快。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM