Friday, June 12, 2015

[0] Intro

<My computing environment>

OS: Mac OS X Yosemite Version 10.10.3

You should be able to get sample codes on this blog tested, on the Windows environment as well. Please install the appropriate files/packages, based on your computer environment.


<R Sources/Binaries on CRAN>
  • Download the following R binary and install it.

R 3.2.0 binary for Mac OS X 10.9 (Mavericks) and higher, signed package.
R-3.2.0.pkg


<Packages on CRAN>
  • Download the following R packages.

# From [1] to [10]

PerformanceAnalytics: Econometric tools for performance and risk analysis
http://cran.r-project.org/web/packages/PerformanceAnalytics/index.html
Windows binaries:r-release: PerformanceAnalytics_1.4.3541.zip
OS X Mavericks binaries:  r-release: PerformanceAnalytics_1.4.3541.tgz

quantmod:Quantitative Financial Modelling Framework
http://cran.r-project.org/web/packages/quantmod/index.html
Windows binaries:r-release: quantmod_0.4-4.zip
OS X Mavericks binaries:  r-release: quantmod_0.4-4.tgz

xts: eXtensible Time Series
http://cran.r-project.org/web/packages/xts/index.html
Windows binaries:r-release: xts_0.9-7.zip
OS X Mavericks binaries:  r-release: xts_0.9-7.tgz

