turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Estimation of nonnegative parameters

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2016 01:18 AM

**Dear SAS experts,**

**I would like to estimate nonnegative parameters of a nonlinear function. **

** **

**The original nonlinear function is:**

**Q = alpha*exp(rho*T)*(K^beta1)*(L^beta2)*(E^beta3)**

**alpha, rho, beta1, beta2, beta3 > 0**

**beta1+beta2+beta3 = 1**

**I attached a data file (ChinaQ). These data are log data. **

**I coded SAS, but it does not work. I would like to know how to estimate parameters for the nonlinear function with some restrictions of nonnegative parameters (i.e. beta1+beta2+beta3 = 1).**

**Thank you very much for your help in advance. **

**proc** **nlp** data=chinaQ;

parms alpha rho beta1 beta2 beta3;

bounds alpha rho beta1 beta2 beta3 >= **0**;

model Q = log (alpha) + rho*T + beta1*K + beta2*L + (**1**-beta1-beta2)*E;

**run**;

Sincerely yours,

J1

Accepted Solutions

Solution

08-30-2016
08:34 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-29-2016 03:57 AM

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2016 08:44 AM

Your program statements are calling PROC NLP in SAS/OR software, which is for nonlinear optimization. However, based on the syntax I think you meant to call PROC NLIN, which is for fitting nonlinear regression models.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2016 08:57 AM

Thank you very much for your commment.

I ran SAS based on your comment "NLIN". But I got this message below.

ERROR 22-322: Syntax error, expecting one of the following: a numeric constant,

a datetime constant, -, :, =.

ERROR 76-322: Syntax error, statement will be ignored.

84 bounds alpha rho beta1 beta2 beta3 >= 0;

85 model Q = log (alpha) + rho*T + beta1*K + beta2*L + (1-beta1-beta2)*E;

86 run;

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE NLIN used (Total process time):

real time 0.01 seconds

cpu time 0.00 seconds

I think my coding is not correct.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2016 09:20 AM

Yes. In my response there is a hyperlink to the documentation for PROC NLIN. Click on it and read about the syntax for the statements that you are trying to use.

For example, in the doc for the PARMS statement, the first sentence says

*"A PARAMETERS (or PARMS) statement is required. The purpose of this statement is to provide starting values for the NLIN procedure. ...*

*All parameters must be assigned starting values through the PARAMETERS statement. The NLIN procedure does not assign default starting values to parameters in your model."*

Another issue: beta3 is not a parameter in your model. Since you don't need to estimate it, remove it from all statements.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 06:10 AM

Dear Rick,

Thank you very much for your last comments. I eventuallygot parameter values due to your comments.

I have another model for a nonlinear function. But I have no data for an independent variable (i.e. Utility function). In this case, I would like to know how to estimate X1, X2, X3, X4 with standard errors. This model has many restrictions for parameters.

Sincerely yours,

J1

**Parameters:** X1, X2, X3, X4

**Dependent variable:** U

**Independent variables:** C, M, G, T

**Model:** U = (1/X1)*(C*M^X2*(380/G)^X3)^X1*exp(-X4*T)

**Restriction for parameters:**

X2, X3>0;

-infinity < X1 <1;

X1*(X2+X3) < 1;

X1*(1+X2+X3) < 1

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 06:35 AM

Your statement does not make sense. Without data all you have is a parametrized mathematical function for U as a function of X1,X2,X3,X4 on a constrained domain. What do you want to do with this function?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 06:47 AM

Dear Rick,

There is no data for utility function in Economics.

I know some scholars use the Quasi-FIML (quasi-full-information-maximum-likelihood) to estimate parameter values for the utility function, but they use very special program.

I guess that there are some ways to estimate parameter values for the utlity function using SAS.

If you have any idea to estimate parameter values for the utility function, then please let me know.

Thank you very much for your comments.

Sincerley yours,

J1

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 07:43 AM

I am not an econometrician, so please try to express your questions in terms of mathematical quantities.

From your conversation with KSharp, it sounds like you might want to find the optimum value of this function over the contrained domain. You can do that if you have specific values of the parameters, but not if the parameters are unspecified.

If you want to discuss how to find optima of a constrained function of four variables, please post a new question. Also tell us what SAS products you have licensed. Usually people use SAS/OR or SAS/IML to perform nonlinear optimization.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2016 09:35 AM

