[Returnanalytics-commits] r3308 - pkg/PerformanceAnalytics/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 13 20:49:26 CET 2014
Author: peter_carl
Date: 2014-02-13 20:49:25 +0100 (Thu, 13 Feb 2014)
New Revision: 3308
Modified:
pkg/PerformanceAnalytics/R/chart.Histogram.R
Log:
- replaced 'sn' dependency with 'gamlss' for skew-t fit
Modified: pkg/PerformanceAnalytics/R/chart.Histogram.R
===================================================================
--- pkg/PerformanceAnalytics/R/chart.Histogram.R 2014-02-10 00:06:24 UTC (rev 3307)
+++ pkg/PerformanceAnalytics/R/chart.Histogram.R 2014-02-13 19:49:25 UTC (rev 3308)
@@ -225,11 +225,10 @@
probability = TRUE
},
add.sst = {
-# requires library(sn)
- stopifnot("package:sn" %in% search() || require("sn",quietly=TRUE))
-
- fit = st.mle(y=x)
- fitted.sst = dst(s, location = fit$dp[[1]], scale = fit$dp[[2]], shape = fit$dp[[3]], df=fit$dp[[4]], log = FALSE)
+# requires library(gamlss)
+ stopifnot("package:gamlss" %in% search() || require("gamlss",quietly=TRUE))
+ fit = gamlss(coredata(y)~1, family="ST1", verbose=FALSE)
+ fitted.sst = dST1(s, mu = fitted(fit)[1], sigma = fitted(fit, "sigma")[1], nu = fitted(fit, "nu")[1], tau = fitted(fit, "tau")[1])
yrange=c(yrange,max(fitted.sst))
probability = TRUE
},
@@ -297,6 +296,7 @@
# },
add.sst = { #requires package sn
lines(s, fitted.sst, col = colorset[4], lwd=lwd)
+# curve(fitted.sst, col=colorset[4], lwd=lwd, add=TRUE)
},
add.rug = {
rug(x, col = element.color)
More information about the Returnanalytics-commits
mailing list