From: Luis Torgo <ltorgo_at_liacc.up.pt>

Date: Thu 28 Apr 2005 - 00:41:35 EST

...

Date: Thu 28 Apr 2005 - 00:41:35 EST

Dear R-users,

I'm felling kind of blocked on a quite simple problem and I wonder if someone could give me a help with it.

My problem:

x[0] = 100 x[1] = (1+v[1])*x[0] x[2] = (1+v[2])*x[1]

...

i.e.

x[i] = (1+v[i])*x[i-1]

and x[0]=k

Given a set of v values I wanted to obtain the corresponding x values in an efficient way (i.e. without a for loop).

For instance, if x[0] = 100 and v = c(0.2,-0.1,0.05) then I would get x = c(120,108,113.4)

I'm almost sure the function filter() from package tseries is the key for getting these values but I'm really blocked.

Any help is much appreciated.

Luís Torgo

-- Luis Torgo FEP/LIACC, University of Porto Phone : (+351) 22 339 20 93 Machine Learning Group Fax : (+351) 22 339 20 99 R. de Ceuta, 118, 6o email : ltorgo@liacc.up.pt 4050-190 PORTO - PORTUGAL WWW : http://www.liacc.up.pt/~ltorgo ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Thu Apr 28 03:21:10 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:27 EST
*