SlideShare a Scribd company logo
1 of 15
#HW6, R output
> getSymbols("AMZN",from="2004-01-05",to="2012-05-18")
[1] "AMZN"
> amzn=diff(log(as.numeric(AMZN$AMZN.Adjusted)))
> source("Igarch.R")
> dim(AMZN)
[1] 2110 6
> length(amzn)
[1] 2109
> plot(amzn,type='l')
#Problem 1
> m1=Igarch(amzn)
Estimates: 0.999999
Maximized log-likehood: -4504.73
Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
beta 0.999999 NA NA NA
Warning message:
In sqrt(diag(solve(Hessian))) : NaNs produced
> v1=m1$volatility
> v=.999999*v1[2109]^2+(1-.999999)*amzn[2109]^2
> v
[1] 0.0008170621
> vo=sqrt(v)
> vo
[1] 0.0285843
> source("RMeasure.R")
> RMeasure(0,vo)
Risk Measures for selected probabilities:
prob VaR ES
[1,] 0.950 0.04701699 0.05896120
[2,] 0.990 0.06649702 0.07618328
[3,] 0.999 0.08833212 0.09624591
> require(fGarch)
> t.test(amzn)
One Sample t-test
data: amzn
t = 1.0588, df = 2108, p-value = 0.2898
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-0.0005615692 0.0018796360
sample estimates:
mean of x
0.0006590334
> m2=garchFit(~garch(1,1),data=amzn,include.mean=F,trace=F)
> summary(m2)
Title:
GARCH Modelling
Call:
garchFit(formula = ~garch(1, 1), data = amzn, include.mean =
F,
trace = F)
Mean and Variance Equation:
data ~ garch(1, 1)
[data = amzn]
Conditional Distribution:
norm
Coefficient(s):
omega alpha1 beta1
8.1295e-05 4.4142e-02 8.5634e-01
Std. Errors:
based on Hessian
Error Analysis:
Estimate Std. Error t value Pr(>|t|)
omega 8.130e-05 2.587e-05 3.142 0.00168 **
alpha1 4.414e-02 1.458e-02 3.028 0.00246 **
beta1 8.563e-01 4.334e-02 19.759 < 2e-16 ***
---
Standardised Residuals Tests:
Statistic p-Value
Jarque-Bera Test R Chi^2 22801.82 0
Shapiro-Wilk Test R W 0.877114 0
Ljung-Box Test R Q(10) 6.174051 0.8004343
Ljung-Box Test R Q(15) 11.60764 0.7084517
Ljung-Box Test R Q(20) 18.48538 0.555467
Ljung-Box Test R^2 Q(10) 1.863959 0.9972804
Ljung-Box Test R^2 Q(15) 2.104383 0.9999585
Ljung-Box Test R^2 Q(20) 2.546816 0.999999
LM Arch Test R TR^2 1.858131 0.9995944
> predict(m2,1)
meanForecast meanError standardDeviation
1 0 0.02708331 0.02708331
> RMeasure(0,.027083)
Risk Measures for selected probabilities:
prob VaR ES
[1,] 0.950 0.04454757 0.05586445
[2,] 0.990 0.06300448 0.07218200
[3,] 0.999 0.08369276 0.09119090
>
m3=garchFit(~garch(1,1),data=amzn,include.mean=F,trace=F,co
nd.dist="std")
> summary(m3)
Title:
GARCH Modelling
Call:
garchFit(formula = ~garch(1, 1), data = amzn, cond.dist =
"std",
include.mean = F, trace = F)
Mean and Variance Equation:
data ~ garch(1, 1)
[data = amzn]
Conditional Distribution:
std
Coefficient(s):
omega alpha1 beta1 shape
5.4010e-06 2.0039e-02 9.7171e-01 3.6910e+00
Std. Errors:
based on Hessian
Error Analysis:
Estimate Std. Error t value Pr(>|t|)
omega 5.401e-06 2.351e-06 2.297 0.0216 *
alpha1 2.004e-02 4.550e-03 4.404 1.06e-05 ***
beta1 9.717e-01 6.252e-03 155.428 < 2e-16 ***
shape 3.691e+00 2.805e-01 13.158 < 2e-16 ***
---
Standardised Residuals Tests:
Statistic p-Value
Jarque-Bera Test R Chi^2 44179.67 0
Shapiro-Wilk Test R W 0.8497441 0
Ljung-Box Test R Q(10) 6.935119 0.7315556
Ljung-Box Test R Q(15) 11.39435 0.7241714
Ljung-Box Test R Q(20) 17.60512 0.6134033
Ljung-Box Test R^2 Q(10) 2.171012 0.9948534
Ljung-Box Test R^2 Q(15) 2.921834 0.9996587
Ljung-Box Test R^2 Q(20) 3.835627 0.9999671
LM Arch Test R TR^2 2.402731 0.9984912
> predict(m3,1)
meanForecast meanError standardDeviation
1 0 0.02602888 0.02602888
> RMeasure(0,0.02603,cond.dist="std",df=3.691)
Risk Measures for selected probabilities:
prob VaR ES
[1,] 0.950 0.05685405 0.08725013
[2,] 0.990 0.10220280 0.14580552
[3,] 0.999 0.20346447 0.28199876
>
#Problem 2
> require(evir)
> namzn=-amzn #Long position
> m4=gev(namzn,21)
> m4
$n.all
[1] 2109
$n
[1] 101
$data
[1] 0.07148198 0.03824780 0.04663128 0.05770617
0.02916481 0.03440878
...
[97] 0.08017129 0.03635603 0.02880931 0.02581640
0.02576880
$block
[1] 21
$par.ests
xi sigma mu
0.37144211 0.01645415 0.03269744
$par.ses
xi sigma mu
0.096305320 0.001609465 0.001883217
$varcov
[,1] [,2] [,3]
[1,] 9.274715e-03 4.039022e-06 -5.420633e-05
[2,] 4.039022e-06 2.590378e-06 2.064383e-06
[3,] -5.420633e-05 2.064383e-06 3.546507e-06
$converged
[1] 0
$nllh.final
[1] -233.9451
attr(,"class")
[1] "gev"
>
#
> source("evtVaR.R")
> evtVaR(0.37144211,0.01645415, 0.03269744)
[1] 0.06734551
> 0.06734551*10^(.37144)
[1] 0.1583976
#Problem 3
> m5=gpd(namzn,thres=0.03)
> m5
$n
[1] 2109
$data
[1] 0.03250727 0.07022383 0.05417415 0.04318093
0.07148198 0.03824780
.....
[169] 0.03549203 0.03011677 0.04870838 0.04579498
0.08017129 0.03635603
$threshold
[1] 0.03
$p.less.thresh
[1] 0.9174964
$n.exceed
[1] 174
$method
[1] "ml"
$par.ests
xi beta
0.34313804 0.01443334
$par.ses
xi beta
0.105037392 0.001811058
$varcov
[,1] [,2]
[1,] 0.0110328538 -1.194869e-04
[2,] -0.0001194869 3.279929e-06
$information
[1] "observed"
$converged
[1] 0
$nllh.final
[1] -503.7101
attr(,"class")
[1] "gpd"
> riskmeasures(m5,c(0.99))
p quantile sfall
[1,] 0.99 0.07470822 0.1200365
> m6=gpd(namzn,thres=0.045)
> m6
$n
[1] 2109
$data
[1] 0.07022383 0.05417415 0.07148198 0.04663128
0.05403311 0.05770617
....
[73] 0.04579498 0.08017129
$threshold
[1] 0.045
$p.less.thresh
[1] 0.9649123
$n.exceed
[1] 74
$method
[1] "ml"
$par.ests
xi beta
0.45764955 0.01647918
$par.ses
xi beta
0.20579974 0.00376538
$varcov
[,1] [,2]
[1,] 0.042353533 -5.446820e-04
[2,] -0.000544682 1.417809e-05
$information
[1] "observed"
$converged
[1] 0
$nllh.final
[1] -195.9504
attr(,"class")
[1] "gpd"
> riskmeasures(m6,c(0.99))
p quantile sfall
[1,] 0.99 0.07294936 0.1269185
>
#Problem 4
> getSymbols("KO",from="2004-01-05",to="2012-05-18")
[1] "KO"
> ko=diff(log(as.numeric(KO$KO.Adjusted)))
> mm1=Igarch(ko)
Estimates: 0.9462869
Maximized log-likehood: -6669.622
Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
beta 0.94628692 0.00850725 111.233 < 2.22e-16 ***
---
> v2=mm1$volatility
> length(ko)
[1] 2109
> vo=0.9463*v2[2109]^2+(1-.9463)*ko[2109]^2
> vo=sqrt(vo)
> vo
[1] 0.007926053
> RMeasure(0,vo)
Risk Measures for selected probabilities:
prob VaR ES
[1,] 0.950 0.01303720 0.01634917
[2,] 0.990 0.01843876 0.02112463
[3,] 0.999 0.02449335 0.02668773
> nko=-ko
> cor(namzn,nko)
[1] 0.3433976
>
> nko=-ko
> cor(namzn,nko)
[1] 0.3433976
>
> r1=amzn+ko
> r2=amzn-ko
> n1=Igarch(r1)
Estimates: 0.999999
Maximized log-likehood: -4098.254
Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
beta 0.999999 NA NA NA
Warning message:
In sqrt(diag(solve(Hessian))) : NaNs produced
> vn1=n1$volatility
> n2=Igarch(r2)
Estimates: 0.999999
Maximized log-likehood: -4629.792
Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
beta 0.999999 NA NA NA
Warning message:
In sqrt(diag(solve(Hessian))) : NaNs produced
> vn2=n2$volatility
> m1=Igarch(amzn)
Estimates: 0.999999
Maximized log-likehood: -4504.73
Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
beta 0.999999 NA NA NA
Warning message:
In sqrt(diag(solve(Hessian))) : NaNs produced
> v1=m1$volatility
> cov1=(vn1[2109]^2-vn2[2109]^2)/4
> cov1
[1] 0.0001189115
> corr1=cov1/(v1[2109]*v2[2109])
> corr1
[1] 0.5624339
>
#Problem 5
> cor(amzn,nko)
[1] -0.3433976
>
> t.test(ko)
One Sample t-test
data: ko
t = 1.1073, df = 2108, p-value = 0.2683
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-0.0002249640 0.0008085214
sample estimates:
mean of x
0.0002917787
>
k1=garchFit(~garch(1,1),data=nko,trace=F,include.mean=F,con
d.dist="std")
> summary(k1)
Title:
GARCH Modelling
Call:
garchFit(formula = ~garch(1, 1), data = nko, cond.dist = "std",
include.mean = F, trace = F)
Mean and Variance Equation:
data ~ garch(1, 1)
[data = nko]
Conditional Distribution:
std
Coefficient(s):
omega alpha1 beta1 shape
1.7747e-06 6.8873e-02 9.1784e-01 5.2960e+00
Std. Errors:
based on Hessian
Error Analysis:
Estimate Std. Error t value Pr(>|t|)
omega 1.775e-06 6.549e-07 2.710 0.00673 **
alpha1 6.887e-02 1.454e-02 4.738 2.16e-06 ***
beta1 9.178e-01 1.680e-02 54.640 < 2e-16 ***
shape 5.296e+00 5.937e-01 8.920 < 2e-16 ***
---
Standardised Residuals Tests:
Statistic p-Value
Jarque-Bera Test R Chi^2 2505.346 0
Shapiro-Wilk Test R W 0.9658619 0
Ljung-Box Test R Q(10) 9.347308 0.4994903
Ljung-Box Test R Q(15) 17.2665 0.3031844
Ljung-Box Test R Q(20) 19.89797 0.4643285
Ljung-Box Test R^2 Q(10) 7.080028 0.7178688
Ljung-Box Test R^2 Q(15) 7.736915 0.9338964
Ljung-Box Test R^2 Q(20) 10.5478 0.9571176
LM Arch Test R TR^2 7.44726 0.8266984
> predict(k1,1)
meanForecast meanError standardDeviation
1 0 0.008945565 0.008945565
> RMeasure(0,.008945565,cond.dist="std",df=5.296)
Risk Measures for selected probabilities:
prob VaR ES
[1,] 0.950 0.01780556 0.02529450
[2,] 0.990 0.02941036 0.03850407
[3,] 0.999 0.05054351 0.06368452
>
k2=garchFit(~garch(1,1),data=amzn,cond.dist="std",include.me
an=F,trace=F)
> summary(k2)
Title:
GARCH Modelling
Call:
garchFit(formula = ~garch(1, 1), data = amzn, cond.dist =
"std",
include.mean = F, trace = F)
Mean and Variance Equation:
data ~ garch(1, 1)
[data = amzn]
Conditional Distribution:
std
Error Analysis:
Estimate Std. Error t value Pr(>|t|)
omega 5.401e-06 2.351e-06 2.297 0.0216 *
alpha1 2.004e-02 4.550e-03 4.404 1.06e-05 ***
beta1 9.717e-01 6.252e-03 155.428 < 2e-16 ***
shape 3.691e+00 2.805e-01 13.158 < 2e-16 ***
---
Standardised Residuals Tests:
Statistic p-Value
Jarque-Bera Test R Chi^2 44179.67 0
Shapiro-Wilk Test R W 0.8497441 0
Ljung-Box Test R Q(10) 6.935119 0.7315556
Ljung-Box Test R Q(15) 11.39435 0.7241714
Ljung-Box Test R Q(20) 17.60512 0.6134033
Ljung-Box Test R^2 Q(10) 2.171012 0.9948534
Ljung-Box Test R^2 Q(15) 2.921834 0.9996587
Ljung-Box Test R^2 Q(20) 3.835627 0.9999671
LM Arch Test R TR^2 2.402731 0.9984912
> predict(k2,1)
meanForecast meanError standardDeviation
1 0 0.02602888 0.02602888
> RMeasure(0,0.02602888,cond.dist="std",df=3.691)
Risk Measures for selected probabilities:
prob VaR ES
[1,] 0.950 0.0568516 0.08724638
[2,] 0.990 0.1021984 0.14579925
[3,] 0.999 0.2034557 0.28198662
>