zoo: S3 Infrastructure for Regular and Irregular Time Series (Z's Ordered Observations)
cran.r-project.org/package=zoo
Windows binaries:r-release: zoo_1.7-12.zip
OS X Mavericks binaries:  r-release: zoo_1.7-12.tgz

TTR: Technical Trading Rules
cran.r-project.org/package=TTR
Windows binaries:r-release: TTR_0.22-0.zip
OS X Mavericks binaries:r-release: TTR_0.22-0.tgz


# [11] Portfolio Optimization

quadprog: Functions to solve Quadratic Programming Problems
http://cran.r-project.org/web/packages/quadprog/index.html
Windows binaries:r-release: quadprog_1.5-5.zip
OS X Mavericks binaries:r-release: quadprog_1.5-5.tgz

timeDate: Rmetrics - Chronological and Calendar Objects
http://cran.r-project.org/package=timeDate
Windows binaries:r-release: timeDate_3012.100.zip
OS X Mavericks binaries:r-release: timeDate_3012.100.tgz

timeSeries: Rmetrics - Financial Time Series Objects
http://cran.r-project.org/package=timeSeries
Windows binaries:r-release: timeSeries_3012.99.zip
OS X Mavericks binaries:r-release: timeSeries_3012.99.tgz

fBasics: Rmetrics - Markets and Basic Statistics
http://cran.r-project.org/package=fBasics
Windows binaries:r-release: fBasics_3011.87.zip
OS X Mavericks binaries:r-release: fBasics_3011.87.tgz

fAssets: Rmetrics - Analysing and Modelling Financial Assets
http://cran.r-project.org/package=fAssets
Windows binaries:r-release: fAssets_3011.83.zip
OS X Mavericks binaries:r-release: fAssets_3011.83.tgz

fMultivar: Rmetrics - Analysing and Modeling Multivariate Financial Return Distributions
http://cran.r-project.org/package=fMultivar
Windows binaries:r-release: fMultivar_3011.78.zip
OS X Mavericks binaries:r-release: fMultivar_3011.78.tgz

robustbase: Basic Robust Statistics
http://cran.r-project.org/package=robustbase
Windows binaries:r-release: robustbase_0.92-4.zip
OS X Mavericks binaries:r-release: robustbase_0.92-4.tgz

DEoptimR: Differential Evolution Optimization in pure R
http://cran.r-project.org/package=DEoptimR
Windows binaries:r-release: DEoptimR_1.0-2.zip
OS X Mavericks binaries:r-release: DEoptimR_1.0-2.tgz

ecodist: Dissimilarity-based functions for ecological analysis
http://cran.r-project.org/package=ecodist
Windows binaries:r-release: ecodist_1.2.9.zip
OS X Mavericks binaries:r-release: ecodist_1.2.9.tgz

mvnormtest: Normality test for multivariate variables
http://cran.r-project.org/package=mvnormtest
Windows binaries:r-release: mvnormtest_0.1-9.zip
OS X Mavericks binaries:r-release: mvnormtest_0.1-9.tgz

energy: E-statistics (energy statistics)
http://cran.r-project.org/package=energy
Windows binaries:r-release: energy_1.6.2.zip
OS X Mavericks binaries:r-release: energy_1.6.2.tgz

sn: The Skew-Normal and Skew-t Distributions
http://cran.r-project.org/package=sn
Windows binaries:r-release: sn_1.2-2.zip
OS X Mavericks binaries:r-release: sn_1.2-2.tgz

mnormt: The Multivariate Normal and t Distributions
http://cran.r-project.org/package=mnormt
Windows binaries:r-release: mnormt_1.5-3.zip
OS X Mavericks binaries:r-release: mnormt_1.5-3.tgz

numDeriv: Accurate Numerical Derivatives
http://cran.r-project.org/package=numDeriv
Windows binaries:r-release: numDeriv_2014.2-1.zip
OS X Mavericks binaries:r-release: numDeriv_2014.2-1.tgz

fCopulae: Rmetrics - Bivariate Dependence Structures with Copulae
http://cran.r-project.org/package=fCopulae
Windows binaries:r-release: fCopulae_3011.81.zip
OS X Mavericks binaries:r-release: fCopulae_3011.81.tgz

Rglpk: R/GNU Linear Programming Kit Interface
http://cran.r-project.org/package=Rglpk
Windows binaries:r-release: Rglpk_0.6-1.zip
OS X Mavericks binaries:r-release: Rglpk_0.6-1.tgz

slam: Sparse Lightweight Arrays and Matrices
http://cran.r-project.org/package=slam
Windows binaries:r-release: slam_0.1-32.zip
OS X Mavericks binaries:r-release: slam_0.1-32.tgz

Windows binaries:r-release: Rsymphony_0.1-21.zip
OS X Snow Leopard binaries:r-oldrel: Rsymphony_0.1-17.tgz
OS X Mavericks binaries:r-release: not available

Rsolnp: General Non-linear Optimization
http://cran.r-project.org/package=Rsolnp
Windows binaries:r-release: Rsolnp_1.15.zip
OS X Mavericks binaries:r-release: Rsolnp_1.15.tgz

truncnorm: Truncated normal distribution
http://cran.r-project.org/package=truncnorm
Windows binaries:r-release: truncnorm_1.0-7.zip
OS X Mavericks binaries:r-release: truncnorm_1.0-7.tgz

kernlab: Kernel-based Machine Learning Lab
http://cran.r-project.org/package=kernlab
Windows binaries:r-release: kernlab_0.9-20.zip
OS X Mavericks binaries:r-release: kernlab_0.9-20.tgz

rneos: rneos: XML-RPC Interface to NEOS
http://cran.r-project.org/package=rneos
Windows binaries:r-release: rneos_0.2-8.zip
OS X Mavericks binaries:r-release: rneos_0.2-8.tgz

XML: Tools for Parsing and Generating XML Within R and S-Plus
http://cran.r-project.org/package=XML
Windows binaries:r-release: XML_3.98-1.3.zip
OS X Mavericks binaries:r-release: XML_3.98-1.3.tgz

RCurl: General Network (HTTP/FTP/...) Client Interface for R
http://cran.r-project.org/package=RCurl
Windows binaries:r-release: RCurl_1.95-4.7.zip
OS X Mavericks binaries:r-release: RCurl_1.95-4.7.tgz

bitops: Bitwise Operations
http://cran.r-project.org/package=bitops
Windows binaries:r-release: bitops_1.0-6.zip
OS X Mavericks binaries:r-release: bitops_1.0-6.tgz

fPortfolio: Rmetrics - Portfolio Selection and Optimization
http://cran.r-project.org/package=fPortfolio
Windows binaries:r-release: fPortfolio_3011.81.zip
OS X Snow Leopard binaries:r-oldrel: fPortfolio_3011.81.tgz
OS X Mavericks binaries:r-release: not available





stockPortfolio: Build stock models and analyze stock portfolios
http://cran.r-project.org/web/packages/stockPortfolio/index.html
Windows binaries:r-release: stockPortfolio_1.2.zip
OS X Mavericks binaries:r-release: stockPortfolio_1.2.tgz

ggplot2: An Implementation of the Grammar of Graphics
http://cran.r-project.org/web/packages/ggplot2/index.html
Windows binaries:r-release: ggplot2_1.0.1.zip
OS X Mavericks binaries:r-release: ggplot2_1.0.1.tgz

reshape2: Flexibly Reshape Data: A Reboot of the Reshape Package
Windows binaries:r-release: reshape2_1.4.1.zip
OS X Mavericks binaries:r-release: reshape2_1.4.1.tgz

digest: Create Cryptographic Hash Digests of R Objects
http://cran.r-project.org/web/packages/digest/index.html
Windows binaries:r-release: digest_0.6.8.zip
OS X Mavericks binaries:r-release: digest_0.6.8.tgz

gtable: Arrange grobs in tables
http://cran.r-project.org/web/packages/gtable/index.html
Windows binaries:r-release: gtable_0.1.2.zip
OS X Mavericks binaries:r-release: gtable_0.1.2.tgz

plyr: Tools for Splitting, Applying and Combining Data
http://cran.r-project.org/web/packages/plyr/index.html
Windows binaries:r-release: plyr_1.8.3.zip
OS X Mavericks binaries:r-release: plyr_1.8.3.tgz

Rcpp: Seamless R and C++ Integration
http://cran.r-project.org/web/packages/Rcpp/index.html
Windows binaries:r-release: Rcpp_0.11.6.zip
OS X Mavericks binaries:r-release: Rcpp_0.11.6.tgz

proto: Prototype object-based programming
http://cran.r-project.org/web/packages/proto/index.html
Windows binaries:r-release: proto_0.3-10.zip
OS X Mavericks binaries:r-release: proto_0.3-10.tgz

stringr: Simple, Consistent Wrappers for Common String Operations
http://cran.r-project.org/web/packages/stringr/index.html
Windows binaries:r-release: stringr_1.0.0.zip
OS X Mavericks binaries:r-release: stringr_1.0.0.tgz

stringi: Character String Processing Facilities
http://cran.r-project.org/web/packages/stringi/index.html
Windows binaries:r-release: stringi_0.5-5.zip
OS X Mavericks binaries:r-release: stringi_0.5-5.tgz

magrittr: A Forward-Pipe Operator for R
http://cran.r-project.org/web/packages/magrittr/index.html
Windows binaries:r-release: magrittr_1.5.zip
OS X Mavericks binaries:r-release: magrittr_1.5.tgz

scales: Scale Functions for Visualization
http://cran.r-project.org/web/packages/scales/index.html
Windows binaries:r-release: scales_0.2.5.zip
OS X Mavericks binaries:r-release: scales_0.2.5.tgz

Windows binaries:r-release: munsell_0.4.2.zip
OS X Mavericks binaries:r-release: munsell_0.4.2.tgz

Windows binaries:r-release: colorspace_1.2-6.zip
OS X Mavericks binaries:r-release: colorspace_1.2-6.tgz

labeling: Axis Labeling
Windows binaries: r-release: labeling_0.3.zip
OS X Mavericks binaries: r-release: labeling_0.3.tgz


install.packages()
  • Start the installed R console and then install packages (Unlike library() below, it's one-time procedure and you do not need to do it again.).
install.packages(path_to_file, repos = NULL, type="source")

sample codes (Mac OS X)
install.packages("~/Google Drive/Finance/R/PerformanceAnalytics_1.4.3541.tar", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/quantmod_0.4-4.tar", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/xts_0.9-7.tar", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/zoo_1.7-12.tar", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/TTR_0.22-0.tgz", repos = NULL, type="source")


# [11] Portfolio Optimization

install.packages("~/Google Drive/Finance/R/fPortfolio_3011.81.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/quadprog_1.5-5.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/timeDate_3012.100.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/timeSeries_3012.99.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/fBasics_3011.87.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/fAssets_3011.83.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/fMultivar_3011.78.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/robustbase_0.92-4.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/DEoptimR_1.0-2.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/ecodist_1.2.9.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/mvnormtest_0.1-9.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/energy_1.6.2.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/sn_1.2-2.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/mnormt_1.5-3.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/numDeriv_2014.2-1.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/fCopulae_3011.81.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/Rglpk_0.6-1.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/slam_0.1-32.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/Rsymphony_0.1-17.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/Rsolnp_1.15.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/truncnorm_1.0-7.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/kernlab_0.9-20.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/rneos_0.2-8.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/XML_3.98-1.3.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/RCurl_1.95-4.7.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/bitops_1.0-6.tgz", repos = NULL, type="source")




install.packages("~/Google Drive/Finance/R/stockPortfolio_1.2.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/ggplot2_1.0.1.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/reshape2_1.4.1.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/digest_0.6.8.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/gtable_0.1.2.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/plyr_1.8.3.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/Rcpp_0.11.6.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/proto_0.3-10.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/stringr_1.0.0.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/stringi_0.5-5.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/magrittr_1.5.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/scales_0.2.5.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/munsell_0.4.2.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/colorspace_1.2-6.tgz", repos = NULL, type="source")
install.packages("~/Google Drive/Finance/R/labeling_0.3.tgz", repos = NULL, type="source")

No comments:

Post a Comment