交易策略描述统计分析
> library(readxl)
> library(psych)
> data1=read_excel("检验0.5_0_策略.xlsx")
> str(data1)
> describe(data1$每日盈亏)
vars n mean sd median trimmed mad min max range
X1 1 1458 2276.62 52511.89 665.26 938.51 38742.78 -243345 413885 657230
skew kurtosis se
X1 0.63 5.51 1375.24
交易策略中自相关阶数
> aa=acf(data1$每日盈亏)
> print(aa)
Autocorrelations of series ‘data1$每日盈亏’, by lag
0 1 2 3 4 5 6 7 8 9 10
1.000 0.186 0.000 -0.005 -0.028 0.013 0.006 -0.004 0.030 0.020 0.074
11 12 13 14 15 16 17 18 19 20 21
0.062 0.000 -0.025 -0.009 0.020 0.000 -0.020 -0.021 0.029 -0.010 0.027
22 23 24 25 26 27 28 29 30 31
-0.001 -0.014 -0.006 -0.010 -0.034 0.010 0.010 0.025 -0.001 -0.003
买入卖出盈亏
Buy为买入收益均值,shell为卖出收益均值。二者之间的是收益率的标准差,buy-shell是(买入区间的收益率均值-卖出区间的收益率均值)/(样本方差平方与样本比例的商之和,再进行开方)
ADF检验
> y=data1$平仓盈亏
Warning message:
Unknown or uninitialised column: '平仓盈亏'.
> lc.df=ur.df(y,type = c("none", "drift", "trend"), lags = 1, selectlags = c("Fixed", "AIC", "BIC"))
Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), :
'data'的种类必需为矢量,但现在是'NULL'
> y=data1$每日盈亏
> lc.df=ur.df(y,type = c("none", "drift", "trend"), lags = 1, selectlags = c("Fixed", "AIC", "BIC"))
> summary(lc.df)#单位根检验
###############################################
#Augmented Dickey-Fuller Test Unit Root Test #
###############################################
Test regression none
Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)
Residuals:
Min 1Q Median 3Q Max
-292301 -24561 313 25607 396814
Coefficients:
Estimate Std. Error t value Pr(>|t|)
z.lag.1 -0.84004 0.03341 -25.144 <2e-16 ***
z.diff.lag 0.03447 0.02622 1.315 0.189
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 51650 on 1454 degrees of freedom
Multiple R-squared: 0.4066, Adjusted R-squared: 0.4057
F-statistic: 498.1 on 2 and 1454 DF, p-value: < 2.2e-16
Value of test-statistic is: -25.1436
Critical values for test statistics:
1pct 5pct 10pct
tau1 -2.58 -1.95 -1.62
```![在这里插入图片描述](https://img-blog.csdnimg.cn/20190301224453267.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3RhbmRlbGlu,size_16,color_FFFFFF,t_70)
### 帕累托检验
1. List item
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190301224736107.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3RhbmRlbGlu,size_16,color_FFFFFF,t_70)
### 蒙特卡洛模拟收益分布
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190301224751974.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3RhbmRlbGlu,size_16,color_FFFFFF,t_70)