More Related Content

Similar to #HW6, R output getSymbols(AMZN,from=2004-01-05,to=2012-05-.docx

Capítulo 02 considerações estatísticas
Capítulo 02   considerações estatísticasCapítulo 02   considerações estatísticas
Capítulo 02 considerações estatísticasJhayson Carvalho
 
working data(Group5)
working data(Group5)working data(Group5)
working data(Group5)Kritika Gupta
 
Solutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdfSolutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdfWaleedHussain30
 
Capítulo 07 falha por fadiga resultante de carregamento variável
Capítulo 07   falha por fadiga resultante de carregamento variávelCapítulo 07   falha por fadiga resultante de carregamento variável
Capítulo 07 falha por fadiga resultante de carregamento variávelJhayson Carvalho
 
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬Simen Li
 
Solucionario_Diseno_en_Ingenieria_Mecani (1).pdf
Solucionario_Diseno_en_Ingenieria_Mecani (1).pdfSolucionario_Diseno_en_Ingenieria_Mecani (1).pdf
Solucionario_Diseno_en_Ingenieria_Mecani (1).pdfDannyCoronel5
 
Solucionario_Diseno_en_Ingenieria_Mecani.pdf
Solucionario_Diseno_en_Ingenieria_Mecani.pdfSolucionario_Diseno_en_Ingenieria_Mecani.pdf
Solucionario_Diseno_en_Ingenieria_Mecani.pdffranciscoantoniomonr1
 
