proc model - start values

Reply
Contributor
Posts: 23

proc model - start values

Hello, i have a problem with start values in the estimation of function in the proc model.

When i write specific initial values, the proc model works properly.

example1:

    PROC model data=a    Converge=0.01    SINGULAR=0.01    MAXSUBIT=30  ;

    Rate=%function();

    PARMS AlfaParam BetaParam GammaParam1 GammaParam2 DeltaParam1 DeltaParam2;

    fit Rate start=(AlfaParam=300  BetaParam=-200 GammaParam1=500 GammaParam2=-200 DeltaParam1=1 DeltaParam2=3)

    / out=a_out itprint OUTPREDICT  OUTEST=a_conv;

    run;

    quit;

But i use a macro, and i estimate a few curves and therefore i have to use for every curve his specific initial values,and i create them by call symputx.

example2:

%macro question;

     data _NULL_;

        merge Tbl_parms_prev blg_parparms_excel;   /*import yesterday parms*/

        by CurveId CurveType CurveSubType; 

        if CurveId=&CurveId and CurveType=&CurveType and CurveSubType=&CurveSubType;

        call symputx('Alfa_start',  round(AlfaParam,0.0001));

        call symputx('Beta_start',  round(BetaParam,0.0001));

        call symputx('Gamma_start1',round(GammaParam1,0.0001));

        call symputx('Delta_start1',round(DeltaParam1,0.0001));

        call symputx('Gamma_start2',round(GammaParam2,0.0001));

        call symputx('Delta_start2',round(DeltaParam2,0.0001));

        run;

    PROC model data=a  MAXITER=100    Converge=0.01    SINGULAR=0.01    MAXSUBIT=30;

    Rate=%function();

    PARMS AlfaParam BetaParam GammaParam1 GammaParam2 DeltaParam1 DeltaParam2;

       fit Rate start=(AlfaParam=&Alfa_start  BetaParam=&Beta_start GammaParam1=&Gamma_start1 GammaParam2=&Gamma_start2 DeltaParam1=&Delta_start1          DeltaParam2=&Delta_start2)

    / out=a_out itprint OUTPREDICT  OUTEST=a_conv;

    run;

    quit;

%mend question;

%question;

Problem when i create start values through macro data step. the proc model doesn't converged, but when i write identical start values in directly, the proc model works perfectly. Maybe problem that after call symputx the macro variables is character number values.

Maybe somebody know what a solution to this problem?

Thank you

Alexey

Super User
Posts: 11,343

Re: proc model - start values

What does the log show when you run the macro with Options Mprint Symbolgen? Does the generated code look as expected?

There are a couple of possiblities if the generated code looks wrong. One might be to explicitly control the output of the rounded values in the Call Symputx statments. You currently are getting a likely default conversion from numeric to text using a Bestw. format which may be losing significant digits. I would try something like:

call symputx('Alfa_start',put(  round(AlfaParam,0.0001),f12.5));


Contributor
Posts: 23

Re: proc model - start values

Hello, i tried, but it doesn't help us.

this is log:

MLOGIC(CPI_BRANCHES_EVAL_P2):  %PUT alfa_start_param=&alfa_start_param

SYMBOLGEN: Macro variable ALFA_START_PARAM resolves to 347

alfa_start_param=347

MLOGIC(CPI_BRANCHES_EVAL_P2):  %PUT betta_start_param=&betta_start_param

SYMBOLGEN: Macro variable BETTA_START_PARAM resolves to -454

betta_start_param=-454

MLOGIC(CPI_EVAL_TWO_BOUNDS):  Beginning execution.

SYMBOLGEN: Macro variable PARAMSNUM resolves to 2

MLOGIC(CPI_EVAL_TWO_BOUNDS):  %IF condition &ParamsNum=2 is TRUE

MLOGIC(CPI_EVAL_TWO_BOUNDS):  %PUT ParamsNum=&ParamsNum

SYMBOLGEN: Macro variable PARAMSNUM resolves to 2

ParamsNum=2

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable SCALE resolves to AAp

SYMBOLGEN: Macro variable MAXITER resolves to 100

SYMBOLGEN: Macro variable CONVERGE resolves to 0.000001

SYMBOLGEN: Macro variable SINGULAR resolves to 0.000001

