Vous êtes sur la page 1sur 3

---

title: "FINC621 Winter 2018-19 Lab Worksheet 01"
author: "Your Name Here"
date: "Add Date Here"
output:
html_document: default
html_notebook: default
subtitle: Exploration of R in Finance (finc621-lab01)
---

### About

This worksheet is your warm-up exercises to getting started with some R for
finance, based on examples from the book. It is also your getting started with
problems solving (no R required) and expressing your methods/answers using proper
mathematical symbols and representations.

### Setup

Remember to always set your working directory to the source file location. Go to
'Session', scroll down to 'Set Working Directory', and click 'To Source File
Location'. Read carefully the below and follow the instructions to complete the
tasks and answer any questions. Submit your work to RPubs as detailed in previous
notes.

### Note

For clarity, tasks/questions to be completed/answered are highlighted in red color
(color visible only in preview mode) and numbered according to their particular
placement in the task section. Type your answers outside the red color tags!

Quite often you will need to add your own code chunk. Execute sequentially all code
chunks, preview, publish, and submit link on Sakai following the naming convention.
Make sure to add comments to your code where appropriate. Use own language!

**Any sign of plagiarism, will result in dissmissal of work!**

--------------

### Task 1: Charting Stock Time Series

This task follows the book's R Example 1.1/p. 8 also exhibited in the R-Labs
section R Labs1 from the book’s website (*). In order to work with R in finance we
need to first install the package `quantmod` that allows us to retrieve financial
data and conduct various statistical analysis.

```{r}
# Require will load the package only if not installed
# Dependencies = TRUE makes sure that dependencies are install
if(!require("quantmod",quietly = TRUE))
install.packages("quantmod",dependencies = TRUE, repos = "https://cloud.r-
project.org")
```

<span style="color:red">
##### 1A) Insert in the code chunk below the rest of the code to calculate and
chart the time series for stock GE. Follow the example in the book. Add comments,
where appropriate, explaining what the particular line(s) of code is/are

take a clear image capture of your work and include here. Hard to read work will be dismissed. </span> To add math symbols in R Markdown check the link [MathinRmd.png) ### Task 3: Problem(s) Solving This task does not require use of R code. You will however need to type your work here. Other.8 Problem/p.calvin. less preferred options. <span style="color:red"> ##### 3A) Solve for 1. to describe the formula being calculated and plotted in the code </span> <span style="color:red"> ##### 2C) Write a paragraph. using proper mathematical symbols and representations. </span> . and four other stocks of your choice over a time period dating back one year from present date. It is assumed that the image resides in the same folder as the worksheet.html] ( https://www. and pertinent econonomical factors.3.edu/~rpruim/courses/s341/S17/from-class/MathinRmd. ![Caption Here](img01. 34 also R Labs 1 from the book’s website (*). using proper math symbols. Many other examples are on Google. or include a clear image capture of your work. </span> <span style="color:red"> ##### 2B) Write the mathematical form/representation. Below is an example on how to include an image. Otherwise the path to the folder where the image resides needs to be included in the name referencing below.executing/solving for. </span> ```{r} ##retrieve historical price data for General Electric Co. from Yahoo Finance getSymbols('GE'. 36. from="2000-01-01".4 R Lab/p. to="2009-12-30") ##to see headers of file (OHLCV type) names(GE) ``` ### Task 2: Comparing Performance of Stocks Time Series This follows the book’s example 1. in your own words.3. is to neatly handwrite your equations on a paper or use own preferred tools like Microsoft Word. Following is an example: $\sum_{n=1}^{10} n^2$.html).src='yahoo'. comparing the stock performances based on your assessment of the companies general business and their valuation vis- a-vis the market overall performance. <span style="color:red"> ##### 2A) Insert the code chunk to chart instead the performance of Value Line Index VLIC (sort of benchmark).

36 </span> *[http://computationalfinance.upc.lsi.upc.lsi.edu) .<span style="color:red"> ##### 3B) Solve for 1.edu ] (http://computationalfinance.9 Problem/p.3.