[R] Kendall package tau-a, b, and c

2012-08-19 Thread Kota Hattori
Hi all, I would like to ask a question related to Kendall package. I ran Kendall (x,y) and saw the results. But I am not sure which tau values R reported. I have ties in my data set, so I want tau-b. Can anybody tell how Kendall package is calculating tau values? I have looked at the package

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread William Dunlap
Yes, if the Special_Dates are not sorted then f4 needs to sort them. Perhaps closestValue should just sort its vec argument. I didn't realize that the output should not have any duplicate entries. I thought it should have the same number of rows as the input A. Bill Dunlap Spotfire, TIBCO Softwa

Re: [R] relating data in two data frames

2012-08-19 Thread David Winsemius
On Aug 19, 2012, at 5:56 PM, Sapana Lohani wrote: Hi, My data.frame "A" has FID like this FID a a b b b c c d d d d Now my second data.frame "B" has age value for a, b, c, d like FID Age a 5 b 7 c 9 d 3 How can search for the Age column in "B" and replace the value

[R] relating data in two data frames

2012-08-19 Thread Sapana Lohani
Hi, My data.frame "A" has FID like this FID a a b b b c c d d d d Now my second data.frame "B" has age value for a, b, c, d like FID Age a  5 b  7 c  9 d  3 How can search for the Age column in "B" and replace the values in "A" so that my new "A" looks like this FID Age

Re: [R] (no subject)

2012-08-19 Thread David Winsemius
On Aug 19, 2012, at 5:14 PM, Dikán Szabolcs András wrote: Dear R Users! I'm new in R! I've got a data.frame. For example:a<-data.frame(cbind( 0:1, 1:10)) X1 X2 1 0 1 2 1 2 3 0 3 4 1 4 5 0 5 6 1 6 7 0 7 8 1 8 9 0 9 10 1 10 Firstly i want to create combinations

[R] (no subject)

2012-08-19 Thread Dikán Szabolcs András
Dear R Users! I'm new in R! I've got a data.frame. For example:a<-data.frame(cbind( 0:1, 1:10)) X1 X2 1 0 1 2 1 2 3 0 3 4 1 4 5 0 5 6 1 6 7 0 7 8 1 8 9 0 9 10 1 10 Firstly i want to create combinations from X2, for example:combn(a$X2,2) It's ok, butsecondly I wo

Re: [R] moving distance between two sets of data

2012-08-19 Thread David Winsemius
On Aug 19, 2012, at 4:34 PM, White, William Patrick wrote: Also it occurred to me that my initial explanation was not explicitly clear as to what the desired output is. What I am trying to get is a moving absolute deviation between the two sets of numbers. The phrase "a moving absolute dev

Re: [R] moving distance between two sets of data

2012-08-19 Thread White, William Patrick
Also it occurred to me that my initial explanation was not explicitly clear as to what the desired output is. What I am trying to get is a moving absolute deviation between the two sets of numbers. This is not to be confused with the mean absolute deviation, or the median absolute deviation whic

Re: [R] moving distance between two sets of data

