Re: [R] creating a loop for a function

2011-10-06 Thread R. Michael Weylandt
To see what sort of things are available from Box.test() (and most everything else), hit ?Box.test and scroll down to "Value". There's actually more but its not called so frequently in my experience Michael On Thu, Oct 6, 2011 at 3:04 PM, upananda pani wrote: > Respected Sir, > I am grateful to

Re: [R] creating a loop for a function

2011-10-06 Thread upananda pani
Respected Sir, I am grateful to you for helping me out. Earlier i used to directly the formula without calling for statstic, parameter or p-value. As i am learning R first time, i can see how deep i have to go to learn it. With regards, Upananda On Fri, Oct 7, 2011 at 12:00 AM, R. Michael Weyla

Re: [R] creating a loop for a function

2011-10-06 Thread R. Michael Weylandt
Well you said you wanted statistics from the test, but you didn't say which statistics you wanted: any of the following would work: sapply(1:10, function(i) Box.test (lfut, lag = i, type="Ljung")$statistic) sapply(1:10, function(i) Box.test (lfut, lag = i, type="Ljung")$parameter) sapply(1:10, fun

Re: [R] creating a loop for a function

2011-10-05 Thread R. Michael Weylandt
lapply(1:10, function(i) Box.test (lfut, lag = i, type="Ljung")) Add extractors to get statistics as desired. Michael Weylandt On Wed, Oct 5, 2011 at 1:09 PM, upananda pani wrote: > Dear All, > > I want to create a loop within a function r. The example follows: > > Box.test (lfut, lag = 1, type

[R] creating a loop for a function

2011-10-05 Thread upananda pani
Dear All, I want to create a loop within a function r. The example follows: Box.test (lfut, lag = 1, type="Ljung") if i want to compute the Box.test for lag 1 to 10, I have to write manually change each time for different lag. So i wan to write a loop for the lag 1 to 10 and return the statisti