PerformanceAnalytics

PerformanceAnalytics

library(PerformanceAnalytics)
> library ( quadprog )
> library ( rrcov )
Loading required package: robustbase
Scalable Robust Estimators with High Breakdown Point (version 1.4-7)

Warning messages:
1: package ‘rrcov’ was built under R version 3.5.2
2: package ‘robustbase’ was built under R version 3.5.1
> library ( rrcov )
> Dmat       <- matrix(0,3,3)
> diag(Dmat) <- 1
> dvec       <- c(0,5,0)
> Amat       <- matrix(c(-4,-3,0,2,1,0,0,-2,1),3,3)
> bvec       <- c(-8,2,0)
> solve.QP(Dmat,dvec,Amat,bvec=bvec)
$`solution`
[1] 0.4761905 1.0476190 2.0952381

$value
[1] -2.380952

$unconstrained.solution
[1] 0 5 0

$iterations
[1] 3 0

$Lagrangian
[1] 0.0000000 0.2380952 2.0952381

$iact
[1] 3 2
mathclasstutor


> library ( zoo )
> data ( StockIndex )
> pzoo <− zoo ( StockIndex , order.by = rownames( StockIndex ) )
> rzoo <− (pzoo/lag ( pzoo , k = −1) − 1 ) ∗ 100
> boxplot ( coredata ( rzoo ) )
> rstats <− rbind ( apply ( rzoo , 2 , summary ) ,
+                   skewness ( rzoo ) ,
+                   kurtosis ( rzoo )
+ )

Post a Comment

0 Comments