Stock price Titan with R
Close Price has been taken from Jan 2004 to 10 Oct 2019
head(TITAN.NS)
TITAN.NS.Open TITAN.NS.High TITAN.NS.Low TITAN.NS.Close
2004-01-01 6.3525 6.5205 6.3525 6.4645
2004-01-02 6.5205 6.5690 6.3870 6.4210
2004-01-05 6.5205 6.5545 6.1315 6.3160
2004-01-06 6.0825 6.4235 6.0825 6.1700
2004-01-07 6.1315 6.2775 5.8880 6.1850
2004-01-08 6.3845 6.4960 6.2335 6.2700
TITAN.NS.Volume TITAN.NS.Adjusted
2004-01-01 1541540 2.371147
2004-01-02 1706280 2.355192
2004-01-05 1920180 2.316678
2004-01-06 2188640 2.263126
2004-01-07 2549280 2.268628
2004-01-08 1983360 2.299806
> chartSeries(Cl(TITAN.NS))
> addMACD()
> addRSI()
> ret <- dailyReturn(Cl(TITAN.NS), type='log')
kurtosis(ret)
daily.returns
9.993311
> plot(density(ret), main='Return EDF - upper tail', xlim = c(0.1, 0.2),ylim=c(0,2));
> curve(dnorm(x, mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")
Warning message:
In xy.coords(x, y, xlabel, ylabel, log) :
9 y values <= 0 omitted from logarithmic plot
> curve(dnorm(x, mean=m,sd=s), from=-5*s, to=5*s, log="y", add=TRUE,
+ col="red")
> library("rugarch", lib.loc="~/R/win-library/3.6")
Loading required package: parallel
Attaching package: ‘rugarch’
The following object is masked from ‘package:stats’:
sigma
> ret.titan <- dailyReturn(Cl(TITAN.NS), type='log')
Warning message:
In to_period(xx, period = on.opts[[period]], ...) :
missing values removed from data
> garch11.spec = ugarchspec(variance.model = list(model="sGARCH",
+ garchOrder=c(1,1)), mean.model = list(armaOrder=c(0,0)))
> titan.garch11.fit = ugarchfit(spec=garch11.spec, data=ret.titan)
> coef(titn.garch11.fit)
Error in coef(titn.garch11.fit) : object 'titn.garch11.fit' not found
> coef(titan.garch11.fit)
mu omega alpha1 beta1
1.819743e-03 2.415436e-05 7.697594e-02 8.913049e-01
> vcov(titan.garch11.fit)
[,1] [,2] [,3] [,4]
[1,] 1.378465e-07 6.991433e-11 3.165485e-07 -3.884537e-07
[2,] 6.991433e-11 5.358298e-11 8.841252e-08 -1.600228e-07
[3,] 3.165485e-07 8.841252e-08 2.176863e-04 -3.196175e-04
[4,] -3.884537e-07 -1.600228e-07 -3.196175e-04 5.262606e-04
> infocriteria(titan.garch11.fit)
Akaike -4.541518
Bayes -4.535075
Shibata -4.541520
Hannan-Quinn -4.539231
> uncmean(titan.garch11.fit)
[1] 0.001819743
> uncvariance(titan.garch11.fit)
[1] 0.0007615068
conclusion
conclusion
> signbias(titan.garch11.fit)
t-value prob sig
Sign Bias 1.01021551 0.31245496
Negative Sign Bias 1.87576669 0.06076225 *
Positive Sign Bias 0.07560179 0.93973981
Joint Effect 3.55376613 0.31385549
>
newsimpact(titan.garch11.fit)
$zy
[1] 0.0076307233 0.0073536382 0.0070822079 0.0068164324
[5] 0.0065563117 0.0063018458 0.0060530347 0.0058098784
[9] 0.0055723769 0.0053405302 0.0051143383 0.0048938011
[13] 0.0046789188 0.0044696913 0.0042661186 0.0040682006
[17] 0.0038759375 0.0036893292 0.0035083757 0.0033330769
[21] 0.0031634330 0.0029994439 0.0028411095 0.0026884300
[25] 0.0025414052 0.0024000353 0.0022643201 0.0021342598
[29] 0.0020098542 0.0018911035 0.0017780075 0.0016705664
[33] 0.0015687800 0.0014726484 0.0013821717 0.0012973497
[37] 0.0012181825 0.0011446702 0.0010768126 0.0010146098
[41] 0.0009580618 0.0009071686 0.0008619303 0.0008223467
[45] 0.0007884179 0.0007601439 0.0007375247 0.0007205603
[49] 0.0007092507 0.0007035959 0.0007035959 0.0007092507
[53] 0.0007205603 0.0007375247 0.0007601439 0.0007884179
[57] 0.0008223467 0.0008619303 0.0009071686 0.0009580618
[61] 0.0010146098 0.0010768126 0.0011446702 0.0012181825
[65] 0.0012973497 0.0013821717 0.0014726484 0.0015687800
[69] 0.0016705664 0.0017780075 0.0018911035 0.0020098542
[73] 0.0021342598 0.0022643201 0.0024000353 0.0025414052
[77] 0.0026884300 0.0028411095 0.0029994439 0.0031634330
[81] 0.0033330769 0.0035083757 0.0036893292 0.0038759375
[85] 0.0040682006 0.0042661186 0.0044696913 0.0046789188
[89] 0.0048938011 0.0051143383 0.0053405302 0.0055723769
[93] 0.0058098784 0.0060530347 0.0063018458 0.0065563117
[97] 0.0068164324 0.0070822079 0.0073536382 0.0076307233
$zx
[1] -0.300000000 -0.293939394 -0.287878788 -0.281818182
[5] -0.275757576 -0.269696970 -0.263636364 -0.257575758
[9] -0.251515152 -0.245454545 -0.239393939 -0.233333333
[13] -0.227272727 -0.221212121 -0.215151515 -0.209090909
[17] -0.203030303 -0.196969697 -0.190909091 -0.184848485
[21] -0.178787879 -0.172727273 -0.166666667 -0.160606061
[25] -0.154545455 -0.148484848 -0.142424242 -0.136363636
[29] -0.130303030 -0.124242424 -0.118181818 -0.112121212
[33] -0.106060606 -0.100000000 -0.093939394 -0.087878788
[37] -0.081818182 -0.075757576 -0.069696970 -0.063636364
[41] -0.057575758 -0.051515152 -0.045454545 -0.039393939
[45] -0.033333333 -0.027272727 -0.021212121 -0.015151515
[49] -0.009090909 -0.003030303 0.003030303 0.009090909
[53] 0.015151515 0.021212121 0.027272727 0.033333333
[57] 0.039393939 0.045454545 0.051515152 0.057575758
[61] 0.063636364 0.069696970 0.075757576 0.081818182
[65] 0.087878788 0.093939394 0.100000000 0.106060606
[69] 0.112121212 0.118181818 0.124242424 0.130303030
[73] 0.136363636 0.142424242 0.148484848 0.154545455
[77] 0.160606061 0.166666667 0.172727273 0.178787879
[81] 0.184848485 0.190909091 0.196969697 0.203030303
[85] 0.209090909 0.215151515 0.221212121 0.227272727
[89] 0.233333333 0.239393939 0.245454545 0.251515152
[93] 0.257575758 0.263636364 0.269696970 0.275757576
[97] 0.281818182 0.287878788 0.293939394 0.300000000
$yexpr
expression(sigma[t]^2)
$xexpr
expression(epsilon[t - 1])
0 Comments