笑雪-STePhaNie's profileLittleZ Blog 小Z也有部落格PhotosBlogListsMore ![]() | Help |
|
December 01 First Indepent Code!1st independent work of coding, ever!
i am so happy after spending 10+ hr working on a iteration function---I finally worked it out!
First of all, i gotta admit that I've got no talent in computer programming.
For those Com-Sci people, pls don't laugh at me although the following might just seem to be a little piece of cake.
But for me, it's like a milestone. \clap/\clap/!!!
Now, here it comes... Panjer's Recursive Method:
panjer = function (k){
a=0 b=20 lambda=5 if (k==0) exp(20*(dpois(0,lambda)-1)) else { g = numeric(0) g[1]= exp(20*(dpois(0,lambda)-1)) p=1/(1-a*dpois(0,lambda)) for (i in 1:k){ q=(a+b*(1:k)/i)*dpois((1:k),lambda) g[i+1]=p*sum((q[1:i]*g[i:1])) } g[i+1] } } panjer(0);panjer(1);panjer(2);panjer(3) panjer(100) from Dec. 18-20, i'm gonna modify this function; make it capable to estimate the probabilty of ruin; and compare the probabilities of ruin under different policies.
Now, i can go to DR. Jones' house to party--theme tonight: cowboy, and do some line-dancing!
i am sure we will have some "fun before the finals"!!! |
|
|