Re: [R] Order of formula terms in model.matrix

2016-01-18 Thread Guelman, Leo
, January, 18 11:16 AM To: Guelman, Leo Cc: r-help@r-project.org; Charles C. Berry Subject: Re: [R] Order of formula terms in model.matrix On 18 Jan 2016, at 16:49 , Guelman, Leo wrote: > Is it really the same model? No, and I didn't say that they would be. I did say that they would b

Re: [R] Order of formula terms in model.matrix

2016-01-18 Thread Guelman, Leo
Is it really the same model? Following the example provided by Lars: set.seed(1) x1 <- rnorm(100) f1 <- factor(sample(letters[1:3], 100, replace = TRUE)) trt <- sample(c(-1,1), 100, replace = TRUE) y <- factor(sample(c(0,1), 100, T)) df <- data.frame(y=y, x1=x1, f1=f1, trt=trt) fit1 <- glm(y ~ x

[R] Order of factor levels

2016-01-11 Thread Guelman, Leo
Dear list, What is a better way relative to the one below to keep the order of factor levels created from cut()? Notice, I'm simply pasting letters to levels before converting to character so to keep the desired order of levels. This is not very elegant... I'm converting to character so I can c

[R] formula method with "special" characters

2012-06-20 Thread Guelman, Leo
Dear List, I'm trying to create a formula method, allowing for a "special" character in the formula (i.e., similar to for example the gam package with the character "s" in y ~ s(x)). I've checked and it seems this is done through attr(,"specials"). However, the section of code below (as an example

Re: [R] Help with contrasts

2011-05-11 Thread Guelman, Leo
Or alternatively (though very similar to Peter's idea) you can do ci <- contrasts formals(ci)$contrasts <- FALSE dd <- data.frame(a = gl(3,4), b = gl(4,1,12)) mm <- model.matrix(~ a + b, dd, contrasts = list(a=ci(dd$a), b=ci(dd$b))) Best, Leo. -Original Message- From: r-help-boun...@r-p

Re: [R] Reproducibility issue in gbm (32 vs 64 bit)

2011-02-28 Thread Guelman, Leo
I'm guessing this has something to do with numerical precision on the two platforms. Leo. - Original Message - From: Joshua Wiley To: Axel Urbiz Cc: R-help@r-project.org ; Ridgeway, Greg Sent: Fri Feb 25 22:16:02 2011 Subject: Re: [R] Reproducibility issue in gbm (32 vs 64 bit) Hi Axe

[R] New R User Group in Toronto

2010-10-12 Thread Guelman, Leo
Dear R users, I'm pleased to announce that the Greater Toronto Area (GTA) user's group is now active on meetup.com, and taking suggestions for the first meeting. If you are on the region, you can sign-up now at the link below http://www.meetup.com/Greater-Toronto-Area-GTA-R-Users-Group This gro

[R] Can this code be written more efficiently?

2010-09-30 Thread Guelman, Leo
Dear users, I'm working on binary classification problem using Support Vector Machines (SVM). My objective is to train a series of SVM models on a grid of hyperparameters and then select those that maximize the AUC based on an independent validation sample. My attempted code is shown below. It r

Re: [R] TM Package - Corpus function - Memory Allocation Problems

2010-08-17 Thread Guelman, Leo
I'm using R 2.11.1 on Win XP (32-bit) with 3 GB of RAM. My data has (only) 16.0 MB. I want to create a VCorpus object using the Corpus function in the tm package but I'm running into Memory allocation issues: "Error: cannot allocate vector of size 372 Kb". My data is stored in a csv file which