How does one plot the set S of parameter region of equations using r?. My problem is that I have one equation with 2 variables defined by $g(x,a,b) = 0$ and I want to plot the set of $(a,b)$ where the solution exists.
The specific example I am interested in is the following:
$$(F(x) - a)f^2(x) + \left(\frac{F^2(x)}{2} - a F(x) + \left(\frac{a^2}{2} + b\right)\right)f^\prime(x)=0.$$
where $F$ is the cumulative function of a normal distribution of mean=0 and sd=1, $f$ the density function of the normal, and $f^\prime$ is the first derivative of $f$.
My goal is to construct the region (surface) $S$ where
$$S = \{(a,b)\in [0,1]^2\ |\text{ a solution }x\text{ of the equation exists and belongs to }[0,1]\}. $$
E<-function(a,u) {
((a-u)*(dnorm(q(u),m,s, log = FALSE))/(qnorm(u)))-((qnorm(u))^2)/2 +a*qnorm(u)-(a^2)/2
}
a <- u <- seq(0,1,0.01)
z <- outer(a,u,E)
b<-seq(0,1,0.001)
contour( x=a, y=a, z=z,levels=b, las=1, drawlabels=FALSE, lwd=3,xlab="a", ylab="x")
Please help me here. I hope this can teach me more. Thanks in advance.
Thanks, this is exactly what I was looking for. But I have 2 remarks or comments : Remark 1 : I made a mistake $u=F(x)\in[0,1]$ but $x = N(0,1)$ so $x$ is not restricted in $[0,1]$. So is it possible for you to propose the code that you used in Mathematica such that I can try to adapt it.
Remark 2 : I did also a simulation using Mathematica and I get the 3D picture of my equation but it was not possible to get the projection to get S. This is the code I used :
f[u_] := Quantile[NormalDistribution[0, 1], u]
g[u_]:=PDF[NormalDistribution[0,1],f[u]]
h[u_, a_, e_] := (u - a)*((g[u])^2) + ((u^2)/2 - a*u + (a^2)/2 + e)*f[u]*g[u]
ContourPlot3D[h[u, a, e] == 0, {a, 0, 1}, {u, 0, 1}, {e, 0, 1}]
Then I get this picture :
So is there way to get the projection from this picture.