Re: [R] coxph means not equal to means of model matrix

2021-09-03 Thread Therneau, Terry M., Ph.D. via R-help
On 9/3/21 12:59 PM, Bond, Stephen wrote: > > I looked at the nocenter and it says (-1,0,1) values but it seems that any > three-level > factor is included in that (represented as 1,2,3 in R) . > A factor is turned into a set of 0/1 dummy variable, so the nocenter applies.� I will add more cla

Re: [R] coxph means not equal to means of model matrix

2021-09-03 Thread Bond, Stephen
I looked at the nocenter and it says (-1,0,1) values but it seems that any three-level factor is included in that (represented as 1,2,3 in R) . Also, is the baseline curve now showing the reference level and not the fictional .428 sex? If I predict the risk for a new row, should I multiply the c

Re: [R] coxph means not equal to means of model matrix

2021-09-03 Thread Therneau, Terry M., Ph.D. via R-help
See ?coxph, in particular the new "nocenter" option. Basically, the "mean" component is used to center later computations.� This can be critical for continuous variables, avoiding overflow in the exp function, but is not necessary for 0/1 covariates.�� The fact that the default survival curve

[R] coxph means not equal to means of model matrix

2021-09-03 Thread Bond, Stephen
Hi, Please, help me understand what is happening with the means of a Cox model? I have: R version 4.0.2 (2020-06-22) -- "Taking Off Again" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) getOption("contrasts") unordered ord

Re: [R] COXPH: How should weights be entered in coxph, as the log of the weight or as the weight on its original scale?

2021-05-19 Thread David Winsemius
Perhaps this package could be considered https://cran.r-project.org/web/packages/hrIPW/hrIPW.pdf That packages author also has a 2016 article in Statistics in Medicine on the properties of estimates from such analyses that might be useful. — David Winsemius, MD, MPH Sent from my iPhone > On

[R] COXPH: How should weights be entered in coxph, as the log of the weight or as the weight on its original scale?

2021-05-19 Thread Sorkin, John
When running a propensity score weighted analysis using coxph(), are the weights entered as the log of the weights, or as the weights on the original scale, i.e. coxph(Surv(time,status)~group,weights=weights ,data=mydata) or coxph(Surv(time,status)~group,weights=log(weights),data=myda

Re: [R] CoxPH multivariate frailty model with coxph (survival)

2019-08-08 Thread Denise b
t) > # might want to allow different shapes or scales for different events > for (k in seq(kk)) { > short[[paste0("time", k)]] <- rweibullPH(nn, shape=2, > scale=exp(beta[k]*tx)*gamma) > } > # might want to allow censoring > > long <- reshape(sho

Re: [R] CoxPH multivariate frailty model with coxph (survival)

2019-07-29 Thread Andrews, Chris
<- coxph(Surv(times) ~ tx, data=long, subset=event==1) #summary(mod1) mod2 <- coxph(Surv(times) ~ tx, data=long, subset=event==2) #summary(mod2) coef(mod) coef(mod0) coef(mod1) coef(mod2) - coef(mod1) coef(summary(mod)) coef(summary(mod0)) coef(summary(mod1)) -----Original Message---

Re: [R] CoxPH multivariate frailty model with coxph (survival)

2019-07-27 Thread David Winsemius
On 7/19/19 10:19 AM, Denise b wrote: Dear R users, I am interested in estimating the effects of a treatment on two time-to-event traits (on simulated data), accounting for the dependency between the two time-to-event outcomes. I precise that the events are NOT recurrent, NOT competitive, NO

[R] CoxPH multivariate frailty model with coxph (survival)

2019-07-19 Thread Denise b
Dear R users, I am interested in estimating the effects of a treatment on two time-to-event traits (on simulated data), accounting for the dependency between the two time-to-event outcomes. I precise that the events are NOT recurrent, NOT competitive, NOT ordered. The individuals are NOT related

[R] coxph: no convergence with completely tied data with 'exact'-method

2016-06-02 Thread Johannes Hengelbrock
Dear users, I'm trying to estimate a conditional logistic model using the coxph()-function from the survival package. Somehow, the model does not converge if time is set to the same value for all observations: library(survival) set.seed(12345) n <- 3000 a <- rbinom(n, 1, 0.5

Re: [R] Coxph model treating all the values of 1 variable as separate variables PLEASE HELP!!

