Showing posts with label tgarch. Show all posts
Showing posts with label tgarch. Show all posts

Tuesday, September 24, 2019

Stock market to improve skill engle,sign bias,joint effect,fitted data series,residuals,long run variance

This is statistics to use in the stock market to improve skill engle.

 engle,sign bias,joint effect,fitted data series,residuals,long run variance &mean,egarch,omega,alpha,beta,mu,garch,news impact,tgarch,egarch.There are stocks snp,msft and aapl

Engle - Ng sign bias test SNP,AAPL and MSFT data till 20 sept 2019
signbias(msft.garch11.fit)
                      t-value      prob sig
Sign Bias          0.70444250 0.4812048 
Negative Sign Bias 1.34568853 0.1784915 
Positive Sign Bias 0.05954528 0.9525213 
Joint Effect       1.83715467 0.6068832 
> signbias(SNP.garch11.fit)
Error in signbias(SNP.garch11.fit) : object 'SNP.garch11.fit' not found
> signbias(snp.garch11.fit)
                     t-value      prob sig
Sign Bias          0.6967790 0.4859821 
Negative Sign Bias 0.3794855 0.7043478 
Positive Sign Bias 0.0314979 0.9748741 
Joint Effect       1.5655740 0.6672206 
> signbias(aapl.garch11.fit)
                     t-value        prob sig
Sign Bias           1.191976 0.233352783 
Negative Sign Bias  1.429066 0.153075729 
Positive Sign Bias  0.696806 0.485971162 
Joint Effect       12.191934 0.006753779 ***
#obtain the fitted data series
fitted(msft.garch11.fit)
fitted(aapl.garch11.fit)
fitted(snp.garch11.fit)

#obtain the residuals

residuals(msft.garch11.fit)
residualssnp.garch11.fit)  
residuals(aapl.garch11.fit)
 #unconditional (long-run) variance
 > uncvariance(msft.garch11.fit) 
[1] 0.0002713749
> uncvariance(snp.garch11.fit) 
[1] 0.0004354734
> uncvariance(aapl.garch11.fit) 
[1] 0.0004115198
#unconditional (long-run) mean
> uncmean(msft.garch11.fit)
[1] 0.0007734746
> uncmean(snp.garch11.fit)
[1] 0.0001706789
> uncmean(aapl.garch11.fit)
[1] 0.001700167
> ni.garch11 <- newsimpact(aapl.garch11.fit)
> ni.garch11 <- newsimpact(snp.garch11.fit)
> ni.garch11 <- newsimpact(msft.garch11.fit)
> plot(ni.garch11$zx, ni.garch11$zy, type="l", lwd=2, col="blue",main="GARCH(1,1) - News Impact", ylab=ni.garch11$yexpr, xlab=ni.garch11$xexpr)
> # specify EGARCH(1,1) model with only constant in mean equation
> egarch11.spec = ugarchspec(variance.model = list(model="eGARCH",garchOrder=c(1,1)), mean.model = list(armaOrder=c(0,0)))
> snp.egarch11.fit = ugarchfit(spec=egarch11.spec, data=ret)
> msft.egarch11.fit = ugarchfit(spec=egarch11.spec, data=ret.msft)
> aapl.egarch11.fit = ugarchfit(spec=egarch11.spec, data=ret.aapl)
> coef(aapl.egarch11.fit)
          mu        omega       alpha1        beta1 
 0.001278574 -0.295929592 -0.098506289  0.962361371 
      gamma1 
 0.160656079 
> coef(snp.egarch11.fit)
           mu         omega        alpha1         beta1 
 3.815443e-05 -8.361389e-02 -1.235035e-02  9.885770e-01 
       gamma1 
 1.294049e-01 
> coef(msft.egarch11.fit)
           mu         omega        alpha1         beta1 
 0.0005355845 -0.1207375255 -0.0457206556  0.9847924046 
       gamma1 
 0.0714261354 
News impact curve 

> ni.egarch11 <- newsimpact(aapl.egarch11.fit)
> ni.egarch11 <- newsimpact(snp.egarch11.fit)
> ni.egarch11 <- newsimpact(msft.egarch11.fit)
> plot(ni.egarch11$zx, ni.egarch11$zy, type="l", lwd=2, col="blue",
+      main="EGARCH(1,1) - News Impact",
+      ylab=ni.egarch11$yexpr, xlab=ni.egarch11$xexpr)

The Threshold GARCH model (TGARCH)

> # specify TGARCH(1,1) model with only constant in mean equation
> tgarch11.spec = ugarchspec(variance.model = list(model="fGARCH",submodel="TGARCH", garchOrder=c(1,1)),
+ mean.model = list(armaOrder=c(0,0)))
> aapl.tgarch11.fit = ugarchfit(spec=tgarch11.spec, data=ret.aapl)
> snp.tgarch11.fit = ugarchfit(spec=tgarch11.spec, data=ret)
> msft.tgarch11.fit = ugarchfit(spec=tgarch11.spec, data=ret.msft)

  > coef(aapl.egarch11.fit)
          mu        omega       alpha1        beta1
 0.001278574 -0.295929592 -0.098506289  0.962361371
      gamma1
 0.160656079
> coef(snp.egarch11.fit)
           mu         omega        alpha1         beta1
 3.815443e-05 -8.361389e-02 -1.235035e-02  9.885770e-01
       gamma1
 1.294049e-01
> coef(msft.egarch11.fit)
           mu         omega        alpha1         beta1
 0.0005355845 -0.1207375255 -0.0457206556  0.9847924046
       gamma1
 0.0714261354
> plot(ni.tgarch11$zx, ni.tgarch11$zy, type="l", lwd=2, col="blue",
+      main="TGARCH(1,1) - News Impact",
+      ylab=ni.tgarch11$yexpr, xlab=ni.tgarch11$xexpr)
> garch11.spec = ugarchspec(variance.model = list(garchOrder=c(1,1)),mean.model = list(armaOrder=c(0,0)),fixed.pars=list(mu = 0, omega=0.1, alpha1=0.1,
+ beta1 = 0.7))
> ni.tgarch11 <- newsimpact(msft.tgarch11.fit)
> plot(ni.tgarch11$zx, ni.tgarch11$zy, type="l", lwd=2, col="blue",
+      main="TGARCH(1,1) - News Impact",
+      ylab=ni.tgarch11$yexpr, xlab=ni.tgarch11$xexpr)
> garch11.spec = ugarchspec(variance.model = list(garchOrder=c(1,1)),mean.model = list(armaOrder=c(0,0)),fixed.pars=list(mu = 0, omega=0.1, alpha1=0.1,
+ beta1 = 0.7))
> garch11.sim = ugarchpath(garch11.spec, n.sim=1000)
> aapl.garch11.fit = ugarchfit(spec=garch11.spec, data=ret.aapl, out.sample=20)
conclusion
This is statistics to use in stock market to improve skill engle,sign bias,joint effect,fitted data series,residuals,long run variance &mean,egarch,omega,alpha,beta,mu,garch,news .impact,tgarch,egarch.There are stocks snp,msft and aapl