[R] .arch.uni in function call in arch test of vars package
Pfaff, Bernhard Dr.
Bernhard_Pfaff at fra.invesco.com
Wed Oct 11 09:57:11 CEST 2006
>The arch test requires a varest object and I am trying to
>write one that
>will use R-metrics arima, arch, Garch objects, or at least a vector.
>Also the arch function has the following line of code that I can not
>find the function anywhere
>
> archs.resids <- apply(resids, 2, function(x) .arch.uni(x,
> lags.single = lags.single))
>
Hello Joe,
have a look at the source code (internal.R). For your convenience the
function is:
## univariate ARCH test
".arch.uni" <-
function(x, lags.single){
lags.single <- lags.single + 1
mat <- embed(scale(x)^2, lags.single)
arch.lm <- summary(lm(mat[, 1] ~ mat[, -1]))
STATISTIC <- arch.lm$r.squared*length(resid(arch.lm))
names(STATISTIC) <- "Chi^2"
PARAMETER <- lags.single - 1
names(PARAMETER) <- "df"
PVAL <- 1 - pchisq(STATISTIC, df = PARAMETER)
METHOD <- "ARCH test (univariate)"
result <- list(statistic = STATISTIC, parameter = PARAMETER, p.value =
PVAL, method = METHOD, data.name = deparse(substitute(x)))
class(result) <- "htest"
return(result)
}
Best,
Bernhard
>does any one know about the function .arch.uni?
>
>Thank you
>Joe
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>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.
>
*****************************************************************
Confidentiality Note: The information contained in this mess...{{dropped}}
More information about the R-help
mailing list