You should post it at IML forum, since it is about nonlinear optimization problem. proc iml; start function(x) global(T,K,L,E,Q); obj=abs( log(x[1]) + x[2]*T + x[3]*K + x[4]*L + x[5]*E - log(Q) ); return (obj); finish; con={0 0 0 0 0 . ., . . . . . . ., 0 0 1 1 1 0 1 }; x=j(1,5,4); optn={0 3}; T=1/2; K=1/4; L=2; E=3; Q=8; call nlpcg(xres,rc,"function",x,optn,con); quit; OUTPUT: Optimization Start Parameter Estimates N Parameter Estimate Gradient Objective Function Lower Bound Constraint Upper Bound Constraint 1 X1 4.000000 0.250000 0 . 2 X2 4.000000 0.500000 0 . 3 X3 0.333333 0.250000 0 . 4 X4 0.333333 2.000000 0 . 5 X5 0.333333 3.000000 0 . Value of Objective Function = 3.0568528194

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2016 09:43 AM

Once you got Object value ~ 0, you can say you got what you want. OUTPUT: Optimization Results Parameter Estimates N Parameter Estimate Gradient Objective Function 1 X1 3.535421 0.277617 2 X2 0.002152 0.476309 3 X3 0.794348 0.236768 4 X4 0.000008818 1.976258 5 X5 0.205643 2.980308 Value of Objective Function = 1.768923E-10

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 03:26 AM

**Dear Xia Keshan**

**Thank you very much for your comments. **

**I have several questions about your coding.**

**Can you explain what this coding means?**

con={**0** **0** **0** **0** **0** **.** **.**,

**.** **.** **.** **.** **.** **.** **.**,

**0** **0** **1** **1** **1** **0** **1** };

x=j(**1**,**5**,**4**);

optn={**0** **3**};

**I would like to know these values below. Are there average values of my data?**

** **

T=**1**/**2**;

K=**1**/**4**;

L=**2**;

E=**2**;

Q=**6**;

**I would like to know how to estimate the parameters of a nonlinear function with STANDARD ERRORS. Do you have any idea to get standard error?**

**I have another model for a nonlinear function. But I have no data for an independent variable (i.e. U). In this case, I would like to know how to estimate X1, X2, X3, X4 with standard errors. This model has many restrictions for parameters. I also would like to know how to add these restrictions in the coding. I added my coding below. Please see this. Thank you very much in advance.**

** **

**Sincerely yours,**

**J1**

**Parameters**: X1, X2, X3, X4

**Dependent variable:** U

**Independent variables:** C, M, G, T

**Model:** U = (1/X1)*(C*M^X2*(380/G)^X3)^X1*exp(-X4*T)

**Restriction for parameters:**

X2, X3>0;

-infinity < X1 <1;

X1*(X2+X3) < 1;

X1*(1+X2+X3) < 1

**Coding is:**

proc iml;

start function(x) global(C,M,G,T,U);

obj=abs( log(1/x[1]) + x[1]*C + x[1]*x[2]*M + x[1]*x[3]*(log(380)-G) + x[4]*T - U);

return (obj);

finish;

con={0 0 0 0 0 . .,

. . . . . . .,

0 0 1 1 1 0 1 };

x=j(1,5,4);

optn={0 3};

C=1/2;

M=1/4;

G=2;

T=1/2;

U=8;

call nlpcg(xres,rc,"function",x,optn,con);

quit;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 03:58 AM

I misunderstand your question. If you want estimate parameter like PROC REG+RESTRICT statement , then my code is not appropriated . @Rick point you right way .

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 04:18 AM

Dear Xia Keshan,

Thank you very much for your comments. I would like to know how to estimate parameter values when there is no data about the value of a dependent variable (e.g. utility function). I guess that your coding is appropriate, but I would like to know your opinion. Also, I would like to know if your coding can get the standard error or not. If your coding is appropriate, then please see my second model in the previous response.

Sincerely yours,

J1

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 05:11 AM

No. My code would get you standard error. I don't think you can build a model without a dependent variable. There is URL that you might be interested in .Especial for comment in it. http://blogs.sas.com/content/iml/2015/06/08/fit-circle.html

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2016 05:37 AM

Ha. I think the following code from the comment of URL could give you both parameter estimate and standard error. *--- SAS/STAT ---; proc nlin data=circle converge=1e-6; parms x0 = 0, y0 = 0, R = 1; bounds R >= 0; delta = ( (x - x0)**2 + (y - y0)**2 - R**2 ) **2; model zero = delta; run; zero is a column of 0's to satisfy nlin syntax. Cheers. I could get it too by IML code, but that would lead to many code . Enjoy PROC NLIN .