Skip to content
Prev 314100 / 398503 Next

creating a function

Hello,

If I understand it correctly, a simple change to my previous code will 
do. I have also change the name of function 'x' to 'FUN', to make it 
more readable.

Yfun <- function(Y, p, FUN, epsilon){
     for (i in 2:length(Y)) {
         Y[i] <- Y[i-1] + (1/p)*sum(FUN(Y[1:(i-1)])) + epsilon[i]
     }
     Y
}


Hope this helps,

Rui Barradas
Em 23-12-2012 08:39, Simone Gogna escreveu: