Re: [R] as.function parameters

2012-05-29 Thread jackl
Hi there, ~ sry for the late answer.. and thanks for the advice. i'm using a different approach than the CRR model because i'm implementing a pricing algorithm for american options with transaction costs. i'm not sure if i should close this thread for now, because right now i'm trying to do a d

Re: [R] as.function parameters

2012-05-22 Thread R. Michael Weylandt
Jumping in from a finance perspective... You really don't want to actually use nested lists for this -- the overhead and index-book-keeping will quickly become quite annoying. Instead use a 2D array (I assume you're using the CRR Binomial Tree model for an American Option) where the column number

Re: [R] as.function parameters

2012-05-22 Thread jackl
Hi there, ~ the 'problem' or rather the task I'm trying to solve is to implement an algorithm to compute the ask/bid price of american options in a close to R related program language. because i'm not really using R but just it's basic functionalities I cannot rely on different packages include

Re: [R] as.function parameters

2012-05-17 Thread Jason Edgecombe
On 05/17/2012 06:30 AM, jackl wrote: 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, ea

Re: [R] as.function parameters

2012-05-17 Thread jackl
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 func

Re: [R] as.function parameters

2012-05-14 Thread David Winsemius
On May 14, 2012, at 1:56 PM, jackl wrote: Hi, ~ well that seems to be a better solution. Question is how much an enviroment for each node costs in terms of save space.. Seems unlike that it would expand you space very much. Every function you create will have an environment. The exampl

Re: [R] as.function parameters

2012-05-14 Thread jackl
Hi, ~ well that seems to be a better solution. Question is how much an enviroment for each node costs in terms of save space.. The example code is hard to present, because it is really based on that problem. The frame of the problem is, that I have to write a program that gives each node in a b

Re: [R] as.function parameters

2012-05-11 Thread Rui Barradas
Hello, I'm not completely sure if I understand, but maybe using environments. If each function copy in the list has a different environment, you can set the parameters values in that environment. Something like f <- as.function(alist(y=,x=tmp,y+x)) env <- list( e1=new.env(), e2=

Re: [R] as.function parameters

2012-05-11 Thread jackl
Thanks for the fast answer.. The problem with your "free" definition of f is, that it does not really fit my task. I have to build a tree where each node contains the same function just with adjusted parameters. Setting the parameters in the function call is not really an option. Is there anothe

Re: [R] as.function parameters

2012-05-09 Thread Rui Barradas
Hello, > > Is there a way to force a call-by-value instead of a call-by-address? > Yes, there is one way, just do nothing. R always uses call-by-value. I'm not completely sure about this, but when you create f() the parameter x default value is a promise, not an actual, evaluated value. Courtesy

[R] as.function parameters

2012-05-09 Thread jackl
Hi, i have a question regarding the as.function functionality. I need to save multiple functions with adjusted parameters in a list. The adjusted parameters are changed via variables in a loop. The problem I'm facing right now is that the functions saved in the list don't have the values of the pa