## Non Standard Regression

Frequent Contributor
Posts: 92

# Non Standard Regression

Hello Everyone,

I want to estimate z1-z9 of the function below:

y=w1[(x1-1)z1+1] + w2[(x2-1)z2+1] + *** + w9[(x9-1)z9+1]

where

y=dependent variable

w1-w9 are weights (between 0 and 1) that have already been selected

x1-x9 are the independent variables

What is the best way to do this?  Exponential regression?  If so, then how to separate out the zs?

Thanks very much for any suggestions.

-Bill

sample code:

data input;

input y x1 x2 x3 x4 x5 x6 x7 x8 x9;

datalines;

0.433009378 0.260269441 1.092278706 0.425360662 0.164029628 0.429880491 0.950489941 0.047595925 0.531987245 0.336139451

0.386133454 0.184529366 0.033661616 0.245561093 0.105340609 0.882803079 0.981167833 1.07619815 0.781841268 0.233372548

0.258993942 1.119821022 0.109476847 0.000812581 0.419804897 0.391490911 0.769809934 0.659436672 0.144127286 0.746489656

0.359816223 1.046465239 0.268638572 0.137649556 1.059282484 0.142724361 0.902195762 0.073187585 1.044987784 0.080340265

0.41451314 0.07467261 1.142594057 0.097833794 0.6281817 0.804104506 0.953123478 0.877716887 0.986232903 0.413012511

0.499895162 0.388482105 0.769424554 0.449226135 0.864276043 0.093162782 0.735842414 0.729262551 0.021170317 0.946582289

0.554731409 0.059169663 0.671669625 0.573134236 0.059555794 0.688838956 1.112734086 0.082975813 0.985157911 0.954789222

0.933065823 1.09077688 0.937373275 0.961720206 1.137356787 0.912617055 0.414739423 1.179989148 0.793556015 0.527731975

0.449350652 0.889961987 0.448923153 0.16477621 1.039273537 1.101642002 0.417949375 0.892596492 0.107396261 0.300592589

0.436482177 0.218474064 0.817187061 0.444305392 0.010617679 0.316182089 0.871165126 0.396994326 0.274244319 1.054925185

0.844492128 1.199795926 0.562302873 1.087265891 0.857350825 0.717381217 0.361552016 0.188030616 0.078408845 0.477629287

0.986259829 1.11546778 0.67784779 1.076318082 0.711326509 1.147214979 0.949628603 1.159315584 0.683949937 0.658723083

0.536026142 0.03874538 0.603083965 0.615275769 1.199564925 0.097081463 1.116060342 0.025003849 0.125264809 0.066314023

0.478861694 0.623029236 1.118083449 0.343243377 0.445421704 0.990867977 0.074432208 0.093372058 0.301435613 1.061868184

0.755038738 0.917477552 0.568455848 0.653801794 1.11512354 1.167247795 0.78977679 0.620451789 0.21932299 0.882529179

0.870345527 0.278402165 0.645632762 1.04345974 1.192690633 0.317710531 0.946307396 0.799783639 0.66667504 0.614709813

0.653262402 1.077775155 0.181791546 0.669990623 0.776631367 0.513769454 0.39812198 0.078470159 0.870051912 1.178329425

0.577799576 0.545255692 0.898698641 0.635702755 0.768766323 0.60748745 0.478514258 0.208562345 0.057506345 0.257919144

0.640086114 0.347670625 0.760234063 0.733585918 0.638387923 0.510148474 0.07436439 0.352510307 0.593989168 1.040021751

0.823371633 0.638037368 1.01259897 1.097597318 0.644682512 0.266643423 0.344110563 0.450192716 0.383177214 0.840690779

0.62449019 0.282835785 1.007170731 0.610136182 1.029590947 0.074149805 1.116463349 0.503368539 1.007803905 0.263318173

0.444804746 0.017693426 0.526388959 0.187740591 1.129412956 0.915406787 1.073308894 0.619777948 0.146676128 0.54520417

0.484480172 0.497735344 0.104527198 0.500746335 0.985787824 0.199781266 0.065829102 0.202553479 0.626455295 0.813901488

0.317012256 1.192924294 0.251183508 0.093961339 0.174368642 0.477715786 0.657812327 1.031320803 0.245768093 0.717453859

0.588034285 0.489578192 0.207186181 0.699312378 0.4967007 0.891018763 0.097971171 0.532467973 0.37236279 0.292556691

0.598541777 0.331222229 1.194910587 0.566202209 1.181182139 0.344148387 1.135667393 0.369079141 0.224891936 0.002381108

0.789085218 0.561051456 0.430842595 1.05544095 0.176816812 0.475019069 0.669435603 0.443071061 0.681417633 1.137804746

0.487889626 0.634337348 1.155309283 0.341090334 0.523437654 1.041496843 0.658849627 0.407481423 0.212381753 0.148660757

0.500437513 1.003388064 0.028107549 0.408941718 1.140653445 0.546878092 0.312132981 0.164647159 0.896599531 0.139394726

0.648913057 0.23470331 0.708473294 0.715658801 0.503438628 0.778258155 0.824497121 1.003766639 0.281078622 0.205760578

0.47675595 0.226090918 0.267337491 0.207966394 0.959121283 1.097665676 0.222061633 0.836446043 0.960294339 0.82965073

0.709378295 0.009130251 0.192221036 0.993585371 0.209080202 0.157499618 1.190016415 0.748792229 0.836817845 0.541574774

0.696826726 0.879948846 1.125725147 0.744493446 0.740876159 0.219321144 1.089204287 0.920192756 0.351082149 0.205052275

0.260997361 0.00973165 0.176036305 0.059693106 0.111782576 1.025158879 0.136361192 0.918763623 0.595752643 0.512487841

0.570310745 0.632237184 0.304292779 0.526779408 0.822717014 1.004175775 0.548448316 0.063847267 0.41276116 0.523048535

0.736222587 0.24588289 0.14861863 0.844209142 0.629919526 0.941650487 0.532280328 0.696269823 0.870934505 0.645234111

0.434171719 0.948062641 0.696583303 0.254165508 0.674046478 0.242673335 1.188268109 0.934818027 0.506338586 0.034269001

0.705494851 0.68325986 0.106653146 0.811958384 0.269531941 0.696427753 1.081084338 1.057956238 0.729979889 0.399460328

0.280503587 0.416168159 0.409217298 0.05717669 0.130358799 0.904330781 0.486648621 0.915596266 0.580948113 0.160347238

0.458996388 1.029620307 0.152837123 0.460200554 0.306766207 0.638229727 0.323942705 0.470856463 0.595152795 0.115520964

0.740670108 0.829959193 0.801371222 0.700047998 1.02184578 1.130850744 0.500220331 0.29845238 1.054722256 0.022803759

0.628111577 0.775435333 0.899677969 0.809379813 0.630802294 0.346100793 0.296477882 0.378814672 0.117778822 0.04644256

0.616620558 1.195580632 0.66884203 0.629953026 0.580271276 0.452977027 0.748081499 0.103261188 0.903194269 0.347424679

0.485100919 0.640793811 0.984983366 0.174869342 0.568463983 1.075565391 0.768921803 1.017558465 0.700763394 0.552245365

0.380522255 1.026669851 0.023575147 0.181301495 0.678121679 0.126734702 0.498002422 1.116297938 0.781122541 0.742049492

0.386310145 0.489322502 0.928953839 0.108098712 0.887426928 0.61118902 0.460495358 0.892752621 0.013579578 0.862879983

0.644081655 0.791733164 0.807384987 0.832247035 0.041075155 0.063473692 0.424127906 0.853328728 0.293989069 1.179501191

0.664011771 0.235924253 0.284018069 0.772072735 0.303979747 0.781867879 0.345935375 0.990578377 0.83253673 0.698820026

0.695065576 0.263981518 0.911212968 0.780187919 0.956728666 0.033297408 0.486447384 1.160349181 0.697104382 0.600284743

0.742614249 0.389088378 0.856478819 0.855145861 0.507586603 0.737463437 0.021562337 1.154630872 0.806242913 0.582722966

;

run;

data input;

set input;

w1=0.23; w2=0.07; w3=0.21; w4=0.09; w5=0.05; w6=0.15; w7=0.10; w8=0.04; w9=0.06;

run;

Frequent Contributor
Posts: 92

## Re: Non Standard Regression

It appears that I need to use proc nlin.  I drafted some code, see below.  It runs but I'm a bit perplexed by the output.  I try to limit z1-z9 from 0.25 to 1, but there are estimates for z over 2?  Additionally, I tried to set z1-z9 from 0 to 1 by 0.01 and got an "insufficient memory" error.  Is there a way to have sas search for the best fit by 0.01?  Perhaps employ some logic that would reduce the possible number of combinations?  Also, I got a warning stating that DER.z1 to DER.z9 are missing and sas will compute them automatically.  Should I specify DER.z1 to DER.z9?

Thanks for any suggestions.

-Bill

dm 'clear log';

data input;

input y x1 x2 x3 x4 x5 x6 x7 x8 x9;

datalines;

0.433009378 0.260269441 1.092278706 0.425360662 0.164029628 0.429880491 0.950489941 0.047595925 0.531987245 0.336139451

0.386133454 0.184529366 0.033661616 0.245561093 0.105340609 0.882803079 0.981167833 1.07619815 0.781841268 0.233372548