2012-08-19 Thread White, William Patrick
The first method described produces a value other than the desired output every time the Firstset value is positive and the Secondset is negative, such as the second instance when seed is set to 123. The second method described produces a value other than the desired output every time the Firsts

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread Rui Barradas
Hello, You're right, your solution is much faster, but it doesn't remove duplicates. When I ran f4() with larger datasets it poduced an error, Error in findInterval(x, vec) : 'vec' must be sorted non-decreasingly So here they all are. f1 <- function(A, B){ m <- merge(A, B) result <-

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread William Dunlap
And the following, f4, uses the same algorithm as f2 but codes it somewhat more efficiently. It uses the same closestValue() function. f4 <- function (A, B) { A$TYPE <- as.factor(A$TYPE) uA <- levels(A$TYPE) As <- split(A$DATE, A$TYPE) Bs <- split(B$Special_Date, factor(B$TYPE, l

Re: [R] kernlab | ksvm error

2012-08-19 Thread Reza Salimi-Khorshidi
Hi Uwe, I can attach the data file to an email or send you a link so you can download it. Which one do you prefer? Thanks for your help ... Best, Reza On Sun, Aug 19, 2012 at 4:10 PM, Uwe Ligges wrote: > > > On 19.08.2012 11:06, Reza Salimi-Khorshidi wrote: > >> Dear list, >> I am using the ksv

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread William Dunlap
The following, f2(A,B), should do well with lots of rows in A and B as long as the number of types is not huge. f2 <- function(A, B) { types <- as.character(unique(A$TYPE)) result <- numeric(nrow(A)) Bs <- split(B$Special_Date, B$TYPE) for(type in types) { w <- A$TYPE == ty

Re: [R] e1071 - tuning is not giving the best within the range

2012-08-19 Thread Mark Leeds
Hi: I can't go into all the details ( Lutz Hamel has a very nice intro book for SVM's and I wouldn't do the details justice anyway ) but the objective function in an SVM is maximizing the margin ( think of the margin as the amount of seperation between the 2 classes in a 2 class problem ). The obje

Re: [R] moving distance between two sets of data

2012-08-19 Thread David Winsemius
On Aug 19, 2012, at 12:58 PM, David Winsemius wrote: On Aug 19, 2012, at 12:04 PM, White, William Patrick wrote: On the surface this seems pretty simple, but I flummoxed. I have two sets of numbers they bounce around zero, positive one and negative one. They have a relationship between th

Re: [R] moving distance between two sets of data

2012-08-19 Thread David Winsemius
On Aug 19, 2012, at 12:04 PM, White, William Patrick wrote: On the surface this seems pretty simple, but I flummoxed. I have two sets of numbers they bounce around zero, positive one and negative one. They have a relationship between them, where one diverges away from the other. I want cre

[R] moving distance between two sets of data

2012-08-19 Thread White, William Patrick
On the surface this seems pretty simple, but I flummoxed. I have two sets of numbers they bounce around zero, positive one and negative one. They have a relationship between them, where one diverges away from the other. I want create a second set of numbers that tracks that divergence. #Lets m

[R] e1071 - tuning is not giving the best within the range

2012-08-19 Thread delf
Hi everybody, I am new in e1071 and with SVMs. I am trying to understand the performance of SVMs but I face with a situation that I thought as not meaningful. I added the R code for you to see what I have done. /set.seed(1234) data <- data.frame( rbind(matrix(rnorm(1500, mean = 10, sd = 5),ncol

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread Rui Barradas
Hello, Em 19-08-2012 17:33, William Dunlap escreveu: Did you omit m <- merge(A, B) from your code? Yes, completely forgot! It should be before the split/lapply. Rui Barradas Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-projec

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread William Dunlap
How many different types are there? Just a handful or many thousands? For this sort of problem it is often handy to write a function which generates datasets of the sort you are thinking of but parameterized by the number of rows, levels, etc., so you can see how the execution time varies with the

Re: [R] R - rpart - increasing xerror

2012-08-19 Thread Uwe Ligges
On 18.08.2012 21:32, Daniel Blankenheim wrote: Hey my name is daniel, i am writing my bachelor thesis and wondering if you can help me. i am trying to generate a regression tree via rpart. to reduce the error of the model i use cross validation, but instead of reducing the cross validation er

Re: [R] kernlab | ksvm error

2012-08-19 Thread Uwe Ligges
On 19.08.2012 11:06, Reza Salimi-Khorshidi wrote: Dear list, I am using the ksvm function from kernlab as follows: (1) learning svm.pol4 <- ksvm(class.labs ~ ., data = train.data, prob.model = T, scale = T, kernel = "polydot") (2) prediction svm.pol.prd4 <- predict(svm.pol4, train.data, ty

[R] GAM with shrinkage: how to obtain explained deviance of individual terms?

2012-08-19 Thread Tilen Genov
Dear R users, apologies if this has been debated before, but I was unable to find it anywhere (with respect to shrinkage approach). I am trying to evaluate explained deviance of each model term in a GAM. I am using a the mgcv library for fitting a GAM to binary data. Thin plate regression spline

[R] radarchart axis scaling

2012-08-19 Thread Mitra Rahmati
Hello I created a radar chart using the function of “radarchart” from the “fmsb” package in R software. The matrix I am using is as follows: x<-c(c(rep(4.5,7),c(rep(0,7)), 3.34, 3.28, 1.37, 1.12, 3.52, 4.07, 3.66)); a<-matrix(x,nrow=3, ncol=7,byrow=T) I would like to show the range of c(0,5)

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread Francesco
Thank you very much Rui On 19 August 2012 13:49, Rui Barradas wrote: > Hello, > > Yes you can, if you have memory problems, say so and we'll see it then. > In the mean time, there's something you should change, to allow for several > minima but to only return one per combination of TYPE and DATE

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread Rui Barradas
Hello, Yes you can, if you have memory problems, say so and we'll see it then. In the mean time, there's something you should change, to allow for several minima but to only return one per combination of TYPE and DATE. Replace this x[which(min(a) == a), ] by this x[which.min(a), ] Rui Bar

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread Francesco
Dear Riu, Many thanks for your suggestion However these are just simplified examples... in reality the dataset A contains millions of observations and B several thousands of rows... Could I still use a modified form of your suggestion? Thanks On 19 August 2012 12:51, Rui Barradas wrote: > Hello

Re: [R] merging and obtaining the nearest value

2012-08-19 Thread Rui Barradas
Hello, Try the following. A <- read.table(text=" TYPE DATE A2 A5 A20 B10 B2 ", header = TRUE) B <- read.table(text=" TYPE Special_Date A 2 A 6 A 20 A 22 B 5 B

[R] merging and obtaining the nearest value

2012-08-19 Thread Francesco
Dear R-help Î would like to know if there is a short solution in R for this merging problem... Let say I have a dataset A as: TYPE DATE A2 A5 A20 B10 B2 (there can be duplicates for the same type and date) and I have another dataset

[R] kernlab | ksvm error

2012-08-19 Thread Reza Salimi-Khorshidi
Dear list, I am using the ksvm function from kernlab as follows: (1) learning > svm.pol4 <- ksvm(class.labs ~ ., data = train.data, prob.model = T, scale = T, kernel = "polydot") (2) prediction > svm.pol.prd4 <- predict(svm.pol4, train.data, type = "probabilities")[,2] But unfortunately, when ca