I have difficulty implementing the following optimization problem which I know the solution as presented in excel and now I am trying to implement it in R.
The data are :
Kurt=4
Skew =-0.2
as k and t respectively as shown in the picture.
Finding the lower and upper omega is simple in R:
For the lower omega:
w1 = c(-Kurt-6,0,3,2,1)
f = polyroot(w1)
w11=max(Re(f));w11
[1] 1.206575
w2 = c(-4-(Skew)^2 ,0,3,1)
g = polyroot(w2);g
w22=max(Re(g));w22
wl = max(w11,w22) ;wl
1] 1.206575
For the upper omega:
wu = (-1+(2*(Kurt+2))^(0.5))^(0.5)
wu
[1] 1.569746
For the upper and lower omega R agrees with Excel.
Now the problem is that the excel Solver finds the omega value to be 1.56425 but I don't know how to verify it in R.
I tried as well the optimize function for the upper and lower:
m = function(x){ (4+2*( x^2 - ((Kurt +6) /(x^2+2*x+3) ) ))^(0.5) }
om = function(x){(x-1-m(x) )*(x+2+(m(x) /2))^2 - Skew}
optimize(om,interval = c(wl,wu), maximum = TRUE)
but I don't know how to find the result 1.56425 between the upper and lower omega as described in the photo. It makes a Solver in Excel but I don't know to perform it in R.
Excuse me for the photo but stack overflow does not have latex in order to present it properly.
Any help? How can I do it in R?
The excel sheet is the below picture: