[R] How to solve this nonlinear regression problem?

tedzzx zengzhenxing at gmail.com
Mon Nov 17 16:16:31 CET 2008


Hi,all

I am doing a nonlinear regression and I am going to use nls.
To Minimize:sum{(Y-BS(s,x,r,t,v)) ^2}

a<-nls(Y~BS(s,x,r,t,v))
 
BS is the black-scholes model. 
BS<-function(s,x,r,t,v){
d1=(ln(s/x)+v^2*t/2)/(v*t^(0.5))
d2=(ln(s/x)-v^2*t/2)/(v*t^(0.5))
c=e^(rt)*(s*N(d1)-x*N(d2))
}
 
where s,x,r,t are known numbers
But v is dertermined by a linear regression:
ln(v)=a0+a1*n+a2*n^2
 
a0,a1 and a2 are the ones to be estimated.
 
How can write the code for these nonlinear regression?
 
thanks

Ted
-- 
View this message in context: http://www.nabble.com/How-to-solve-this-nonlinear-regression-problem--tp20541306p20541306.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list