[R] Problem of COX model with time dependent covariate

2011-12-26 Thread JiangGZ
Hi all, I am trying to detect association between a covariate and a disease outcome using R. This covariate shows time-varying effect, I add a time-covariate interaction item to build Cox model as follows: COX - coxph(as.formula(Surv(TIME,outcome)~eGFR_BASE+eGFR_BASE:TIME),ori.data);

[R] Summary tables of large datasets including character and numerical variables

2011-12-26 Thread sparandekar
Hello ! I am attempting to switch from being a long time SAS user to R, and would really appreciate a bit of help ! The first thing I do in getting a large dataset (thousands of obervations and hundreds of variables) is to run a SAS command PROC CONTENTS VARNUM command - this provides me a table

[R] glm predict issue

2011-12-26 Thread Giovanni Azua
Hello, I have tried reading the documentation and googling for the answer but reviewing the online matches I end up more confused than before. My problem is apparently simple. I fit a glm model (2^k experiment), and then I would like to predict the response variable (Throughput) for unseen

Re: [R] Problem of COX model with time dependent covariate

2011-12-26 Thread David Winsemius
On Dec 26, 2011, at 3:02 AM, JiangGZ wrote: Hi all, I am trying to detect association between a covariate and a disease outcome using R. This covariate shows time-varying effect, I add a time-covariate interaction item to build Cox model as follows: COX -

