BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Hi All,

 

I'm not a modeling person, though at times in my life I've run PROC REG, PROC LOGISTIC, and a few other basic modeling PROCs like those.

 

So I know how to fit a linear model like:

 

y= B0 + B1*X1 + B2*X1**2 

 

I've been asked to play around with some data, fitting a model like:

 

y= (B0 + B1*X1 + B2*X1**2 )  *  (1 + B3*X2 + B4*X2**2)  *  (1 + B5*X3 + B6*X3**2)

 

The concept of the model (I think : ) is that the first term in parentheses uses X1 to predict Y, the second term uses X2 to inflate/deflate the prediction, and the third term uses X3 to further inflate/deflate the prediction.  We want estimates of B0-B6, which will ultimately used for prediction/scoring.  Y and all of the predictors are continuous.

 

So this looks to me like it's not an additive model, it's some mix of additive and multiplicative.  I was reading up last night on GLMSELECT, but I don't think it's meant for this sort of model.  What PROCs should I be reading up on?

 

Is this the world of PROC NLIN, PROC MODEL or something else?  I have SAS/STAT SAS/ETS  and SAS/QC.

 

Thanks,

-Q.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I don't think I'd describe the model the same way you did (a quadratic that is inflated/deflated), but I will leave the interpretation to you. Yes, this is probably a good task for PROC NLIN, which performs least-squares estimates for nonlinear regression models. 

 

data Have;
array B[0:6] B0-B6 (1 2 -0.3
                    0.4 -0.5
                    0.1  0.2 );
call streaminit(123);
do x1 = -1 to 1;
   do x2 = -1 to 1;
      do x3 = -1 to 1;
         y = (B0 + B1*X1 + B2*X1**2 )  *  
             (1 + B3*X2 + B4*X2**2)  *  
             (1 + B5*X3 + B6*X3**2)
             + rand("Normal", 0, 0.2);
         output;
      end;
   end;
end;
drop B0-B6;
run;

proc nlin data=Have method=marquardt;
   parms B0 0 
         B1 0
         B2 -1
         B3 0
         B4 -1
         B5 0
         B6 1;
   model Y = (B0 + B1*X1 + B2*X1**2 )  *  
             (1 + B3*X2 + B4*X2**2)  *  
             (1 + B5*X3 + B6*X3**2);
run;

Note well the error structure that I used for the simulated data. The errors are additive. 

View solution in original post

5 REPLIES 5
unison
Lapis Lazuli | Level 10

Perhaps model the log() of your desired model and then it becomes some sort of linear-log model? Just a thought.

 

-unison

-unison
Quentin
Super User

Thanks @unison .  I think that's a good thought when the model is Y=X1*X2*X3, e.g. http://www-ist.massey.ac.nz/dstirlin/CAST/CAST/Hmultiplicative/multiplicative1.html.

 

But I don't have variables being multiplied, I have expressions being multiplied:

 

y= (B0 + B1*X1 + B2*X1**2 )  *  (1 + B3*X2 + B4*X2**2)  *  (1 + B5*X3 + B6*X3**2)

 

And I want an estimate for all 7 parameters (B0-B6).  

 

So I don't have a variable to take the log of.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Rick_SAS
SAS Super FREQ

I don't think I'd describe the model the same way you did (a quadratic that is inflated/deflated), but I will leave the interpretation to you. Yes, this is probably a good task for PROC NLIN, which performs least-squares estimates for nonlinear regression models. 

 

data Have;
array B[0:6] B0-B6 (1 2 -0.3
                    0.4 -0.5
                    0.1  0.2 );
call streaminit(123);
do x1 = -1 to 1;
   do x2 = -1 to 1;
      do x3 = -1 to 1;
         y = (B0 + B1*X1 + B2*X1**2 )  *  
             (1 + B3*X2 + B4*X2**2)  *  
             (1 + B5*X3 + B6*X3**2)
             + rand("Normal", 0, 0.2);
         output;
      end;
   end;
end;
drop B0-B6;
run;

proc nlin data=Have method=marquardt;
   parms B0 0 
         B1 0
         B2 -1
         B3 0
         B4 -1
         B5 0
         B6 1;
   model Y = (B0 + B1*X1 + B2*X1**2 )  *  
             (1 + B3*X2 + B4*X2**2)  *  
             (1 + B5*X3 + B6*X3**2);
run;

Note well the error structure that I used for the simulated data. The errors are additive. 

Quentin
Super User

Thanks much @Rick_SAS , will read up on NLIN tonight.  I've used it once before, but I was spoon-fed the code from a statistician.  It is cool how you just write the model.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Rick_SAS
SAS Super FREQ

Glad to help. I have some prior experience with simulating data.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 907 views
  • 6 likes
  • 3 in conversation