[R] Enquiry for applying Self-Organizing Map for Time Series Prediction in R
Dear Sir/Madam Hi, my name is Youngrang Kang and I have started to study R for about a few months ago. I have used some Time Series Prediction (TSP) Models in R and I have found an interesting TSP Model, which is Self-Organizing Map(SOM) for TSP. I have read the articles on the R Package ¡®SOM¡¯ and ¡®kohonen¡¯. However, these articles were insufficient to apply SOM for TSP in R. Does anyone know how to apply SOM for TSP in R? or Does anyone has a sample source code that I can refer? I am looking forward to hearing from you soon. Regards, Youngrang Kang [[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] enquiry
hi, I am new to using R ,I have 2 datasets with dates common in them ,how can i take out the common dates within them. karan [[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.
Re: [R] enquiry
On Monday, October 1, 2012, Karan Anand wrote: hi, I am new to using R ,I have 2 datasets with dates common in them ,how can i take out the common dates within them. Depending on what you mean by 'out' either merge() or setdiff() RMW karan [[alternative HTML version deleted]] __ R-help@r-project.org javascript:; 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.
Re: [R] enquiry
Hello, Or maybe %in%. x - Sys.Date() + 1:10 y - Sys.Date() + 7:15 x %in% y # logical index into 'x' x[x %in% y] # common x[!x %in% y] # not common setdiff(x, y) # doesn't keep class Date Hope this helps, Rui Barradas Em 01-10-2012 15:57, R. Michael Weylandt escreveu: On Monday, October 1, 2012, Karan Anand wrote: hi, I am new to using R ,I have 2 datasets with dates common in them ,how can i take out the common dates within them. Depending on what you mean by 'out' either merge() or setdiff() RMW karan [[alternative HTML version deleted]] __ R-help@r-project.org javascript:; 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. __ 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.
Re: [R] enquiry
Yep, you are right, this works: readCell - function(workbook, sheetName, i, j) { pos - getSheetPos(workbook, sheetName) readWorksheet(workbook, pos, startRow=i, endRow=i, startCol=j, endCol=j, header=FALSE)[[1]] } 2012/7/17 Rui Barradas ruipbarra...@sapo.pt Hello, Sorry, but I'm not at my computer and will be away from it for 2 or 3 days, so I can't install package XLConnect and see what's going on. Heve you tried the functions to get sheets first? (by number, maybe.) Rui Barradas Em 16-07-2012 22:30, Erdal Karaca escreveu: Just tried XLConnect which seems to work without any problems... When defining this: wb - loadWorkbook(c:\\path-to-xls-file) readCell - function(sheet, row, col) { readWorksheet(wb, sheet, startRow=row, endRow=row, startCol=col, endCol=col, header=FALSE)[[1]] } then, calling the function like this: readCell(Tabelle1, 1, 1) I will get this error message: Fehler in startRow - 1 : nicht-numerisches Argument für binären Operator (error in startRow - 1: non-numeric argument for binary operator) What am I doing wrong? Note: I just want to read the value of a specific cell. The best way is to have a function providing an excel like coordinate (e.g. A1)... 2012/7/16 Rui Barradas ruipbarra...@sapo.pt mailto:ruipbarra...@sapo.pt Sorry, it's findFn(xlsx) And the first three hits ARE promising (they work). I use the second, package xlsx. Package XLConnect is more flexible if you want to do things to excel spreadsheets from R. Package xlsx is simpler if you just want to read them and then use R. Rui Barradas Em 16-07-2012 07:37, Rui Barradas escreveu: Hello, Try the following. install.packages(sos) # to install the package library(sos) # to load the package nto R session finFn(xlsx)# find it Have fun. Hope this helps, Rui Barradas Em 16-07-2012 06:17, Karan Anand escreveu: hi, i am new to r ,i have a xlsx data with me with 12 sheet in it and need to convert it to csv first and then need to convert it into time series ,so if u can pls guide me a little how to do it. Regards karan [[alternative HTML version deleted]] __ R-help@r-project.org mailto: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 mailto: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 mailto: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.
Re: [R] enquiry
Hello, Sorry, but I'm not at my computer and will be away from it for 2 or 3 days, so I can't install package XLConnect and see what's going on. Heve you tried the functions to get sheets first? (by number, maybe.) Rui Barradas Em 16-07-2012 22:30, Erdal Karaca escreveu: Just tried XLConnect which seems to work without any problems... When defining this: wb - loadWorkbook(c:\\path-to-xls-file) readCell - function(sheet, row, col) { readWorksheet(wb, sheet, startRow=row, endRow=row, startCol=col, endCol=col, header=FALSE)[[1]] } then, calling the function like this: readCell(Tabelle1, 1, 1) I will get this error message: Fehler in startRow - 1 : nicht-numerisches Argument für binären Operator (error in startRow - 1: non-numeric argument for binary operator) What am I doing wrong? Note: I just want to read the value of a specific cell. The best way is to have a function providing an excel like coordinate (e.g. A1)... 2012/7/16 Rui Barradas ruipbarra...@sapo.pt mailto:ruipbarra...@sapo.pt Sorry, it's findFn(xlsx) And the first three hits ARE promising (they work). I use the second, package xlsx. Package XLConnect is more flexible if you want to do things to excel spreadsheets from R. Package xlsx is simpler if you just want to read them and then use R. Rui Barradas Em 16-07-2012 07:37, Rui Barradas escreveu: Hello, Try the following. install.packages(sos) # to install the package library(sos) # to load the package nto R session finFn(xlsx)# find it Have fun. Hope this helps, Rui Barradas Em 16-07-2012 06:17, Karan Anand escreveu: hi, i am new to r ,i have a xlsx data with me with 12 sheet in it and need to convert it to csv first and then need to convert it into time series ,so if u can pls guide me a little how to do it. Regards karan [[alternative HTML version deleted]] __ R-help@r-project.org mailto: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 mailto: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 mailto: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.
Re: [R] enquiry
Hello, Try the following. install.packages(sos) # to install the package library(sos) # to load the package nto R session finFn(xlsx)# find it Have fun. Hope this helps, Rui Barradas Em 16-07-2012 06:17, Karan Anand escreveu: hi, i am new to r ,i have a xlsx data with me with 12 sheet in it and need to convert it to csv first and then need to convert it into time series ,so if u can pls guide me a little how to do it. Regards karan [[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.
Re: [R] enquiry
Sorry, it's findFn(xlsx) And the first three hits ARE promising (they work). I use the second, package xlsx. Package XLConnect is more flexible if you want to do things to excel spreadsheets from R. Package xlsx is simpler if you just want to read them and then use R. Rui Barradas Em 16-07-2012 07:37, Rui Barradas escreveu: Hello, Try the following. install.packages(sos) # to install the package library(sos) # to load the package nto R session finFn(xlsx)# find it Have fun. Hope this helps, Rui Barradas Em 16-07-2012 06:17, Karan Anand escreveu: hi, i am new to r ,i have a xlsx data with me with 12 sheet in it and need to convert it to csv first and then need to convert it into time series ,so if u can pls guide me a little how to do it. Regards karan [[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. __ 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.
Re: [R] enquiry
Just tried XLConnect which seems to work without any problems... When defining this: wb - loadWorkbook(c:\\path-to-xls-file) readCell - function(sheet, row, col) { readWorksheet(wb, sheet, startRow=row, endRow=row, startCol=col, endCol=col, header=FALSE)[[1]] } then, calling the function like this: readCell(Tabelle1, 1, 1) I will get this error message: Fehler in startRow - 1 : nicht-numerisches Argument für binären Operator (error in startRow - 1: non-numeric argument for binary operator) What am I doing wrong? Note: I just want to read the value of a specific cell. The best way is to have a function providing an excel like coordinate (e.g. A1)... 2012/7/16 Rui Barradas ruipbarra...@sapo.pt Sorry, it's findFn(xlsx) And the first three hits ARE promising (they work). I use the second, package xlsx. Package XLConnect is more flexible if you want to do things to excel spreadsheets from R. Package xlsx is simpler if you just want to read them and then use R. Rui Barradas Em 16-07-2012 07:37, Rui Barradas escreveu: Hello, Try the following. install.packages(sos) # to install the package library(sos) # to load the package nto R session finFn(xlsx)# find it Have fun. Hope this helps, Rui Barradas Em 16-07-2012 06:17, Karan Anand escreveu: hi, i am new to r ,i have a xlsx data with me with 12 sheet in it and need to convert it to csv first and then need to convert it into time series ,so if u can pls guide me a little how to do it. Regards karan [[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. __ 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.
[R] enquiry
hi, i am new to r ,i have a xlsx data with me with 12 sheet in it and need to convert it to csv first and then need to convert it into time series ,so if u can pls guide me a little how to do it. Regards karan [[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] enquiry
hi, i am new to using r .so if you can pls tell me how to read 1951-52 ,1952-52 date format in r [[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.
Re: [R] enquiry
try this: as.Date('1951-52', format = %Y-%j) [1] 1951-02-21 On Mon, Jul 2, 2012 at 5:44 AM, Karan Anand anand.kara...@gmail.com wrote: hi, i am new to using r .so if you can pls tell me how to read 1951-52 ,1952-52 date format in r [[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. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. __ 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.
Re: [R] enquiry
In order to do any conversion, you have to know the format of the data that is being input. So which is it: does 52 represent the day of the year, or the week of the year? Does make a big difference, but until you know what 1952-52 means, it is hard to specify which way you should do the conversion. On Mon, Jul 2, 2012 at 9:12 AM, arun smartpink...@yahoo.com wrote: Hi Jim, I tried, dat2-as.Date(dat1,format=%Y-%V) dat2 [1] 1951-07-02 1952-07-02 But, if the format is for -wk or -yy, then, not sure how this will help. A.K. - Original Message - From: jim holtman jholt...@gmail.com To: Karan Anand anand.kara...@gmail.com Cc: r-help@r-project.org Sent: Monday, July 2, 2012 9:04 AM Subject: Re: [R] enquiry try this: as.Date('1951-52', format = %Y-%j) [1] 1951-02-21 On Mon, Jul 2, 2012 at 5:44 AM, Karan Anand anand.kara...@gmail.com wrote: hi, i am new to using r .so if you can pls tell me how to read 1951-52 ,1952-52 date format in r [[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. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. __ 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. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. __ 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.
Re: [R] enquiry
Hi Jim, I tried, dat2-as.Date(dat1,format=%Y-%V) dat2 [1] 1951-07-02 1952-07-02 But, if the format is for -wk or -yy, then, not sure how this will help. A.K. - Original Message - From: jim holtman jholt...@gmail.com To: Karan Anand anand.kara...@gmail.com Cc: r-help@r-project.org Sent: Monday, July 2, 2012 9:04 AM Subject: Re: [R] enquiry try this: as.Date('1951-52', format = %Y-%j) [1] 1951-02-21 On Mon, Jul 2, 2012 at 5:44 AM, Karan Anand anand.kara...@gmail.com wrote: hi, i am new to using r .so if you can pls tell me how to read 1951-52 ,1952-52 date format in r [[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. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. __ 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.
Re: [R] Enquiry about 2nd-order interactions survival analysis
David's answers were correct. You are looking deep into the code when there is no reason to to so. 1. h(t|(X=x,Z=z)) = exp(Beta0 + XZBeta1) Most statisticians will tell you that this is an unwise model. The reason is that if you replace X with X+1 the fit changes, which is almost never desirable. What if someone coded your dummy variable as 1/0 instead of 0/1 -- wouldn't you want to get the same fit Therefore the default in R for the model lm(y ~ x*z) is to fit y = b0 + b1 x + b2 z + b3 xz You can get exactly the model you specify as lm(y ~ x:z), or as temp - x*z; lm(y ~ temp) Statistically, this is almost surely a mistake. 2. The model formulas work across packages. I used lm() above, but survreg is no different. Formula processing is done by the model.matrix() function, which survreg, lm, glm, all call. My C code is all downstream of this, and irrelevant to your question. Terry T On Sun, 2011-11-13 at 14:39 +0800, Kenji Ryusuke wrote: Dr Terry Therneau, Firstly I do apologize upon unsolicited email. I know about Dr Terry through R package survival and alot of your papers. As we know Equation(1) is a normal parametric survival analysis, I'ld like to modify it to be a 2nd-order interactions as in Equation(2) :- h(t|X=x) = exp(Beta0 + XBeta1) --- (1) h(t|(X=x,Z=z)) = exp(Beta0 + XZBeta1) -- (2) Where x and z are two covariates: x = dummy variable (1 or 0) z = factors (people name) I would like to modify survreg() to be a second-order interactions regression while there is no 2nd-order interactions survival regression as I searched over www.rseek.org. I tried to read through the codes of survreg(), but I am stuck (cannot understand) at survreg6.c survreg6.c apply C Language which involves Cholesky decomposition multi-matrix (first-order interactions) calculation. 1) chinv2.c 2) cholesky3.c 3) chsolve2.c (only solve the equations of first-order interactions) I do appreciate if Dr Terry willing to enlighten me. Thank you. Best, Ryusuke __ 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] Enquiry on Vrtest
Hi there, I am currently working on my dissertation which is about testing the martingale hypothesis in the stock market using a methodology involving a range of variance ratio tests and multiple variance ratio tests. I contacted the author of a reference paper and I was told that the tests can be conducted using R programming language. Although I have gone through the theoretical background of the methodology, but I found it quite difficult to implement the tests practically using my own data. As I have little experience in R. I would be really appreciated if you could do me a favour by giving me some hints on to use the Reference Manual written by the author of Vrtest, is it correct for me to read in my own data, and then type in the codes from the reference manual to get results.Obviously, I have installed the Vrtest package. I tried to type in the command from the reference manual and they always return Error: could not find function, I would like to know how to solve this. Many thanks. -- Best regards River Jim [[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.
Re: [R] Enquiry on Vrtest
On May 28, 2011, at 10:58 AM, Chim Kaho wrote: Hi there, I am currently working on my dissertation which is about testing the martingale hypothesis in the stock market using a methodology involving a range of variance ratio tests and multiple variance ratio tests. I contacted the author of a reference paper and I was told that the tests can be conducted using R programming language. Although I have gone through the theoretical background of the methodology, but I found it quite difficult to implement the tests practically using my own data. As I have little experience in R. I would be really appreciated if you could do me a favour by giving me some hints on to use the Reference Manual written by the author of Vrtest, is it correct for me to read in my own data, and then type in the codes from the reference manual to get results.Obviously, I have installed the Vrtest package. I tried to type in the command from the reference manual and they always return Error: could not find function, I would like to know how to solve this. Many thanks. A fairly common beginner mistake is to install a package but then not not understand that thye also need to laod it. ?require ?library -- David Winsemius, MD West Hartford, CT __ 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] enquiry
Dear R-help, I am trying to estimate a Cox model with nested effects basing on the minimization of the overall AIC; I have two frailties terms, both gamma distributed. There is a error message (theta2 argument misses) and I don?t understand why. I would like to know what I have wrong. Thank you very much for your time. fitM7 - coxph(Surv(lifespan,censured) ~ south + frailty(id, dist='gamma')+ frailty(mob, dist='gamma'), data= usa) tempfun - function(theta1, theta2) { fit - coxph(Surv(lifespan,censured) ~ south + frailty(id, dist='gamma', sparse= TRUE, theta=theta1)+ frailty(mob, dist='gamma', sparse =TRUE, theta=theta2), data=usa) aic - (fit$loglik[2] - fit$loglik[1]) - sum(fit$df) return(2*aic) } nlminb(c(theta1=3.2,theta2=.2), tempfun) Error in (get(temp))(x, ...) : argument theta2 is missing, with no default Best, Silvia __ 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.