Due by 10/9/2016.
Complete exercises and replicate outputs. Note that only PDF and HTML formats will be accepted. All R code you used to generate figures should be included in the document.
There are plenty of options for creating PDF documents with inline R code such as knitr, sweave, sense.io, jupyter, Anaconda cloud or simply save the plots as .png images and add them manually to your document together with R code.
Your output can be stylistically different from the outputs below (e.g. vectors or matrices will show up with row/column numbers). This doesn't matter as long as you have the correct numbers, labels and graphs.
Find a generation mechanism for the following vectors / matrices and replicate it in R using for loops or vectors / matrices.
Print density function and cumulative distribution function of normally distributed random variable with $\mu = 0$ and $\sigma^2 = 1$ at points $(-4, -3, \ldots, 4)$. Can you find from these numbers any interesting function properties (e.g. monotonicity, limits, ...)?
Load data from dow_jones_index.csv into a dataframe and do the following:
hint: Don't forget to convert date from Factor
type to Date
type. You can see the representation and type with str(myobject)
command.
hint: Let $p_t$ stand for stock price at time $t$, stock return is then defined as
$$
r_t = \frac{p_t}{p_{t-1}} - 1
$$
hint: use h = hist(..., plot=F)
to return histogram object without plotting the histogram itself. Accessing its properties is done with $
, e.g. h$attribute
.