[R] How to extract the standardized residuals tests from the summary report of fGarch

David Winsemius dwinsemius at comcast.net
Mon May 25 19:58:39 CEST 2015


> On May 24, 2015, at 7:25 PM, wsq at szu.edu.cn wrote:
> 
> I am using the Rmarkdown to produce a  html slides automatically, and I want to known
> How to extract the standardized residuals tests section from the summary report?
> 

Probbly the easiest way is with capture.output. I looked at the returned value from the summary method for that S4 object and it was NULL, so the function appears to simply be acting via side-effects of cat to the console. You could look at the code with:

showMethods(class="fGARCH", f="summary", includeDefs=TRUE)

— 
David.
> 
> Here are the R-code:
> 
> 
>> library("fGarch") 
>> N = 200
>> x.vec = as.vector(garchSim(garchSpec(rseed = 1985), n = N)[,1])
>> fit=garchFit(~ garch(1,1), data = x.vec, trace = FALSE)
> 
> 
>> summary(fit)
> 
> 
> Title:
> GARCH Modelling 
> 
> 
> Call:
> garchFit(formula = ~garch(1, 1), data = x.vec, trace = FALSE) 
> 
> 
> Mean and Variance Equation:
> data ~ garch(1, 1)
> <environment: 0x000000002df6b330>
> [data = x.vec]
> 
> 
> Conditional Distribution:
> norm 
> 
> 
> Coefficient(s):
>        mu       omega      alpha1       beta1  
> 3.5418e-05  1.0819e-06  8.8855e-02  8.1200e-01  
> 
> 
> Std. Errors:
> based on Hessian 
> 
> 
> Error Analysis:
>        Estimate  Std. Error  t value Pr(>|t|)    
> mu     3.542e-05   2.183e-04    0.162    0.871    
> omega  1.082e-06   1.051e-06    1.030    0.303    
> alpha1 8.885e-02   5.450e-02    1.630    0.103    
> beta1  8.120e-01   1.242e-01    6.538 6.25e-11 ***
> ---
> Signif. codes:  0 กฎ***กฏ 0.001 กฎ**กฏ 0.01 กฎ*กฏ 0.05 กฎ.กฏ 0.1 กฎ กฏ 1
> 
> 
> Log Likelihood:
> 861.9494    normalized:  4.309747 
> 
> 
> Description:
> Mon May 25 09:10:52 2015 by user: WENSQ 
> 
> 
> 
> 
> Standardised Residuals Tests:
>                                Statistic p-Value  
> Jarque-Bera Test   R    Chi^2  1.114092  0.5728988
> Shapiro-Wilk Test  R    W      0.9932317 0.4911085
> Ljung-Box Test     R    Q(10)  7.303961  0.6964713
> Ljung-Box Test     R    Q(15)  8.712829  0.8920477
> Ljung-Box Test     R    Q(20)  9.766984  0.972203 
> Ljung-Box Test     R^2  Q(10)  11.88455  0.2928573
> Ljung-Box Test     R^2  Q(15)  14.93927  0.4558006
> Ljung-Box Test     R^2  Q(20)  20.08937  0.4523516
> LM Arch Test       R    TR^2   11.57234  0.480607 
> 
> 
> Information Criterion Statistics:
>      AIC       BIC       SIC      HQIC 
> -8.579494 -8.513527 -8.580273 -8.552798 
> 
> 
> 
> 
> Dr.  WEN SONG-QIAO
> SHENZHEN UNIVERSITY
> SHENZHEN,CHINA
> Emailฃบwsq at szu.edu.cn
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Alameda, CA, USA



More information about the R-help mailing list