Lab Data Trial License -- for use to evaluate programs for possi.docx
Lab Data Trial License -- for use to evaluate programs for possi.docxLab Data Trial License -- for use to evaluate programs for possi.docx
Lab Data Trial License -- for use to evaluate programs for possi.docxssuser47f0be
 
Cobb-douglas production function
Cobb-douglas production functionCobb-douglas production function
Cobb-douglas production functionSuniya Sheikh
 
Cobb-douglas production function
Cobb-douglas production functionCobb-douglas production function
Cobb-douglas production functionSuniya Sheikh
 
Arna Friend Controls II Final
Arna Friend Controls II FinalArna Friend Controls II Final
Arna Friend Controls II FinalArna Friend
 

Similar to #HW6, R output getSymbols(AMZN,from=2004-01-05,to=2012-05-.docx (20)

HIDRAULICA DE CANALES
HIDRAULICA DE CANALESHIDRAULICA DE CANALES
HIDRAULICA DE CANALES
 
Capítulo 02 considerações estatísticas
Capítulo 02   considerações estatísticasCapítulo 02   considerações estatísticas
Capítulo 02 considerações estatísticas
 
working data(Group5)
working data(Group5)working data(Group5)
working data(Group5)
 
Solutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdfSolutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdf
 
Dispersion uwsb
Dispersion   uwsbDispersion   uwsb
Dispersion uwsb
 