2016-03-26 Thread Marc Schwartz
> On Mar 25, 2016, at 8:32 PM, Shelby Leonard > wrote: > > > I have been working for 12 hours now on trying to fix my cox model. I have a > large data set (n>300) and In my model I have time in months, status > (1=dead), and change represents my variable. I am trying to determine if the > v

Re: [R] Coxph convergence

2014-02-05 Thread Hin-Tak Leung
Dear Prof Therneau, I have explored a bit more on this issue - I found that for this specific problem, one can get the older convergent behavior with just setting toler.chol to 4 e-12. This is only a little larger than 2x the current default = .Machine$double.eps^.75 = 1.8e-12. Since you have

Re: [R] coxph with time-dependent covariates

2014-01-14 Thread Terry Therneau
R throws out this event due to the missing time-dependent covariate at day 6. Is there a way I can keep this event without filling in a covariate value at day 6? No. The Cox model assesses the risk associated with each covariate by comparing, at each event time, the values of the subject who h

Re: [R] coxph with time-dependent covariates

2014-01-13 Thread David Winsemius
On Jan 13, 2014, at 10:50 AM, Phil Stevenson wrote: > I am using the coxph() function (from the 'survival' package) for a data > set that requires one of the covariates to be treated as time-dependent. > The issue is with this data set is there are some covariate values that are > missing at the t

[R] coxph with time-dependent covariates

2014-01-13 Thread Phil Stevenson
I am using the coxph() function (from the 'survival' package) for a data set that requires one of the covariates to be treated as time-dependent. The issue is with this data set is there are some covariate values that are missing at the time point when the event occurs. For example: Person A: Da

Re: [R] Coxph convergence

2013-12-18 Thread Terry Therneau
I'll re-enter the fray. The data set is an example where coxph is incorrect; due to round off error it is treating a 5 column rank 3 matrix as if it were rank 4. This of course results in 0 digits of precision. Immediate fix, for the user, is to add "toler.chol= 1e-10" to their coxph call.

Re: [R] coxph: how to define interaction terms?

2013-10-29 Thread David Winsemius
On Oct 29, 2013, at 4:38 AM, rm wrote: > Any ideas would be much appreciated; I suspect that this problem of > constructing the dummies applies not only to function coxph but to other > regression models in R as well. Effectively, my question is how to better > control for which dummies and inter

Re: [R] coxph: how to define interaction terms?

2013-10-29 Thread rm
Any ideas would be much appreciated; I suspect that this problem of constructing the dummies applies not only to function coxph but to other regression models in R as well. Effectively, my question is how to better control for which dummies and interactions to include in the model and which not. T

Re: [R] coxph: how to define interaction terms?

2013-10-28 Thread rm
The output is as follows. My question is how to include only the interaction terms where x is equal to "Maintained". (x has two possible values "Maintained" and "Nonmaintained".) -- View this message in context: http://r.789695.n4.nabble.com/coxph-how-to-define-interaction-terms-tp4679162p46

[R] coxph: how to define interaction terms?

2013-10-28 Thread rm
I’m trying to set up Cox Proptional Hazard model with interactions between time and the covariates (which are categorical). The problem that I face is that how to define the interactions, i.e. “x+cutStart:x”, properly. The code below illustrates the problem. R gives the error message ” X matrix de

Re: [R] coxph diagnostics

2013-08-15 Thread John Sorkin
Dr. Therneau, Thank you as always for first writing, and second continuing the Cox model in R (and earlier I believe in SAS). While your comments concerning non-proportional hazards is helpful, it does not fully address the question, "What alternatives do I have if I assume proportional assump

Re: [R] coxph diagnostics

2013-08-14 Thread Andrews, Chris
ards does NOT hold but it may be close enough to be useful. This is always a problem with goodness-of-fit tests and large datasets. Chris -Original Message- From: Soumitro Dey [mailto:soumitrod...@gmail.com] Sent: Tuesday, August 13, 2013 10:38 AM To: Terry Therneau Cc: r-help@r-pr

Re: [R] coxph diagnostics

2013-08-13 Thread Soumitro Dey
Thank you for your response, Terry. To put the discussion into perspective, my data set is quite large with over 160,000 samples and 38 variables. The event is true for all samples in this dataset. The distribution is zero-inflated (i.e. most events occur at time = 0). The result of the cox.zph l

Re: [R] coxph diagnostics

