[Returnanalytics-commits] r3323 - pkg/FactorAnalytics/data
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Feb 21 03:48:40 CET 2014
Author: efmrforge
Date: 2014-02-21 03:48:39 +0100 (Fri, 21 Feb 2014)
New Revision: 3323
Removed:
pkg/FactorAnalytics/data/.Rhistory
Log:
Removed .Rhistory
Deleted: pkg/FactorAnalytics/data/.Rhistory
===================================================================
--- pkg/FactorAnalytics/data/.Rhistory 2014-02-21 02:44:50 UTC (rev 3322)
+++ pkg/FactorAnalytics/data/.Rhistory 2014-02-21 02:48:39 UTC (rev 3323)
@@ -1,512 +0,0 @@
-eigenvector <- eigen(cov(data))$vectors
-eigenvector
-u <- 0.2
-chol <- cbind(c(1,p,q,r),c(0,1,s,t),c(0,0,1,u),c(0,0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-eigenvector <- eigen(cov(data))$vectors
-eigenvector
-library(corpcor)
-install.packages("corpcor")
-install.packages("corpcor")
-library(corpcor)
-? make.positive.definite
-set.seed(125)
-p <- 0.9
-q <- 0.0
-r <- 0.8
-s <- 0
-t <- 0.1
-u <- 0.2
-chol <- cbind(c(1,p,q,r),c(0,1,s,t),c(0,0,1,u),c(0,0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-library(mvtnorm)
-covvar
-eigen(covvar)
-chol <- cbind(c(0,p,q,r),c(0,0,s,t),c(0,0,0,u),c(0,0,0,0))
-covvar <- chol%*%t(chol)
-covvar
-eigen(covvar)
-covvar
-chol
-is.positive.definite(chol)
-eigen(covvar)
-make.positive.definite(chol)
-A <- make.positive.definite(chol)
-eigen(A)
-A
-is.positive.definite(chol)
-chol <- cbind(c(0,p,q,r),c(0,0,s,t),c(0,0,0,u),c(0,0,0,0))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q,r),c(1,1,s,t),c(1,1,1,u),c(0,0,0,0))
-covvar <- chol%*%t(chol)
-covvar
-is.positive.definite(chol)
-eigen(A)
-data <- replicate(rnorm(100),2)
-data <- replicate(2,rnorm(100))
-data
-cov(data)
-cor(data)
-plot(data)
-eigen(cov(data))
-eigen(cor(data))
-eigenvector <- eigen(cov(data))$vectors
-eigenvalues <- eigen(cov(data))$values
-abline(a=0,b=eigenvector[2,1]/eigenvector[1,1],col="red")
-abline(a=0,b=eigenvector[2,2]/eigenvector[1,2],col="red")
-covvar <- cbind(c(2,1),c(1,1))
-data <- rmvnorm(100,mean=c(0,0),sigma=covvar)
-eigenvector <- eigen(cov(data))$vectors
-eigenvector
-eigenvalues <- eigen(cov(data))$values
-eigenvalues
-plot(data)
-abline(a=0,b=eigenvector[2,1]/eigenvector[1,1],col="red")
-abline(a=0,b=eigenvector[2,2]/eigenvector[1,2],col="red")
-eigenvector <- eigen(cor(data))$vectors
-eigenvector
-eigenvalues <- eigen(cor(data))$values
-eigenvalues
-plot(data)
-abline(a=0,b=eigenvector[2,1]/eigenvector[1,1],col="red")
-abline(a=0,b=eigenvector[2,2]/eigenvector[1,2],col="red")
-covvar <- cbind(c(2,-1),c(-1,1))
-data <- rmvnorm(100,mean=c(0,0),sigma=covvar)
-eigenvector <- eigen(cor(data))$vectors
-eigenvector
-eigenvalues <- eigen(cor(data))$values
-eigenvalues
-plot(data)
-abline(a=0,b=eigenvector[2,1]/eigenvector[1,1],col="red")
-abline(a=0,b=eigenvector[2,2]/eigenvector[1,2],col="red")
-covvar <- cbind(c(0,-1),c(-1,0))
-data <- rmvnorm(100,mean=c(0,0),sigma=covvar)
-covvar <- cbind(c(0,1),c(1,0))
-data <- rmvnorm(100,mean=c(0,0),sigma=covvar)
-eigen(covvar)
-covvar <- cbind(c(0,1,0),c(1,0,1),c(0,1,0))
-covvar
-eigen(covvar)
-covvar <- cbind(c(1,1,0),c(1,1,1),c(0,1,1))
-covvar
-eigen(covvar)
-covvar <- cbind(c(2,1,0),c(1,1,1),c(0,1,1))
-covvar
-eigen(covvar)
-cor(covvar)
-covvar <- cbind(c(1,1,0),c(1,1,1),c(0,1,1))
-covvar
-eigen(covvar)
-cor(covvar)
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-p <- 0.9
-q <- 0.1
-r <- 0.8
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-is.positive.definite(chol)
-eigen(covvar)
-covvar
-chol <- cbind(c(2,p,q),c(0,1,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-is.positive.definite(chol)
-eigen(covvar)
-chol <- cbind(c(20,p,q),c(0,1,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-eigen(covvar)
-data <- rmvnorm(100,mean=c(0,0,0),sigma=covvar)
-install.packages("scatterplot3d")
-library(mvtnorm)
-library(scatterplot3d)
-? scatterplot3d
-scatterplot3d(data)
-trans3d(data)
-trans3d(data[,1],data[,2],data[,3])
-scatterplot3d(data,highlight.3d=TRUE, col.axis="blue",
-col.grid="lightblue", main="scatterplot3d - 1", pch=20)
-eigen(covvar)
-eigenvector <- eigen(cor(data))$vectors
-eigenvector
-eigenvector <- eigen(cov(data))$vectors
-eigenvector
-p <- 10
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-p <- 1
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,0,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-p <- .1
-chol <- cbind(c(1,p,q),c(0,0,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-p <- .1
-p <- .1
-q <- 0.1
-r <- 0.8
-chol <- cbind(c(1,p,q),c(0,0,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,1))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,0.7))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.65))
-covvar <- chol%*%t(chol)
-covvar
-is.positive.definite(chol)
-eigen(covvar)
-r <- 10
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.65))
-covvar <- chol%*%t(chol)
-covvar
-r <- 1
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.65))
-covvar <- chol%*%t(chol)
-covvar
-r <- 0.1
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.65))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.9))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.98))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.999))
-covvar <- chol%*%t(chol)
-covvar
-eigen(covvar)
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.997))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.9999))
-covvar <- chol%*%t(chol)
-covvar
-r <- 0.5
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.9999))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.8))
-covvar <- chol%*%t(chol)
-covvar
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.9))
-covvar <- chol%*%t(chol)
-covvar
-eigen(covvar)
-chol <- cbind(c(1,p,q),c(0,1,r),c(0,0,.9))
-data <- rmvnorm(100,mean=c(0,0,0),sigma=covvar)
-pc <- princomp(data)
-summary(pc)
-plot(pc)
-loadings(pc)
-eigen(cov(data))
-data <- rmvnorm(100,mean=c(1,0,0),sigma=covvar)
-eigen(cov(data))
-pc <- princomp(data)
-summary(pc)
-loadings(pc)
-data <- rmvnorm(100,mean=c(0,0,0),sigma=covvar)
-# download data small scale experiment
-# using the finance sector provided by CNN money
-library(quantmod)
-library(PerformanceAnalytics)
-symbol.vec=c("AAN","AB","ACAS","ACY","AFL","AIG","AMG","AXP","BAC","BGCP",
-"C","CCNE","DB","GS","HCC","IHC","JPM","KEY","PLFE","TCHC")
-getSymbols(symbol.vec, from ="2000-01-03", to = "2012-05-10")
-# extract monthly adjusted closing prices
-l <- length(symbol.vec)
-db.m.price <- to.monthly(AAN)[, "AAN.Adjusted", drop=FALSE]
-colnames(db.m.price) <- "AAN"
-db.m.ret <- CalculateReturns(db.m.price, method="compound")[-1,]
-for (i in (2:l)) {
-name.price <- paste(symbol.vec[i],"m","price",sep=".")
-stock <- as.name(symbol.vec[i])
-db.m.new <- to.monthly(eval(stock))[,"eval(stock).Adjusted",drop=FALSE]
-colnames(db.m.new) <- symbol.vec[i]
-db.m.price <- cbind(db.m.price,db.m.new)
-# calculate log-returns
-db.m.ret.new <- CalculateReturns(db.m.new, method="compound")[-1,]
-db.m.ret <- cbind(db.m.ret,db.m.ret.new)
-}
-head(db.m.price)
-dim(db.m.price)
-dim(db.m.ret)
-corr.m <- cor(db.m.ret)
-corr.m.inv <- solve(corr.m)
-db.pc <- princomp(db.m.ret)
-summary(db.pc)
-centrality <- loadings(db.pc)[,1]
-centrality
-eigen(corr.m.inv)
-centrality
-centrality.inv <- eigen(corr.m.inv)$vectors[,1]
-eigen(corr.m)$vectors[,1]
-cov.m.inv <- solve(cov(db.m.ret))
-centrality.inv <- eigen(cov.m.inv)$vectors[,1]
-centrality.inv
-eigen(cov(db.m.ret))$vectors[,1]
-centrality
-centrality.inv
-head(db.m.ret)
-names(centrality.inv) <- colnames(db.m.ret)
-centrality.inv
-covvar <- cbind(c(0.8,0.1,0.1),c(0.8,0.1,.1),c(.8,.1,.1))
-covvar
-covvar <- cbind(c(0.8,0.8,0.8),c(0.1,0.1,.1),c(.1,.1,.1))
-covvar
-eigen(covvar)
-covvar <- cbind(c(0.5,0.5,0.5),c(0.4,0.4,.4),c(.1,.1,.1))
-covvar
-eigen(covvar)
-sum(eigen(covvar)$vectors[,1]^2)
-eigen(covvar)$vectors[,1]^2
-sd(eigen(covvar)$vectors[,1])
-covvar <- cbind(replicate(3,c(.33,.33,.33))
-covvar <- cbind(replicate(3,c(.33,.33,.33)))
-covvar
-covvar <- cbind(replicate(3,c(.33,.33,.33)))
-covvar
-eigen(covvar)
-sd(eigen(covvar)$vectors[,1])
-covvar <- cbind(c(0.5,0.4,0.5),c(0.4,0.5,.4),c(.1,.1,.1))
-covvar
-eigen(covvar)
-covvar <- cbind(c(0.5,0.4,0.3),c(0.4,0.5,.6),c(.1,.1,.1))
-covvar
-eigen(covvar)
-sd(eigen(covvar)$vectors[,1])
-covvar <- cbind(c(0.5,0.4,0.3),c(0.4,0.5,.5),c(.1,.1,.2))
-covvar
-eigen(covvar)
-sd(eigen(covvar)$vectors[,1])
-covvar <- cbind(c(0,0.7,0.5),c(0.9,0,.5),c(.1,0.3,0))
-covvar
-eigen(covvar)
-eigen(t(covvar)
-eigen(t(covvar))
-eigen(t(covvar))
-covvar
-t(covvar)
-eigen(t(covvar))
-covvar <- cbind(c(0.1,0.7,0.5),c(0.8,0.1,.2),c(.1,0.2,0.3))
-covvar
-t(covvar)
-eigen(t(covvar))
-sd(eigen(covvar)$vectors[,1])
-eigen(covvar)
-t(covvar)
-eigen(t(covvar))
-covvar <- cbind(c(0.8,0.8,0.8),c(0.1,0.1,.1),c(.1,0.1,0.1))
-covvar
-eigen(covvar)
-t(covvar)
-eigen(t(covvar))
-sd(eigen(covvar)$vectors[,1])
-sd(eigen(t(covvar))$vectors[,1])
-t(covvar)
-library("rmgarch")
-? dcc
-? DCC.fit
-? dccfit
-eigen(diag(2))
-eigen(matrix(rep(1,4),nrow=2))
-eigen(matrix(c(1,-1,-1,1),nrow=2))
-covvar <- matrix(rep(1,9),nrow=3)
-n <- length(covvar[1,])
-alpha <- eigen(cov(covvar))$values[1] -10^(-3)
-solve(diag(n)-alpha*cov(covvar))%*%rep(1,n)
-alpha <- eigen(covvar)$values[1] -10^(-3)
-solve(diag(n)-alpha*cov(covvar))%*%rep(1,n)
-eigen(covvar)$values
-alpha <- eigen(covvar)$values[1] -10^(-3)
-solve(diag(n)-alpha*cov(covvar))%*%rep(1,n)
-kalz <- function(covvar) {
-n <- length(covvar[1,])
-alpha <- eigen(covvar)$values[1] -10^(-3)
-kalz.ec <- solve(diag(n)-alpha*cov(covvar))%*%rep(1,n)
-return(kalz.ec)
-}
-kalz(covvar)
-covvar2 <- matrix(rep(.1,9),nrow=3)
-kalz(covvar2)
-kalz <- function(covvar) {
-n <- length(covvar[1,])
-alpha <- eigen(covvar)$values[1] -10^(-1)
-kalz.ec <- solve(diag(n)-alpha*cov(covvar))%*%rep(1,n)
-return(kalz.ec)
-}
-# example of all 1 matrix
-covvar <- matrix(rep(1,9),nrow=3)
-kalz(covvar)
-# example of all .1 matrix
-covvar2 <- matrix(rep(.1,9),nrow=3)
-kalz(covvar2)
-kalz <- function(covvar) {
-n <- length(covvar[1,])
-alpha <- eigen(covvar)$values[1] -10^(-2)
-kalz.ec <- solve(diag(n)-alpha*cov(covvar))%*%rep(1,n)
-return(kalz.ec)
-}
-# example of all 1 matrix
-covvar <- matrix(rep(1,9),nrow=3)
-kalz(covvar)
-# example of all .1 matrix
-covvar2 <- matrix(rep(.1,9),nrow=3)
-kalz(covvar2)
-covvar3 <- eigen(matrix(c(1,0,0,0,1,0,0,0,1),nrow=3))
-covvar3
-covvar3 <- matrix(c(1,0,0,0,1,0,0,0,1),nrow=3)
-covvar3
-kalz(covvar3)
-covvar
-covvar2
-covvar2 <- matrix(c(1,0.1,0.1,0.1,1,0.1,0.1,0.1,1),nrow=3)
-kalz(covvar2)
-covvar2 <- matrix(c(1,0.1,0.1,0.1,1,0.1,0.1,0.1,1),nrow=3)
-kalz(covvar2)
-covvar2
-diag(covvar2) <- c(0,0,0)
-covvar2
-kalz(covvar2)
-matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3)
-covvar4 <- matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3)
-kalz(covvar4)
-covvar4
-kalz(matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3))
-matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3)
-kalz(matrix(c(1,1,.1,1,1,.1,.1,.1,1),nrow=3))
-kalz <- function(covvar) {
-n <- length(covvar[1,])
-alpha <- (eigen(covvar)$values[1])^(-1) -10^(-2)
-kalz.ec <- solve(diag(n)-alpha*cov(covvar))%*%rep(1,n)
-return(kalz.ec)
-}
-covvar <- matrix(rep(1,9),nrow=3)
-kalz(covvar)
-covvar2 <- matrix(c(1,0.1,0.1,0.1,1,0.1,0.1,0.1,1),nrow=3)
-kalz(covvar2)
-covvar3 <- matrix(c(1,0,0,0,1,0,0,0,1),nrow=3)
-kalz(covvar3)
-covvar4 <- matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3)
-kalz(covvar4)
-kalz(matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3))
-kalz(matrix(c(1,1,.1,1,1,.1,.1,.1,1),nrow=3))
-covvar4 <- matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3)
-kalz(covvar4)
-covvar4 <- matrix(c(1,1,-.9,1,1,-.9,-.9,-.9,1),nrow=3)
-kalz(covvar4)
-kalz(matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3))
-kalz(matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3))
-kalz(matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3))
-kalz(matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3))
-kalz(matrix(c(1,1,.1,1,1,.1,.1,.1,1),nrow=3))
-matrix(c(1,1,.1,1,1,.1,.1,.1,1),nrow=3)
-kalz(matrix(c(1,1,0,1,1,0,0,0,1),nrow=3)
-kalz(matrix(c(1,1,0,1,1,0,0,0,1),nrow=3))
-###########################################################
-kalz(matrix(c(1,1,0,1,1,0,0,0,1),nrow=3))
-matrix(c(1,1,0,1,1,0,0,0,1),nrow=3)
-###########################################################
-kalz(matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3))
-kalz(matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3))
-kalz(matrix(c(1,1,.5,1,1,.5,.5,.5,1),nrow=3))
-kalz(matrix(c(1,1,-.5,1,1,-.5,-.5,-.5,1),nrow=3))
-kalz(matrix(c(1,1,.9,1,1,.9,.9,.9,1),nrow=3))
-kalz(matrix(c(1,1,-.9,1,1,-.9,-.9,-.9,1),nrow=3))
-library(matrixcalc)
-install.packages("matrixcalc")
-is.positive.definite(matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3))
-is.positive.definite(matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3))
-library(matrixcalc)
-is.positive.definite(matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3))
-is.positive.definite(matrix(c(1,1,-.1,1,1,-.1,-.1,-.1,1),nrow=3))
-is.positive.definite(matrix(c(1,1,.1,1,1,.1,.1,.1,1),nrow=3))
-is.positive.definite(matrix(c(1,1,0,1,1,0,0,0,1),nrow=3))
-is.positive.definite(matrix(c(1,1,0,1,1,0,0,0,1),nrow=3))
-is.positive.definite(diag(3))
-is.positive.definite(matrix(c(1,1,-1,1,1,-1,-1,-1,1),nrow=3))
-library(mvtnorm)
-library(sna)
-library(matrixcalc)
-library(corpcor)
-chol <- cbind(c(1,0.1,0.1,0.1,0.1),c(0,0.99,0.1,0.1,0.2),c(0,0,0.98,0.4,0.5),
-c(0,0,0,0.9,0.5),c(0,0,0,0,0.7))
-covvar <- chol%*%t(chol)
-covvar
-is.positive.definite(covvar)
-eigen(covvar)
-eigen(solve(covvar))
-is.positive.definite(covvar)
-gplot(covvar,gmode="graph",edge.lwd=15,label=c(1,2,3,4,5))
-eigen(covvar)
-? gplot
-install.packages(c("JGR","Deducer","DeducerExtras"))
-library(JGR)
-JGR()
-install.packages("rJava")
-JPR()
-JGR()
-library(JGR)
-plot.lm
-? plot.ts
-? plotcorr
-install.packages("ellipse")
-install.packages("strucchange")
-library(ellipse)
-? plotcorr
-setwd("C:/Users/Yi-An Chen/Documents/R-project/returnanalytics/pkg/FactorAnalytics/data")
-load("stat.fm.data.RData")
-setwd("C:/Users/Yi-An Chen/Documents/R-project/factoranalytics/pkg/factorAnalytics/R")
-source("fitStatisticalFactorModel.r")
-source("print.StatFactorModel.r")
-sfm.pca.fit <- fitStatisticalFactorModel(sfm.dat,k=10)
-source("plot.StatFactorModel.r")
-plot(sfm.pca.fit)
-source("plot.StatFactorModel.r")
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-source("factorModelCovariance.r")
-source("factorModelSdDecomposition.r")
-source("factorModelEsDecomposition.r")
-source("factorModelVaRDecomposition.r")
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-plot(sfm.pca.fit)
-setwd("C:/Users/Yi-An Chen/Documents/R-project/returnanalytics/pkg/FactorAnalytics/data")
-load("stock.RData")
-setwd("C:/Users/Yi-An Chen/Documents/R-project/returnanalytics/pkg/FactorAnalytics/R")
-source("fitFundamentalFactorModel.r")
-assets = unique(fulldata[,"PERMNO"])
-timedates = as.Date(unique(fulldata[,"DATE"]))
-exposures <- exposures.names <- c("BOOK2MARKET", "LOG.MARKETCAP")
-? data
-data(stock)
-setwd("C:/Users/Yi-An Chen/Documents/R-project/returnanalytics/pkg/FactorAnalytics/data")
-data(stock)
More information about the Returnanalytics-commits
mailing list