Perhitunngan
PerhitunnganPerhitunngan
Perhitunngan
 
Capítulo 07 falha por fadiga resultante de carregamento variável
Capítulo 07   falha por fadiga resultante de carregamento variávelCapítulo 07   falha por fadiga resultante de carregamento variável
Capítulo 07 falha por fadiga resultante de carregamento variável
 
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
Agilent ADS 模擬手冊 [實習3] 壓控振盪器模擬
 
Solucionario_Diseno_en_Ingenieria_Mecani (1).pdf
Solucionario_Diseno_en_Ingenieria_Mecani (1).pdfSolucionario_Diseno_en_Ingenieria_Mecani (1).pdf
Solucionario_Diseno_en_Ingenieria_Mecani (1).pdf
 
Solucionario_Diseno_en_Ingenieria_Mecani.pdf
Solucionario_Diseno_en_Ingenieria_Mecani.pdfSolucionario_Diseno_en_Ingenieria_Mecani.pdf
Solucionario_Diseno_en_Ingenieria_Mecani.pdf
 
Lab Data Trial License -- for use to evaluate programs for possi.docx
Lab Data Trial License -- for use to evaluate programs for possi.docxLab Data Trial License -- for use to evaluate programs for possi.docx
Lab Data Trial License -- for use to evaluate programs for possi.docx
 
Cobb-douglas production function
Cobb-douglas production functionCobb-douglas production function
Cobb-douglas production function
 
Cobb-douglas production function
Cobb-douglas production functionCobb-douglas production function
Cobb-douglas production function
 
Shi20396 ch08
Shi20396 ch08Shi20396 ch08
Shi20396 ch08
 
Practica 8.docx
Practica 8.docxPractica 8.docx
Practica 8.docx
 
Arna Friend Controls II Final
Arna Friend Controls II FinalArna Friend Controls II Final
Arna Friend Controls II Final
 
Dispersion
DispersionDispersion
Dispersion
 
om
omom
om
 
Shi20396 ch07
Shi20396 ch07Shi20396 ch07
Shi20396 ch07
 
Shi20396 ch03
Shi20396 ch03Shi20396 ch03
Shi20396 ch03
 

More from katherncarlyle

After reading chapter 4, evaluate the history of the Data Encryp.docx
After reading chapter 4, evaluate the history of the Data Encryp.docxAfter reading chapter 4, evaluate the history of the Data Encryp.docx
After reading chapter 4, evaluate the history of the Data Encryp.docxkatherncarlyle
 
After reading Chapter 2 and the Required Resources please discuss th.docx
After reading Chapter 2 and the Required Resources please discuss th.docxAfter reading Chapter 2 and the Required Resources please discuss th.docx
After reading Chapter 2 and the Required Resources please discuss th.docxkatherncarlyle
 
After reading chapters 16 and 17 post a short reflection, approximat.docx
After reading chapters 16 and 17 post a short reflection, approximat.docxAfter reading chapters 16 and 17 post a short reflection, approximat.docx
After reading chapters 16 and 17 post a short reflection, approximat.docxkatherncarlyle
 
After reading chapter 3, analyze the history of Caesar Cypher an.docx
After reading chapter 3, analyze the history of Caesar Cypher an.docxAfter reading chapter 3, analyze the history of Caesar Cypher an.docx
After reading chapter 3, analyze the history of Caesar Cypher an.docxkatherncarlyle
 
After having learned about Cognitive Psychology and Humaistic Psycho.docx
After having learned about Cognitive Psychology and Humaistic Psycho.docxAfter having learned about Cognitive Psychology and Humaistic Psycho.docx
After having learned about Cognitive Psychology and Humaistic Psycho.docxkatherncarlyle
 
Advisory from Professionals Preparing Information .docx
Advisory from Professionals Preparing Information .docxAdvisory from Professionals Preparing Information .docx
Advisory from Professionals Preparing Information .docxkatherncarlyle
 
After completing the assigned readings and watching the provided.docx
After completing the assigned readings and watching the provided.docxAfter completing the assigned readings and watching the provided.docx
After completing the assigned readings and watching the provided.docxkatherncarlyle
 
Advocacy is a vital component of the early childhood professiona.docx
Advocacy is a vital component of the early childhood professiona.docxAdvocacy is a vital component of the early childhood professiona.docx
Advocacy is a vital component of the early childhood professiona.docxkatherncarlyle
 
After completing this weeks assignment...   Share with your classma.docx
After completing this weeks assignment...   Share with your classma.docxAfter completing this weeks assignment...   Share with your classma.docx
After completing this weeks assignment...   Share with your classma.docxkatherncarlyle
 