2013-08-13 Thread Terry Therneau
That's the primary reason for the plot: so that you can look and think. The test statistic is based on whether a LS line fit to the plot has zero slope. For larger data sets you can sometimes have a "significant" p-value but good agreement with proportional hazards. It's much like an example

Re: [R] coxph diagnostics

2013-08-12 Thread Soumitro Dey
Thanks to Bert and Göran for your responses. To answer Göran's comment, yes I did plot the Schoenfeld residuals using plot.cox.zph and the lines look horizontal (slope = 0) to me, which makes me think that it contradicts the results of cox.zph. What alternatives do I have if I assume proportional

Re: [R] coxph diagnostics

2013-08-11 Thread Göran Broström
On 08/11/2013 06:14 AM, Soumitro Dey wrote: Hello all, This may be a naive question but since I'm new to R/survival models, I cannot figure it out the problem myself. I have a coxph model for my data and I am trying to test if the proportional hazards assumption holds. Using cox.zph on the mo

Re: [R] coxph diagnostics

2013-08-10 Thread Bert Gunter
Although someone on this list may respond, AFAICS this does not seem to be an R question for R-help.I would suggest that you spend some time with a local statistician. A general observation: Statistical model assumptions neither :hold" nor "don't hold." Quoting George Box, "All models are wrong, b

[R] coxph diagnostics

2013-08-10 Thread Soumitro Dey
Hello all, This may be a naive question but since I'm new to R/survival models, I cannot figure it out the problem myself. I have a coxph model for my data and I am trying to test if the proportional hazards assumption holds. Using cox.zph on the model I get a global score: GLOBAL NA 4.20e+02 0

Re: [R] coxph won't converge when including categorical (factor) variables

2013-07-11 Thread E Joffe
tion but I still need to research that. Many thanks to Thomas Hielscher who authored the c060 package and was extremely kind to help me with this. -Original Message- From: E Joffe [mailto:ejo...@hotmail.com] Sent: Sunday, July 07, 2013 10:02 AM To: 'Marc Schwartz' Cc: 'r-

Re: [R] coxph won't converge when including categorical (factor) variables

2013-07-07 Thread E Joffe
rds, Marc -Original Message- From: Marc Schwartz [mailto:marc_schwa...@me.com] Sent: Saturday, July 06, 2013 8:46 AM To: E Joffe Cc: r-help@r-project.org Subject: Re: [R] coxph won't converge when including categorical (factor) variables On Jul 6, 2013, at 7:04 AM, E Joffe wr

Re: [R] coxph won't converge when including categorical (factor) variables

2013-07-06 Thread Jeff Newmiller
I don't know much about your problem, but if you want help you are going to need to learn to communicate effectively. This may help: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --- Je

Re: [R] coxph won't converge when including categorical (factor) variables

2013-07-06 Thread Marc Schwartz
On Jul 6, 2013, at 7:04 AM, E Joffe wrote: > Hello, > > > > [rephrasing and reposting of a previous question (that was not answered) > with new information] > > > > I have a dataset of 371 observations. > > When I run coxph with numeric variables it works fine. > > However, when I try to

Re: [R] coxph won't converge when including categorical (factor) variables

2013-07-06 Thread Bert Gunter
Hint: Why do you think no one replied? 1. That it converged with one model/fitting algorithm and not with another is useless. 2. This cannot possibly be answered without your data. 3. A guess: you are overfitting -- glmnet regularizes and will therefore fit (highly) correlated regressors coxph w

[R] coxph won't converge when including categorical (factor) variables

2013-07-06 Thread E Joffe
Hello, [rephrasing and reposting of a previous question (that was not answered) with new information] I have a dataset of 371 observations. When I run coxph with numeric variables it works fine. However, when I try to add factor (categorical) variables it returns "Ran out of iterations a

[R] coxph doesn't converge when including factor variables

2013-07-04 Thread E Joffe
Hello, I have a dataset of 371 observations. When I run coxph with numeric variables it works fine. However, when I try to add factor variables it returns "Ran out of iterations and the model did not converge" There is something very strange with the factors - some of them should actually be

[R] coxph and variables

2013-04-02 Thread sylvain
Dear list,I am quite new to the world of biostatistics and I encounter some issues in the precise understanding of the coxph function of the survival package.I have a set of survival data (patient who had (or died from) a breast cancer) I'd like to see which are the variables that might cause dead

