OK, it's no good. Here is the result:
> data(m.intc7303) > archTest(log(1+as.numeric(m.intc7303)), lags=12) ARCH test (univariate) data: Residual of y1 equation Chi-squared = 13.1483, df = 12, p-value = 0.3584 On 2/2/08, tom soyer <[EMAIL PROTECTED]> wrote: > > Spencer, > > Sorry, I forgot that the default lag in arch is 16. Here is the fix. Can > you try it again and see if it gives the correct (or at least similar > compared to a true LM test) result? > > archTest=function(x, lags=12){ > #x is a vector > require(vars) > s=embed(x,lags) > y=VAR(s,p=1,type="const") > result=arch(y,lags.single=lags,multi=F)$arch.uni[[1]] > return(result) > } > > Thanks and sorry about the bug. > > > On 2/2/08, Spencer Graves <[EMAIL PROTECTED]> wrote: > > > > Dear Tom, Bernhard, Ruey: > > > > I can't get that to match Tsay's example, but I have other > > questions about that. > > > > 1. I got the following using Tom's 'archTest' function (below): > > > > > archTest(log(1+as.numeric(m.intc7303)), lags=12) > > > > ARCH test (univariate) > > > > data: Residual of y1 equation > > Chi-squared = 10.8562, df = 16, p-value = 0.8183 > > > > Warning message: > > In VAR(s, p = 1, type = "const") : > > No column names supplied in y, using: y1, y2, y3, y4, y5, y6, y7, y8, > > y9, y10, y11, y12 , instead. > > > > > > > ** First note that the answer has df = 16, even though I > > supplied lags = 12. > > > > 2. For (apparently) this example, S-Plus FinMetrics 'archTest' > > function returned "Test for ARCH Effects: LM Test. Null Hypothesis: > > no ARCH effects. Test Stat 43.5041, p.value 0.0000. Dist. under Null: > > chi-square with 12 degrees of freedom". > > > > 3. Starting on p. 101, Ruey mentioned "the Lagrange multiplier > > test of Engle (1982)", saying "This test is equivalent to the usual F > > test for" no regression, but refers it to a chi-square, not an F > > distribution. Clearly, there is a gap here, because the expected value > > of the F distribution is close to 1 [d2/(d2-2), where d2 = denominator > > degrees of freedom; http://en.wikipedia.org/wiki/F-distribution], while > > the expected value for a chi-square is the number of degrees of freedom > > > > Unfortunately, I don't feel I can afford the time to dig into this > > further right now. > > > > Thanks for your help. > > Spencer Graves > > > > tom soyer wrote: > > > Spencer, how about something like this: > > > > > > archTest=function (x, lags= 16){ > > > #x is a vector > > > require(vars) > > > s=embed(x,lags) > > > y=VAR(s,p=1,type="const") > > > result=arch(y,multi=F)$arch.uni[[1]] > > > return(result) > > > } > > > > > > can you, or maybe Bernhard, check and see whether this function gives > > > the correct result? > > > > > > thanks, > > > > > > On 2/1/08, *Spencer Graves* <[EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > > > Hi, Tom: > > > > > > The 'arch' function in the 'vars' package is supposed to be > > able > > > to do that. Unfortunately, I was unable to make it work for a > > > univariate series. Bernhard Pfaff, the author of 'vars', said > > > that if I > > > read the code for 'arch', I could easily retrieve the necessary > > lines > > > and put them in my own function; I have not so far found the time > > to > > > try that. If you do, or if you get a better answer than this, > > > would you > > > please let me know? I would like to have this capability for the > > > 'FinTS' package, and I would happily write a help page if someone > > > would > > > contribute the function -- or use a function in another > > package. Tsay > > > (2005) Analysis of Financial Time Series, 2nd ed. (Wiley) includes > > an > > > example on p. 103 that could be used for a reference. > > > > > > Hope this helps. > > > Spencer Graves > > > > > > tom soyer wrote: > > > > Hi, > > > > > > > > Does anyone know if R has a Lagrange multiplier (LM) test for > > ARCH > > > > effects for univariant time series? > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > > > -- > > > Tom > > > > > > -- > Tom -- Tom [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.