2017-08-21 80 views
1

我正在嘗試使用性能分析軟件包繪製每日利潤的下拉圖。我設法使用代碼:性能分析下拉功能不起作用

cols = rainbow(ncol(pdrawdown),s=0.7, v=0.8, alpha= 0.7) 
chart.Drawdown(pdrawdown, legend.loc = "bottomleft",colorset = cols, 
       main = "Drawdown Chart", xlab ="Date", ylab = "Drawdown") 

用於百分比回報。但是,當我使用利潤(處理更大的數字)時,圖形窗口甚至不顯示任何表格,也不會產生錯誤或警告消息。

我pdrawdown數據的結構,像這樣:

structure(list(Arbitrage = c(-410344.36040002, 43186613.0914002, 
-56243745.8289002, 33212085.9369, 2685633.86650004, 52056396.8137002 
), Cmdty = c(-5661740.59000004, -12816611.3327999, -15271367.5797001, 
30328698.7996001, 2346206.95040001, -20111667.3121), Cnvt = c(-0.448500000005879, 
-4.09389999999985, -3.76900000000023, -4.46530000000348, 9.47310000000289, 
5.57809999999154), FI = c(-4959851.92789985, 51301719.2496983, 
19347533.8012021, -45928596.3382014, -126566982.481699, 7039919.16710053 
), IndexArb = c(465514.007300064, 712460.314099789, -1241298.64239982, 
859103.288600107, -9142.46960010222, 1670160.15220016), OptVolD = c(3207463.8402, 
-2645827.2004, 1917467.1194, -1645717.199, 1346643.9976, 1249267.9222 
), OptVolG = c(1809178.81009999, -1247076.75579998, 1208738.92329999, 
-998966.340099988, 474978.958799993, 2312496.41480001), Other = c(3121114.45319998, 
-7558428.4574, 28751941.5262, -8287057.41060003, -5057308.97439997, 
25541692.1845), RVG = c(107064420.2606, 41122417.5658004, -33634242.2959002, 
-25318480.7920002, -9396822.53510034, 69874891.7186005), SAAsia = c(-31022426.4966, 
-1381533.43030003, 21484053.8479001, 15456037.1175, 11307323.7993999, 
8081090.74740009)), .Names = c("Arbitrage", "Cmdty", "Cnvt", 
"FI", "IndexArb", "OptVolD", "OptVolG", "Other", "RVG", "SAAsia" 
), row.names = c("2015-08-03", "2015-08-04", "2015-08-05", "2015-08-06", 
"2015-08-07", "2015-08-10"), class = "data.frame") 

更新:設置即

cols = rainbow(ncol(pdrawdown),s=0.7, v=0.8, alpha= 0.7) 
chart.Drawdown(pdrawdown, legend.loc = "bottomleft",colorset = cols, 
       main = "Drawdown Chart", xlab ="Date", ylab = "Drawdown",ylim = c(-1,0)) 

一個ylim值導致顯示圖形,但它仍然顯示有效無意義的數據,不管是什麼我下限是ylim。但是,通過返回,此ylim項按預期工作,修復了繪圖的座標軸。

回答

0

由於沒有人能夠給出答案,我會發布我的最佳解決方案,以防其他人在將來遇到此問題。

據我所知,在(預期)簡單地造成問題,因爲縮編損益過大。我的「黑客」來解決這個問題是由一個數字,導致所有值低於1。對我來說,這意味着我的Y比例以十億是像這樣來劃分數據表:

pdrawdown = pdrawdown/1000000000 # PnL displays in billions (set units here) 

cols = rainbow(ncol(pdrawdown),s=0.7, v=0.8, alpha= 0.7) 
chart.Drawdown(pdrawdown, legend.loc = "bottomleft",colorset = cols, 
       main = "Drawdown Chart", xlab ="Date", ylab = "Drawdown ($billions) 

除以任意數量較小隻是給出了一個非常奇怪的圖形,其大量跳轉與相同數據的返回圖不相似。

我懷疑這是因爲縮編圖表是專爲百分比和因而可以與數字0和-1(在百分比是最大虧損,當然,-100%)之間只處理。