Displaying 1 result from an estimated 1 matches for "delta_calc".
2010 Mar 16
0
recursive term
...91966 10.091279
Then I wrote this the following code:
term <- function(i, lamda, lamda_m)
{sum(sapply(lamda, function(lamda, lamda_m,i) ((1-lamda_m/lamda)^i), lamda_m, i))}
sm <- sapply(1:N, term, lamda, lamda_m);sm
#now calculate the deltas
k1 <- 3+1
delta <- rep(1, k1);delta
delta_calc <- function(k1, delta, sm, alp)
{ k <- k1-1
alp/k*sum(sapply(1:k, function(i, delta, sm, k1) (sm[i]*delta[k1-i]), delta, sm, k1))
}
delta[2:k1] <- sapply(2:k1, delta_calc, delta, sm, alp);delta[2:k1]
> delta[2:k1] <- sapply(2:k1, delta_calc, delta, sm, alp);delta[2:k1]
[1] 3.2247...