This tutorial gives an overview of data objects in R. Read more Overview of Data Objects in R

Skip to content
Skip to main menu
#
Quant Lego

## Financial quant skills

#
Monthly Archives: October 2014

# Overview of Data Objects in R

# Install R package from local zipped file

# Stationarity, Autocorrelation, White Noise, and Linear Time Series

### 1 Stationarity

#### 1.1 Strict stationarity

# Asset Return and Distributions

### 1 Asset returns

# Download financial data using R’s quantmod package

### 1 Overview of quantmod package

# Arrays and Matrices in Python

### 1 Array

#### 1.1 Initialization of arrays

# Shallow and deep copies in Python

This tutorial gives an overview of data objects in R. Read more Overview of Data Objects in R

Sometimes it is necessary to install R package from locally stored zipped binary file. This tutorial tells you how to do this quickly and easily, in two steps.

- Download the ZIP file of the package,save it to local drive of your computer.
- Run following R commans

1install.packages(file.choose(), repos=NULL)

That’s it!

Notes:

- The file.choose() command will show a window allowing you to choose the .zip file or the tar.gz file where you downloaded it. This command is very useful when you don’t have enough rights on a Windows machine and run R from a flash drive like myself.
- It is also useful before running this command to RENAME the zip file you are going to install into the package name that you intend to use.

This tutorial introduces basic concepts about stationarity, autocorrelation, white noise, and linear time series.

A time series {\(r_t\)} is said to be *strictly stationary* if the joint distribution of \((t_{t_1},\cdots,r_{t_k})\,\) is identical to \((t_{t_1+l},\cdots,r_{t_k+l})\,\) for all *t*, where *k* is an arbitrary positive integer and (\(t_1,\cdots,r_k\)) is a collection of *k* positive integers.

In other words, strict stationarity requires that the joint distribution of (\(r_{t_1},\cdots,r_{t_k}\)) is invariant under time shift. This is a very hard condition that is hard to verify empirically. Read more Stationarity, Autocorrelation, White Noise, and Linear Time Series

This post talks about asset return and distributions, covering various definitions of returns and the relationship among them, return distributions and tests of returns.

Most financial studies involves returns, instead of prices, for two reasons:

- Return is a complete and scale-free summary of investment opportunity;
- Return has more attractive statistical properties than price.

This tutorial gives a short intruduction about how to use R’s Quantmod package to retrieve financial time series data from internet.

The **quantmod** package for R is designed to assist the quantitative trader in the development, testing, and deployment of statistically based trading models. It provides a rapid prototyping environment, where quant traders can quickly and cleanly explore and build trading models. Quantmod makes modelling easier by removing the repetitive workflow issues surrounding data management, modelling interfaces, and performance analysis.

However, quantmod is not a replacement for anything statistical. It has no ‘new’ modelling routines or analysis tool to speak of. It does now offer charting not currently available elsewhere in R, but most everything else is more of a wrapper to what you already know and love about the language and packages you currently use.

Read more Download financial data using R’s quantmod package

This tutorial gives introduction about arrays and matrices in Python, provided by the Numpy module.

Arrays are initialized from lists or tuples using the *numpy.array()* function. Two dimentional arrays are initialized using list of lists, or tuples of lists, or list of tuples, etc. Higher dimensional arrays can be initialized by further nesting lists or tuples. Read more Arrays and Matrices in Python

This tutorial describes the differences between shallow and deep copies in Python.

The difference between shallow and deep copying is only relevant for compound objects, i.e. objects containing other objects, like lists or class instances. Python creates real copies only if it has to, i.e. if the user, the programmer, explicitly demands it. Read more Shallow and deep copies in Python