African Americans men are at a greater risk for developing prostate .docx
African Americans men are at a greater risk for developing prostate .docxAfrican Americans men are at a greater risk for developing prostate .docx
African Americans men are at a greater risk for developing prostate .docxkatherncarlyle
 
Advances over the last few decades have brought innovative and c.docx
Advances over the last few decades have brought innovative and c.docxAdvances over the last few decades have brought innovative and c.docx
Advances over the last few decades have brought innovative and c.docxkatherncarlyle
 
Advocacy is a vital component of the early childhood professional’s .docx
Advocacy is a vital component of the early childhood professional’s .docxAdvocacy is a vital component of the early childhood professional’s .docx
Advocacy is a vital component of the early childhood professional’s .docxkatherncarlyle
 
Advocacy Through LegislationIdentify a problem or .docx
Advocacy Through LegislationIdentify a problem or .docxAdvocacy Through LegislationIdentify a problem or .docx
Advocacy Through LegislationIdentify a problem or .docxkatherncarlyle
 
Advanced pathoRespond to Stacy and Sonia 1 day agoStacy A.docx
Advanced pathoRespond to  Stacy and Sonia 1 day agoStacy A.docxAdvanced pathoRespond to  Stacy and Sonia 1 day agoStacy A.docx
Advanced pathoRespond to Stacy and Sonia 1 day agoStacy A.docxkatherncarlyle
 
After completing the reading this week, we reflect on a few ke.docx
After completing the reading this week, we reflect on a few ke.docxAfter completing the reading this week, we reflect on a few ke.docx
After completing the reading this week, we reflect on a few ke.docxkatherncarlyle
 
Adopting Enterprise Risk Management inToday’s Wo.docx
Adopting Enterprise Risk Management inToday’s Wo.docxAdopting Enterprise Risk Management inToday’s Wo.docx
Adopting Enterprise Risk Management inToday’s Wo.docxkatherncarlyle
 
Addisons diseaseYou may use the textbook as one reference a.docx
Addisons diseaseYou may use the textbook as one reference a.docxAddisons diseaseYou may use the textbook as one reference a.docx
Addisons diseaseYou may use the textbook as one reference a.docxkatherncarlyle
 
AdultGeriatric DepressionIntroduction According to Mace.docx
AdultGeriatric DepressionIntroduction According to Mace.docxAdultGeriatric DepressionIntroduction According to Mace.docx
AdultGeriatric DepressionIntroduction According to Mace.docxkatherncarlyle
 
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docxAdopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docxkatherncarlyle
 
Adolescent development is broad and wide-ranging, including phys.docx
Adolescent development is broad and wide-ranging, including phys.docxAdolescent development is broad and wide-ranging, including phys.docx
Adolescent development is broad and wide-ranging, including phys.docxkatherncarlyle
 

More from katherncarlyle (20)

After reading chapter 4, evaluate the history of the Data Encryp.docx
After reading chapter 4, evaluate the history of the Data Encryp.docxAfter reading chapter 4, evaluate the history of the Data Encryp.docx
After reading chapter 4, evaluate the history of the Data Encryp.docx
 
After reading Chapter 2 and the Required Resources please discuss th.docx
After reading Chapter 2 and the Required Resources please discuss th.docxAfter reading Chapter 2 and the Required Resources please discuss th.docx
After reading Chapter 2 and the Required Resources please discuss th.docx
 
After reading chapters 16 and 17 post a short reflection, approximat.docx
After reading chapters 16 and 17 post a short reflection, approximat.docxAfter reading chapters 16 and 17 post a short reflection, approximat.docx
After reading chapters 16 and 17 post a short reflection, approximat.docx
 
After reading chapter 3, analyze the history of Caesar Cypher an.docx
After reading chapter 3, analyze the history of Caesar Cypher an.docxAfter reading chapter 3, analyze the history of Caesar Cypher an.docx
After reading chapter 3, analyze the history of Caesar Cypher an.docx
 
After having learned about Cognitive Psychology and Humaistic Psycho.docx
After having learned about Cognitive Psychology and Humaistic Psycho.docxAfter having learned about Cognitive Psychology and Humaistic Psycho.docx
After having learned about Cognitive Psychology and Humaistic Psycho.docx
 
Advisory from Professionals Preparing Information .docx
Advisory from Professionals Preparing Information .docxAdvisory from Professionals Preparing Information .docx
Advisory from Professionals Preparing Information .docx
 
After completing the assigned readings and watching the provided.docx
After completing the assigned readings and watching the provided.docxAfter completing the assigned readings and watching the provided.docx
After completing the assigned readings and watching the provided.docx
 
Advocacy is a vital component of the early childhood professiona.docx
Advocacy is a vital component of the early childhood professiona.docxAdvocacy is a vital component of the early childhood professiona.docx
Advocacy is a vital component of the early childhood professiona.docx
 
After completing this weeks assignment...   Share with your classma.docx
After completing this weeks assignment...   Share with your classma.docxAfter completing this weeks assignment...   Share with your classma.docx
After completing this weeks assignment...   Share with your classma.docx
 
African Americans men are at a greater risk for developing prostate .docx
African Americans men are at a greater risk for developing prostate .docxAfrican Americans men are at a greater risk for developing prostate .docx
African Americans men are at a greater risk for developing prostate .docx
 
Advances over the last few decades have brought innovative and c.docx
Advances over the last few decades have brought innovative and c.docxAdvances over the last few decades have brought innovative and c.docx
Advances over the last few decades have brought innovative and c.docx
 