[R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread iliketurtles
Hi, I'm quite new to R (1 month full time use so far). I have to run loop regressions VERY often in my work, so I would appreciate some new methodology that I'm not considering. #-

[R] regarding QRb() function

2011-12-26 Thread narendarreddy kalam
Error in `[.data.frame`(x, order(x, na.last = na.last, decreasing = decreasing)) :undefined columns selected during the execution of following r sequence of commands X-subset(data,select=c(V1,V2,V3,V4,V5,V6,V7,V8,V9)) y-subset(data,selcet=10) Data = list(y=y, X=X, p=.75) Prior =

Re: [R] glm predict issue

2011-12-26 Thread Weidong Gu
Hi, This might be due to the fact that factor levels are arbitary unless they are ordinal, even that quantitative relationships between levels are unclear. Therefore, the model has no way to predict unseen factor levels. Does it make sense to treat 'No_databases' as numeric instead of a factor

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread Steinar Veka
You can get the ols coefficients with basic matrix operations as well ( https://files.nyu.edu/mrg217/public/ols_matrix.pdf) and by that avoid one of the loops. I do not know how efficient this is but I have attached an example you can paste bellow your code. Here, one x-array is used as a right

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread Gerrit Eichner
Hello, iliketurtles (?), for whatever strange reasons you want to regress all y-columns on all x-columns, maybe reg - apply( x, 2, function( xx) lm( y ~ xx)) do.call( cbind, lapply( reg, coef)) does what you want. (To understand what the code above does, check the documentation for lm(): If

Re: [R] glm predict issue

2011-12-26 Thread Ben Bolker
Giovanni Azua bravegag at gmail.com writes: Hello, I have tried reading the documentation and googling for the answer but reviewing the online matches I end up more confused than before. My problem is apparently simple. I fit a glm model (2^k experiment), and then I would like to

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread Bert Gunter
Dear anonymous: 1. You may be more likely to get useful tips on this list if you sign with your real name. It's friendlier. 2. If you are using R 14 hours/day. get and read a good R book. The CRAN site or Amazon lists many; choose one or more that suits your needs. 3. Read the R Help files

Re: [R] glm predict issue

2011-12-26 Thread Giovanni Azua
Hi Ben, Yes thanks you are right, I was able to fix it but first I had to fix the data frame over which I built my model to use numeric for those and then making the grid values also numeric it finally worked thanks! Thank you for your help! Best regards, Giovanni On Dec 26, 2011, at 4:57 PM,

[R] Finding all triangles in a graph

2011-12-26 Thread Taral
I have the adjacency matrix of a graph. I'm trying to find all triangles (embeddings of C_3). This doesn't work: index = function(l) seq(l)[l] pairs = do.call(rbind, lapply(seq(nrow(adj)), function(x) cbind(x, index(adj[x,] triangles = do.call(rbind, apply(pairs, 1, function(x) cbind(x,

Re: [R] cast in reshape and reshape2

2011-12-26 Thread Hadley Wickham
?plyr::summarise seems pretty helpful to me.  If you can do better, please submit a patch - they are very much appreciated. My failure to find it stemmed from it not being mentioned in any way in package reshape2's help files, but maybe I was mistaken that it was meant to be used in that

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread iliketurtles
Thanks for the advice everyone. All very helpful. @Bert Added my information to signature, thanks. - Isaac Research Assistant Quantitative Finance Faculty, UTS -- View this message in context: http://r.789695.n4.nabble.com/Other-ways-to-lm-regression-non-loop-tp4234487p4235654.html

Re: [R] Summary tables of large datasets including character and numerical variables

2011-12-26 Thread John Kane
It would be  very helpful to have an actual sample of your data. As usual in R there are probably several different ways to approach the problem but a small sample of the data or a mock-up would be most helpful. Probably the easiest way to supply some data would be something like df1 -

[R] Zero-inflated Negative Binomial Error

2011-12-26 Thread Melissa Aikens
Hello, I am having a problem with the zero-inflated negative binomial (package pscl). I have 6 sites with plant populations, and I am trying to model the number of seeds produced as a function of their size and their site. There are a lot of zero's because many of my plants get eaten before

[R] comparing fields within a record

2011-12-26 Thread Eric Wolff
Hi, I hope this isn't a really simple question, I've been struggling with it for a while. I'm looking for a way to get a function to go through a data frame line by line, compare fields, and produce a result, kind of a transform and an if statement combined (I tried to put them together and it

Re: [R] comparing fields within a record

2011-12-26 Thread Jorge I Velez
Hi Eric, Try # data x - structure(list(House_number = 1:4, Inspected = structure(c(3L, 4L, 1L, 2L), .Label = c(10/31/2011, 8/3/2011, 9/2/2011, 9/4/2011), class = factor), Sold = structure(c(1L, 2L, 4L, 3L), .Label = c(10/10/2011, 10/20/2011, 11/1/2011, 8/28/2011 ), class = factor)), .Names =

Re: [R] Summary tables of large datasets including character and numerical variables

2011-12-26 Thread Duncan Murdoch
On 11-12-26 5:44 AM, sparandekar wrote: Hello ! I am attempting to switch from being a long time SAS user to R, and would really appreciate a bit of help ! The first thing I do in getting a large dataset (thousands of obervations and hundreds of variables) is to run a SAS command PROC CONTENTS

Re: [R] comparing fields within a record

2011-12-26 Thread David Winsemius
On Dec 26, 2011, at 7:52 PM, Eric Wolff wrote: Hi, I hope this isn't a really simple question, I've been struggling with it for a while. I'm looking for a way to get a function to go through a data frame line by line, compare fields, and produce a result, kind of a transform and an if

[R] Simulate binary time series with known Hurst exponent

2011-12-26 Thread Andrew MacIntosh
Dear R users, I am looking for a package in R that will simulate binary time series given some known value for the Hurst exponent. I see that the package FGN allows for simulation of fGn, but it does not seem that parameters other than sequence length and H can be manipulated. What I want to do

Re: [R] Summary tables of large datasets including character and numerical variables

2011-12-26 Thread David Winsemius
On Dec 26, 2011, at 5:44 AM, sparandekar wrote: Hello ! I am attempting to switch from being a long time SAS user to R, and would really appreciate a bit of help ! The first thing I do in getting a large dataset (thousands of obervations and hundreds of variables) is to run a SAS

Re: [R] Zero-inflated Negative Binomial Error

2011-12-26 Thread Ben Bolker
Melissa Aikens mla2j at virginia.edu writes: I am having a problem with the zero-inflated negative binomial (package pscl). I have 6 sites with plant populations, and I am trying to model the number of seeds produced as a function of their size and their site. [snip] Anyways, the code I

Re: [R] Help with code

2011-12-26 Thread Petr PIKAL
Hi Can you explain rules for propagating values? I do not see any pattern. Only when there is no Y in a line you want to fill all columns with either T1D_noc or Ctrl_noc based on t1d_ptype. I would start with narrowing the levels in last column as it seems to me there is no difference between

[R] differences between 1.7 and 1.7.1 glmnet versions

2011-12-26 Thread Damjan Krstajic
Dear All,   I have found differences between glmnet versions 1.7 and 1.7.1 which, in my opinion, are not cosmetic and do not appear in the ChangeLog. If I am not mistaken, glmnet appears to return different number of selected input variables, i.e. nonzeroCoef(fit$beta[[1]]) differes between