[R] as.function parameters

jackl jackspam at hotmail.de
Thu May 17 12:30:04 CEST 2012


Hi..

Ok here is an example on how I wanted the tree to be implemented in R:

-  the tree is, as you wrote, saved as a list of different tree levels
- each tree level is also saved as a list of different nodes in that
specific level
- and for the last part, each node is then saved as a list of functions

example:
tree <- list(root, lvl1, lvl2)
root <- list(node00)
lvl1 <- list(node10, node11)
lvl2 <- list(node20, node21, node22)

node00 <- list(f1,f2,f3)
node10 <- list(f1,f2,f3)
node11 <- list(f1,f2,f3)
..

note: I wrote f1, f2 and f3 in each node because it is the same function,
just with the different parameter, the stock price at that node.

I tried implementing a tree manually and I found out that the
independences between one node and each childnode cause a
heavy computation power.. (the function f3 contains f3 of the
two childnodes and so on..)
example:
node11$f3 <- max(node11$f2, node21$f3, node22$f3)

Im facing this problem even with a tree with 'only' 4-5 layers.. 

best thanks for any answers

--
View this message in context: http://r.789695.n4.nabble.com/as-function-parameters-tp4620390p4630353.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list