0.258993942 1.119821022 0.109476847 0.000812581 0.419804897 0.391490911 0.769809934 0.659436672 0.144127286 0.746489656

0.359816223 1.046465239 0.268638572 0.137649556 1.059282484 0.142724361 0.902195762 0.073187585 1.044987784 0.080340265

0.41451314 0.07467261 1.142594057 0.097833794 0.6281817 0.804104506 0.953123478 0.877716887 0.986232903 0.413012511

0.499895162 0.388482105 0.769424554 0.449226135 0.864276043 0.093162782 0.735842414 0.729262551 0.021170317 0.946582289

0.554731409 0.059169663 0.671669625 0.573134236 0.059555794 0.688838956 1.112734086 0.082975813 0.985157911 0.954789222

0.933065823 1.09077688 0.937373275 0.961720206 1.137356787 0.912617055 0.414739423 1.179989148 0.793556015 0.527731975

0.449350652 0.889961987 0.448923153 0.16477621 1.039273537 1.101642002 0.417949375 0.892596492 0.107396261 0.300592589

0.436482177 0.218474064 0.817187061 0.444305392 0.010617679 0.316182089 0.871165126 0.396994326 0.274244319 1.054925185

0.844492128 1.199795926 0.562302873 1.087265891 0.857350825 0.717381217 0.361552016 0.188030616 0.078408845 0.477629287

0.986259829 1.11546778 0.67784779 1.076318082 0.711326509 1.147214979 0.949628603 1.159315584 0.683949937 0.658723083

0.536026142 0.03874538 0.603083965 0.615275769 1.199564925 0.097081463 1.116060342 0.025003849 0.125264809 0.066314023

0.478861694 0.623029236 1.118083449 0.343243377 0.445421704 0.990867977 0.074432208 0.093372058 0.301435613 1.061868184

0.755038738 0.917477552 0.568455848 0.653801794 1.11512354 1.167247795 0.78977679 0.620451789 0.21932299 0.882529179

0.870345527 0.278402165 0.645632762 1.04345974 1.192690633 0.317710531 0.946307396 0.799783639 0.66667504 0.614709813

0.653262402 1.077775155 0.181791546 0.669990623 0.776631367 0.513769454 0.39812198 0.078470159 0.870051912 1.178329425

0.577799576 0.545255692 0.898698641 0.635702755 0.768766323 0.60748745 0.478514258 0.208562345 0.057506345 0.257919144

0.640086114 0.347670625 0.760234063 0.733585918 0.638387923 0.510148474 0.07436439 0.352510307 0.593989168 1.040021751

0.823371633 0.638037368 1.01259897 1.097597318 0.644682512 0.266643423 0.344110563 0.450192716 0.383177214 0.840690779

0.62449019 0.282835785 1.007170731 0.610136182 1.029590947 0.074149805 1.116463349 0.503368539 1.007803905 0.263318173

0.444804746 0.017693426 0.526388959 0.187740591 1.129412956 0.915406787 1.073308894 0.619777948 0.146676128 0.54520417

0.484480172 0.497735344 0.104527198 0.500746335 0.985787824 0.199781266 0.065829102 0.202553479 0.626455295 0.813901488

0.317012256 1.192924294 0.251183508 0.093961339 0.174368642 0.477715786 0.657812327 1.031320803 0.245768093 0.717453859

0.588034285 0.489578192 0.207186181 0.699312378 0.4967007 0.891018763 0.097971171 0.532467973 0.37236279 0.292556691

0.598541777 0.331222229 1.194910587 0.566202209 1.181182139 0.344148387 1.135667393 0.369079141 0.224891936 0.002381108

0.789085218 0.561051456 0.430842595 1.05544095 0.176816812 0.475019069 0.669435603 0.443071061 0.681417633 1.137804746

0.487889626 0.634337348 1.155309283 0.341090334 0.523437654 1.041496843 0.658849627 0.407481423 0.212381753 0.148660757

0.500437513 1.003388064 0.028107549 0.408941718 1.140653445 0.546878092 0.312132981 0.164647159 0.896599531 0.139394726

0.648913057 0.23470331 0.708473294 0.715658801 0.503438628 0.778258155 0.824497121 1.003766639 0.281078622 0.205760578

0.47675595 0.226090918 0.267337491 0.207966394 0.959121283 1.097665676 0.222061633 0.836446043 0.960294339 0.82965073

0.709378295 0.009130251 0.192221036 0.993585371 0.209080202 0.157499618 1.190016415 0.748792229 0.836817845 0.541574774

0.696826726 0.879948846 1.125725147 0.744493446 0.740876159 0.219321144 1.089204287 0.920192756 0.351082149 0.205052275

0.260997361 0.00973165 0.176036305 0.059693106 0.111782576 1.025158879 0.136361192 0.918763623 0.595752643 0.512487841

0.570310745 0.632237184 0.304292779 0.526779408 0.822717014 1.004175775 0.548448316 0.063847267 0.41276116 0.523048535

0.736222587 0.24588289 0.14861863 0.844209142 0.629919526 0.941650487 0.532280328 0.696269823 0.870934505 0.645234111

0.434171719 0.948062641 0.696583303 0.254165508 0.674046478 0.242673335 1.188268109 0.934818027 0.506338586 0.034269001

0.705494851 0.68325986 0.106653146 0.811958384 0.269531941 0.696427753 1.081084338 1.057956238 0.729979889 0.399460328

0.280503587 0.416168159 0.409217298 0.05717669 0.130358799 0.904330781 0.486648621 0.915596266 0.580948113 0.160347238

0.458996388 1.029620307 0.152837123 0.460200554 0.306766207 0.638229727 0.323942705 0.470856463 0.595152795 0.115520964

0.740670108 0.829959193 0.801371222 0.700047998 1.02184578 1.130850744 0.500220331 0.29845238 1.054722256 0.022803759

0.628111577 0.775435333 0.899677969 0.809379813 0.630802294 0.346100793 0.296477882 0.378814672 0.117778822 0.04644256

0.616620558 1.195580632 0.66884203 0.629953026 0.580271276 0.452977027 0.748081499 0.103261188 0.903194269 0.347424679

0.485100919 0.640793811 0.984983366 0.174869342 0.568463983 1.075565391 0.768921803 1.017558465 0.700763394 0.552245365

0.380522255 1.026669851 0.023575147 0.181301495 0.678121679 0.126734702 0.498002422 1.116297938 0.781122541 0.742049492

0.386310145 0.489322502 0.928953839 0.108098712 0.887426928 0.61118902 0.460495358 0.892752621 0.013579578 0.862879983

0.644081655 0.791733164 0.807384987 0.832247035 0.041075155 0.063473692 0.424127906 0.853328728 0.293989069 1.179501191

0.664011771 0.235924253 0.284018069 0.772072735 0.303979747 0.781867879 0.345935375 0.990578377 0.83253673 0.698820026

0.695065576 0.263981518 0.911212968 0.780187919 0.956728666 0.033297408 0.486447384 1.160349181 0.697104382 0.600284743

0.742614249 0.389088378 0.856478819 0.855145861 0.507586603 0.737463437 0.021562337 1.154630872 0.806242913 0.582722966

;

run;

*Set weights;

%let w1=0.23; %let w2=0.07; %let w3=0.21; %let w4=0.09; %let w5=0.05; %let w6=0.15; %let w7=0.10; %let w8=0.04; %let w9=0.06;

%let start=0.25;

%let end=1.0;

%let inc=0.25;

PROC NLIN DATA=input METHOD=GAUSS NOITPRINT;

PARMS z1 = &start. to &end. by &inc. z2 =&start. to &end. by &inc.  z3 = &start. to &end. by &inc. z4 = &start. to &end. by &inc.

z5 = &start. to &end. by &inc. z6 = &start. to &end. by &inc. z7 = &start. to &end. by &inc. z8 = &start. to &end. by &inc.

z9 = &start. to &end. by &inc.;

MODEL Y = &w1.*((x1-1)*z1+1) + &w2.*((x2-1)*z2+1) + &w3.*((x3-1)*z3+1) + &w4.*((x4-1)*z4+1) + &w5.*((x5-1)*z5+1) + &w6.*((x6-1)*z6+1) + &w7.*((x7-1)*z7+1)

+&w8.*((x8-1)*z8+1) + &w9.*((x9-1)*z9+1) ;

OUTPUT OUT=PRED P=PR ;

RUN;

output from proc nlin

SAS Employee
Posts: 340

## Re: Non Standard Regression

Hi Bill,

If you set 0 to 1 by 0.01 for each z parameter, NLIN first will do a grid search: will try each combination of the z starting values. This is 100**9 combinations.

In this specific case I don't think it is necessary to specify such a fine grid for starting values. One starting value will be enough, because your model is linear, it will always converge.

You could also convert (reparameterize) this problem and solve with proc reg or glm.

You don't need to specify a formula for the derivatives with the DER statement. It is just a note. DER statement is needed in special cases, when you know the formula for derivatives better then SAS

You can use the bound statement to restrict z parameters:

BOUNDS z1-z9 <=1;

Frequent Contributor
Posts: 92

## Re: Non Standard Regression

Gergely,

Thanks very much for your detailed explanation.  I was able to bound the parameter estimates to the interval [0,1].

Best,

Bill

Discussion stats
• 3 replies
• 287 views
• 3 likes
• 2 in conversation