Re: [R] coxph with smooth survival

2013-01-21 Thread Terry Therneau
For your first question -- read the manual. ?survfit.coxph will reveal the "censor" argument, which controls the inclusion of points where the curve does not drop. For your second, "smooth" is in the eye of the beholder, literally. If the reason for a smooth curve is to plot it, you need to d

Re: [R] coxph with smooth survival

2013-01-18 Thread Andrews, Chris
f.int=FALSE) lines(steps.x, steps.y, col=2) smoothfun <- approxfun(steps.x, steps.y) plot(smoothfun, from=0, to=3, add=TRUE, col=3, n=1000, lty=2) -Original Message- From: Bond, Stephen [mailto:stephen.b...@cibc.com] Sent: Thursday, January 17, 2013 9:49 AM To: r-help@r-project.org S

Re: [R] coxph with smooth survival

2013-01-17 Thread Bond, Stephen
I also tried fitting a spline to the resulting survival curve and the result was horrible. maybe spline won't work or knots need special handling. overall, I must have the final point of the smooth survival to be same as the final point of the raw Cox survival and no flat days, the drops sho

[R] coxph with smooth survival

2013-01-17 Thread Bond, Stephen
Hello users, I would like to obtain a survival curve from a Cox model that is smooth and does not have zero differences due to no events for those particular days. I have: > sum((diff(surv))==0) [1] 18 So you can see 18 days where the survival curve did not drop due to no events. Is there a wa

Re: [R] Coxph not converging with continuous variable

2012-09-04 Thread Ravi Varadhan
Dear Terry, I agree that this example is highly atypical. Having said that, my experience with optimization algorithms is that scaling (a.k.a. standardizing) the continuous covariates is greatly helpful in terms of convergence. Have you considered automatically standardizing the continuous co

Re: [R] Coxph not converging with continuous variable

2012-09-03 Thread Terry Therneau
On 09/03/2012 05:00 AM, r-help-requ...@r-project.org wrote: The coxph function in R is not working for me when I use a continuous predictor in the model. Specifically, it > fails to converge, even when bumping up the number of max iterations or setting reasonable initial values. > The estimat

Re: [R] Coxph not converging with continuous variable

2012-09-02 Thread Keil, Alex
The coxph function in R is not working for me when I use a continuous predictor in the model. Specifically, it fails to converge, even when bumping up the number of max iterations or setting reasonable initial values. The estimated Hazard ratio from the model is incorrect (verified by an AFT mod

[R] R coxph Method=df (Question on methods)

2012-08-20 Thread David Parker
achieve? Is it statistically correct to use this option of method=df where I fix the df to a certain number so that my model converges? Suggestions (and criticisms :) ) are all welcome. Thank you very much. Regards, D -- View this message in context: http://r.789695.n4.nabble.com/R-coxph

Re: [R] coxph weirdness

2012-07-26 Thread Peter Langfelder
On Thu, Jul 26, 2012 at 4:19 PM, Thomas Lumley wrote: > YOu need to update the survival package: from its NEWS file > > Changes in version 2.36-14 >A supposedly cosmetic change to coxph in the last release caused > formulas with a "." on the right hand side to fail. Fix this and add a > case

Re: [R] coxph weirdness

2012-07-26 Thread Thomas Lumley
YOu need to update the survival package: from its NEWS file Changes in version 2.36-14 A supposedly cosmetic change to coxph in the last release caused formulas with a "." on the right hand side to fail. Fix this and add a case with "." to the test suite. -thomas On Thu, Jul 26, 2012 at

[R] coxph weirdness

2012-07-26 Thread Peter Langfelder
Hi all, I cant' wrap my head around an error from the coxph function (package survival). Here's an example: library(survival) n = 100; set.seed(1); time = rexp(n); event = sample(c(0,1), n, replace = TRUE) covar = data.frame(z = rnorm(n)); model = coxph(Surv(time, event)~ . , data = covar) R g

[R] coxph data format

2012-05-07 Thread Ehsan Karim
Dear List, Here is an example of survival data in counting process format (detailed record of each day) > data[data$Id == 11,] # extracted one person's record Id Event Fup Start Stop sex Drug1 601 11 0 6 01 0 0 602 11 0 6 12 0 0 603 11 0 6 2

Re: [R] coxph reference hazard rate

