Displaying 1 result from an estimated 1 matches for "lossdistribution".
Did you mean:
loopdistribution
2005 Dec 10
2
Problems with integrate
...1*fd(K,Beta))*fd(K,Beta)+alpha20*fd2(K,Beta))
}
Beta needs to be passed in as a function:
Beta<-splinefun(c(.03,.06,.09,.12,.22,.6),c(.117,.248,.35,.426,.603,1),method="natural")
Now, when I try out lossdensity, it works fine:
> lossdensity(.02,Beta,.4)
[1] 0.1444915
I defined lossdistribution as:
lossdistribution<-function(p,Beta,R=0.4){
integrate(function(x)lossdensity(x,Beta,R),0.0000000000001,p)}
But this gives a weird error:
> lossdistribution(0.1,Beta)
Error in "[<-"(`*tmp*`, k, i, value = c(4.29850518211428, 0, 0, 0, 0, :
number of items to replace...