Advocacy is a vital component of the early childhood professional’s .docx
Advocacy is a vital component of the early childhood professional’s .docxAdvocacy is a vital component of the early childhood professional’s .docx
Advocacy is a vital component of the early childhood professional’s .docx
 
Advocacy Through LegislationIdentify a problem or .docx
Advocacy Through LegislationIdentify a problem or .docxAdvocacy Through LegislationIdentify a problem or .docx
Advocacy Through LegislationIdentify a problem or .docx
 
Advanced pathoRespond to Stacy and Sonia 1 day agoStacy A.docx
Advanced pathoRespond to  Stacy and Sonia 1 day agoStacy A.docxAdvanced pathoRespond to  Stacy and Sonia 1 day agoStacy A.docx
Advanced pathoRespond to Stacy and Sonia 1 day agoStacy A.docx
 
After completing the reading this week, we reflect on a few ke.docx
After completing the reading this week, we reflect on a few ke.docxAfter completing the reading this week, we reflect on a few ke.docx
After completing the reading this week, we reflect on a few ke.docx
 
Adopting Enterprise Risk Management inToday’s Wo.docx
Adopting Enterprise Risk Management inToday’s Wo.docxAdopting Enterprise Risk Management inToday’s Wo.docx
Adopting Enterprise Risk Management inToday’s Wo.docx
 
Addisons diseaseYou may use the textbook as one reference a.docx
Addisons diseaseYou may use the textbook as one reference a.docxAddisons diseaseYou may use the textbook as one reference a.docx
Addisons diseaseYou may use the textbook as one reference a.docx
 
AdultGeriatric DepressionIntroduction According to Mace.docx
AdultGeriatric DepressionIntroduction According to Mace.docxAdultGeriatric DepressionIntroduction According to Mace.docx
AdultGeriatric DepressionIntroduction According to Mace.docx
 
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docxAdopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
Adopt-a-Plant Project guidelinesOverviewThe purpose of this.docx
 
Adolescent development is broad and wide-ranging, including phys.docx
Adolescent development is broad and wide-ranging, including phys.docxAdolescent development is broad and wide-ranging, including phys.docx
Adolescent development is broad and wide-ranging, including phys.docx
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 