2012-05-02 Thread David Winsemius
As has been answered several times on rhelp ... the baseline hazard is for a case with the "mean value". It's not a meaningful case with all factor variables. There can be no cases where fidelity>3 has a fractional value. You should be using predict() and survfit() to display estimates for

[R] coxph reference hazard rate

2012-05-01 Thread Georges Dupret
Hi, In the following results I interpret exp(coef) as the factor that multiplies the base hazard rate if the corresponding variable is TRUE. For example, when the bucket is ks008 and fidelity <= 3, then the rate, compared to the base rate h_0(t), is h(t) = 0.200 h_0(t). My question is then, to wha

Re: [R] COXPH TIME-DEPENDENT

2011-08-19 Thread javier palacios
Thanks, Javier -- View this message in context: http://r.789695.n4.nabble.com/COXPH-TIME-DEPENDENT-tp3754837p3756128.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listin

Re: [R] COXPH TIME-DEPENDENT

2011-08-19 Thread Daniel Malter
B is the specification for time-varying covariates. Otherwise, your model will think that each row is one independent observation that either had an event or was censored at "time" or "total_time." HTH, Daniel javier palacios wrote: > > Dear R-community, > > which of the following two format

Re: [R] coxph() - unexpected result using Crawley's seedlings data (The R Book)

