[R] XGBoost continuos outcome case --- reg:linear in R

2016-02-08 Thread Sandeep Rana
Hi, While learning how to implement XGBoost in R I came across below case and want to know how to go about it. Outcome variable: continous independent features: mix of categorical and continuous nrow(train_set): 8523 Since, XGBoost natively supports only numeric features, I applied one hot enc

[R] Markovchain and Sensitivity analysis

2016-02-08 Thread Kristin Bornstein
I'm trying to develop a markov chain transition matrix to simulate an infectious disease model. I've got a much larger matrix that I'm working with but here's the code for a toy version of the model: library("markovchain") byRow <- TRUE #Parameters pop <- 1000 b1 <- 0.095 b2 <- 0.048 b3 <

Re: [R] [FORGED] Plot step function

2016-02-08 Thread jupiter
Thanks Jeff, I've already added color and lwd to make it visible. I know it is not the optimal thing to do, but I was required. Cheers. On Tue, Feb 9, 2016 at 3:11 AM, Jeff Newmiller wrote: > R by default puts the axes at the edge of the plot, not at x=0 and y=0, > for the reason that doing oth

Re: [R] calling plot

2016-02-08 Thread Spencer Graves
Hi, Jeff et al.: On 2/8/2016 9:52 PM, Jeff Newmiller wrote: > plotxy(y1~x1, XY, xlim=c(0, max(XY$x1))) Yes, Thanks. Is there a way to do this from within "plotxy", so I can call "plotxy" as I call "plot"? Thanks, Spencer > -- > Sent from my phone. Please excu

Re: [R] calling plot

2016-02-08 Thread Jeff Newmiller
plotxy(y1~x1, XY, xlim=c(0, max(XY$x1))) -- Sent from my phone. Please excuse my brevity. On February 8, 2016 7:17:57 PM PST, Spencer Graves wrote: >I'm getting an interesting error: > > > > plotxy <- function(x, ...){ >+ plot(x, ...) >+ } > > XY <- data.frame(x1=1:3, y1=4:6) > > plotxy(y1~x1

[R] calling plot

2016-02-08 Thread Spencer Graves
I'm getting an interesting error: > plotxy <- function(x, ...){ + plot(x, ...) + } > XY <- data.frame(x1=1:3, y1=4:6) > plotxy(y1~x1, XY, xlim=c(0, max(x1))) Show Traceback Rerun with Debug Error in eval(expr, envir, enclos) : object 'x1' not found The following work: plotxy(y1~x

Re: [R] readline is not working

2016-02-08 Thread Jim Lemon
Hi Jean, Many laptops perform complicated workarounds to accommodate the virtual keypads on the keyboard. Sometimes a sticky shift key (e.g. NumLock, Caps Lock) will mess up keyboard entry if it is on. Just a wild guess. Jim On Mon, Feb 8, 2016 at 7:16 PM, MAURICE Jean - externe < jean-externe.m

Re: [R] Help in meta-analysis (URGENT please)

2016-02-08 Thread MCGUIRE, Rhydwyn
Hi Rosa, This looks like a mix of a R problem and a statistical problem. For the statistical part I think you are going to need to find a statistician/adviser to sit down with and workout what you want to measure and whether it is possible. For the R part it might be more useful to ask specif

[R] Compare correlation coefficients between samples

2016-02-08 Thread swaraj basu
Dear All, I have a dataframe of 1000 rows and 4 columns. Each row represents a pair of vectors (in my case a pair of genes) while the columns represent the following estimate.A: spearman correlation coefficient of gene[i] and gene[j] expression across 120 samples from cancer type A prob.A: Probab

Re: [R] Dates and missing values

2016-02-08 Thread Marc Schwartz
> On Feb 8, 2016, at 12:45 PM, Göran Broström wrote: > > Thanks Marc, but see below! > > On 2016-02-08 19:26, Marc Schwartz wrote: >> >>> On Feb 8, 2016, at 11:26 AM, Göran Broström wrote: >>> >>> I have a data frame with dates as integers: >>> summary(persons[, c("foddat", "doddat")])

[R] Help in meta-analysis (URGENT please)

2016-02-08 Thread Rosa Oliveira
Dear all, I’m conducting a met analysis and I usually use Revman, bur as I’m trying to use R more and more, I would like to conduct the met analysis here, in R (R-studio). One off my problems, I think, is that: 1st. it’s the first time :) 2. I only have data for 1 arm as you can see on the data

[R] syntax for nested random factors in lme

2016-02-08 Thread Kathleen Côté
Hi, I've been taught that if I want to nest random factor A into B in an lme model, the syntax is as follows: lme(x~y+B,random=~1|B/A). In the case of my data, matters seem to be complicated by the fact that B is a categorical variable with only 2 levels. When I run the lme with the above syntax,

Re: [R] Dates and missing values

2016-02-08 Thread Göran Broström
Thanks Marc, but see below! On 2016-02-08 19:26, Marc Schwartz wrote: On Feb 8, 2016, at 11:26 AM, Göran Broström wrote: I have a data frame with dates as integers: summary(persons[, c("foddat", "doddat")]) foddat doddat Min. :1679 Min. :1800 1st Qu.:1876090

Re: [R] Dates and missing values

