Hi Subhamitra, This isn't too hard: # read in the sample data that was # saved in the file "sp_8_5.tab" sp_8_5<-read.table("sp_8_5.tab",sep="\t", header=TRUE,stringsAsFactors=FALSE) library(tseries) library(FinTS) # using "sapply", run the test on each column spout<-sapply(sp_8_5[,2:12],ArchTest)
The list "spout" contains the test results. If you really want to use a loop: spout<-list() for(i in 2:12) spout[[i-1]]<-ArchTest(sp_8_5[,i]) Jim On Fri, May 8, 2020 at 5:27 PM Subhamitra Patra <subhamitra.pa...@gmail.com> wrote: > Dear Sir, > > Herewith I am pasting a part of my sample data having 12 columns below, > and want to calculate ARCH test for the 12 columns by using a loop. > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.