2011-06-28 Thread Ben Bolker
Jacob Brogren brogren.nu> writes: > > All, > > I rerun once again and managed to reproduce the results from the text book. > Made no changes to the code. Could > it be some problem with convergence? It is possible, but *extremely* unlikely, to get non-deterministic results from R (i.e. runn

Re: [R] coxph() - unexpected result using Crawley's seedlings data (The R Book)

2011-06-28 Thread Jacob Brogren
All, I rerun once again and managed to reproduce the results from the text book. Made no changes to the code. Could it be some problem with convergence? Anyhow, now it works! Cheers Jacob ps. I find "The R Book" very useful ds. 28 jun 2011 kl. 15.48 skrev Robert A LaBudde: > Did you create

Re: [R] coxph() - unexpected result using Crawley's seedlings data (The R Book)

2011-06-28 Thread Jacob Brogren
Hi, sorry about that; here is the full output - data set, structure, model and result. Cheers Jacob > seedlings cohort death gapsize status 1 September 7 0.5889 1 2 September 3 0.6869 1 3 September12 0.1397 1 4 September 1 0.1921 1 5 September

Re: [R] coxph() - unexpected result using Crawley's seedlings data (The R Book)

2011-06-28 Thread Robert A LaBudde
Did you create the 'status' variable the way indicated on p. 797? Frequently with Surv() it pays to use syntax such as Surv(death, status==1) to make a clear logical statement of what is an event (status==1) vs. censored. PS. Next time include head(seedlings) and str(seedlings) to make clear

Re: [R] coxph() - unexpected result using Crawley's seedlings data (The R Book)

2011-06-28 Thread David Winsemius
On Jun 28, 2011, at 6:51 AM, Jacob Brogren wrote: Hi, I ran the example on pp. 799-800 from Machael Crawley's "The R Book" using package survival v. 2.36-5, R 2.13.0 and RStudio 0.94.83. The model is a Cox's Proportional Hazards model. The result was quite different compared to the R Boo

[R] coxph() - unexpected result using Crawley's seedlings data (The R Book)

2011-06-28 Thread Jacob Brogren
Hi, I ran the example on pp. 799-800 from Machael Crawley's "The R Book" using package survival v. 2.36-5, R 2.13.0 and RStudio 0.94.83. The model is a Cox's Proportional Hazards model. The result was quite different compared to the R Book. I have compared my code to the code in the book but ca

[R] coxph: cumulative mortality hazard over time with associated confidence intervals

2011-06-16 Thread Lise Aubry
Dear R-users, I computed a simple coxph model and plotted survival over time with associated confidence intervals for 2 covariate levels (males and females). M1 <- coxph(survobject~sex, data=surv) M1 survsex <- survfit(survobject~sex,data=surv) summary(survsex) plot(survsex, conf.int=T, col=c("b

Re: [R] coxph and survfit issue - strata

2011-05-09 Thread Terry Therneau
> Dear users, > > In a study with recurrent events: > My objective is to get estimates of survival (obtained through a Cox > model) by rank of recurrence and by treatment group. > With the following code (corresponding to a model with a global > effect of the treatment=rx), I get no error and m

Re: [R] coxph and survfit issue - strata

2011-05-06 Thread David Winsemius
On May 6, 2011, at 6:22 PM, Eva Bouguen wrote: Dear users, In a study with recurrent events: My objective is to get estimates of survival (obtained through a Cox model) by rank of recurrence and by treatment group. With the following code (corresponding to a model with a global effect of t

[R] coxph and survfit issue - strata

2011-05-06 Thread Eva Bouguen
Dear users, In a study with recurrent events: My objective is to get estimates of survival (obtained through a Cox model) by rank of recurrence and by treatment group. With the following code (corresponding to a model with a global effect of the treatment=rx), I get no error and manage to obtai

Re: [R] coxph fails to survfit

2011-02-04 Thread Bond, Stephen
Responding to T. Therneau: > sessionInfo() R version 2.10.1 (2009-12-14) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.125

Re: [R] coxph fails to survfit

2011-02-04 Thread Terry Therneau
> I have a model with quant vars only and the error message does not make sense: Could you tell us what version of S and of the survival package you are using? You can get this with sessionInfo(), see the posting guide for details. This would help me identify the issue. I was planning to pos

Re: [R] coxph fails to survfit

2011-02-03 Thread David Winsemius
plains is missing. Thanks David. Stephen -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Thursday, February 03, 2011 3:10 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R] coxph fails to survfit On Feb 3, 2011, at 2:14 PM, Bond, Stephen wrote: I have

Re: [R] coxph fails to survfit

2011-02-03 Thread Bond, Stephen
ching time dependent risk to the proper time index of the survival curve. Thanks David. Stephen -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Thursday, February 03, 2011 3:10 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R] coxph fails t

Re: [R] coxph fails to survfit

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 2:14 PM, Bond, Stephen wrote: I have a model with quant vars only and the error message does not make sense: (mod1 <- coxph(Surv(time=strt,time2=stp,event=(resp==1))~ +incpost +I(amt/1e5)+rate+strata(termfac), subset=dt<"2010-08-30", data=inc,method="efron"

[R] coxph fails to survfit

2011-02-03 Thread Bond, Stephen
I have a model with quant vars only and the error message does not make sense: (mod1 <- coxph(Surv(time=strt,time2=stp,event=(resp==1))~ +incpost+I(amt/1e5)+rate+strata(termfac), subset=dt<"2010-08-30", data=inc,method="efron")) Call: coxph(formula = Surv(time = strt, time2 = stp,

Re: [R] coxph failure

2010-12-07 Thread Therneau, Terry M., Ph.D.
Larry, You found a data set that kills coxph. I'll have to think about what to do since on the one hand it's your own fault for trying to fit a very bad model, and on the other I'd like the routine to give a nice error message before it dies. In the data set you sent me the predictor varia

Re: [R] coxph strange result

2010-11-25 Thread David Winsemius
On Nov 25, 2010, at 5:16 PM, Bond, Stephen wrote: The following fit does not make sense to me, please, correct me if I have a logical error. moddowsn Call: coxph(formula = Surv(start, stop, resp) ~ sn + matfac2, data = coxsn1, method = "efron") coef exp(coef) se(coef)

[R] coxph strange result

2010-11-25 Thread Bond, Stephen
The following fit does not make sense to me, please, correct me if I have a logical error. > moddowsn Call: coxph(formula = Surv(start, stop, resp) ~ sn + matfac2, data = coxsn1, method = "efron") coef exp(coef) se(coef) z p sn2 0.0497 1.051 0.02030 2.45

Re: [R] coxph linear.predictors

2010-11-02 Thread Bond, Stephen
made smart and subsequent calls on the same model will use the first call to survfit?? It's your call :-) Kind regards Stephen B -Original Message- From: Terry Therneau [mailto:thern...@mayo.edu] Sent: Thursday, October 28, 2010 6:39 PM To: Bond, Stephen; David Winsemius Cc:

Re: [R] coxph linear.predictors

2010-10-28 Thread Terry Therneau
Gentlemen, I read R-news in batch mode so I'm often a day behind. Let me try to answer some of the questions. 1. X*beta != linear.predictor. I'm sorry if the documentation isn't all it could be. Between the book, tech report, and help I've written about 400 pages, but this particular topic

Re: [R] coxph linear.predictors

2010-10-28 Thread Bond, Stephen
comcast.net] Sent: Wednesday, October 27, 2010 1:15 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R] coxph linear.predictors On Oct 27, 2010, at 12:12 PM, Bond, Stephen wrote: > I would like to be able to construct hazard rates (or unconditional > death prob) Hazards are

Re: [R] coxph linear.predictors

2010-10-27 Thread Bond, Stephen
sem...@comcast.net] Sent: Wednesday, October 27, 2010 1:15 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R] coxph linear.predictors On Oct 27, 2010, at 12:12 PM, Bond, Stephen wrote: > I would like to be able to construct hazard rates (or unconditional > death prob) Hazard

Re: [R] coxph linear.predictors

2010-10-27 Thread Bond, Stephen
riety of formulas, so I guess this is the spirit of SAS disguising itself as an R package. Stephen Bond -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Wednesday, October 27, 2010 2:17 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R]

Re: [R] coxph linear.predictors

2010-10-27 Thread David Winsemius
lp so it's quite possible that my errors in this area will get expert review and correction. Your comments are appreciated. Stephen Bond -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Wednesday, October 27, 2010 1:15 PM To: Bond, Stephen Cc: r-h

Re: [R] coxph linear.predictors

2010-10-27 Thread Bond, Stephen
sampled daily this is a day interval. Your comments are appreciated. Stephen Bond -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Wednesday, October 27, 2010 1:15 PM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R] coxph linear.predictors

