| Date: | Tue, 19 Apr 2005 13:39:38 -0700 |
| Reply-To: | shiling99@YAHOO.COM |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | shiling99@YAHOO.COM |
| Organization: | http://groups.google.com |
| Subject: | non-linear estimation |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
I posted the following message of non-linear estimation about a
functional form that cannot be explicitly specified in Mar. 2005. I
found way to deal with it. The whole idea is to define the functional
form numericaly through Newton's method within proc model. Suppose you
have a function form as
y**2+(ax+b)=0, a, b are parameters,and you observe ys with some
errors. But soppose you don't know square root function or suppose that
you cannot use square root function. How do you estimate a, b?
You can define it numericaly with proc model as(standard Newton's
method)
*define yhat;
err=1e-4;
yhat=20;
do until (abs(f)<err);
j=2*yhat;
f=yhat**2-(a*x+b);
delta=-f/j;
yhat=yhat+delta;
end;
****************SAS sample code here************;
data t1;
do i = 1 to 500;
x=3*ranuni(123)+2;
y=sqrt(5*x+5)+rannor(123);
output;
end;
run;
title '*****results 1*****';
proc model data=t1;
parms a b;
y=sqrt(a*x+b);
fit y/ols;
run;
quit;
title '*****results 2*****';
proc model data=t1;
parms a b;
eq.one=y-sqrt(a*x+b);
fit one/ols;
run;
quit;
title '*****results 3*****';
proc model data=t1;
parms a b;
eq.one=y*y-(a*x+b);
fit one/ols;
run;
quit;
title '*****results 4*****';
proc model data=t1;
parms a b;
*define yhat;
err=1e-4;
yhat=20;
do until (abs(f)<err);
j=2*yhat;
f=yhat**2-(a*x+b);
delta=-f/j;
yhat=yhat+delta;
end;
eq.one=y-yhat;
fit one/ols collin;
run;
quit;
title '*****results 5*****';
proc nlp data=t1 vardef=n covariance=h pcov phes outest=est outall/*
OUTHESSIAN OUTJAC*/ ;
min e2;
parms a b;
err=1e-4;
yhat=20;
*define yhat;
do until (abs(f)<err);
j=2*yhat;
f=yhat**2-(a*x+b);
delta=-f/j;
yhat=yhat+delta;
end;
e2=(y-yhat)**2;
run;
shiling99@yahoo.com wrote:
> I have a highly non-linear equition needed to estimate. The equition
is
> solved from a stochastic dynamic programming. Here is the problem.
>
> I need to estimate parameters
>
> min sum over(i) (y(i)-yhat(i))**2
> s.t. F(yhat(i),x(i);thetas)=0
>
> where y(i) is endogenous var and x(i) is exogenous var.
>
> If yhat could be explicitly expressed as a function x(i) and
> parameters, then a usual model procedure would do it. But yhat CANNOT
> be explicitly expressed as a function x(i) and parameters.
>
> Question 1) Any trick I can play with proc model.
> 2) Any other procedures I can levelage (NLP/OR/IML)
>
> TIA.
|