SYMBOLGEN: Macro variable MAXSUBIT resolves to 30

MPRINT(CPI_EVAL_TWO_BOUNDS):   PROC model data=curve_cpi_Other_AAp MAXITER=100

Converge=0.000001 SINGULAR=0.000001 MAXSUBIT=30 NOITPRINT;

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

MPRINT(CPI_EVAL_TWO_BOUNDS):   cpi_Other_curve=

MLOGIC(NSS_CPI_EVAL):  Beginning execution.

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable GAMMA1_GOV_CPI resolves to 1667.927124

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable DELTA1_GOV_CPI resolves to 1.1252459288

SYMBOLGEN: Macro variable GAMMA2_GOV_CPI resolves to -2361.17626953125

SYMBOLGEN: Macro variable DELTA2_GOV_CPI resolves to 1.3986303806

SYMBOLGEN: Macro variable DELTA2_GOV_CPI resolves to 1.3986303806

SYMBOLGEN: Macro variable DELTA2_GOV_CPI resolves to 1.3986303806

MPRINT(NSS_CPI_EVAL):

AlfaParam+BetaParam*((1-exp(-tm/1.1252459288))/(tm/1.1252459288))+1667.927124*(

(1-exp(-tm/1.1252459288))/(tm/1.1252459288)-exp(-tm/1.1252459288))+-2361.17626953125*((

1-exp(-tm/1.3986303806))/(tm/1.3986303806)-exp(-tm/1.3986303806))

MLOGIC(NSS_CPI_EVAL):  Ending execution.

MPRINT(CPI_EVAL_TWO_BOUNDS):  ;

MPRINT(CPI_EVAL_TWO_BOUNDS):   PARMS AlfaParam BetaParam;

SYMBOLGEN: Macro variable ALFA_LOWER_BOUND resolves to 347

SYMBOLGEN: Macro variable ALFA_UPPER_BOUND resolves to 515

MPRINT(CPI_EVAL_TWO_BOUNDS):   BOUNDS 347 <= AlfaParam <= 515 ;

SYMBOLGEN: Macro variable ALFA_BETTA_LOWER_BOUND resolves to -107

MPRINT(CPI_EVAL_TWO_BOUNDS):   RESTRICT -107 <= AlfaParam+BetaParam ;

SYMBOLGEN: Macro variable ALFA_BETTA_UPPER_BOUND resolves to -107

MPRINT(CPI_EVAL_TWO_BOUNDS):   RESTRICT AlfaParam+BetaParam <= -107 ;

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable ALFA_START_PARAM resolves to 347

SYMBOLGEN: Macro variable BETTA_START_PARAM resolves to -454

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable SCALE resolves to AAp

SYMBOLGEN: Macro variable LINKAGE resolves to cpi

SYMBOLGEN: Macro variable SECTION resolves to Other

SYMBOLGEN: Macro variable SCALE resolves to AAp

MPRINT(CPI_EVAL_TWO_BOUNDS):   fit cpi_Other_curve start= (AlfaParam= 347 BetaParam= -454) /

out=cpi_Other_eval_out_AAp itprint OUTPREDICT OUTEST=cpi_Other_eval_conv_AAp;

MPRINT(CPI_EVAL_TWO_BOUNDS):   run;

NOTE: The iteration limit is exceeded for OLS.

ERROR: The parameter estimates failed to converge for OLS after 100 iterations using CONVERGE=

1E-6 as the convergence criteria.

NOTE: The data set WORK.CPI_OTHER_EVAL_OUT_AAP has 100 observations and 5 variables.

NOTE: The data set WORK.CPI_OTHER_EVAL_CONV_AAP has 1 observations and 6 variables.

MPRINT(CPI_EVAL_TWO_BOUNDS):   quit;

NOTE: PROCEDURE MODEL used (Total process time):

real time           0.34 seconds

        cpu time            0.34 seconds

Super User
Posts: 11,343

Re: proc model - start values

Your converge criteria is a lot tighter than in your example, 0.00001 vs 0.01. I would suggest either increasing the iterations or loosening the convergence criteria, maybe to 0.00001 or 0.0001.

Ask a Question
Discussion stats
  • 3 replies
  • 349 views
  • 0 likes
  • 2 in conversation