Re: [R] coxph and ordinal variables?

2010-09-10 Thread Paul Johnson
Hi, everybody >On Wed, Sep 8, 2010 at 5:43 PM, Min-Han Tan > wrote: David said my R code text attachment got rejected by the mailing list. Pooh. I don't think that's nice. I don't see anything in the posting guide about a limit on text attachments. Well, if you are still trying to understan

Re: [R] coxph and ordinal variables?

2010-09-09 Thread Thomas Lumley
On Wed, 8 Sep 2010, Paul Johnson wrote: run it with factor() instead of ordered(). You don't want the "orthogonal polynomial" contrasts that result from ordered if you need to compare against Stata. If you don't want polynomial contrasts for ordered factors, you can just tell R not to use th

Re: [R] coxph and ordinal variables?

2010-09-08 Thread Peng, C
I look at this question in a different angle. My understanding is: 1. If treat tumor_grade as a numerical variable, you assume the hazard ratio is invariant between any two adjacent levels of the tumor grade (assuming invariant covariate patterns of other risks); 2. If you treat the tumor_grade a

Re: [R] coxph and ordinal variables?

2010-09-08 Thread Paul Johnson
run it with factor() instead of ordered(). You don't want the "orthogonal polynomial" contrasts that result from ordered if you need to compare against Stata. I attach an R program that I wrote to explore ordered factors a while agol I believe this will clear everything up if you study the exampl

Re: [R] coxph and ordinal variables?

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 6:43 PM, Min-Han Tan wrote: Dear R-help members, Apologies - I am posting on behalf of a colleague, who is a little puzzled as STATA and R seem to be yielding different survival estimates for the same dataset when treating a variable as ordinal. Ordered() is used to r

[R] coxph and ordinal variables?

2010-09-08 Thread Min-Han Tan
Dear R-help members, Apologies - I am posting on behalf of a colleague, who is a little puzzled as STATA and R seem to be yielding different survival estimates for the same dataset when treating a variable as ordinal. Ordered() is used to represent an ordinal variable) I understand that R's coxph

Re: [R] coxph

