R Studio: Analysis of data of stocks in SP500 -- 2


A reproducible code in R + a short .pdf report with commented tables and graphs. The two files should be named STUDENT1ID STUDENT2ID.R and STU- DENT1ID [login to view URL], where STUDENT1ID and STUDENT2ID are student IDs of the members of the group. The files should be uploaded to a designated area in the [login to view URL] website.

Project Description:

Analysis of data of stocks in SP500. Your tasks are the following.

1. Get the data. First, you should set your individual first and the last date for your

data analysis. This is done by

[login to view URL](STUDENT1ID)

[login to view URL] <- [login to view URL]("2018-03-31") - 365 - sample(1:20,1)

[login to view URL](STUDENT2ID)

[login to view URL] <- [login to view URL]("2018-03-31") + sample(1:20,1)

One possible way to get the data is from the R library BatchGetSymbols and run the following code:


[login to view URL] <- GetSP500Stocks()

tickers <- [login to view URL]$tickers

[login to view URL] <- BatchGetSymbols(tickers = tickers,

[login to view URL] = [login to view URL],

[login to view URL] = [login to view URL]) The object [login to view URL] has now the data for SP500 stocks.

Another possibility is to use a package library(pdfetch) and get the selected data (adjusted close for individual stocks) by calling

yahoo <- pdfetch_YAHOO(tickers, fields = "adjclose",

from=[login to view URL], to = [login to view URL])

2. We are interested just in the adjusted closing price value. Organize the data in a table, where rows represent the dates and columns represent the individual stocks. The first column should be the date, the following columns should have a name that correspond to the tickers. It helps that you may get the data using two alternative procedures (and compare the resulting two tables). Clean the data (address missing values if any) and make sure that each entry in the table corresponds to the correct date and the correct ticker. Note that some data entries may be missed in download, or the dates may not be 100% consistent for all tickers. As a part of the exercise, save the corresponding table in a .csv file.

3. Perform a basic mean - variance analysis. From the table of the closing prices, create a table representing log returns. Avoid the use of for loops. Instead, apply vector operations (such as log, diff, apply). Compute the averages and standard deviations for each stock. Properly treat any missing values. Plot a frequency histogram for the averages with a density fit. Add a fit based on normal distribution. Do the same for the standard deviations. Run a command summary on both the vector of the averages and the vector of standard deviations. Plot a graph on (x, y) axis with points representing the standard deviation x and the average y for each stock. Add a ticker name to each point (this can be done by a command textxy from library(calibrate)).

4. Perform a basic CAPM analysis for each stock in your SP500 data. For each stock, run regression lm(y ⇠ x), where y is a vector of returns of a given stock and x is a vector of returns of a given benchmark, in our case the SP500 index. This means in particular that you need to get the values of the index itself (ticker bGSPC) and compute its returns. Make sure that the dates of the returns are consistent, otherwise the data would be shifted and the entire analysis would give irrelevant results. Store the resulting coe cients representing ↵ and for each stock together with the P- value corresponding to the coe cient ↵. Plot the histogram of the vector of betas with the density fit and the fit based on a normal distribution. Identify the stocks at both extremes, the ones with the smallest and the largest betas. Plot the histogram of the vector of alphas with the density fit. Identify the stocks with statistically significant alphas (from the corresponding P-values). Lastly, choose one stock that you find interesting, and plot the joint returns of the stock and the index together with the corresponding regression line.

Kemahiran: Econometrics, Bahasa Pengaturcaraan R, Analisis Statistik, Statistik

Lihat lagi: s&p 500, time series analysis example, R,machine learning,statistical modelling,predictive analysis,data analysis,speech,image recognition,deep neural network, R,machine learning,statistical modelling,predictive analysis,data analysis,speech,image recognition,, R,machine learning,statistical modelling,predictive analysis,data analysis,speech, R,machine learning,statistical modelling,predictive analysis,data analysis, data analysis excel stocks, analysis data done qualitative research, mysql tick data stocks, visual studio listen data, presentation analysis data, html output xml file data, research training market analysis data, conjoint analysis data entry excel, can find beta data stocks, technical analysis data, useful statistical tool analysis data questionnaire

Tentang Majikan:
( 0 ulasan ) Germany

ID Projek: #16947168

Dianugerahkan kepada:


We are a team of industrial and mechanical engineers. We had done more complex finance projects (such as implementing a research article) and we are already working on implementation of HMM and random forest algorithms Lagi

€150 EUR dalam 3 hari
(4 Ulasan)

13 pekerja bebas membida secara purata €135 untuk pekerjaan ini


Hello, I can help with you in your project R Studio: Analysis of data of stocks in SP500. I have more than 5 years of experience in Econometrics, R Programming Language, Statistical Analysis, Statistics . We have w Lagi

€250 EUR dalam 3 hari
(19 Ulasan)
€155 EUR dalam 10 hari
(45 Ulasan)

I read the whole description, thank you first for the clarity of specification. You can visit my profile and note that all the projects I've done were using R. I can do it, but it will be costly that's why I bid with t Lagi

€250 EUR dalam 5 hari
(9 Ulasan)

I have Masters degree in Economics and Statistics. I also have 5 years of professional experience working as a Quantitative Analyst (in the field of Statistics). As a part of the firm I have handled large datasets usin Lagi

€30 EUR dalam sehari
(3 Ulasan)

As an engineer in statistics and applied economics as well as a technician specializing in office computing (Microsoft Office MOS Diploma), I am able, available and ready to do this kind of work easily and quickly and Lagi

€130 EUR dalam 3 hari
(5 Ulasan)

A proposal has not yet been provided

€88 EUR dalam 5 hari
(1 Ulasan)

Hi, I'm familiarized with R studio analysis. I read the project content and it looks intereseting. I only need data and project instruction/details to start working on it. Regards.

€133 EUR dalam 7 hari
(2 Ulasan)

Hi, bro I am a well-experienced and talented full-stack R developer. I have rich experiences with this kind of Statistic analysis project. I can get started my work right away. I hope your kind contact to discuss Lagi

€120 EUR dalam 3 hari
(1 Ulasan)

A proposal has not yet been provided

€88 EUR dalam 4 hari
(1 Ulasan)

Hi, I can do this work. Individual and hard working person done your work accurately. Waiting your response. Always I do my best & fast with on time delivery for my all clients. Please tell me what you need and how Lagi

€150 EUR dalam 3 hari
(0 Ulasan)

Hi i am saprative I specialize in designing and architecture high traffic website using django. I have extensive experience in developing django based apps.I did work on Some mechanic learning and BI projects I will Lagi

€155 EUR dalam 3 hari
(0 Ulasan)

A proposal has not yet been provided

€55 EUR dalam 4 hari
(0 Ulasan)