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 <upananda.p...@gmail.com> wrote: > 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 statistics for each lag. Is there any method to do this > ? > > With regards, > Upananda > > -- > > > You may delay, but time will not. > > > Research Scholar > alternative mail id: up...@iitkgp.ac.in > Department of HSS, IIT KGP > KGP > > [[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. > ______________________________________________ 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.