[R] R-help mailing list

Sarah Goslee sarah.goslee at gmail.com
Thu Dec 3 23:33:05 CET 2015


You need to start with a basic understanding of how R works. Here are
a couple of sources that might help you get started:
http://www.burns-stat.com/documents/tutorials/impatient-r/
http://cyclismo.org/tutorial/R/

Sarah

On Thu, Dec 3, 2015 at 4:51 PM, Saba Sehrish via R-help
<r-help at r-project.org> wrote:
> Hi
>
>
>
> I am a PhD student and I want to learn how to run Linear regression with Lag-5 on R through "For Loop". Please find the details below:
>
>
>
> 1-            I need guidance about Coding/ Programming for Simple Linear Regression with Lag-5 on R.
>
> 2-           I have time series data of “Daily Returns” of 15 stocks and I want to see how each stock’sreturn is connected to all other stocks’ returns. This means, I have to runregression as follows:
>
>
>
>                     a) Impact of Stock 1’s return on return of Stock 2. Impact of Stock 1’s return onreturn of Stock 3. Impact of Stock 1’s return on return of Stock 4 ……… tillreturn of Stock 15.                    b) Then, Impact of Stock 2’s return on return of Stock 1. Impact of Stock 2’sreturn on return of Stock 3. Impact of Stock 2’s return on return of Stock 4……… till return of Stock 15. And this will continue till Stock 15, one after another.                    c)  As the the process will have to be repeated, therefore instead of manual coding everytime, “For Loop” is required.
>
>
>
>
> I shall bereally grateful for a detailed reply.
>
>
>
> Thanks.
>
>
>
> Regards
>
> Saba Sehrish
>



More information about the R-help mailing list