#HW6, R output getSymbols(AMZN,from=2004-01-05,to=2012-05-.docx

  • 1. #HW6, R output > getSymbols("AMZN",from="2004-01-05",to="2012-05-18") [1] "AMZN" > amzn=diff(log(as.numeric(AMZN$AMZN.Adjusted))) > source("Igarch.R") > dim(AMZN) [1] 2110 6 > length(amzn) [1] 2109 > plot(amzn,type='l') #Problem 1 > m1=Igarch(amzn) Estimates: 0.999999 Maximized log-likehood: -4504.73 Coefficient(s): Estimate Std. Error t value Pr(>|t|) beta 0.999999 NA NA NA Warning message: In sqrt(diag(solve(Hessian))) : NaNs produced > v1=m1$volatility > v=.999999*v1[2109]^2+(1-.999999)*amzn[2109]^2 > v [1] 0.0008170621 > vo=sqrt(v) > vo [1] 0.0285843 > source("RMeasure.R") > RMeasure(0,vo) Risk Measures for selected probabilities: prob VaR ES [1,] 0.950 0.04701699 0.05896120 [2,] 0.990 0.06649702 0.07618328
  • 2. [3,] 0.999 0.08833212 0.09624591 > require(fGarch) > t.test(amzn) One Sample t-test data: amzn t = 1.0588, df = 2108, p-value = 0.2898 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.0005615692 0.0018796360 sample estimates: mean of x 0.0006590334 > m2=garchFit(~garch(1,1),data=amzn,include.mean=F,trace=F) > summary(m2) Title: GARCH Modelling Call: garchFit(formula = ~garch(1, 1), data = amzn, include.mean = F, trace = F) Mean and Variance Equation: data ~ garch(1, 1) [data = amzn] Conditional Distribution: norm Coefficient(s): omega alpha1 beta1 8.1295e-05 4.4142e-02 8.5634e-01
  • 3. Std. Errors: based on Hessian Error Analysis: Estimate Std. Error t value Pr(>|t|) omega 8.130e-05 2.587e-05 3.142 0.00168 ** alpha1 4.414e-02 1.458e-02 3.028 0.00246 ** beta1 8.563e-01 4.334e-02 19.759 < 2e-16 *** --- Standardised Residuals Tests: Statistic p-Value Jarque-Bera Test R Chi^2 22801.82 0 Shapiro-Wilk Test R W 0.877114 0 Ljung-Box Test R Q(10) 6.174051 0.8004343 Ljung-Box Test R Q(15) 11.60764 0.7084517 Ljung-Box Test R Q(20) 18.48538 0.555467 Ljung-Box Test R^2 Q(10) 1.863959 0.9972804 Ljung-Box Test R^2 Q(15) 2.104383 0.9999585 Ljung-Box Test R^2 Q(20) 2.546816 0.999999 LM Arch Test R TR^2 1.858131 0.9995944 > predict(m2,1) meanForecast meanError standardDeviation 1 0 0.02708331 0.02708331 > RMeasure(0,.027083) Risk Measures for selected probabilities: prob VaR ES [1,] 0.950 0.04454757 0.05586445 [2,] 0.990 0.06300448 0.07218200 [3,] 0.999 0.08369276 0.09119090 > m3=garchFit(~garch(1,1),data=amzn,include.mean=F,trace=F,co nd.dist="std") > summary(m3)
  • 4. Title: GARCH Modelling Call: garchFit(formula = ~garch(1, 1), data = amzn, cond.dist = "std", include.mean = F, trace = F) Mean and Variance Equation: data ~ garch(1, 1) [data = amzn] Conditional Distribution: std Coefficient(s): omega alpha1 beta1 shape 5.4010e-06 2.0039e-02 9.7171e-01 3.6910e+00 Std. Errors: based on Hessian Error Analysis: Estimate Std. Error t value Pr(>|t|) omega 5.401e-06 2.351e-06 2.297 0.0216 * alpha1 2.004e-02 4.550e-03 4.404 1.06e-05 *** beta1 9.717e-01 6.252e-03 155.428 < 2e-16 *** shape 3.691e+00 2.805e-01 13.158 < 2e-16 *** --- Standardised Residuals Tests: Statistic p-Value Jarque-Bera Test R Chi^2 44179.67 0 Shapiro-Wilk Test R W 0.8497441 0 Ljung-Box Test R Q(10) 6.935119 0.7315556 Ljung-Box Test R Q(15) 11.39435 0.7241714
  • 5. Ljung-Box Test R Q(20) 17.60512 0.6134033 Ljung-Box Test R^2 Q(10) 2.171012 0.9948534 Ljung-Box Test R^2 Q(15) 2.921834 0.9996587 Ljung-Box Test R^2 Q(20) 3.835627 0.9999671 LM Arch Test R TR^2 2.402731 0.9984912 > predict(m3,1) meanForecast meanError standardDeviation 1 0 0.02602888 0.02602888 > RMeasure(0,0.02603,cond.dist="std",df=3.691) Risk Measures for selected probabilities: prob VaR ES [1,] 0.950 0.05685405 0.08725013 [2,] 0.990 0.10220280 0.14580552 [3,] 0.999 0.20346447 0.28199876 > #Problem 2 > require(evir) > namzn=-amzn #Long position > m4=gev(namzn,21) > m4 $n.all [1] 2109 $n [1] 101 $data [1] 0.07148198 0.03824780 0.04663128 0.05770617 0.02916481 0.03440878 ... [97] 0.08017129 0.03635603 0.02880931 0.02581640 0.02576880
  • 6. $block [1] 21 $par.ests xi sigma mu 0.37144211 0.01645415 0.03269744 $par.ses xi sigma mu 0.096305320 0.001609465 0.001883217 $varcov [,1] [,2] [,3] [1,] 9.274715e-03 4.039022e-06 -5.420633e-05 [2,] 4.039022e-06 2.590378e-06 2.064383e-06 [3,] -5.420633e-05 2.064383e-06 3.546507e-06 $converged [1] 0 $nllh.final [1] -233.9451 attr(,"class") [1] "gev" > # > source("evtVaR.R") > evtVaR(0.37144211,0.01645415, 0.03269744) [1] 0.06734551 > 0.06734551*10^(.37144) [1] 0.1583976 #Problem 3 > m5=gpd(namzn,thres=0.03) > m5
  • 7. $n [1] 2109 $data [1] 0.03250727 0.07022383 0.05417415 0.04318093 0.07148198 0.03824780 ..... [169] 0.03549203 0.03011677 0.04870838 0.04579498 0.08017129 0.03635603 $threshold [1] 0.03 $p.less.thresh [1] 0.9174964 $n.exceed [1] 174 $method [1] "ml" $par.ests xi beta 0.34313804 0.01443334 $par.ses xi beta 0.105037392 0.001811058 $varcov [,1] [,2] [1,] 0.0110328538 -1.194869e-04 [2,] -0.0001194869 3.279929e-06 $information
  • 8. [1] "observed" $converged [1] 0 $nllh.final [1] -503.7101 attr(,"class") [1] "gpd" > riskmeasures(m5,c(0.99)) p quantile sfall [1,] 0.99 0.07470822 0.1200365 > m6=gpd(namzn,thres=0.045) > m6 $n [1] 2109 $data [1] 0.07022383 0.05417415 0.07148198 0.04663128 0.05403311 0.05770617 .... [73] 0.04579498 0.08017129 $threshold [1] 0.045 $p.less.thresh [1] 0.9649123 $n.exceed [1] 74 $method [1] "ml"
  • 9. $par.ests xi beta 0.45764955 0.01647918 $par.ses xi beta 0.20579974 0.00376538 $varcov [,1] [,2] [1,] 0.042353533 -5.446820e-04 [2,] -0.000544682 1.417809e-05 $information [1] "observed" $converged [1] 0 $nllh.final [1] -195.9504 attr(,"class") [1] "gpd" > riskmeasures(m6,c(0.99)) p quantile sfall [1,] 0.99 0.07294936 0.1269185 > #Problem 4 > getSymbols("KO",from="2004-01-05",to="2012-05-18") [1] "KO" > ko=diff(log(as.numeric(KO$KO.Adjusted))) > mm1=Igarch(ko) Estimates: 0.9462869 Maximized log-likehood: -6669.622
  • 10. Coefficient(s): Estimate Std. Error t value Pr(>|t|) beta 0.94628692 0.00850725 111.233 < 2.22e-16 *** --- > v2=mm1$volatility > length(ko) [1] 2109 > vo=0.9463*v2[2109]^2+(1-.9463)*ko[2109]^2 > vo=sqrt(vo) > vo [1] 0.007926053 > RMeasure(0,vo) Risk Measures for selected probabilities: prob VaR ES [1,] 0.950 0.01303720 0.01634917 [2,] 0.990 0.01843876 0.02112463 [3,] 0.999 0.02449335 0.02668773 > nko=-ko > cor(namzn,nko) [1] 0.3433976 > > nko=-ko > cor(namzn,nko) [1] 0.3433976 > > r1=amzn+ko > r2=amzn-ko > n1=Igarch(r1) Estimates: 0.999999 Maximized log-likehood: -4098.254 Coefficient(s): Estimate Std. Error t value Pr(>|t|) beta 0.999999 NA NA NA
  • 11. Warning message: In sqrt(diag(solve(Hessian))) : NaNs produced > vn1=n1$volatility > n2=Igarch(r2) Estimates: 0.999999 Maximized log-likehood: -4629.792 Coefficient(s): Estimate Std. Error t value Pr(>|t|) beta 0.999999 NA NA NA Warning message: In sqrt(diag(solve(Hessian))) : NaNs produced > vn2=n2$volatility > m1=Igarch(amzn) Estimates: 0.999999 Maximized log-likehood: -4504.73 Coefficient(s): Estimate Std. Error t value Pr(>|t|) beta 0.999999 NA NA NA Warning message: In sqrt(diag(solve(Hessian))) : NaNs produced > v1=m1$volatility > cov1=(vn1[2109]^2-vn2[2109]^2)/4 > cov1 [1] 0.0001189115 > corr1=cov1/(v1[2109]*v2[2109]) > corr1 [1] 0.5624339 > #Problem 5 > cor(amzn,nko) [1] -0.3433976 > > t.test(ko)
  • 12. One Sample t-test data: ko t = 1.1073, df = 2108, p-value = 0.2683 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.0002249640 0.0008085214 sample estimates: mean of x 0.0002917787 > k1=garchFit(~garch(1,1),data=nko,trace=F,include.mean=F,con d.dist="std") > summary(k1) Title: GARCH Modelling Call: garchFit(formula = ~garch(1, 1), data = nko, cond.dist = "std", include.mean = F, trace = F) Mean and Variance Equation: data ~ garch(1, 1) [data = nko] Conditional Distribution: std Coefficient(s): omega alpha1 beta1 shape 1.7747e-06 6.8873e-02 9.1784e-01 5.2960e+00 Std. Errors:
  • 13. based on Hessian Error Analysis: Estimate Std. Error t value Pr(>|t|) omega 1.775e-06 6.549e-07 2.710 0.00673 ** alpha1 6.887e-02 1.454e-02 4.738 2.16e-06 *** beta1 9.178e-01 1.680e-02 54.640 < 2e-16 *** shape 5.296e+00 5.937e-01 8.920 < 2e-16 *** --- Standardised Residuals Tests: Statistic p-Value Jarque-Bera Test R Chi^2 2505.346 0 Shapiro-Wilk Test R W 0.9658619 0 Ljung-Box Test R Q(10) 9.347308 0.4994903 Ljung-Box Test R Q(15) 17.2665 0.3031844 Ljung-Box Test R Q(20) 19.89797 0.4643285 Ljung-Box Test R^2 Q(10) 7.080028 0.7178688 Ljung-Box Test R^2 Q(15) 7.736915 0.9338964 Ljung-Box Test R^2 Q(20) 10.5478 0.9571176 LM Arch Test R TR^2 7.44726 0.8266984 > predict(k1,1) meanForecast meanError standardDeviation 1 0 0.008945565 0.008945565 > RMeasure(0,.008945565,cond.dist="std",df=5.296) Risk Measures for selected probabilities: prob VaR ES [1,] 0.950 0.01780556 0.02529450 [2,] 0.990 0.02941036 0.03850407 [3,] 0.999 0.05054351 0.06368452 > k2=garchFit(~garch(1,1),data=amzn,cond.dist="std",include.me an=F,trace=F) > summary(k2)
  • 14. Title: GARCH Modelling Call: garchFit(formula = ~garch(1, 1), data = amzn, cond.dist = "std", include.mean = F, trace = F) Mean and Variance Equation: data ~ garch(1, 1) [data = amzn] Conditional Distribution: std Error Analysis: Estimate Std. Error t value Pr(>|t|) omega 5.401e-06 2.351e-06 2.297 0.0216 * alpha1 2.004e-02 4.550e-03 4.404 1.06e-05 *** beta1 9.717e-01 6.252e-03 155.428 < 2e-16 *** shape 3.691e+00 2.805e-01 13.158 < 2e-16 *** --- Standardised Residuals Tests: Statistic p-Value Jarque-Bera Test R Chi^2 44179.67 0 Shapiro-Wilk Test R W 0.8497441 0 Ljung-Box Test R Q(10) 6.935119 0.7315556 Ljung-Box Test R Q(15) 11.39435 0.7241714 Ljung-Box Test R Q(20) 17.60512 0.6134033 Ljung-Box Test R^2 Q(10) 2.171012 0.9948534 Ljung-Box Test R^2 Q(15) 2.921834 0.9996587 Ljung-Box Test R^2 Q(20) 3.835627 0.9999671 LM Arch Test R TR^2 2.402731 0.9984912 > predict(k2,1) meanForecast meanError standardDeviation
  • 15. 1 0 0.02602888 0.02602888 > RMeasure(0,0.02602888,cond.dist="std",df=3.691) Risk Measures for selected probabilities: prob VaR ES [1,] 0.950 0.0568516 0.08724638 [2,] 0.990 0.1021984 0.14579925 [3,] 0.999 0.2034557 0.28198662 >