[R] question concerning the acf function

Jean-Christophe BOUËTTÉ jcbouette at gmail.com
Fri Sep 16 17:31:10 CEST 2011


Hi Samir,
to me, autocorrelation is the cross-correlation of a signal with
itself. Which is why I don't really understand the meaning of your
question.
Are you looking for cross-correlation, for example the ccf function
documented in the same help page as acf ?

JC


2011/9/16 Samir Benzerfa <benzerfa at gmx.ch>:
> Below you can see a sample of my data.
>
> I learned that I can calculate the autocorrelation of such time series by
> using the function acf(Stock A) or pacf(Stock A) and the same for the other
> stocks. What I would like to do, is to calculate the overall autocorrelation
> in the whole set (so for all stocks together).
>
> Any ideas?
>
> Thanks,
> SB
>
>
> Date    Stock A         Stock B
> 01.01.1980      0                       0
> 02.01.1980      0                       0
> 03.01.1980      0.002149977             0
> 04.01.1980      -0.002149977    0.003966489
> 07.01.1980      0                       0
> 08.01.1980      0.007478811             0
> 09.01.1980      0.007352198             0.00393059
> 10.01.1980      0.003113235             0.009673601
> 11.01.1980      -0.008352074    -0.003843623
> 14.01.1980      0                       0
> 15.01.1980      -0.006371182    -0.009760568
> 16.01.1980      0.007424018             0.00393059
> 17.01.1980      0.007299239             0.001952035
> 18.01.1980      -0.008352074    -0.001952035
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Jean-Christophe BOUËTTÉ [mailto:jcbouette at gmail.com]
> Gesendet: Freitag, 16. September 2011 15:20
> An: Samir Benzerfa
> Cc: r-help at r-project.org
> Betreff: Re: [R] question concerning the acf function
>
> Hi,
> you did not supply a reproducible example. We do not know what your
> data nor your code looks like.
> Please follow the recommandations found at the bottom of this email!
> You're more likely to get a quick and meaningful reply.
> JC
>
> 2011/9/16 Samir Benzerfa <benzerfa at gmx.ch>:
>> Hi everyone,
>>
>>
>>
>> I've got a question concerning the function acf(.) in R for calculating
> the
>> autocorrelation in my data.
>>
>>
>>
>> I have a table with daily returns of several stocks over time and I would
>> like to calculate the autocorrelation for all the series (not only for one
>> time series). How can I do this?
>>
>> After that I want to apply an autoregressive model based on the estimated
>> lag in the data and finally extract the residuals for further
> calculations.
>>
>>
>>
>> Many thanks & best regards
>>
>> Benzerfa
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at 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.
>
>



More information about the R-help mailing list