Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-13 Thread Subhamitra Patra
Dear Sir, I am so sorry that due to certain inconveniences, I became late to try your suggested code and to reply to your email. Thank you very much for your wonderful solution and suggestion for my problem. Like before, Your suggested code has worked awesome. Even, I successfully imported the

Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-08 Thread Jim Lemon
Hi Subhamitra, I have washed the dishes and had a night's sleep, so I can now deal with your text munging problem. First, I'll reiterate the solution I sent: sp_8_5<-read.table("sp_8_5.tab",sep="\t", header=TRUE,stringsAsFactors=FALSE) library(tseries) library(FinTS) # create a function that

Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-08 Thread Subhamitra Patra
Dear Sir, Thank you very much for your wonderful suggestion for my problem. Your suggested code has excellently worked and successfully extracted the statistics and p-value in another R object. Concerning your last suggestion, I attempted to separate the strings with TAB character in the "spout"

Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-08 Thread Jim Lemon
1) In general, *apply functions return a list with the number of elements equal to the number of columns or other elements of the input data. You can assign that list as I have to "spout" in the first example. 2) spout<-list() assigns the name "spout" to an empty list. As we are processing

Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-08 Thread Subhamitra Patra
Dear Sir, Thank you very much for such an excellent solution to my problem. I was trying sapply function since last days, but was really unable to write properly. Now, I understood my mistake in using sapply function in the code. Therefore, I have two queries regarding this which I want to

Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-08 Thread Jim Lemon
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

Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-08 Thread Subhamitra Patra
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. Please help me in this regard. Thank you very much for your help. Year_Month A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 94-Jan 0.051197 7.05E-05

Re: [R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-07 Thread Jim Lemon
Hi Subhamitra, For some reason, your data didn't make it through. Maybe you tried to send an .xls or .xlsx file. If so, export it as CSV or if it's not too big, just paste the text into your email. Jim On Thu, May 7, 2020 at 10:30 PM Subhamitra Patra wrote: > > Dear R-users, > > I want to

[R] [R ] Writing loop to estimate ARCH test for a multiple columns of a data frame?

2020-05-07 Thread Subhamitra Patra
Dear R-users, I want to estimate ARCH test for multiple columns (i.e., from 2:21 COLUMNS ) in my data. For this purpose, I want to run a loop to calculate ARCH test results for each column in the data frame. I tried by using for loop and lapply function, but unable to write a loop for computing