Maximise a piecewise defined function
Re: Maximise a piecewise defined function
Works fine for me. You can get rid of the simplex iterations. They aren't necessary and could cause it to leave the non-negative range for beta. (PMETHOD=SIMPLEX doesn't use the constraints).
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Maximise a piecewise defined function
Many Thanks Tom, still getting Rats Stopped...., could you send me your output or advise me what I should do. I will reboot may be that would help or reinstall the program again. Just to be sure, did you run the last code I sent you? Thank you
Rachid
Rachid
Re: Maximise a piecewise defined function
Code: Select all
MAXIMIZE - Estimation by BFGS
Convergence in 3 Iterations. Final criterion was 0.0000002 <= 0.0000100
Usable Observations 1150
Function Value -1055.2676
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. MUGZ 3.3767076290 0.0137455081 245.65899 0.00000000
2. SIGMAGZ 0.7382213094 0.0152971412 48.25878 0.00000000
3. ALPHA 2.1819414012 0.2767405879 7.88443 0.00000000
4. BETA 0.2209384865 0.0103424435 21.36231 0.00000000
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Maximise a piecewise defined function
Dear Tom,
Thanks for the output. Could you send me the text file too. Thanks
Rachid
Thanks for the output. Could you send me the text file too. Thanks
Rachid
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Maximise a piecewise defined function
Dear Tom,
I was not may be clear in my last email to you, I meant the code I last sent you to see if you haven't made any changes, anyhow I appreciate and thank you for all your efforts.
Rachid
I was not may be clear in my last email to you, I meant the code I last sent you to see if you haven't made any changes, anyhow I appreciate and thank you for all your efforts.
Rachid
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Maximise a piecewise defined function
Dear Tom,
Hope all is well. I have a question along the same line of my last email, but different objective function this time. I run the code, it works fine but no output, I believe the looping is empty. I am not sure if my %if statement is where it should be. Please advise, I have attached the code and the data. Thank you
Rachid
Hope all is well. I have a question along the same line of my last email, but different objective function this time. I run the code, it works fine but no output, I believe the looping is empty. I am not sure if my %if statement is where it should be. Please advise, I have attached the code and the data. Thank you
Rachid
Re: Maximise a piecewise defined function
On
g5=1/2+(1/2)*%gamma(1/alpha)*%sign(c*(x(t)-mux))*%gammainc(abs((b*c*(x(t)-mux)))^alpha,1/alpha) , $
use .5 or 1.0/2 rather than 1/2. The last does an integer divide giving 0.
g5=1/2+(1/2)*%gamma(1/alpha)*%sign(c*(x(t)-mux))*%gammainc(abs((b*c*(x(t)-mux)))^alpha,1/alpha) , $
use .5 or 1.0/2 rather than 1/2. The last does an integer divide giving 0.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Maximise a piecewise defined function
Thanks Tom, very much appreciated.
Rachid
Rachid
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Maximise a piecewise defined function
Dear Tom,
Hope my email finds you well. I run the attached code and data, it converges to something that I don't want (negative sigma2), (output is also attached), however, in the output, many of my data points are "skipped/missing" , could it be because of bad choice of starting values? or maybe I need to add more information into the code to read all the data set. Please advise. Thank you
Rachid
Hope my email finds you well. I run the attached code and data, it converges to something that I don't want (negative sigma2), (output is also attached), however, in the output, many of my data points are "skipped/missing" , could it be because of bad choice of starting values? or maybe I need to add more information into the code to read all the data set. Please advise. Thank you
Rachid
- Attachments
-
- codeoutput.PRG
- (1.1 KiB) Downloaded 961 times
-
- returns.xls
- (850 KiB) Downloaded 723 times
-
- code.PRG
- (1.53 KiB) Downloaded 977 times
Re: Maximise a piecewise defined function
Yes. You probably have a problem at your guess values. I suspect that the problem is with the following:
g1=-(-(x(t)-mux1)*b/sigmax1)^alpha1, $
g2=-((x(t)-mux2)*b/sigmax2)^alpha2, $
Negative number to real power isn't defined. If you're mux1 and mux2 aren't chosen to make that (x(t)-mu)*b/sigma negative in the first line and positive in the second, you'll trigger a missing value at t.
g1=-(-(x(t)-mux1)*b/sigmax1)^alpha1, $
g2=-((x(t)-mux2)*b/sigmax2)^alpha2, $
Negative number to real power isn't defined. If you're mux1 and mux2 aren't chosen to make that (x(t)-mu)*b/sigma negative in the first line and positive in the second, you'll trigger a missing value at t.
Re: Maximise a piecewise defined function
Yes. You probably have a problem at your guess values. I suspect that the problem is with the following:
g1=-(-(x(t)-mux1)*b/sigmax1)^alpha1, $
g2=-((x(t)-mux2)*b/sigmax2)^alpha2, $
Negative number to real power isn't defined. If your mux1 and mux2 aren't chosen to make that (x(t)-mu)*b/sigma negative in the first line and positive in the second, you'll trigger a missing value at t. But at any rate, you'll have to see where the missing values are, evaluate the FRML there and check the intermediate calculations.
g1=-(-(x(t)-mux1)*b/sigmax1)^alpha1, $
g2=-((x(t)-mux2)*b/sigmax2)^alpha2, $
Negative number to real power isn't defined. If your mux1 and mux2 aren't chosen to make that (x(t)-mu)*b/sigma negative in the first line and positive in the second, you'll trigger a missing value at t. But at any rate, you'll have to see where the missing values are, evaluate the FRML there and check the intermediate calculations.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Maximise a piecewise defined function
Thanks Tom for your thoughtful insights, my mistake, I left off the factors d and (1-d) in the terms you mentioned. Thanks
Rachid
Rachid