2016-02-08 Thread Marc Schwartz
> On Feb 8, 2016, at 11:26 AM, Göran Broström wrote: > > I have a data frame with dates as integers: > > > summary(persons[, c("foddat", "doddat")]) > foddat doddat > Min. :1679 Min. :1800 > 1st Qu.:18760904 1st Qu.:18810924 > Median :19030426 Median :19091227

[R] Dates and missing values

2016-02-08 Thread Göran Broström
I have a data frame with dates as integers: > summary(persons[, c("foddat", "doddat")]) foddat doddat Min. :1679 Min. :1800 1st Qu.:18760904 1st Qu.:18810924 Median :19030426 Median :19091227 Mean :18946659 Mean :19027233 3rd Qu.:19220911 3rd Qu.:19

Re: [R] How to extract same columns from identical dataframes in a list?

2016-02-08 Thread Dénes Tóth
Hi, Although you did not provide any reproducible example, it seems you store the same type of values in your data.frames. If this is true, it is much more efficient to store your data in an array: mylist <- list(a = data.frame(week1 = rnorm(24), week2 = rnorm(24)), b = data.fr

Re: [R] How to extract same columns from identical dataframes in a list?

2016-02-08 Thread Jeff Newmiller
Or do.call( rbind, list.of.df ) from base R (without some of the robust behaviors that ldply implements). -- Sent from my phone. Please excuse my brevity. On February 8, 2016 7:33:54 AM PST, Ulrik Stervbo wrote: >Hi Wolfgang, > >I'm not sure exactly what you want, but the ldply in the package

Re: [R] [FORGED] Plot step function

2016-02-08 Thread Jeff Newmiller
R by default puts the axes at the edge of the plot, not at x=0 and y=0, for the reason that doing otherwise makes the plot harder to read. To see this, consider: plot( c( -4, 0, 4 ), c( 0, 1, 1 ), type="s", xlab="x", ylab="y", axes=FALSE, xlim=c( -5, 5 ), ylim=c( -2, 2 ), lwd=2 ) axis( side=1,

Re: [R] How to extract same columns from identical dataframes in a list?

2016-02-08 Thread Ulrik Stervbo
Hi Wolfgang, I'm not sure exactly what you want, but the ldply in the package plyr can help you make a data.frame from a list of data.frames: library(plyr) dfa <- data.frame(cola = LETTERS[1:5], colb = c(1:5)) dfb <- data.frame(cola = LETTERS[1:5], colb = c(1:5)) df.lst <- list(dfa.name = dfa,

Re: [R] Help for survival curves for the survfit object‏

2016-02-08 Thread Göran Broström
On 2016-02-08 14:11, 于慧琳 wrote: Hi guy,I have some problems when plotting survival curves for the survfit object.My survfit model is as follows:fit6<-survfit(Surv(Survival_time_year_,event)~Race_1_Desc,data=data6)Race_1_Desc is a indicator variable which has 0 and 1 values.However, in my datase

Re: [R] middle of interval

2016-02-08 Thread David L Carlson
Here is another approach: > interval <- c("1902-1931", "1912-1930", "1902-1951") > sapply(strsplit(interval, "-"), function(x) mean(as.numeric(x))) [1] 1916.5 1921.0 1926.5 - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77

[R] readline is not working

2016-02-08 Thread MAURICE Jean - externe
HI, I am new to R and English is not my natural language. I work on 4 laptops that are supposed to be the same. Win7-64. R version 3.1.0. I can use readline to enter a value from keyboard on three of them but not on the fourth : R doesn't stop on the readline instruction and acts as if the resp

[R] How to extract same columns from identical dataframes in a list?

2016-02-08 Thread Wolfgang Waser
Hello, I have a list of 7 data frames, each data frame having 24 rows (hour of the day) and 5 columns (weeks) with a total of 5 x 24 values I would like to combine all 7 columns of week 1 (and 2 ...) in a separate data frame for hourly calculations, e.g. > apply(new.data.frame,1,mean) In some wa

[R] Help for survival curves for the survfit object‏

2016-02-08 Thread 于慧琳
Hi guy,I have some problems when plotting survival curves for the survfit object.My survfit model is as follows:fit6<-survfit(Surv(Survival_time_year_,event)~Race_1_Desc,data=data6)Race_1_Desc is a indicator variable which has 0 and 1 values.However, in my dataset, all of the Race_1_Desc are of

Re: [R] middle of interval

2016-02-08 Thread PIKAL Petr
Hi you have got one answer, here is another interval <- c("1902-1931", "1912-1930", "1902-1951") (as.numeric(substr(interval, 1,4))+as.numeric(substr(interval, nchar(interval)-3, nchar(interval/2 [1] 1916.5 1921.0 1926.5 It works only if positions of years in intervals is first and last 4

Re: [R] middle of interval

2016-02-08 Thread Duncan Murdoch
On 08/02/2016 5:09 AM, catalin roibu wrote: Dear R users! I have a data frame with first column is an interval (1902-1931) and I want to find the middle of the interval? Is there a possibility to do that in R? Thank you very much! Best regards! I don't know of a single function that does th

[R] middle of interval

2016-02-08 Thread catalin roibu
Dear R users! I have a data frame with first column is an interval (1902-1931) and I want to find the middle of the interval? Is there a possibility to do that in R? Thank you very much! Best regards! -- - - Catalin-Constantin ROIBU ​ Lecturer PhD, Forestry engineer Forestry Faculty of Suceav