BookmarkSubscribeRSS Feed
HAHN1989
Calcite | Level 5

Dear All,

I want to estimate the following f"ixed" equation; y = a*(b + c + f + g) + a with new coefficients;

Where Y is the depend variable, a is a dummy variable and b, c, f and g are the independent variables.

I have tried the following code without success. The old coefficients are  a=0.3 b=10 c=0.1 f=7 g=18.  

proc nlin data=work1;

parms a=0.3 b=10 c=0.1 f=7 g=18;

ods output ParameterEstimates=select;

model salt_tons= a*(b + c + f + g) + a;

run;

 

Any suggestions or help

 

Best regards.

 

 

7 REPLIES 7
PeterClemmensen
Tourmaline | Level 20

Define "Without Success". What went wrong? And what did you expect? 

HAHN1989
Calcite | Level 5

Re estimating the "fixed" equation with new coefficients for the independent variables.

 

The old coefficients fits to an old dataset, and the task is to re estimate the coefficients given a new dataset with the same "old" equation.

 

The SAS code did 'nt re estimate the independent variables coefficients, maybe the code or generel approach is 'nt correct for re estimating  a given equations.  

 

 

PGStats
Opal | Level 21

Please post the LOG from the execution of the above code.

PG
FreelanceReinh
Jade | Level 19

Hello @HAHN1989 (and welcome to the SAS Support Communities :-)),

 

Your PARMS statement specifies that a, b, c, f and g are coefficients to be estimated in order to fit the model to the data. But your equation leaves room for only one variable in "the data": y (or really salt_tons). In the absence of any "x" variables the best fit (in the sense of least squares) would be a solution where a*(b + c + f + g) + a equals the mean of salt_tons. This is exactly what PROC NLIN did when I applied your code to random data. Only parameter a was modified to achieve that almost trivial goal. Obviously, the solution is anything, but unique. b=c=f=g=0 and a=mean(salt_tons) would fit equally "well."

 

So, you need to introduce independent variables from your input dataset work1 into the model equation (factors suitable for predicting salt_tons) and these must not be mentioned in the PARMS statement.

HAHN1989
Calcite | Level 5

Thank you very much for your answer.

 

The model I am intended to describe is the relation between used tons salt on highroads (winter), where the depended variabel Y = used salt, a (dummy- snow or not), b = how many times the road temperatur is below 0, C = equals the temperatur, f= snow below zero degrees and g=  smooth roads.

 

Following the equation -->  y= a*(b + c + f + g) + a.

 

But after some reading, the proc model statement seems more convenient?

proc model data=work1;

parms a b c f g f;

salt_tons=a*(b + c + f + g) + a;  

fit "Salt_tons";

run;

 

But the following code doens't return any meaningful estimates, is the formular correct (expression)?

 

Kind regards

 

 

FreelanceReinh
Jade | Level 19

PROC MODEL is part of SAS/ETS, which I haven't licensed and never used. But its documentation Nonlinear Regression Analysis is consistent with the point I tried to make in my previous post: If there is a non-trivial functional relationship between a dependent variable y (here: salt_tons) and explanatory variables x1, x2, ... such as temperature in your case, the right side of the (mathematical) model equation must contain both the explanatory variables (dummy variables in the case of categorical xi)  and parameters to be estimated (like c in a linear regression model Y=cx+e). You need to distinguish between these two. See also Nonlinear or Linear Model in PROC NLIN documentation.

PGStats
Opal | Level 21

It looks like you need a different model equation. Contrary to the syntax of linear model fitting procedures, the parameters in proc nlin must be explicitly named and included in the model equation. You would need something like:

 

proc nlin data=work1;
parms xa=0.3 xb=10 xc=0.1 xf=7 xg=18 x0=0;
model salt_tons= a*xa*(b*xb + c*xc + f*xf + g*xg) + a*x0;
ods output ParameterEstimates=select;
run; 

where xa, xb, xc, xf, xg, and x0 are the unknown parameters and a, b, c, f, and g are your observed variables.

PG

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 799 views
  • 1 like
  • 4 in conversation