2010-08-09 Thread David Winsemius
On Aug 9, 2010, at 8:17 PM, Hongying Li wrote: Hello, when using coxph function from survival package, what do you do if you encounter such problem like: Warning message: In fitter(X, Y, strats, offset, init, control, weights = weights, : Loglik converged before variable 3,4 ; beta may

[R] coxph

2010-08-09 Thread Hongying Li
Hello, when using coxph function from survival package, what do you do if you encounter such problem like: Warning message: In fitter(X, Y, strats, offset, init, control, weights = weights, : Loglik converged before variable 3,4 ; beta may be infinite. Thanks!

Re: [R] COXPH: how to get the score test and likelihood ratio test for a specific variable in a multivariate Coxph ?

2010-07-30 Thread David Winsemius
On Jul 30, 2010, at 11:08 AM, Biau David wrote: Hello, I would like to get the likelihood ratio and score tests for specific variables in a multivariate coxph model. The default is Wald, so the tests for each separate variable is based on Wald's test. I have the other tests for the full

[R] COXPH: how to get the score test and likelihood ratio test for a specific variable in a multivariate Coxph ?

2010-07-30 Thread Biau David
Hello, I would like to get the likelihood ratio and score tests for specific variables in a multivariate coxph model. The default is Wald, so the tests for each separate variable is based on Wald's test. I have the other tests for the full model but I don't know how to get them for each variabl

Re: [R] coxph and remaing events

2010-06-15 Thread David Winsemius
On Jun 15, 2010, at 1:34 PM, Federico Calboli wrote: Hi everyone, I'm running a cox ph model on a dataset with a number of variables. Each variable has a different number of missing data, so that coxph() drops the individuals who are missing data at one or more variables. Because of this

Re: [R] coxph and remaing events

2010-06-15 Thread Federico Calboli
On 15 Jun 2010, at 18:34, Federico Calboli wrote: > I'm running a cox ph model on a dataset with a number of variables. Each > variable has a different number of missing data, so that coxph() drops the > individuals who are missing data at one or more variables. Because of this > dropping (total

[R] coxph and remaing events

2010-06-15 Thread Federico Calboli
Hi everyone, I'm running a cox ph model on a dataset with a number of variables. Each variable has a different number of missing data, so that coxph() drops the individuals who are missing data at one or more variables. Because of this dropping (totally fine btw) I want to know how many events

Re: [R] coxph and completely missing strata/subsetting

2010-06-10 Thread Erik Iverson
I'm doing some coxph() analyses with a large and complex dataset. The data was collected in different centers, so I am using strata(centers) to stratify the analysis. My main issue is, not all centers collected all the variables, so for a model such as: coxph(Surv(days, cancer) ~ varA + sex +

[R] coxph and completely missing strata/subsetting

2010-06-10 Thread Federico Calboli
Hi everyone, I'm doing some coxph() analyses with a large and complex dataset. The data was collected in different centers, so I am using strata(centers) to stratify the analysis. My main issue is, not all centers collected all the variables, so for a model such as: coxph(Surv(days, cancer)

Re: [R] coxph() and survfit()

2009-10-23 Thread tlumley
On Thu, 22 Oct 2009, Mura Tamakou wrote: Dear All, I have a question regarding the output of survfit() when I supply a Cox model. Lets say for example: we observe that the 95% CIs overlap!! How is this possible since the HR for spiders is significant. It's perfectly natural. To a goo

[R] coxph() and survfit()

2009-10-22 Thread Mura Tamakou
Dear All, I have a question regarding the output of survfit() when I supply a Cox model. Lets say for example: library(survival) fit <- coxph(Surv(time, status == 2) ~ factor(spiders), data = pbc) fit # HR for spiders is significant newdata <- data.frame(spiders = factor(0:1)) sf <- survfit(f

[R] coxph (survival) paper from '82

2009-08-18 Thread Damjan Krstajic
Dear All, I am interested to understand better the coxph() function from the survival R package. There is one referenced paper there which I am not able to get hold of and it is Andersen, P. Gill, R. (1982) Cox's regression model for counting processes, a large sample study. Annals of Statisti

Re: [R] Coxph frailty model counting process error X matrix deemed singular

2009-06-25 Thread Terry Therneau
... > Occasionally, (about 1 in every 100 simulations) I get the following warning: > Error in coxph(Surv(start, end, censorind) ~ binary + uniform : > X matrix deemed to be singular; variable 2 It is not uncommon for the X matrix in a Cox model to be close enough to singular that the p

[R] Coxph frailty model counting process error X matrix deemed singular

2009-06-24 Thread Porter, Aaron T
Hello, I am currently trying to simulate data and analyze it using the frailty option in the coxph function. I am working with recurrent event data, using counting process notation. Occasionally, (about 1 in every 100 simulations) I get the following warning: Error in coxph(Surv(start, end,

Re: [R] coxph and robust variance estimation

2009-06-15 Thread Terry Therneau
> It seems that the function anova don't use a robust estimation for the > analysis of deviance. You are correct, anova.coxph always uses the partial likelihood This is a serious oversight, particularly since some of the situations in which the robust variance is recommended are ones where t

  1   2   >