Hanke, Alex
2004-Aug-19 12:36 UTC
[R] A question about external time-dependent covariates in co x model
Dear Rui,>From my understanding of time-dependent covariates (not an expert but havebeen working on a similar problem), it would appear that the coding of the status column is not correct. Unless you have observed an event at each interval you should only have status=1 for the last interval. In your example I see 3 in total. Also, I think that if "end" is proportional to your "covariate" you are incorporating a redundant time effect into the model. The time effect is in the baseline hazard. Alex -----Original Message----- From: Rui Song [mailto:rsong at stat.wisc.edu] Sent: August 19, 2004 12:21 AM To: r-help at stat.math.ethz.ch Subject: [R] A question about external time-dependent covariates in cox model Dear Sir or Madam: I am a graduate student in UW-Madison statistics department. I have a question about fitting a cox model with external time-dependent covariates. Say the original data is in the following format: Obs Eventtime Status Cov(time=5) Cov(time=8) Cov(time=10) Cov(time=12) 1 5 1 2 2 8 0(censored) 2 4 3 10 1 2 4 6 4 12 1 2 4 6 8 .... Notice that the time-dependent covariates are identical at the same time points for all obs since they are external to the failure process. process. Then I organized the data as the following: obs start end eventtime status cov 1 0 5 5 1 2 2 0 5 8 0 2 2 5 8 8 0 4 3 0 5 10 1 2 3 5 8 10 1 4 3 8 10 10 1 6 4 0 5 12 1 2 4 5 8 12 1 4 4 8 10 12 1 6 4 10 12 12 1 8 And fit the model using: fit<-coxph(Surv(start, end, status)~cov); When I fit the model to my data set (Which has 89 observations and 81 distinct time points, sort of large.), I always got a message that "Process R segmentation fault (core dumped)". Would you let me know if it is due to the matrix sigularity in the computation of the partial likelihood or something else? And how should I fit a cox model with external time-dependent covariates? Thanks a lot for your time and help! Sincerely, Rui Song ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Rui Song
2004-Aug-19 15:47 UTC
[R] A question about external time-dependent covariates in co x model
Dear Alex, Thanks a lot for your help! The "end" is not proportional to the covariate in my data set. I recoded the status as you suggested, but the problem still exists. I tried to fit the model with partial data, it has no problem when I use the first 25 rows (from the data in the form "start", "end", "status", "cov"), with very huge standard error. And the problem exists if I cooperated more data. It is kind of weird... Rui On Thu, 19 Aug 2004, Hanke, Alex wrote:> Dear Rui, > >From my understanding of time-dependent covariates (not an expert but have > been working on a similar problem), it would appear that the coding of the > status column is not correct. Unless you have observed an event at each > interval you should only have status=1 for the last interval. In your > example I see 3 in total. Also, I think that if "end" is proportional to > your "covariate" you are incorporating a redundant time effect into the > model. The time effect is in the baseline hazard. > > Alex > -----Original Message----- > From: Rui Song [mailto:rsong at stat.wisc.edu] > Sent: August 19, 2004 12:21 AM > To: r-help at stat.math.ethz.ch > Subject: [R] A question about external time-dependent covariates in cox > model > > > Dear Sir or Madam: > I am a graduate student in UW-Madison statistics department. I have a > question about fitting a cox model with external time-dependent > covariates. > > Say the original data is in the following format: > Obs Eventtime Status Cov(time=5) Cov(time=8) Cov(time=10) Cov(time=12) > 1 5 1 2 > 2 8 0(censored) 2 4 > 3 10 1 2 4 6 > 4 12 1 2 4 6 8 > .... > > Notice that the time-dependent covariates are identical at the same > time points for all obs since they are external to the failure process. > process. > > Then I organized the data as the following: > obs start end eventtime status cov > 1 0 5 5 1 2 > 2 0 5 8 0 2 > 2 5 8 8 0 4 > 3 0 5 10 1 2 > 3 5 8 10 1 4 > 3 8 10 10 1 6 > 4 0 5 12 1 2 > 4 5 8 12 1 4 > 4 8 10 12 1 6 > 4 10 12 12 1 8 > > And fit the model using: > > fit<-coxph(Surv(start, end, status)~cov); > > When I fit the model to my data set (Which has 89 observations and 81 > distinct time points, sort of large.), I always got a message that > "Process R segmentation fault (core dumped)". Would you let me know if it > is due to the matrix sigularity in the computation of the partial > likelihood or something else? And how should I fit a cox model with > external time-dependent covariates? > > Thanks a lot for your time and help! > > Sincerely, > Rui Song > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >
Dear group,
Apologies for asking the most chomped FAQ.
I have a file with list of gene names(genes.txt):
EGF
EGFR
PTPN6
TIEG2
MAPK1
I have another object in R, I do not know the data
type for that object that looks like this
("lidnames"):
"RABGGTA" "MAPK3" "TIE" "CYP2C19"
> lidnames[1:10]
100_g_at 1000_at 1001_at 1002_f_at 1003_s_at
"RABGGTA" "MAPK3" "TIE" "CYP2C19"
"BLR1"
I want to pick list of genes from lidnames object that
are in genes.txt. I am using %in% function.
>mygenes<-read.table("genes.txt")
> mygenes[mygenes %in% lidnames]
NULL data frame with 164 rows>
I am unable to pullout genes from lidnames object.
Is it because that lidnames is as a list type and
mygenes object is as a vector/matrix type.
How can I convert mygenes to list type where I can
have the elements:
"EGF","EGFR","PTPN6","TIEG2","MAPK1".
I think in this way I can pull out the names from
lidnames object or any other complex matrix.
Please help me.
Thank you
SP
S Peri wrote:> Dear group, > Apologies for asking the most chomped FAQ. > > I have a file with list of gene names(genes.txt): > EGF > EGFR > PTPN6 > TIEG2 > MAPK1 > > > I have another object in R, I do not know the data > type for that object that looks like this > ("lidnames"): > "RABGGTA" "MAPK3" "TIE" "CYP2C19" > > > >>lidnames[1:10] > > 100_g_at 1000_at 1001_at 1002_f_at 1003_s_at > "RABGGTA" "MAPK3" "TIE" "CYP2C19" "BLR1" > > > I want to pick list of genes from lidnames object that > are in genes.txt. I am using %in% function. > > >>mygenes<-read.table("genes.txt") > > >>mygenes[mygenes %in% lidnames] > > NULL data frame with 164 rows > > > I am unable to pullout genes from lidnames object. > > Is it because that lidnames is as a list type and > mygenes object is as a vector/matrix type.Well, mygenes is a data frame, and lidnames a vector. E.g., try to read in mygenes as a vector directly: mygenes <- scan("genes.txt", what = "character") Uwe Ligges> How can I convert mygenes to list type where I can > have the elements: > > "EGF","EGFR","PTPN6","TIEG2","MAPK1". > > I think in this way I can pull out the names from > lidnames object or any other complex matrix. > > Please help me. > > Thank you > SP > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
G�öran Brostr�öm
2004-Aug-19 19:56 UTC
[R] A question about external time-dependent covariates in co x model
On Thu, Aug 19, 2004 at 09:36:22AM -0300, Hanke, Alex wrote:> Dear Rui, > >From my understanding of time-dependent covariates (not an expert but have > been working on a similar problem), it would appear that the coding of the > status column is not correct. Unless you have observed an event at each > interval you should only have status=1 for the last interval. In your > example I see 3 in total. Also, I think that if "end" is proportional to > your "covariate" you are incorporating a redundant time effect into the > model. The time effect is in the baseline hazard.Right, the 'splitting' was made incorrectly, but 'coxph' shouldn't segfault anyway. The error seems to be (caught) in 'coxph_wtest.c', line 29, which may be of interest to the R maintainer of 'survival', Thomas L. G??ran> > Alex > -----Original Message----- > From: Rui Song [mailto:rsong at stat.wisc.edu] > Sent: August 19, 2004 12:21 AM > To: r-help at stat.math.ethz.ch > Subject: [R] A question about external time-dependent covariates in cox > model > > > Dear Sir or Madam: > I am a graduate student in UW-Madison statistics department. I have a > question about fitting a cox model with external time-dependent > covariates. > > Say the original data is in the following format: > Obs Eventtime Status Cov(time=5) Cov(time=8) Cov(time=10) Cov(time=12) > 1 5 1 2 > 2 8 0(censored) 2 4 > 3 10 1 2 4 6 > 4 12 1 2 4 6 8 > .... > > Notice that the time-dependent covariates are identical at the same > time points for all obs since they are external to the failure process. > process. > > Then I organized the data as the following: > obs start end eventtime status cov > 1 0 5 5 1 2 > 2 0 5 8 0 2 > 2 5 8 8 0 4 > 3 0 5 10 1 2 > 3 5 8 10 1 4 > 3 8 10 10 1 6 > 4 0 5 12 1 2 > 4 5 8 12 1 4 > 4 8 10 12 1 6 > 4 10 12 12 1 8 > > And fit the model using: > > fit<-coxph(Surv(start, end, status)~cov); > > When I fit the model to my data set (Which has 89 observations and 81 > distinct time points, sort of large.), I always got a message that > "Process R segmentation fault (core dumped)". Would you let me know if it > is due to the matrix sigularity in the computation of the partial > likelihood or something else? And how should I fit a cox model with > external time-dependent covariates? > > Thanks a lot for your time and help! > > Sincerely, > Rui Song > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- G??ran Brostr??m tel: +46 90 786 5223 Department of Statistics fax: +46 90 786 6614 Ume?? University http://www.stat.umu.se/egna/gb/ SE-90187 Ume??, Sweden e-mail: gb at stat.umu.se
Peri, Please stop posting to both R-help and BioConductor simultaneously. Please read the posting guide and decide which list is more appropriate. http://www.R-project.org/posting-guide.html On Thu, 2004-08-19 at 17:20, S Peri wrote:> Dear group, > Apologies for asking the most chomped FAQ. > > I have a file with list of gene names(genes.txt): > EGF > EGFR > PTPN6 > TIEG2 > MAPK1 > > > I have another object in R, I do not know the data > type for that object that looks like this > ("lidnames"): > "RABGGTA" "MAPK3" "TIE" "CYP2C19" > > > > lidnames[1:10] > 100_g_at 1000_at 1001_at 1002_f_at 1003_s_at > "RABGGTA" "MAPK3" "TIE" "CYP2C19" "BLR1" > > > I want to pick list of genes from lidnames object that > are in genes.txt. I am using %in% function. > > >mygenes<-read.table("genes.txt") > > > mygenes[mygenes %in% lidnames] > NULL data frame with 164 rows > > > > I am unable to pullout genes from lidnames object. > > Is it because that lidnames is as a list type and > mygenes object is as a vector/matrix type. > > How can I convert mygenes to list type where I can > have the elements: > > "EGF","EGFR","PTPN6","TIEG2","MAPK1". > > I think in this way I can pull out the names from > lidnames object or any other complex matrix. > > Please help me. > > Thank you > SP > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
Dear S,
when posting something to R-help or bioconductor,
please do *NOT* reply to an existing message and add a new
subject!!! {it breaks threads for most e-mail system that use
threads, including the threaded archives, see, e.g.
https://stat.ethz.ch/pipermail/bioconductor/2004-August/thread.html
(and look for "S Peri").
This is clearly said in the posting guide, see below
>>>>> "S" == S Peri <biocperi at yahoo.com>
>>>>> on Thu, 19 Aug 2004 09:20:41 -0700 (PDT) writes:
S> Dear group,
<..........>
S> ______________________________________________
S> R-help at stat.math.ethz.ch mailing list
S> https://stat.ethz.ch/mailman/listinfo/r-help
S> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
PLEASE do read it!
Martin Maechler
Hi Kevin,
{and R-help readers: Kevin's (privatae) question is a quite
relevant one to this sidetrack topic of "mailing list netiquette"}
>>>>> "Kevin" == Kevin Wang <Kevin.Wang at
maths.anu.edu.au>
>>>>> on Fri, 20 Aug 2004 22:37:39 +1000 (EST) writes:
Kevin> Just out of interest, what about those posts with (no
Kevin> subject) as the subject? Sometimes I would change
Kevin> the subject so it fits the body...is it recommended?
yes, I'd recommend it --- IFF --- your e-mail system is good
enough to set / augment the (usually invisible) headers
"References:" and "In-Reply-To:".
AFAIK, by official standards, these are used for threading
(if available) rather than the subjects.
Martin
Kevin> On Fri, 20 Aug 2004, Martin Maechler wrote:
>> Dear S,
>>
>> when posting something to R-help or bioconductor,
>> please do *NOT* reply to an existing message and add a new
>> subject!!! {it breaks threads for most e-mail system that use
>> threads, including the threaded archives, see, e.g.
>> https://stat.ethz.ch/pipermail/bioconductor/2004-August/thread.html