[R] R object as a function

Thomas Steiner finbref.2006 at gmail.com
Tue Jan 22 17:07:42 CET 2008


Dear Duncan,

thanks a lot for your answer. I was think a was distracted by the FED
rate cut ;)
Now it works.
Have a nice day
Thomas

myfun1<-function(x,pa) {
  return(pa[1]*x^2+pa[2]*x+pa[3])
}
myfun2<-function(x,param,myfunk1,pa) {
  return(param[1]*myfunk1(x,pa)+param[2]*myfunk1(-x,pa))
}
test<-function(pars1,pars2,lo,up){
  integ=integrate(f=myfun2,lower=lo,upper=up,param=pars2,myfunk1=myfun1,pa=pars1)
  return( integ$value )
}
test(pars1=c(1,2,3),pars2=c(-1,0),lo=1,up=7)



More information about the R-help mailing list