Send this again using dput() to give a plain text output and I'll look at it.
Also, I think you should probably look into the difference between a row and a column. Michael On Tue, Sep 27, 2011 at 11:48 AM, Samir Benzerfa <benze...@gmx.ch> wrote: > Many thanks for your hint. I tried regular apply now. However, it still > doesnt work. Function apply works fine with other regular functions like > sum or mean. But for the function Box.test(x, ) it gives me the following > error message: **** > > ** ** > > *Error in Box.test( ) : * > > * x is not a vector or univariate time series* > > * * > > For simplicity, I tried to do the test with a simple 2x20 Matrix for 2 > stocks (see below), but it still does not work. It works well if I do the > test individually for each row à Box.test(x[,1], ) and Box.test(x[,2], )** > ** > > ** ** > > BANK.ABC ABC.MATERIAL**** > > 1 0.000000000 0.000000000**** > > 2 0.000000000 0.000000000**** > > 3 0.000000000 0.000000000**** > > 4 0.003181659 -0.008194479**** > > 5 -0.006386799 -0.008352074**** > > 6 0.028028724 0.008352074**** > > 7 -0.015347692 0.004116566**** > > 8 -0.015910002 0.016086820**** > > 9 0.003228970 0.019305155**** > > 10 -0.013062473 -0.011479818**** > > 11 0.000000000 0.000000000**** > > 12 -0.038090050 -0.011791525**** > > 13 0.021189299 -0.008042720**** > > 14 -0.003460532 -0.008194479**** > > 15 -0.010550182 -0.012589127**** > > 16 0.017443890 0.016705694**** > > 17 0.010139631 0.000000000**** > > 18 -0.017033339 0.012120633**** > > 19 0.010299957 0.023271342**** > > 20 0.000000000 -0.007619397**** > > ** ** > > Any other hints? My goal is to do the Box.test for each row (for each > stock) separately. So I want R to take each row one by one and perform the > test.**** > > ** ** > > ** ** > > *Von:* R. Michael Weylandt [mailto:michael.weyla...@gmail.com] > *Gesendet:* Dienstag, 27. September 2011 13:12 > *An:* Samir Benzerfa > *Cc:* r-help@r-project.org > *Betreff:* Re: [R] Question concerning Box.test**** > > ** ** > > Did you try regular apply? If you have univariate input, there's no reason > to use the multivariate mapply. Or more generally: > > apply(P[-1,],1,function(p) Box.test(p)$p.value) > > Michael**** > > On Tue, Sep 27, 2011 at 4:45 AM, Samir Benzerfa <benze...@gmx.ch> wrote:** > ** > > Hi everyone, > > > > I've got a question concerning the function Box.test for testing > autocorrelation in my data. > > > > My data consist of (daily) returns of several stocks over time (first > row=time, all other rows=stock returns). I intend to perform a Box-Ljung > test for my returns (for each stock). Since I have about 3000 stocks in my > list, I'm not able to perform the test individually for each stock. > Unfortunately the Box.test only works for univariate series. My goal is to > get a list with every p-value (from the output) of the 3000 tests (that is > a > list with 3000 p-values). Any hint how to do this? I tried to do this with > the function mapply, but it didn't work. > > > > Many thanks in advance & best regards > > S.B. > > > > > [[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.**** > > ** ** > [[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.