That's a bit more clear.
> Prod2007=2

> Delta=c(4,3,5)

> Delta <- 1+Delta/100

> Series <- Prod2007+cumsum(Delta)
> Series
[1] 3.04 4.07 5.12

On Thu, Jun 3, 2010 at 1:21 PM, n.via...@libero.it <n.via...@libero.it>wrote:

> What I would like to do is for example:
> Suppose that I have the following value
>
> a)PROD(2006)=PROD(2007)/1+[DELTA_PROD(2007)]
> b)PROD(2005)=PROD(2006)+[1+DELTA_PROD(2006)]
> c)PROD(2004)=PROD(2005)+[1+DELTA_PROD(2005)]
>
>
> where prod(2007)=2
>
> DELTA_PROD(2007)=4
>
> DELTA_PROD(2006)=3
>
> DELTA_PROD(2005)=5
>
> so prod(2007) is like the starting value of production from wich starts the
> construction of its the time series. So:
>
> prod(2006)=2+[1+4/100] which is equal to 3.04
>
> so i will have:
>
> prod(2005)=3.04+ [1+3/100]
>
> and so on
>
>
>
>
>
>
>
> ----Messaggio originale----
> Da: jorism...@gmail.com
> Data: 03/06/2010 13.05
> A: "n.via...@libero.it"<n.via...@libero.it>
> Cc: <r-help@r-project.org>
> Ogg: Re: [R] function
>
>
> This is what you asked for.
>
> > Prod2007 <- 1:10
>
> > Prod2006 <- Prod2007/1+c(0,diff(Prod2007))
>
> > Prod2005 <- Prod2006+(1+c(0,diff(Prod2006)))
>
> > Prod2004 <- Prod2005+(1+c(0,diff(Prod2005)))
>
> > Prod2006
>  [1]  1  3  4  5  6  7  8  9 10 11
>
> > Prod2005
>  [1]  2  6  6  7  8  9 10 11 12 13
>
> > Prod2004
>  [1]  3 11  7  9 10 11 12 13 14 15
>
> Sure that's what you want?
>
> On Thu, Jun 3, 2010 at 12:30 PM, n.via...@libero.it <n.via...@libero.it>wrote:
>
>>
>> Dear list,
>> I would like to ask you a question. I'm trying to build  the time series'
>> production with the Divisia index. The final step would require to do the
>> following calculations:
>> a)PROD(2006)=PROD(2007)/1+[DELTA_PROD(2007)]
>> b)PROD(2005)=PROD(2006)+[1+DELTA_PROD(2006)]
>> c)PROD(2004)=PROD(2005)+[1+DELTA_PROD(2005)]
>> my question is how can I tell R to take the value generated in the
>> previous step (for example is the case of the produciton of 2005 that need
>> the value of the production of 2006) in order to generate the time series
>> production??
>> (PS:my data.frame is not set as a time series)
>> Thanks for your attention!!
>>
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Joris Meys
> Statistical Consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Applied mathematics, biometrics and process control
>
> Coupure Links 653
> B-9000 Gent
>
> tel : +32 9 264 59 87
> joris.m...@ugent.be
> -------------------------------
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>
>
>


-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to