Thank you so much for the reply.
Yes, I meant gamma and it was my mistake. I also looked at the link which you sent me but I like to know if the procedure that I used works?
Moreover, after I fixed the spelling I received an error, regarding "n" but I am not using it inside the procedure? please see attached log file.
Thank you again
NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.4 (TS1M2) Licensed to UNIVERSITY OF JORDAN, Site 70235184. NOTE: This session is executing on the X64_8PRO platform.
NOTE: Updated analytical products:
SAS/STAT 13.2 SAS/ETS 13.2 SAS/OR 13.2 SAS/IML 13.2 SAS/QC 13.2
NOTE: Additional host information:
X64_8PRO WIN 6.2.9200 Workstation
NOTE: SAS initialization used: real time 0.92 seconds cpu time 0.62 seconds
1 /*Solve system of non linear equations */ 2 3 title1 'Solving a Simultaneous System'; 4 data test; 5 input a b @@; 6 datalines;
NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.TEST has 3 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.09 seconds cpu time 0.00 seconds
8 ; 9 NOTE: Writing HTML Body file: sashtml.htm 10 proc model data=test; 11 eq.sqrt = sqrt(x) - y; 12 eq.hyperbola = a + b / x - y;
13 solve x y / solveprint; 14 id a b; 15 run;
16
NOTE: PROCEDURE MODEL used (Total process time): real time 28:52.50 cpu time 14.54 seconds
17 proc iml; NOTE: IML Ready 18 19 seed=12345; 19 ! k=1; 20 21 alpha=2; 21 ! lambda=2; 22 23 24 n=100; 24 ! m=n; 24 ! R=J(m,1,0); 25 26 print alpha lambda; 27 28 29 30 W=J(m,1,0); 30 ! V=J(m,1,0); 30 ! X_p=J(m,1,0); 30 ! X_A=J(m,1,0); 30 ! U=J(m,1,0); 31 32 X=J(m,1,0); 33 34 do i=1 to m; 35 W[i]=Uniform(seed); 36 end; 37 38 S=1+R[m]; 39 V[1]=W[1]**(1/S); 40 41 do i=2 to m; 42 S=S+(1+R[m-i+1]); 43 V[i]=W[i]**(1/S); 44 end; 45 46 do i=1 to m; 47 48 U[i]=1-prod( V[ m:( m-i+1)] ); 48 ! ** the U's are the required progressively type II from U(0,1); 49 50 END; 51 52 53 X=( 1-(1-U)##(1/alpha) )##(1/lambda); 54 55 56 print X; 57 58 quit; NOTE: Exiting IML. NOTE: PROCEDURE IML used (Total process time): real time 0.06 seconds cpu time 0.06 seconds
59 60 proc iml; NOTE: IML Ready 61 62 seed=12345; 62 ! k=1; 63 64 alpha=2; 64 ! lambda=2; 65 66 67 n=10; 67 ! m=n; 67 ! R=J(m,1,0); 68 69 print alpha lambda; 70 71 72 73 W=J(m,1,0); 73 ! V=J(m,1,0); 73 ! X_p=J(m,1,0); 73 ! X_A=J(m,1,0); 73 ! U=J(m,1,0); 74 75 X=J(m,1,0); 76 77 do i=1 to m; 78 W[i]=Uniform(seed); 79 end; 80 81 S=1+R[m]; 82 V[1]=W[1]**(1/S); 83 84 do i=2 to m; 85 S=S+(1+R[m-i+1]); 86 V[i]=W[i]**(1/S); 87 end; 88 89 do i=1 to m; 90 91 U[i]=1-prod( V[ m:( m-i+1)] ); 91 ! ** the U's are the required progressively type II from U(0,1); 92 93 END; 94 95 96 X=( 1-(1-U)##(1/alpha) )##(1/lambda); 97 98 99 print X; 100 101 quit; NOTE: Exiting IML. NOTE: PROCEDURE IML used (Total process time): real time 0.03 seconds cpu time 0.03 seconds
102 103 proc iml; NOTE: IML Ready 104 105 seed=12345; 105! k=1; 106 107 alpha=2; 107! lambda=2; 108 109 110 n=10; 110! m=n; 110! R=J(m,1,0); 111 112 print alpha lambda; 113 114 115 116 W=J(m,1,0); 116! V=J(m,1,0); 116! X_p=J(m,1,0); 116! X_A=J(m,1,0); 116! U=J(m,1,0); 117 118 X=J(m,1,0); 119 120 do i=1 to m; 121 W[i]=Uniform(seed); 122 end; 123 124 S=1+R[m]; 125 V[1]=W[1]**(1/S); 126 127 do i=2 to m; 128 S=S+(1+R[m-i+1]); 129 V[i]=W[i]**(1/S); 130 end; 131 132 do i=1 to m; 133 134 U[i]=1-prod( V[ m:( m-i+1)] ); 134! ** the U's are the required progressively type II from U(0,1); 135 136 END; 137 138 139 X=( 1-(1-U)##(1/alpha) )##(1/lambda); 140 141 142 *******************************************************************************; 143 *** MLE for the Kumaraswamy using Type II Adaptive progressive censoring ***** ; 144 *******************************************************************************; 145 146 start MLE_func(y) global (n,m,X,R); 147 148 func=0; 149 150 alpha=y[1]; 151 lambda=y[2]; 152 153 154 Sum_log=J(m,1,0); 155 Sum_log=log(x); 156 157 Sum_log_1=J(m,1,0); 158 Sum_log_1=log(1-X##lambda); 159 160 161 func=func + m*log(alpha*lambda)+(lambda-1)* Sum_log[+] + (alpha-1) * Sum_log_1[+] ; 162 163 Return(func); 164 165 finish; NOTE: Module MLE_FUNC defined. 166 167 168 169 170 ************* Constrain MLE ***********************; 171 172 con={0.01 0.01 , . .}; 173 x0={0.05, 0.05}; 174 tc={10000 14000}; 175 176 *************** MLE *********************; 177 178 179 call nlpnra(rc, MLE_ret, "MLE_func", x0, opt, con,tc); ERROR: (execution) Matrix has not been set to a value.
operation : NLPNRA at line 179 column 1 operands : *LIT1049, x0, opt, con, tc
*LIT1049 1 row 1 col (character, size 😎
MLE_func
x0 2 rows 1 col (numeric)
0.05 0.05
opt 0 row 0 col (type ?, size 0)
con 2 rows 2 cols (numeric)
0.01 0.01 . .
tc 1 row 2 cols (numeric)
10000 14000
statement : CALL at line 179 column 1 180 181 alpha_mle =MLE_ret[1]; ERROR: (execution) Matrix has not been set to a value.
operation : [ at line 181 column 19 operands : MLE_ret, *LIT1050
MLE_ret 0 row 0 col (type ?, size 0)
*LIT1050 1 row 1 col (numeric)
1
statement : ASSIGN at line 181 column 1 182 lambda_mle=MLE_ret[2]; ERROR: (execution) Matrix has not been set to a value.
operation : [ at line 182 column 19 operands : MLE_ret, *LIT1051
MLE_ret 0 row 0 col (type ?, size 0)
*LIT1051 1 row 1 col (numeric)
2
statement : ASSIGN at line 182 column 1 183 184 185 print alpha_mle lambda_mle; ERROR: Matrix alpha_mle has not been set to a value.
statement : PRINT at line 185 column 1 186 187 188 189 190 quit; NOTE: Exiting IML. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE IML used (Total process time): real time 0.08 seconds cpu time 0.03 seconds
... View more